13 Aug, 2019

1 commit


07 Aug, 2019

2 commits


04 Jul, 2019

1 commit


29 Jun, 2019

1 commit


21 Jun, 2019

1 commit

  • Yes this is a bit a big patch, but since it's essentially a complete
    rewrite of all the prime docs I didn't see how to better split it up.

    Changes:
    - Consistently point to drm_gem_object_funcs as the preferred hooks,
    where applicable.

    - Document all the hooks in &drm_driver that lacked kerneldoc.

    - Completely new overview section, which now also includes the cleaned
    up lifetime/reference counting subchapter. I also mentioned the weak
    references in there due to the lookup caches.

    - Completely rewritten helper intro section, highlight the
    import/export related functionality.

    - Polish for all the functions and more cross references.

    I also sprinkled a bunch of todos all over.

    Most important: 0 code changes in here. The cleanup motivated by
    reading and improving all this will follow later on.

    v2: Actually update the prime helper docs. Plus add a few FIXMEs that
    I won't address right away in subsequent cleanup patches.

    v3:
    - Split out the function moving. This patch is now exclusively
    documentation changes.
    - Typos and nits (Sam).

    v4: Polish suggestions from Noralf.

    Acked-by: Gerd Hoffmann
    Acked-by: Emil Velikov
    Acked-by: Noralf Trønnes
    Cc: Thomas Zimmermann
    Cc: Gerd Hoffmann
    Cc: Noralf Trønnes
    Cc: Sam Ravnborg
    Cc: Eric Anholt
    Cc: Emil Velikov
    Signed-off-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/msgid/20190620124615.24434-1-daniel.vetter@ffwll.ch

    Daniel Vetter
     

17 Jun, 2019

1 commit


17 Apr, 2019

1 commit

  • I needed to add implicit dependency support for v3d, and Rob Herring
    has been working on it for panfrost, and I had recently looked at the
    lima implementation so I think this will be a good intersection of
    what we all want and simplify our scheduler implementations.

    v2: Rebase on xa_limit_32b API change, and tiny checkpatch cleanups on
    the way in (unsigned int vs unsigned, extra return before
    EXPORT_SYMBOL_GPL)

    Signed-off-by: Eric Anholt
    Link: https://patchwork.freedesktop.org/patch/msgid/20190401222635.25013-6-eric@anholt.net
    Reviewed-and-tested-by: Qiang Yu (v1)

    Eric Anholt
     

13 Apr, 2019

1 commit

  • Similar to the single handle drm_gem_object_lookup(),
    drm_gem_objects_lookup() takes an array of handles and returns an array
    of GEM objects.

    v2:
    - Take the userspace pointer directly and allocate the array.
    - Expand the function documentation.

    Cc: Maarten Lankhorst
    Cc: Maxime Ripard
    Cc: Sean Paul
    Cc: David Airlie
    Cc: Daniel Vetter
    Acked-by: Alyssa Rosenzweig
    Acked-by: Tomeu Vizoso
    Signed-off-by: Rob Herring
    Link: https://patchwork.freedesktop.org/patch/msgid/20190409205427.6943-3-robh@kernel.org

    Rob Herring
     

15 Mar, 2019

1 commit

  • Now that we have the reservation object in the GEM object, it's easy
    to provide a helper for this common case. Noticed while reviewing
    panfrost and lima drivers. This particular version came out of v3d,
    which in turn was a copy from vc4.

    v2: Fix kerneldoc warnings.

    Signed-off-by: Eric Anholt
    Link: https://patchwork.freedesktop.org/patch/msgid/20190308161716.2466-2-eric@anholt.net
    Acked-by: Rob Herring (v1)

    Eric Anholt
     

19 Feb, 2019

1 commit

  • Many users of drm_gem_object embed a struct reservation_object into
    their subclassed struct, so let's add one to struct drm_gem_object.
    This will allow removing the reservation object from the subclasses
    and removing the ->gem_prime_res_obj callback.

    With the addition, add a drm_gem_reservation_object_wait() helper
    function for drivers to use in wait ioctls.

    Cc: Maarten Lankhorst
    Cc: Maxime Ripard
    Cc: Sean Paul
    Cc: David Airlie
    Cc: Daniel Vetter
    Signed-off-by: Rob Herring
    Acked-by: Daniel Vetter
    Reviewed-by: Eric Anholt
    Reviewed-by: Christian Gmeiner
    Link: https://patchwork.freedesktop.org/patch/msgid/20190202154158.10443-2-robh@kernel.org
    Signed-off-by: Maxime Ripard

    Rob Herring
     

25 Nov, 2018

1 commit


20 Nov, 2018

