freedreno: use renderonly path for buffers allocated with modifiers
authorJonathan Marek <jonathan@marek.ca>
Wed, 20 Feb 2019 10:50:47 +0000 (11:50 +0100)
committerRob Clark <robdclark@gmail.com>
Wed, 27 Feb 2019 18:46:28 +0000 (18:46 +0000)
Now that freedreno has create_with_modifiers(), this "hack" is needed to
make some cases work. Copied from vc4.

Fixes: 41ddf1d1
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
src/gallium/drivers/freedreno/freedreno_resource.c

index 163fa70312a47ace72f47d0cca53806f617c18e9..144d725fdec8b1fc0283155b6576cbfafed72ea1 100644 (file)
@@ -860,7 +860,13 @@ fd_resource_create_with_modifiers(struct pipe_screen *pscreen,
        enum pipe_format format = tmpl->format;
        uint32_t size;
 
-       if (screen->ro && (tmpl->bind & PIPE_BIND_SCANOUT)) {
+       /* when using kmsro, scanout buffers are allocated on the display device
+        * create_with_modifiers() doesn't give us usage flags, so we have to
+        * assume that all calls with modifiers are scanout-possible
+        */
+       if (screen->ro &&
+               ((tmpl->bind & PIPE_BIND_SCANOUT) ||
+                !(count == 1 && modifiers[0] == DRM_FORMAT_MOD_INVALID))) {
                struct pipe_resource scanout_templat = *tmpl;
                struct renderonly_scanout *scanout;
                struct winsys_handle handle;