[Mesa-dev] [PATCH] etnaviv: direct YUYV/UYVY support

Christian Gmeiner christian.gmeiner at gmail.com
Sun Apr 14 18:44:20 UTC 2019


The GPU is able to sample from YUYV/UYVY textures directly.

Passes following piglits:
 - ext_image_dma_buf_import-sample_yuv -fmt=YUYV
 - ext_image_dma_buf_import-sample_yuv -fmt=UYVY

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

diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c b/src/gallium/drivers/etnaviv/etnaviv_format.c
index 29e81c4a8b0..7633274e3c2 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
@@ -283,7 +283,7 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
 
    /* YUV */
    _T(YUYV, YUY2, SWIZ(X, Y, Z, W), YUY2, NONE),
-   _T(UYVY, UYVY, SWIZ(X, Y, Z, W), NONE, NONE),
+   _T(UYVY, UYVY, SWIZ(X, Y, Z, W), YUY2, NONE),
 };
 
 uint32_t
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 83179d3cd08..f31464aa85a 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -571,6 +571,10 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
    if (!rsc->pending_ctx)
       goto fail;
 
+   /* The constraint checks below are invalid for some supported YUV formats. */
+   if (tmpl->format == PIPE_FORMAT_YUYV || tmpl->format == PIPE_FORMAT_UYVY)
+      return prsc;
+
    if (rsc->layout == ETNA_LAYOUT_LINEAR) {
       /*
        * Both sampler and pixel pipes can't handle linear, create a compatible
-- 
2.20.1



More information about the mesa-dev mailing list