[PATCH 4/4] etnaviv: hook up linear texture sampling support

Christian Gmeiner christian.gmeiner at gmail.com
Mon Jan 21 06:50:01 UTC 2019


If the GPU supports linear sampling, linear addressing mode
will be used as default.

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_resource.c | 10 +++++++---
 src/gallium/drivers/etnaviv/etnaviv_texture.c  |  4 +++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 9a7ebf3064e..7d24b1f03bd 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -318,9 +318,9 @@ etna_resource_create(struct pipe_screen *pscreen,
 {
    struct etna_screen *screen = etna_screen(pscreen);
 
-   /* Figure out what tiling and address mode to use -- for now, assume that
-    * texture cannot be linear. there is a capability LINEAR_TEXTURE_SUPPORT
-    * (supported on gc880 and gc2000 at least), but not sure how it works.
+   /* Figure out what tiling and address mode to use.
+    * Textures are TILED or LINEAR. If LINEAR_TEXTURE_SUPPORT capability is
+    * available LINEAR gets prefered.
     * Buffers always have LINEAR layout.
     */
    unsigned layout = ETNA_LAYOUT_LINEAR;
@@ -334,6 +334,10 @@ etna_resource_create(struct pipe_screen *pscreen,
 
       if (util_format_is_compressed(templat->format))
          layout = ETNA_LAYOUT_LINEAR;
+      else if (VIV_FEATURE(screen, chipMinorFeatures1, LINEAR_TEXTURE_SUPPORT)) {
+         layout = ETNA_LAYOUT_LINEAR;
+         mode = ETNA_ADDRESSING_MODE_LINEAR;
+      }
    } else if (templat->target != PIPE_BUFFER) {
       bool want_multitiled = false;
       bool want_supertiled = screen->specs.can_supertile;
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c
index 3993e31cec1..b06f20531fd 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c
@@ -172,7 +172,9 @@ etna_resource_sampler_compatible(struct etna_resource *res)
    if (res->layout == ETNA_LAYOUT_SUPER_TILED && VIV_FEATURE(screen, chipMinorFeatures2, SUPERTILED_TEXTURE))
       return true;
 
-   /* TODO: LINEAR_TEXTURE_SUPPORT */
+   /* This GPU supports texturing from linear textures? */
+   if (res->layout == ETNA_LAYOUT_LINEAR && VIV_FEATURE(screen, chipMinorFeatures1, LINEAR_TEXTURE_SUPPORT))
+      return true;
 
    /* Otherwise, only support tiled layouts */
    if (res->layout != ETNA_LAYOUT_TILED)
-- 
2.20.1



More information about the etnaviv mailing list