aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2020-02-05 10:21:20 +0100
committerPierre-Eric Pelloux-Prayer <[email protected]>2020-02-27 10:01:31 +0100
commit24f2b0a8560f34745854bf8263fa7c2d0f95f2bc (patch)
tree775bf398b06d9e3c10cc4d5f9a0f9ca80d09ccea /src/gallium/state_trackers
parent87807298a307d4e38195dc04f66c26404e7cb791 (diff)
gallium/video: remove pipe_video_buffer.chroma_format
chroma_format depends on buffer_format so use the format_to_chroma_format helper instead of storing it next to buffer_format. This avoids bugs where one value is changed without updating the other. Reviewed-by: Marek Olšák <[email protected]> Acked-by: Leo Liu <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3738>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/omx/bellagio/vid_enc.c1
-rw-r--r--src/gallium/state_trackers/omx/vid_dec_common.c5
-rw-r--r--src/gallium/state_trackers/omx/vid_dec_h264_common.c1
-rw-r--r--src/gallium/state_trackers/omx/vid_enc_common.c1
-rw-r--r--src/gallium/state_trackers/va/image.c6
-rw-r--r--src/gallium/state_trackers/va/postproc.c6
-rw-r--r--src/gallium/state_trackers/va/surface.c2
-rw-r--r--src/gallium/state_trackers/vdpau/decode.c3
-rw-r--r--src/gallium/state_trackers/vdpau/mixer.c2
-rw-r--r--src/gallium/state_trackers/vdpau/output.c1
-rw-r--r--src/gallium/state_trackers/vdpau/surface.c8
-rw-r--r--src/gallium/state_trackers/xvmc/surface.c2
12 files changed, 18 insertions, 20 deletions
diff --git a/src/gallium/state_trackers/omx/bellagio/vid_enc.c b/src/gallium/state_trackers/omx/bellagio/vid_enc.c
index 8153103e97b..7f4a673d3cd 100644
--- a/src/gallium/state_trackers/omx/bellagio/vid_enc.c
+++ b/src/gallium/state_trackers/omx/bellagio/vid_enc.c
@@ -547,7 +547,6 @@ static OMX_ERRORTYPE vid_enc_SetConfig(OMX_HANDLETYPE handle, OMX_INDEXTYPE idx,
struct pipe_video_buffer templat = {};
templat.buffer_format = PIPE_FORMAT_NV12;
- templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
templat.width = priv->scale.xWidth;
templat.height = priv->scale.xHeight;
templat.interlaced = false;
diff --git a/src/gallium/state_trackers/omx/vid_dec_common.c b/src/gallium/state_trackers/omx/vid_dec_common.c
index 21952513de1..5ca544f8386 100644
--- a/src/gallium/state_trackers/omx/vid_dec_common.c
+++ b/src/gallium/state_trackers/omx/vid_dec_common.c
@@ -52,7 +52,6 @@ void vid_dec_NeedTarget(vid_dec_PrivateType *priv)
if (!priv->target) {
memset(&templat, 0, sizeof(templat));
- templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
templat.width = priv->codec->width;
templat.height = priv->codec->height;
templat.buffer_format = pscreen->get_video_param(
@@ -132,7 +131,9 @@ void vid_dec_FillOutput(vid_dec_PrivateType *priv, struct pipe_video_buffer *buf
if (!views[i]) continue;
width = def->nFrameWidth;
height = def->nFrameHeight;
- vl_video_buffer_adjust_size(&width, &height, i, buf->chroma_format, buf->interlaced);
+ vl_video_buffer_adjust_size(&width, &height, i,
+ pipe_format_to_chroma_format(buf->buffer_format),
+ buf->interlaced);
for (j = 0; j < views[i]->texture->array_size; ++j) {
struct pipe_box box = {0, 0, j, width, height, 1};
struct pipe_transfer *transfer;
diff --git a/src/gallium/state_trackers/omx/vid_dec_h264_common.c b/src/gallium/state_trackers/omx/vid_dec_h264_common.c
index 388852ba542..4190251c90d 100644
--- a/src/gallium/state_trackers/omx/vid_dec_h264_common.c
+++ b/src/gallium/state_trackers/omx/vid_dec_h264_common.c
@@ -1096,7 +1096,6 @@ void vid_dec_FrameDecoded_common(vid_dec_PrivateType* priv, OMX_BUFFERHEADERTYPE
port = tiz_krn_get_port(tiz_get_krn(handleOf (priv)), OMX_VID_DEC_AVC_INPUT_PORT_INDEX);
#endif
memset(&templat, 0, sizeof(templat));
- templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
#if ENABLE_ST_OMX_BELLAGIO
templat.width = port->sPortParam.format.video.nFrameWidth;
templat.height = port->sPortParam.format.video.nFrameHeight;
diff --git a/src/gallium/state_trackers/omx/vid_enc_common.c b/src/gallium/state_trackers/omx/vid_enc_common.c
index c15c3516973..1cc0c130e5d 100644
--- a/src/gallium/state_trackers/omx/vid_enc_common.c
+++ b/src/gallium/state_trackers/omx/vid_enc_common.c
@@ -194,7 +194,6 @@ struct encode_task *enc_NeedTask_common(vid_enc_PrivateType * priv, OMX_VIDEO_PO
return NULL;
templat.buffer_format = PIPE_FORMAT_NV12;
- templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
templat.width = def->nFrameWidth;
templat.height = def->nFrameHeight;
templat.interlaced = false;
diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c
index b0e32da3e8b..89dd5baab07 100644
--- a/src/gallium/state_trackers/va/image.c
+++ b/src/gallium/state_trackers/va/image.c
@@ -65,7 +65,7 @@ vlVaVideoSurfaceSize(vlVaSurface *p_surf, int component,
*height = p_surf->templat.height;
vl_video_buffer_adjust_size(width, height, component,
- p_surf->templat.chroma_format,
+ pipe_format_to_chroma_format(p_surf->templat.buffer_format),
p_surf->templat.interlaced);
}
@@ -453,10 +453,10 @@ vlVaGetImage(VADriverContextP ctx, VASurfaceID surface, int x, int y,
unsigned box_y = y & ~1;
if (!views[i]) continue;
vl_video_buffer_adjust_size(&box_w, &box_h, i,
- surf->templat.chroma_format,
+ pipe_format_to_chroma_format(surf->templat.buffer_format),
surf->templat.interlaced);
vl_video_buffer_adjust_size(&box_x, &box_y, i,
- surf->templat.chroma_format,
+ pipe_format_to_chroma_format(surf->templat.buffer_format),
surf->templat.interlaced);
for (j = 0; j < views[i]->texture->array_size; ++j) {
struct pipe_box box = {box_x, box_y, j, box_w, box_h, 1};
diff --git a/src/gallium/state_trackers/va/postproc.c b/src/gallium/state_trackers/va/postproc.c
index 661e3bf9414..83293c8343f 100644
--- a/src/gallium/state_trackers/va/postproc.c
+++ b/src/gallium/state_trackers/va/postproc.c
@@ -97,9 +97,11 @@ static void vlVaGetBox(struct pipe_video_buffer *buf, unsigned idx,
width = region->width;
height = region->height;
- vl_video_buffer_adjust_size(&x, &y, plane, buf->chroma_format,
+ vl_video_buffer_adjust_size(&x, &y, plane,
+ pipe_format_to_chroma_format(buf->buffer_format),
buf->interlaced);
- vl_video_buffer_adjust_size(&width, &height, plane, buf->chroma_format,
+ vl_video_buffer_adjust_size(&width, &height, plane,
+ pipe_format_to_chroma_format(buf->buffer_format),
buf->interlaced);
box->x = region->x < 0 ? -x : x;
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
index 47c6f9b06c9..495a68b492c 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -786,8 +786,6 @@ vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int format,
templat.buffer_format = expected_format;
}
- templat.chroma_format = ChromaToPipe(format);
-
templat.width = width;
templat.height = height;
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
index 48dfb0e0003..8d3c58714a8 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -600,7 +600,8 @@ vlVdpDecoderRender(VdpDecoder decoder,
if (vlsurf->device != vldecoder->device)
return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
- if (vlsurf->video_buffer != NULL && vlsurf->video_buffer->chroma_format != dec->chroma_format)
+ if (vlsurf->video_buffer != NULL &&
+ pipe_format_to_chroma_format(vlsurf->video_buffer->buffer_format) != dec->chroma_format)
// TODO: Recreate decoder with correct chroma
return VDP_STATUS_INVALID_CHROMA_TYPE;
diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c
index a50232bfac3..2e2bd20ef39 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -272,7 +272,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
if (vmixer->video_width > video_buffer->width ||
vmixer->video_height > video_buffer->height ||
- vmixer->chroma_format != video_buffer->chroma_format)
+ vmixer->chroma_format != pipe_format_to_chroma_format(video_buffer->buffer_format))
return VDP_STATUS_INVALID_SIZE;
if (layer_count > vmixer->max_layers)
diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c
index cb0e2ffa57c..ac8fc550bc7 100644
--- a/src/gallium/state_trackers/vdpau/output.c
+++ b/src/gallium/state_trackers/vdpau/output.c
@@ -465,7 +465,6 @@ vlVdpOutputSurfacePutBitsYCbCr(VdpOutputSurface surface,
mtx_lock(&vlsurface->device->mutex);
memset(&vtmpl, 0, sizeof(vtmpl));
vtmpl.buffer_format = format;
- vtmpl.chroma_format = FormatYCBCRToPipeChroma(source_ycbcr_format);
if (destination_rect) {
vtmpl.width = abs(destination_rect->x0-destination_rect->x1);
diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c
index e9d55a282e2..1f1b0b3ef68 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -89,7 +89,7 @@ vlVdpVideoSurfaceCreate(VdpDevice device, VdpChromaType chroma_type,
PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
PIPE_VIDEO_CAP_PREFERED_FORMAT
);
- p_surf->templat.chroma_format = ChromaToPipe(chroma_type);
+ assert(pipe_format_to_chroma_format(p_surf->templat.buffer_format) == ChromaToPipe(chroma_type));
p_surf->templat.width = width;
p_surf->templat.height = height;
p_surf->templat.interlaced = pipe->screen->get_video_param
@@ -168,11 +168,11 @@ vlVdpVideoSurfaceGetParameters(VdpVideoSurface surface,
if (p_surf->video_buffer) {
*width = p_surf->video_buffer->width;
*height = p_surf->video_buffer->height;
- *chroma_type = PipeToChroma(p_surf->video_buffer->chroma_format);
+ *chroma_type = PipeToChroma(pipe_format_to_chroma_format(p_surf->video_buffer->buffer_format));
} else {
*width = p_surf->templat.width;
*height = p_surf->templat.height;
- *chroma_type = PipeToChroma(p_surf->templat.chroma_format);
+ *chroma_type = PipeToChroma(pipe_format_to_chroma_format(p_surf->templat.buffer_format));
}
return VDP_STATUS_OK;
@@ -186,7 +186,7 @@ vlVdpVideoSurfaceSize(vlVdpSurface *p_surf, int component,
*height = p_surf->templat.height;
vl_video_buffer_adjust_size(width, height, component,
- p_surf->templat.chroma_format,
+ pipe_format_to_chroma_format(p_surf->templat.buffer_format),
p_surf->templat.interlaced);
}
diff --git a/src/gallium/state_trackers/xvmc/surface.c b/src/gallium/state_trackers/xvmc/surface.c
index c450a273767..03ee59482c6 100644
--- a/src/gallium/state_trackers/xvmc/surface.c
+++ b/src/gallium/state_trackers/xvmc/surface.c
@@ -182,7 +182,7 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
context_priv->decoder->entrypoint,
PIPE_VIDEO_CAP_PREFERED_FORMAT
);
- tmpl.chroma_format = context_priv->decoder->chroma_format;
+ assert(pipe_format_to_chroma_format(tmpl.buffer_format) == context_priv->decoder->chroma_format);
tmpl.width = context_priv->decoder->width;
tmpl.height = context_priv->decoder->height;
tmpl.interlaced = pipe->screen->get_video_param