From 24f2b0a8560f34745854bf8263fa7c2d0f95f2bc Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 5 Feb 2020 10:21:20 +0100 Subject: gallium/video: remove pipe_video_buffer.chroma_format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Leo Liu Part-of: --- src/gallium/state_trackers/va/image.c | 6 +++--- src/gallium/state_trackers/va/postproc.c | 6 ++++-- src/gallium/state_trackers/va/surface.c | 2 -- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/gallium/state_trackers/va') 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; -- cgit v1.2.3