[Mesa-dev] [PATCH 05/12] st/va: add nv12 i420 yv12 format to deriveimage call

Boyuan Zhang boyuan.zhang at amd.com
Thu Jun 30 18:30:46 UTC 2016


Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com>
---
 src/gallium/state_trackers/va/image.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c
index c82b554..3c8cc9c 100644
--- a/src/gallium/state_trackers/va/image.c
+++ b/src/gallium/state_trackers/va/image.c
@@ -275,6 +275,27 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image)
    }
 
    switch (img->format.fourcc) {
+   case VA_FOURCC('N','V','1','2'):
+      img->num_planes = 2;
+      img->pitches[0] = pitch[0];
+      img->offsets[0] = 0;
+      img->pitches[1] = pitch[1];
+      img->offsets[1] = pitch[0] * h;
+      img->data_size  = pitch[0] * h + pitch[1] * h / 2;
+      break;
+
+   case VA_FOURCC('I','4','2','0'):
+   case VA_FOURCC('Y','V','1','2'):
+      img->num_planes = 3;
+      img->pitches[0] = pitch[0];
+      img->offsets[0] = 0;
+      img->pitches[1] = pitch[1];
+      img->offsets[1] = pitch[0] * h;
+      img->pitches[2] = pitch[2];
+      img->offsets[2] = pitch[0] * h + pitch[1] * h / 4;
+      img->data_size  = pitch[0] * h + pitch[1] * h / 4 + pitch[2] * h / 4;
+      break;
+
    case VA_FOURCC('U','Y','V','Y'):
    case VA_FOURCC('Y','U','Y','V'):
       img->num_planes = 1;
-- 
2.7.4



More information about the mesa-dev mailing list