summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanley Chery <nanley.g.chery@intel.com>2020-07-30 17:39:26 -0700
committerMarge Bot <eric+marge@anholt.net>2020-09-09 20:02:03 +0000
commitc3c99f45718080b66676c2b028015abbafeaee11 (patch)
tree196d555e807c275a4b5452ee512cb32e4aa28d6a
parent9efd71466df7706cce21880d5d31c3245654628b (diff)
st/mesa: Don't map all P01X DRM formats to P016
Allow gallium drivers to distinguish between the P010, P012, and P016 DRM formats. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486>
-rw-r--r--src/gallium/frontends/dri/dri_helpers.c4
-rw-r--r--src/gallium/include/pipe/p_format.h2
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c1
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c1
-rw-r--r--src/mesa/state_tracker/st_cb_eglimage.c4
-rw-r--r--src/mesa/state_tracker/st_program.h1
-rw-r--r--src/mesa/state_tracker/st_sampler_view.c1
-rw-r--r--src/util/format/u_format.csv1
-rw-r--r--src/util/format/u_format.h3
9 files changed, 16 insertions, 2 deletions
diff --git a/src/gallium/frontends/dri/dri_helpers.c b/src/gallium/frontends/dri/dri_helpers.c
index 90a8a392fad..01a1fb3d96c 100644
--- a/src/gallium/frontends/dri/dri_helpers.c
+++ b/src/gallium/frontends/dri/dri_helpers.c
@@ -491,11 +491,11 @@ static const struct dri2_format_mapping dri2_format_table[] = {
{ 1, 1, 1, __DRI_IMAGE_FORMAT_GR88, 2 } } },
{ DRM_FORMAT_P010, __DRI_IMAGE_FORMAT_NONE,
- __DRI_IMAGE_COMPONENTS_Y_UV, PIPE_FORMAT_P016, 2,
+ __DRI_IMAGE_COMPONENTS_Y_UV, PIPE_FORMAT_P010, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R16, 2 },
{ 1, 1, 1, __DRI_IMAGE_FORMAT_GR1616, 4 } } },
{ DRM_FORMAT_P012, __DRI_IMAGE_FORMAT_NONE,
- __DRI_IMAGE_COMPONENTS_Y_UV, PIPE_FORMAT_P016, 2,
+ __DRI_IMAGE_COMPONENTS_Y_UV, PIPE_FORMAT_P012, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R16, 2 },
{ 1, 1, 1, __DRI_IMAGE_FORMAT_GR1616, 4 } } },
{ DRM_FORMAT_P016, __DRI_IMAGE_FORMAT_NONE,
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index f1a4652c36e..fd3cf5b3236 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -464,6 +464,7 @@ enum pipe_format {
PIPE_FORMAT_FXT1_RGBA,
PIPE_FORMAT_P010,
+ PIPE_FORMAT_P012,
PIPE_FORMAT_P016,
PIPE_FORMAT_R10G10B10X2_UNORM,
@@ -582,6 +583,7 @@ pipe_format_to_chroma_format(enum pipe_format format)
case PIPE_FORMAT_YV12:
case PIPE_FORMAT_IYUV:
case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
case PIPE_FORMAT_Y16_U16_V16_420_UNORM:
return PIPE_VIDEO_CHROMA_FORMAT_420;
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 7ae981b71b4..0c188c104c1 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -316,6 +316,7 @@ update_shader_samplers(struct st_context *st,
switch (st_get_view_format(stObj)) {
case PIPE_FORMAT_NV12:
case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
case PIPE_FORMAT_YUYV:
case PIPE_FORMAT_UYVY:
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 5a0f91ccb14..f1f8dffcf2c 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -196,6 +196,7 @@ update_textures(struct st_context *st,
st->pipe->create_sampler_view(st->pipe, stObj->pt->next, &tmpl);
break;
case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
/* we need one additional R16G16 view: */
tmpl.format = PIPE_FORMAT_RG1616_UNORM;
diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
index bf25e313091..8b44ba3e65a 100644
--- a/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/src/mesa/state_tracker/st_cb_eglimage.c
@@ -69,6 +69,8 @@ is_format_supported(struct pipe_screen *screen, enum pipe_format format,
PIPE_TEXTURE_2D, nr_samples,
nr_storage_samples, usage);
break;
+ case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
supported = screen->is_format_supported(screen, PIPE_FORMAT_R16_UNORM,
PIPE_TEXTURE_2D, nr_samples,
@@ -250,6 +252,8 @@ st_bind_egl_image(struct gl_context *ctx,
texFormat = MESA_FORMAT_R_UNORM8;
texObj->RequiredTextureImageUnits = 2;
break;
+ case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
texFormat = MESA_FORMAT_R_UNORM16;
texObj->RequiredTextureImageUnits = 2;
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 7483450eae5..7fb94386ff9 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -80,6 +80,7 @@ st_get_external_sampler_key(struct st_context *st, struct gl_program *prog)
switch (format) {
case PIPE_FORMAT_NV12:
case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
key.lower_nv12 |= (1 << unit);
break;
diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c
index a31e573c01a..80ba82d9711 100644
--- a/src/mesa/state_tracker/st_sampler_view.c
+++ b/src/mesa/state_tracker/st_sampler_view.c
@@ -500,6 +500,7 @@ get_sampler_view_format(struct st_context *st,
format = PIPE_FORMAT_R8_UNORM;
break;
case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
format = PIPE_FORMAT_R16_UNORM;
break;
diff --git a/src/util/format/u_format.csv b/src/util/format/u_format.csv
index 2f71e70e736..3ed5bb8aaaa 100644
--- a/src/util/format/u_format.csv
+++ b/src/util/format/u_format.csv
@@ -396,6 +396,7 @@ PIPE_FORMAT_Y16_U16V16_422_UNORM , planar2, 1, 1, 1, , , , , xy
PIPE_FORMAT_Y16_U16_V16_444_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv
PIPE_FORMAT_P010 , planar2, 1, 1, 1, , , , , xyzw, yuv
+PIPE_FORMAT_P012 , planar2, 1, 1, 1, , , , , xyzw, yuv
PIPE_FORMAT_P016 , planar2, 1, 1, 1, , , , , xyzw, yuv
# Usually used to implement IA44 and AI44 formats in video decoding
diff --git a/src/util/format/u_format.h b/src/util/format/u_format.h
index 034d43a2897..f19c6c089b7 100644
--- a/src/util/format/u_format.h
+++ b/src/util/format/u_format.h
@@ -1319,6 +1319,7 @@ util_format_get_plane_format(enum pipe_format format, unsigned plane)
case PIPE_FORMAT_Y16_U16_V16_444_UNORM:
return PIPE_FORMAT_R16_UNORM;
case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
case PIPE_FORMAT_Y16_U16V16_422_UNORM:
return !plane ? PIPE_FORMAT_R16_UNORM : PIPE_FORMAT_R16G16_UNORM;
@@ -1338,6 +1339,7 @@ util_format_get_plane_width(enum pipe_format format, unsigned plane,
case PIPE_FORMAT_NV12:
case PIPE_FORMAT_NV21:
case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
case PIPE_FORMAT_Y8_U8_V8_422_UNORM:
case PIPE_FORMAT_Y8_U8V8_422_UNORM:
@@ -1360,6 +1362,7 @@ util_format_get_plane_height(enum pipe_format format, unsigned plane,
case PIPE_FORMAT_NV12:
case PIPE_FORMAT_NV21:
case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
case PIPE_FORMAT_Y16_U16_V16_420_UNORM:
return !plane ? height : (height + 1) / 2;