From ef3b31c967d682212461f66622a0679fc6866ce2 Mon Sep 17 00:00:00 2001 From: Roman Stratiienko Date: Fri, 10 Dec 2021 19:35:55 +0200 Subject: [PATCH] v3d: Don't force SCANOUT for PIPE_BIND_SHARED requests This was workaround for the users of gbm_bo_create_with_modifiers(), which were unable to specify the buffer usage (GPU / GPU+DISPLAY). But after the commit [1] this become possible. And forcing usage to GBM_BO_USE_SCANOUT migrated directly into gbm_bo_create_with_modifiers [2], allowing us to remove such workarounds from the drivers. This makes possible to allocate the buffers in VRAM using {gbm_bo_create_with_modifiers2 | gbm_bo_create} and providing correct use flag thus saving CMA memory. This should also enable tiling for such buffers. [1]: 268e12c60534 ("gbm: add gbm_{bo,surface}_create_with_modifiers2") [2]: ad50b47a14e9 ("gbm: assume USE_SCANOUT in create_with_modifiers") Signed-off-by: Roman Stratiienko Reviewed-by: Jose Maria Casanova Crespo Part-of: --- src/gallium/drivers/v3d/v3d_resource.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c index d7746bf9cfd..7719525b1de 100644 --- a/src/gallium/drivers/v3d/v3d_resource.c +++ b/src/gallium/drivers/v3d/v3d_resource.c @@ -814,16 +814,7 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen, v3d_setup_slices(rsc, 0, tmpl->bind & PIPE_BIND_SHARED); - /* If we're in a renderonly setup, use the other device to perform our - * allocation and just import it to v3d. The other device may be - * using CMA, and V3D can import from CMA but doesn't do CMA - * allocations on its own. - * - * We always allocate this way for SHARED, because get_handle will - * need a resource on the display fd. - */ - if (screen->ro && (tmpl->bind & (PIPE_BIND_SCANOUT | - PIPE_BIND_SHARED))) { + if (screen->ro && (tmpl->bind & PIPE_BIND_SCANOUT)) { struct winsys_handle handle; struct pipe_resource scanout_tmpl = { .target = prsc->target,