[Mesa-dev] [PATCH 1/9] etnaviv: improve PIPE_BIND_LINEAR handling

Lucas Stach l.stach at pengutronix.de
Mon Jul 9 16:02:32 UTC 2018


We weren't handling this flag at all, which broke some assumptions
made by the users of the resource_create interface. As we can't render
to a linear surface and the usefulness of yet another layout transition
to handle this case seems limited, we only respect the flag when the
resource isn't used for rendering.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
 src/gallium/drivers/etnaviv/etnaviv_resource.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 7fd374ae23d5..c17a1704537e 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -356,6 +356,14 @@ etna_resource_create(struct pipe_screen *pscreen,
    if (templat->target == PIPE_TEXTURE_3D)
       layout = ETNA_LAYOUT_LINEAR;
 
+   /* The render pipe can't handle linear and there is no code to do yet another
+    * layout transformation for this case, so we only respect the linear flag
+    * if the resource isn't meant to be rendered.
+    */
+   if ((templat->bind & PIPE_BIND_LINEAR) &&
+       !(templat->bind & PIPE_BIND_RENDER_TARGET))
+      layout = ETNA_LAYOUT_LINEAR;
+
    /* modifier is only used for scanout surfaces, so safe to use LINEAR here */
    return etna_resource_alloc(pscreen, layout, DRM_FORMAT_MOD_LINEAR, templat);
 }
-- 
2.18.0



More information about the mesa-dev mailing list