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

Christian Gmeiner christian.gmeiner at gmail.com
Wed Apr 24 06:36:21 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 | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

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 650c8e7eb7f..c6d3ab6e79d 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -560,6 +560,15 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
                                                                   level->padded_height);
    level->size = level->layer_stride;
 
+   rsc->pending_ctx = _mesa_set_create(NULL, _mesa_hash_pointer,
+                                       _mesa_key_pointer_equal);
+   if (!rsc->pending_ctx)
+      goto fail;
+
+   /* The constraint checks below are invalid for YUV formats. */
+   if (util_format_is_yuv(tmpl->format))
+      return prsc;
+
    /* The DDX must give us a BO which conforms to our padding size.
     * The stride of the BO must be greater or equal to our padded
     * stride. The size of the BO must accomodate the padded height. */
@@ -576,11 +585,6 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
       goto fail;
    }
 
-   rsc->pending_ctx = _mesa_set_create(NULL, _mesa_hash_pointer,
-                                       _mesa_key_pointer_equal);
-   if (!rsc->pending_ctx)
-      goto fail;
-
    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