Mesa (main): v3d: Don't force SCANOUT for PIPE_BIND_SHARED requests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 14 11:29:48 UTC 2021


Module: Mesa
Branch: main
Commit: ef3b31c967d682212461f66622a0679fc6866ce2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef3b31c967d682212461f66622a0679fc6866ce2

Author: Roman Stratiienko <roman.o.stratiienko at globallogic.com>
Date:   Fri Dec 10 19:35:55 2021 +0200

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 <roman.o.stratiienko at globallogic.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14151>

---

 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,



More information about the mesa-commit mailing list