OSDN Git Service

gallium/winsys/kms: Look up the GEM handle after importing a prime FD
authorTomasz Figa <tfiga@chromium.org>
Tue, 2 Aug 2016 10:46:28 +0000 (19:46 +0900)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 1 Sep 2016 10:39:45 +0000 (11:39 +0100)
commite45e500d4bb452208260aa1c79696b1959eb71c3
tree11833e1f93c1ce830ce79b408095791a91532d83
parent4ec509533e09f0af02969546d6b9bc83713bf852
gallium/winsys/kms: Look up the GEM handle after importing a prime FD

drmPrimeHandleToFD() will return the same GEM handle every time the same
buffer is imported, even from a different prime FD. Since GEM handles
are not reference counted, we need to make sure that each GEM handle is
referenced only by one display target struct, by looking it up in
kms_sw->bo_list first and bumping the refcount of the found dt on hit
and falling back to creating a new dt only on miss.

v2: Split into separate function.
    Use helper function for lookup.

v3 [Emil Velikov]:
    Rename kms_sw_displaytarget_{lookup,find_and_ref} (Jordan)

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com> (v2)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 577f85e2bba093084d5d2af6047aeb328d708d9b)
src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c