Mesa (master): tegra: Treat resources with modifiers as scanout

Thierry Reding tagr at kemper.freedesktop.org
Tue May 29 14:49:11 UTC 2018


Module: Mesa
Branch: master
Commit: 9e539012dfaa848fc4cfde83c3f3a83fee274ca4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e539012dfaa848fc4cfde83c3f3a83fee274ca4

Author: Thierry Reding <treding at nvidia.com>
Date:   Wed Apr  4 16:04:25 2018 +0200

tegra: Treat resources with modifiers as scanout

Resources created with modifiers are treated as scanout because there is
no way for applications to specify the usage (though that capability may
be useful to have in the future). Currently all the resources created by
applications with modifiers are for scanout, so make sure they have bind
flags set accordingly.

This is necessary in order to properly export buffers for such resources
so that they can be shared with scanout hardware.

Tested-by: Daniel Kolesa <daniel at octaforge.org>
Cc: mesa-stable at lists.freedesktop.org
Signed-off-by: Thierry Reding <treding at nvidia.com>

---

 src/gallium/drivers/tegra/tegra_screen.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/tegra/tegra_screen.c b/src/gallium/drivers/tegra/tegra_screen.c
index 8b61c09016..e03e71f81a 100644
--- a/src/gallium/drivers/tegra/tegra_screen.c
+++ b/src/gallium/drivers/tegra/tegra_screen.c
@@ -515,6 +515,7 @@ tegra_screen_resource_create_with_modifiers(struct pipe_screen *pscreen,
                                             int count)
 {
    struct tegra_screen *screen = to_tegra_screen(pscreen);
+   struct pipe_resource tmpl = *template;
    struct tegra_resource *resource;
    int err;
 
@@ -522,8 +523,18 @@ tegra_screen_resource_create_with_modifiers(struct pipe_screen *pscreen,
    if (!resource)
       return NULL;
 
+   /*
+    * Assume that resources created with modifiers will always be used for
+    * scanout. This is necessary because some of the APIs that are used to
+    * create resources with modifiers (e.g. gbm_bo_create_with_modifiers())
+    * can't pass along usage information. Adding that capability might be
+    * worth adding to remove this ambiguity. Not all future use-cases that
+    * involve modifiers may always be targetting scanout hardware.
+    */
+   tmpl.bind |= PIPE_BIND_SCANOUT;
+
    resource->gpu = screen->gpu->resource_create_with_modifiers(screen->gpu,
-                                                               template,
+                                                               &tmpl,
                                                                modifiers,
                                                                count);
    if (!resource->gpu)




More information about the mesa-commit mailing list