Mesa (18.0): st/omx/enc: fix blit setup for YUV LoadImage

Juan Antonio Suárez Romero jasuarez at kemper.freedesktop.org
Thu May 3 16:52:06 UTC 2018


Module: Mesa
Branch: 18.0
Commit: 1a23971b49f77960afb2c686d20fced476185602
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a23971b49f77960afb2c686d20fced476185602

Author: Leo Liu <leo.liu at amd.com>
Date:   Fri Apr 27 08:32:41 2018 -0400

st/omx/enc: fix blit setup for YUV LoadImage

The blit here involves scaling since it's copying from I8 format to R8G8 format.
Half of source will be filtered out with PIPE_TEX_FILTER_NEAREST instruction, it
looks that GPU always uses the second half as source. Currently we use "1" as
the start point of x for R, then causing 1 source pixel of U component shift to
right. So "-1" should be the start point for U component.

Cc: 18.0 18.1 <mesa-stable at lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
(cherry picked from commit 1c5f4f4e17f74d823d9e38c678e40e9f49e2c053)
[Juan A. Suarez: apply patch in
src/gallium/state_trackers/omx_bellagio/vid_enc.c]
Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>

Conflicts:
	src/gallium/state_trackers/omx/vid_enc_common.c

---

 src/gallium/state_trackers/omx_bellagio/vid_enc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/omx_bellagio/vid_enc.c b/src/gallium/state_trackers/omx_bellagio/vid_enc.c
index 1a4fb62d40..84a3654521 100644
--- a/src/gallium/state_trackers/omx_bellagio/vid_enc.c
+++ b/src/gallium/state_trackers/omx_bellagio/vid_enc.c
@@ -934,7 +934,7 @@ static OMX_ERRORTYPE enc_LoadImage(omx_base_PortType *port, OMX_BUFFERHEADERTYPE
       blit.src.resource = inp->resource;
       blit.src.format = inp->resource->format;
 
-      blit.src.box.x = 0;
+      blit.src.box.x = -1;
       blit.src.box.y = def->nFrameHeight;
       blit.src.box.width = def->nFrameWidth;
       blit.src.box.height = def->nFrameHeight / 2 ;
@@ -948,11 +948,11 @@ static OMX_ERRORTYPE enc_LoadImage(omx_base_PortType *port, OMX_BUFFERHEADERTYPE
       blit.dst.box.depth = 1;
       blit.filter = PIPE_TEX_FILTER_NEAREST;
 
-      blit.mask = PIPE_MASK_G;
+      blit.mask = PIPE_MASK_R;
       priv->s_pipe->blit(priv->s_pipe, &blit);
 
-      blit.src.box.x = 1;
-      blit.mask = PIPE_MASK_R;
+      blit.src.box.x = 0;
+      blit.mask = PIPE_MASK_G;
       priv->s_pipe->blit(priv->s_pipe, &blit);
       priv->s_pipe->flush(priv->s_pipe, NULL, 0);
 




More information about the mesa-commit mailing list