diff options
author | Tomasz Figa <[email protected]> | 2016-08-02 19:46:28 +0900 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-08-24 14:39:23 +0100 |
commit | 577f85e2bba093084d5d2af6047aeb328d708d9b (patch) | |
tree | 817f4dd4ded4ae2a12302708457543af58e14251 /src/gallium/winsys/sw | |
parent | 0465c72d46e49bb26c5f1f09bc70074d49e82196 (diff) |
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 <[email protected]>
CC: <[email protected]>
Reviewed-by: Hans de Goede <[email protected]> (v2)
Signed-off-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/winsys/sw')
-rw-r--r-- | src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c index 36ed049f82a..07eca990d04 100644 --- a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c +++ b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c @@ -244,6 +244,10 @@ kms_sw_displaytarget_add_from_prime(struct kms_sw_winsys *kms_sw, int fd, if (ret) return NULL; + kms_sw_dt = kms_sw_displaytarget_find_and_ref(kms_sw, handle); + if (kms_sw_dt) + return kms_sw_dt; + kms_sw_dt = CALLOC_STRUCT(kms_sw_displaytarget); if (!kms_sw_dt) return NULL; |