diff options
author | Eric Anholt <[email protected]> | 2019-03-06 11:08:43 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-03-08 15:33:35 -0800 |
commit | fafead7b6257d0e3f0674a1f19563ed11d47ca8d (patch) | |
tree | db7ab7a0fb89d9efe2774a3adbbc9f4376f782c9 /src/gallium | |
parent | 9d1334d2a0f983e175ffe371bee33f4ce048f910 (diff) |
st/dri: Set the PIPE_BIND_SHARED flag on create_image_with_modifiers.
With createImage(), the caller was expected to set a SHARED flag if they
needed the ability to get a GEM handle. DRI3, wayland, and gbm all set
it, EGL_MESA_drm_image passes it through, and surfaceless doesn't need it
because there's no way to request a handle.
With the new createImageWithModifiers() DRI method to replace it, the
expectation is that you'll always be able to share the buffer, so the flag
is unnecessary in its arguments. However, we do need to tell gallium
about this expectation.
Without this, kmscube's modifiers path using
gbm_bo_create_with_modifiers(&modifier, 1) instead of
gbm_bo_create(SCANOUT | SHARED) will call the driver's resource_create()
function wtih PIPE_BIND_SHARED unset, so the driver (particularly
renderonly drivers) may allocate in such a way that it can't return an
answer from gbm_bo_get_handle(). I used to have a hack in v3d using
count==1 && modifier==LINEAR to indicate that you wanted SHARED anyway,
but that was dropped recently.
Fixes: 59527a36e975 ("v3d: Restructure RO allocations using
resource_from_handle.")
Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/state_trackers/dri/dri2.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 668d177c371..01e88d7c50a 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -992,11 +992,6 @@ dri2_create_image_common(__DRIscreen *_screen, if (!map) return NULL; - /* createImageWithModifiers doesn't supply usage, and we should not get - * here with both modifiers and a usage flag. - */ - assert(!(use && (modifiers != NULL))); - tex_usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; if (use & __DRI_IMAGE_USE_SCANOUT) @@ -1069,7 +1064,7 @@ dri2_create_image_with_modifiers(__DRIscreen *dri_screen, void *loaderPrivate) { return dri2_create_image_common(dri_screen, width, height, format, - 0 /* use */, modifiers, count, + __DRI_IMAGE_USE_SHARE, modifiers, count, loaderPrivate); } |