1 commit

  • This adds an optional function table on GEM objects.
    The main benefit is for drivers that support more than one type of
    memory (shmem,vram,cma) for their buffers depending on the hardware it
    runs on. With the callbacks attached to the GEM object itself, it is
    easier to have core helpers for the the various buffer types. The driver
    only has to make the decision about buffer type on GEM object creation
    and all other callbacks can be handled by the chosen helper.

    drm_driver->gem_prime_res_obj has not been added since there's a todo to
    put a reservation_object into drm_gem_object.

    v3: Add todo entry

    v2: Drop drm_gem_object_funcs->prime_mmap in favour of
    drm_gem_prime_mmap() (Daniel Vetter)

    v1:
    - drm_gem_object_funcs.map -> .prime_map let it only do PRIME mmap like
    the function it superseeds (Daniel Vetter)
    - Flip around the if ladders and make obj->funcs the first choice
    highlighting the fact that this the new default way of doing it
    (Daniel Vetter)

    Signed-off-by: Noralf Trønnes
    Acked-by: Daniel Vetter
    Acked-by: Christian König
    Link: https://patchwork.freedesktop.org/patch/msgid/20181110145647.17580-4-noralf@tronnes.org

    Noralf Trønnes
     

16 Feb, 2018

1 commit

  • i915 is the only driver using those fields in the drm_gem_object
    structure, so they only waste memory for all other drivers.

    Move the fields into drm_i915_gem_object instead and patch the i915 code
    with the following sed commands:

    sed -i "s/obj->base.read_domains/obj->read_domains/g" drivers/gpu/drm/i915/*.c drivers/gpu/drm/i915/*/*.c
    sed -i "s/obj->base.write_domain/obj->write_domain/g" drivers/gpu/drm/i915/*.c drivers/gpu/drm/i915/*/*.c

    Change is only compile tested.

    v2: move fields around as suggested by Chris.

    Signed-off-by: Christian König
    Reviewed-by: Chris Wilson
    Link: https://patchwork.freedesktop.org/patch/msgid/20180216124338.9087-1-christian.koenig@amd.com
    Signed-off-by: Chris Wilson

    Christian König
     

29 Jul, 2017

1 commit

  • Add a common drm_driver.dumb_map_offset function for GEM backed drivers.

    Signed-off-by: Noralf Trønnes
    Reviewed-by: Philipp Zabel
    Reviewed-by: Laurent Pinchart
    Reviewed-by: Sean Paul
    Link: https://patchwork.freedesktop.org/patch/msgid/1500837417-40580-2-git-send-email-noralf@tronnes.org

    Noralf Trønnes
     

06 Jul, 2017

1 commit


14 Mar, 2017

1 commit

  • Sadly there's only 1 driver which can use it, everyone else is special
    for some reason:

    - gma500 has a horrible runtime PM ioctl wrapper that probably doesn't
    really work but meh.
    - i915 needs special compat_ioctl handler because regrets.
    - arcgpu needs to fixup the pgprot because (no idea why it can't do
    that in the fault handler like everyone else).
    - tegra does even worse stuff with pgprot
    - udl does something with vm_flags too ...
    - cma helpers, etnaviv, mtk, msm, rockchip, omap all implement some
    variation on prefaulting.
    - exynos is exynos, I got lost in the midlayers.
    - vc4 has to reinvent half of cma helpers because those are too much
    midlayer, plus vm_flags dances.
    - vgem also seems unhappy with the default vm_flags.

    So pretty sad divergence and I'm sure we could do better, but not
    really an idea. Oh well, maybe this macro here helps to encourage more
    consistency at least going forward.

    Reviewed-by: Sean Paul
    Reviewed-by: Liviu Dudau
    Signed-off-by: Daniel Vetter
    Link: http://patchwork.freedesktop.org/patch/msgid/20170308141257.12119-25-daniel.vetter@ffwll.ch

    Daniel Vetter
     

09 Mar, 2017

1 commit

  • Plus a little bit more documentation.

    v2: Untangle the missing forward decls to make drm_prime|gem.h
    free-standing.

    Reviewed-by: Gustavo Padovan
    Signed-off-by: Daniel Vetter
    Link: http://patchwork.freedesktop.org/patch/msgid/20170308141257.12119-3-daniel.vetter@ffwll.ch

    Daniel Vetter
     

28 Feb, 2017

1 commit

  • For consistency with other reference counting APIs in the kernel, add
    drm_gem_object_get() and drm_gem_object_put(), as well as an unlocked
    variant of the latter, to reference count GEM buffer objects.

    Compatibility aliases are added to keep existing code working. To help
    speed up the transition, all the instances of the old functions in the
    DRM core are already replaced in this commit.

    The existing semantic patch for the DRM subsystem-wide conversion is
    extended to account for these new helpers.

    Reviewed-by: Sean Paul
    Acked-by: Christian König
    Signed-off-by: Thierry Reding
    Link: http://patchwork.freedesktop.org/patch/msgid/20170228144643.5668-6-thierry.reding@gmail.com

    Thierry Reding
     

25 Jan, 2017

