From 338a29b08fe69aa91ad0318d54da1670f40307f0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 3 Jul 2019 12:14:54 -0400 Subject: [PATCH] gallium: add AYUV and XYUV formats this only adds the PIPE_FORMAT members, not any direct handling for them Reviewed-by: Kenneth Graunke --- src/gallium/auxiliary/util/u_format.csv | 4 ++ src/gallium/auxiliary/util/u_format_yuv.c | 46 ++++++++++++++++++++++ src/gallium/auxiliary/util/u_format_yuv.h | 47 +++++++++++++++++++++++ src/gallium/drivers/svga/svga_format.c | 2 + src/gallium/include/pipe/p_format.h | 3 ++ 5 files changed, 102 insertions(+) diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index a7e2dbb70ef..b55d7ba0540 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -157,6 +157,10 @@ PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8 , plain, 1, 1, un8 , un8 , un8 , un8 , PIPE_FORMAT_UYVY , subsampled, 2, 1, x32 , , , , xyz1, yuv # http://www.fourcc.org/yuv.php#YUYV (a.k.a http://www.fourcc.org/yuv.php#YUY2) PIPE_FORMAT_YUYV , subsampled, 2, 1, x32 , , , , xyz1, yuv + +PIPE_FORMAT_AYUV , other, 4, 4, un8 , , , , xyzw, yuv +PIPE_FORMAT_XYUV , other, 4, 4, un8 , , , , xyz1, yuv + # same subsampling but with rgb channels PIPE_FORMAT_R8G8_B8G8_UNORM , subsampled, 2, 1, x32 , , , , xyz1, rgb PIPE_FORMAT_G8R8_G8B8_UNORM , subsampled, 2, 1, x32 , , , , xyz1, rgb diff --git a/src/gallium/auxiliary/util/u_format_yuv.c b/src/gallium/auxiliary/util/u_format_yuv.c index e0f85c5aa97..c3ccc35f272 100644 --- a/src/gallium/auxiliary/util/u_format_yuv.c +++ b/src/gallium/auxiliary/util/u_format_yuv.c @@ -1036,6 +1036,52 @@ util_format_p016_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src, UNUSED unsigned i, UNUSED unsigned j) {} void +util_format_xyuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride, + UNUSED const uint8_t *src_row, UNUSED unsigned src_stride, + UNUSED unsigned width, UNUSED unsigned height) {} + +void +util_format_xyuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride, + UNUSED const uint8_t *src_row, UNUSED unsigned src_stride, + UNUSED unsigned width, UNUSED unsigned height) {} + +void +util_format_xyuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride, + UNUSED const float *src_row, UNUSED unsigned src_stride, + UNUSED unsigned width, UNUSED unsigned height) {} + +void +util_format_xyuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride, + UNUSED const uint8_t *src_row, UNUSED unsigned src_stride, + UNUSED unsigned width, UNUSED unsigned height) {} + +void +util_format_xyuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src, + UNUSED unsigned i, UNUSED unsigned j) {} +void +util_format_ayuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride, + UNUSED const uint8_t *src_row, UNUSED unsigned src_stride, + UNUSED unsigned width, UNUSED unsigned height) {} + +void +util_format_ayuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride, + UNUSED const uint8_t *src_row, UNUSED unsigned src_stride, + UNUSED unsigned width, UNUSED unsigned height) {} + +void +util_format_ayuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride, + UNUSED const float *src_row, UNUSED unsigned src_stride, + UNUSED unsigned width, UNUSED unsigned height) {} + +void +util_format_ayuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride, + UNUSED const uint8_t *src_row, UNUSED unsigned src_stride, + UNUSED unsigned width, UNUSED unsigned height) {} + +void +util_format_ayuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src, + UNUSED unsigned i, UNUSED unsigned j) {} +void util_format_r8g8_r8b8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride, UNUSED const uint8_t *src_row, UNUSED unsigned src_stride, UNUSED unsigned width, UNUSED unsigned height) {} diff --git a/src/gallium/auxiliary/util/u_format_yuv.h b/src/gallium/auxiliary/util/u_format_yuv.h index 171cbc928d7..0acb1747e43 100644 --- a/src/gallium/auxiliary/util/u_format_yuv.h +++ b/src/gallium/auxiliary/util/u_format_yuv.h @@ -284,6 +284,53 @@ util_format_p016_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, void util_format_p016_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_xyuv_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_xyuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_xyuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_xyuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_xyuv_fetch_rgba_float(float *dst, const uint8_t *src, + unsigned i, unsigned j); +void +util_format_ayuv_unpack_rgba_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_ayuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_ayuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_ayuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height); + +void +util_format_ayuv_fetch_rgba_float(float *dst, const uint8_t *src, + unsigned i, unsigned j); void util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, diff --git a/src/gallium/drivers/svga/svga_format.c b/src/gallium/drivers/svga/svga_format.c index 4ccbb82ceb7..dd49ed96855 100644 --- a/src/gallium/drivers/svga/svga_format.c +++ b/src/gallium/drivers/svga/svga_format.c @@ -379,6 +379,8 @@ static const struct vgpu10_format_entry format_conversion_table[] = { PIPE_FORMAT_ATC_RGBA_EXPLICIT, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, 0 }, { PIPE_FORMAT_ATC_RGBA_INTERPOLATED, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, 0 }, { PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, 0 }, + { PIPE_FORMAT_AYUV, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, 0 }, + { PIPE_FORMAT_XYUV, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, SVGA3D_FORMAT_INVALID, 0 }, }; diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 42908e9a720..973442e608f 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -409,6 +409,9 @@ enum pipe_format { PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8 = 320, + PIPE_FORMAT_AYUV = 321, + PIPE_FORMAT_XYUV = 322, + PIPE_FORMAT_COUNT }; -- 2.30.2