1. 31 Dec, 2015 9 commits
  2. 02 Jul, 2015 1 commit
    • Tomi Valkeinen's avatar
      drm/omap: fix omap_gem_put_paddr() error handling · 393a949f
      Tomi Valkeinen authored
      
      
      If tiler_unpin() call in omap_gem_put_paddr() fails,
      omap_gem_put_paddr() will immediately stop processing and return an
      error.
      
      This patch remoes that error checking, and also removes
      omap_gem_put_paddr()'s return value, because:
      
       * The caller of omap_gem_put_paddr() can do nothing if an error
         happens, so it's pointless to return an error value
      
       * If tiler_unpin() fails, the GEM object will possibly be left in an
         undefined state, where the DMM mapping may have been removed, but the
         GEM object still thinks everything is as it should be, leading to
         crashes later.
      
       * There's no point in returning an error from a "free" call, as the
         caller can do nothing about it. So it's better to clean up as much as
         possible.
      Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      393a949f
  3. 24 Jun, 2015 1 commit
  4. 12 Jun, 2015 1 commit
  5. 24 Mar, 2015 3 commits
    • Tomi Valkeinen's avatar
      drm/omap: fix race condition with dev->obj_list · 76c4055f
      Tomi Valkeinen authored
      
      
      omap_gem_objects are added to dev->obj_list in omap_gem_new, and removed
      in omap_gem_free_object. Unfortunately there's no locking for
      dev->obj_list, which eventually leads to a crash:
      
      WARNING: CPU: 1 PID: 1123 at lib/list_debug.c:59 __list_del_entry+0xa4/0xe0()
      list_del corruption. prev->next should be e9281344, but was ea722b84
      
      Add a spinlock to protect dev->obj_list.
      Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      76c4055f
    • Tomi Valkeinen's avatar
      drm/omap: fix TILER on OMAP5 · 7cb0d6c1
      Tomi Valkeinen authored
      
      
      On OMAP5 it is not possible to use TILER buffer with CPU when caching or
      write-combining is used. Doing so leads to errors from the memory
      manager.
      
      However, on OMAP4, write-combining works fine.
      
      This patch adds platform specific data for the TILER, and a function
      tiler_get_cpu_cache_flags() which can be used to get the caching mode to
      be used.
      
      Note that without write-combining the use of the TILER buffer with CPU
      is unusably slow. It's still good to have it operational for testing
      purposes.
      Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      7cb0d6c1
    • Tomi Valkeinen's avatar
      drm/omap: clear omap_obj->paddr in omap_gem_put_paddr() · 3f4d17c4
      Tomi Valkeinen authored
      
      
      Clear omap_obj's paddr when unmapping the memory, so that it's easier to
      catch bad use of the paddr.
      Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      3f4d17c4
  6. 13 Nov, 2014 1 commit
    • Thierry Reding's avatar
      drm/omap: gem: dumb: pitch is an output · bdb2b933
      Thierry Reding authored
      
      
      When creating a dumb buffer object using the DRM_IOCTL_MODE_CREATE_DUMB
      IOCTL, only the width, height, bpp and flags fields are inputs. The
      caller is not guaranteed to zero out or set handle, pitch and size.
      Drivers must not treat these values as possible inputs, otherwise they
      may use uninitialized memory during the computation of the framebuffer
      size.
      
      The OMAP driver uses the pitch field passed in by userspace as a minimum
      and only override it if the driver-computed pitch is larger than what
      userspace provided. To prevent this from causing overallocation, fix the
      minimum pitch to 0 to enforce the driver-computed pitch.
      
      Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: default avatarRob Clark <robdclark@gmail.com>
      Acked-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      bdb2b933
  7. 22 Jul, 2014 1 commit
    • Russell King's avatar
      drm: omapdrm: fix compiler errors · 2d31ca3a
      Russell King authored
      
      
      Regular randconfig nightly testing has detected problems with omapdrm.
      
      omapdrm fails to build when the kernel is built to support 64-bit DMA
      addresses and/or 64-bit physical addresses due to an assumption about
      the width of these types.
      
      Use %pad to print DMA addresses, rather than %x or %Zx (which is even
      more wrong than %x).  Avoid passing a uint32_t pointer into a function
      which expects dma_addr_t pointer.
      
      drivers/gpu/drm/omapdrm/omap_plane.c: In function 'omap_plane_pre_apply':
      drivers/gpu/drm/omapdrm/omap_plane.c:145:2: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t' [-Werror=format]
      drivers/gpu/drm/omapdrm/omap_plane.c:145:2: error: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'dma_addr_t' [-Werror=format]
      make[5]: *** [drivers/gpu/drm/omapdrm/omap_plane.o] Error 1
      drivers/gpu/drm/omapdrm/omap_gem.c: In function 'omap_gem_get_paddr':
      drivers/gpu/drm/omapdrm/omap_gem.c:794:4: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'dma_addr_t' [-Werror=format]
      drivers/gpu/drm/omapdrm/omap_gem.c: In function 'omap_gem_describe':
      drivers/gpu/drm/omapdrm/omap_gem.c:991:4: error: format '%Zx' expects argument of type 'size_t', but argument 7 has type 'dma_addr_t' [-Werror=format]
      drivers/gpu/drm/omapdrm/omap_gem.c: In function 'omap_gem_init':
      drivers/gpu/drm/omapdrm/omap_gem.c:1470:4: error: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t' [-Werror=format]
      make[5]: *** [drivers/gpu/drm/omapdrm/omap_gem.o] Error 1
      drivers/gpu/drm/omapdrm/omap_dmm_tiler.c: In function 'dmm_txn_append':
      drivers/gpu/drm/omapdrm/omap_dmm_tiler.c:226:2: error: passing argument 3 of 'alloc_dma' from incompatible pointer type [-Werror]
      make[5]: *** [drivers/gpu/drm/omapdrm/omap_dmm_tiler.o] Error 1
      make[5]: Target `__build' not remade because of errors.
      make[4]: *** [drivers/gpu/drm/omapdrm] Error 2
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      2d31ca3a
  8. 07 Jul, 2014 3 commits
    • Fabian Frederick's avatar
      drm/omap: remove null test before kfree · d2c87e2d
      Fabian Frederick authored
      
      
      Fix checkpatch warning:
      WARNING: kfree(NULL) is safe this check is probably not required
      
      Cc: David Airlie <airlied@linux.ie>
      Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
      Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      d2c87e2d
    • David Herrmann's avatar
      drm/gem: remove misleading gfp parameter to get_pages() · 0cdbe8ac
      David Herrmann authored
      
      
      drm_gem_get_pages() currently allows passing a 'gfp' parameter that is
      passed to shmem combined with mapping_gfp_mask(). Given that the default
      mapping_gfp_mask() is GFP_HIGHUSER, it is _very_ unlikely that anyone will
      ever make use of that parameter. In fact, all drivers currently pass
      redundant flags or 0.
      
      This patch removes the 'gfp' parameter. The only reason to keep it is to
      remove flags like __GFP_WAIT. But in its current form, it can only be used
      to add flags. So to remove __GFP_WAIT, you'd have to drop it from the
      mapping_gfp_mask, which again is stupid as this mask is used by shmem-core
      for other allocations, too.
      
      If any driver ever requires that parameter, we can introduce a new helper
      that takes the raw 'gfp' parameter. The caller'd be responsible to combine
      it with mapping_gfp_mask() in a suitable way. The current
      drm_gem_get_pages() helper would then simply use mapping_gfp_mask() and
      call the new helper. This is what shmem_read_mapping_pages{_gfp,} does
      right now.
      
      Moreover, the gfp-zone flag-usage is not obvious: If you pass a modified
      zone, shmem core will WARN() or even BUG(). In other words, the following
      must be true for 'gfp' passed to shmem_read_mapping_pages_gfp():
          gfp_zone(mapping_gfp_mask(mapping)) == gfp_zone(gfp)
      Add a comment to drm_gem_read_pages() explaining that constraint.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      0cdbe8ac
    • David Herrmann's avatar
      drm/omap: use __GFP_DMA32 for shmem-backed gem · ab5a60c3
      David Herrmann authored
      
      
      OMAP requires bo-pages to be in the DMA32 zone. Explicitly request this by
      setting __GFP_DMA32 as mapping-gfp-mask during shmem initialization. This
      drops HIGHMEM from the gfp-mask and uses DMA32 instead. shmem-core takes
      care to relocate pages during swap-in in case they have been loaded into
      the wrong zone.
      
      It is _not_ possible to pass __GFP_DMA32 to shmem_read_mapping_page_gfp()
      as the page might have already been swapped-in at that time. The zone-mask
      must be set during initialization and be kept constant for now.
      
      Remove the now superfluous TODO in omap_gem.c.
      Reviewed-by: default avatarRob Clark <robdclark@gmail.com>
      Tested-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      ab5a60c3
  9. 15 Apr, 2014 3 commits
  10. 16 Mar, 2014 1 commit
    • David Herrmann's avatar
      drm: use anon-inode instead of relying on cdevs · 6796cb16
      David Herrmann authored
      
      
      DRM drivers share a common address_space across all character-devices of a
      single DRM device. This allows simple buffer eviction and mapping-control.
      However, DRM core currently waits for the first ->open() on any char-dev
      to mark the underlying inode as backing inode of the device. This delayed
      initialization causes ugly conditions all over the place:
        if (dev->dev_mapping)
          do_sth();
      
      To avoid delayed initialization and to stop reusing the inode of the
      char-dev, we allocate an anonymous inode for each DRM device and reset
      filp->f_mapping to it on ->open().
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      6796cb16
  11. 09 Oct, 2013 1 commit
    • David Herrmann's avatar
      drm: kill ->gem_init_object() and friends · 16eb5f43
      David Herrmann authored
      
      
      All drivers embed gem-objects into their own buffer objects. There is no
      reason to keep drm_gem_object_alloc(), gem->driver_private and
      ->gem_init_object() anymore.
      
      New drivers are highly encouraged to do the same. There is no benefit in
      allocating gem-objects separately.
      
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: Alex Deucher <alexdeucher@gmail.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Inki Dae <inki.dae@samsung.com>
      Cc: Ben Skeggs <skeggsb@gmail.com>
      Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      16eb5f43
  12. 19 Aug, 2013 1 commit
  13. 06 Aug, 2013 1 commit
  14. 25 Jul, 2013 1 commit
    • David Herrmann's avatar
      drm/gem: convert to new unified vma manager · 0de23977
      David Herrmann authored
      
      
      Use the new vma manager instead of the old hashtable. Also convert all
      drivers to use the new convenience helpers. This drops all the
      (map_list.hash.key << PAGE_SHIFT) non-sense.
      
      Locking and access-management is exactly the same as before with an
      additional lock inside of the vma-manager, which strictly wouldn't be
      needed for gem.
      
      v2:
       - rebase on drm-next
       - init nodes via drm_vma_node_reset() in drm_gem.c
      v3:
       - fix tegra
      v4:
       - remove duplicate if (drm_vma_node_has_offset()) checks
       - inline now trivial drm_vma_node_offset_addr() calls
      v5:
       - skip node-reset on gem-init due to kzalloc()
       - do not allow mapping gem-objects with offsets (backwards compat)
       - remove unneccessary casts
      
      Cc: Inki Dae <inki.dae@samsung.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: default avatarPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@gmail.com>
      0de23977
  15. 23 Jul, 2013 1 commit
  16. 16 Feb, 2013 3 commits
  17. 11 Feb, 2013 1 commit
  18. 30 Jan, 2013 1 commit
  19. 17 Jan, 2013 1 commit
    • Andy Gross's avatar
      drm/omap: Add PM capabilities · e78edba1
      Andy Gross authored
      
      
      Added power management capabilities into the omapdrm and DMM drivers.
      During suspend, we don't need to do anything to maintain the state of
      the LUT.  We have all the necessary information to recreate the mappings
      of the GEM object list maintained by the omapdrm driver.
      
      On resume, the DMM resume handler will first reprogram the LUT to point
      to the dummy page.  The subsequent resume handler in the omapdrm will call
      into the DMM and reprogram each of the buffer objects.  This will ensure
      that all of the necessary objects will be pinned into the DMM properly.
      
      Order of suspend/resume handlers is done by device creation.  We create
      the DMM device before the omapdrm, so the correct order is maintained.
      Signed-off-by: default avatarAndy Gross <andy.gross@ti.com>
      Signed-off-by: default avatarRob Clark <rob@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e78edba1
  20. 15 Nov, 2012 3 commits
  21. 22 Oct, 2012 2 commits