1 commit

  • I just learned that &struct_name.member_name works and looks pretty
    even. It doesn't (yet) link to the member directly though, which would
    be really good for big structures or vfunc tables (where the
    per-member kerneldoc tends to be long).

    Also some minor drive-by polish where it makes sense, I read a lot
    of docs ...

    Cc: Jani Nikula
    Cc: Chris Wilson
    Reviewed-by: Gustavo Padovan
    Signed-off-by: Daniel Vetter
    Link: http://patchwork.freedesktop.org/patch/msgid/20170125062657.19270-5-daniel.vetter@ffwll.ch

    Daniel Vetter
     

16 Aug, 2016

1 commit

  • These are the leftovers I could only track down using keep_warnings =
    True. For some of them we might want to update our style guide on how
    to reference structures and constants, not sure ...

    Cc: Markus Heiser
    Cc: Jonathan Corbet
    Cc: linux-doc@vger.kernel.org
    Reviewed-by: Sean Paul
    Signed-off-by: Daniel Vetter
    Link: http://patchwork.freedesktop.org/patch/msgid/1471034937-651-1-git-send-email-daniel.vetter@ffwll.ch

    Daniel Vetter
     

17 May, 2016

1 commit

  • drm_gem_object_lookup() has never required the drm_device for its file
    local translation of the user handle to the GEM object. Let's remove the
    unused parameter and save some space.

    Signed-off-by: Chris Wilson
    Cc: dri-devel@lists.freedesktop.org
    Cc: Dave Airlie
    Cc: Daniel Vetter
    [danvet: Fixup kerneldoc too.]
    Signed-off-by: Daniel Vetter

    Chris Wilson
     

04 May, 2016

1 commit

  • Finally all the core gem and a lot of drivers are entirely free of
    dev->struct_mutex depencies, and we can start to have an entirely
    lockless unref path.

    To make sure that no one who touches the core code accidentally breaks
    existing drivers which still require dev->struct_mutex I've made the
    might_lock check unconditional.

    While at it de-inline the ref/unref functions, they've become a bit
    too big.

    v2: Make it not leak like a sieve.

    v3: Review from Lucas:
    - drop != NULL in pointer checks.
    - fixup copypasted kerneldoc to actually match the functions.

    v4:
    Add __drm_gem_object_unreference as a fastpath helper for drivers who
    abolished dev->struct_mutex, requested by Chris.

    v5: Fix silly mistake in drm_gem_object_unreference_unlocked caught by
    intel-gfx CI - I checked for gem_free_object instead of
    gem_free_object_unlocked ...

    Cc: Chris Wilson
    Cc: Alex Deucher
    Cc: Lucas Stach
    Reviewed-by: Lucas Stach (v3)
    Reviewed-by: Chris Wilson (v4)
    Reviewed-by: Alex Deucher
    Signed-off-by: Daniel Vetter
    Signed-off-by: Daniel Vetter
    Link: http://patchwork.freedesktop.org/patch/msgid/1462178451-1765-1-git-send-email-daniel.vetter@ffwll.ch

    Daniel Vetter
     

24 Nov, 2015

1 commit

  • I just realized that I've forgotten to update all the gem refcounting
    docs. For pennance also add pretty docs for the overall drm_gem_object
    structure, with a few links thrown in fore good.

    As usually we need to make sure the kerneldoc reference is at most a
    sect2 for otherwise it won't be listed.

    Signed-off-by: Daniel Vetter
    Link: http://patchwork.freedesktop.org/patch/msgid/1445533889-7661-1-git-send-email-daniel.vetter@ffwll.ch
    Reviewed-by: Alex Deucher
    Signed-off-by: Daniel Vetter

    Daniel Vetter
     

19 Oct, 2015

1 commit

  • Pretty soon only some drivers will need dev->struct_mutex in their
    gem_free_object callbacks. Hence it's really important to make sure
    everything still keeps getting this right.

    v2: Don't check for locking before we check for non-NULL obj. Spotted
    by Dan Carpenter.

    Link: http://mid.gmane.org/1444894601-5200-10-git-send-email-daniel.vetter@ffwll.ch
    Reviewed-by: David Herrmann
    Signed-off-by: Daniel Vetter

    Daniel Vetter
     

08 Apr, 2015

1 commit


24 Dec, 2014

1 commit


21 Nov, 2014

1 commit

  • It happens on occasion that developers of generic user-space applications
    abuse the dumb buffer API to get hold of drm buffers that they can both
    mmap() and use for GPU acceleration, using the assumptions that dumb buffers
    and buffers available for GPU are
    a) The same type and can be aribtrarily type-casted.
    b) fully coherent.

    This patch makes the most widely used drivers warn nicely when that happens,
    the next step will be to fail.

    v2: Move drmP.h changes to drm_gem.h. Fix Radeon dumb mmap breakage.

    Signed-off-by: Thomas Hellstrom
    Acked-by: Daniel Vetter
    Acked-by: Alex Deucher
    Signed-off-by: Dave Airlie

    Thomas Hellstrom
     

24 Sep, 2014

1 commit