From f3569f215d0f46006ce34485d526c5ad56c463bb Mon Sep 17 00:00:00 2001 From: Thong Thai Date: Wed, 18 Dec 2019 11:26:34 -0500 Subject: gallium: Add PIPE_FORMAT_P010 support Signed-off-by: Thong Thai Reviewed-by: Leo Liu Part-of: --- src/gallium/auxiliary/vl/vl_video_buffer.c | 1 + src/gallium/include/pipe/p_format.h | 1 + src/gallium/state_trackers/va/va_private.h | 3 +++ src/mesa/state_tracker/st_atom_sampler.c | 1 + src/mesa/state_tracker/st_atom_texture.c | 1 + src/mesa/state_tracker/st_program.h | 1 + src/mesa/state_tracker/st_sampler_view.c | 1 + 7 files changed, 9 insertions(+) diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index 25322242b52..bcb19fdad2a 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -80,6 +80,7 @@ vl_video_buffer_plane_order(enum pipe_format format) case PIPE_FORMAT_B8G8R8A8_UNORM: case PIPE_FORMAT_YUYV: case PIPE_FORMAT_UYVY: + case PIPE_FORMAT_P010: case PIPE_FORMAT_P016: return const_resource_plane_order_YUV; diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index c1e8bc0f0d7..46bb8c97a00 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -450,6 +450,7 @@ enum pipe_format { PIPE_FORMAT_FXT1_RGB, PIPE_FORMAT_FXT1_RGBA, + PIPE_FORMAT_P010, PIPE_FORMAT_P016, PIPE_FORMAT_R10G10B10X2_UNORM, diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h index b2b997d4799..bed1189b9d1 100644 --- a/src/gallium/state_trackers/va/va_private.h +++ b/src/gallium/state_trackers/va/va_private.h @@ -96,6 +96,7 @@ VaFourccToPipeFormat(unsigned format) case VA_FOURCC('N','V','1','2'): return PIPE_FORMAT_NV12; case VA_FOURCC('P','0','1','0'): + return PIPE_FORMAT_P010; case VA_FOURCC('P','0','1','6'): return PIPE_FORMAT_P016; case VA_FOURCC('I','4','2','0'): @@ -126,6 +127,8 @@ PipeFormatToVaFourcc(enum pipe_format p_format) switch (p_format) { case PIPE_FORMAT_NV12: return VA_FOURCC('N','V','1','2'); + case PIPE_FORMAT_P010: + return VA_FOURCC('P','0','1','0'); case PIPE_FORMAT_P016: return VA_FOURCC('P','0','1','6'); case PIPE_FORMAT_IYUV: diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 86113c93c49..c0f43befa4d 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -309,6 +309,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_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 070e5609157..ef54bc5a77f 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -191,6 +191,7 @@ update_textures(struct st_context *st, sampler_views[extra] = st->pipe->create_sampler_view(st->pipe, stObj->pt->next, &tmpl); break; + case PIPE_FORMAT_P010: case PIPE_FORMAT_P016: /* we need one additional R16G16 view: */ tmpl.format = PIPE_FORMAT_RG1616_UNORM; diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index e5c6ac0a96a..69ad595143f 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -74,6 +74,7 @@ st_get_external_sampler_key(struct st_context *st, struct gl_program *prog) switch (st_get_view_format(stObj)) { case PIPE_FORMAT_NV12: + case PIPE_FORMAT_P010: 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 ed84b093266..8c0277fe42a 100644 --- a/src/mesa/state_tracker/st_sampler_view.c +++ b/src/mesa/state_tracker/st_sampler_view.c @@ -495,6 +495,7 @@ get_sampler_view_format(struct st_context *st, case PIPE_FORMAT_IYUV: format = PIPE_FORMAT_R8_UNORM; break; + case PIPE_FORMAT_P010: case PIPE_FORMAT_P016: format = PIPE_FORMAT_R16_UNORM; break; -- cgit v1.2.3