diff options
author | Daniel Stone <[email protected]> | 2017-05-30 17:23:48 +0530 |
---|---|---|
committer | Daniel Stone <[email protected]> | 2017-06-08 22:27:30 +0100 |
commit | f58e6358bf775e21d49f7a0ea0007f1940c48217 (patch) | |
tree | a015f77b2e14a7cf950d349126e4bf41a3d86353 | |
parent | 37cdcaf3864345617d5edde661fa8443ee0a2182 (diff) |
i965: Improve same-buffer restriction for imports
Intel hardware requires that all planes of an image come from the same
buffer, which is currently implemented by testing that all FDs are
numerically the same.
However, when going through a winsys (e.g.) or anything which transits
FDs individually, the FDs may be different even if the underlying buffer
is the same.
Instead of checking the FDs for equality, we must check if they actually
point to the same buffer (Jason).
Reviewed-by: Varad Gautam <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_screen.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 96f30168127..638a9b080bd 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -841,11 +841,6 @@ intel_create_image_from_fds(__DRIscreen *dri_screen, if (fds == NULL || num_fds < 1) return NULL; - /* We only support all planes from the same bo */ - for (i = 0; i < num_fds; i++) - if (fds[0] != fds[i]) - return NULL; - f = intel_image_format_lookup(fourcc); if (f == NULL) return NULL; @@ -872,6 +867,19 @@ intel_create_image_from_fds(__DRIscreen *dri_screen, return NULL; } + /* We only support all planes from the same bo. + * brw_bo_gem_create_from_prime() should return the same pointer for all + * fds received here */ + for (i = 1; i < num_fds; i++) { + struct brw_bo *aux = brw_bo_gem_create_from_prime(screen->bufmgr, fds[i]); + brw_bo_unreference(aux); + if (aux != image->bo) { + brw_bo_unreference(image->bo); + free(image); + return NULL; + } + } + image->modifier = tiling_to_modifier(image->bo->tiling_mode); tiled_height = get_tiled_height(image->modifier, height); |