Mesa (master): frontends/va: Add support for NV12/P010/P016 to vaDeriveImage
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Sep 15 15:03:53 UTC 2020
Module: Mesa
Branch: master
Commit: 8c7ca97d3e3e9f83d7d968fcd916e6c1242cfd75
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c7ca97d3e3e9f83d7d968fcd916e6c1242cfd75
Author: Thong Thai <thong.thai at amd.com>
Date: Sat Aug 15 14:09:01 2020 -0400
frontends/va: Add support for NV12/P010/P016 to vaDeriveImage
Signed-off-by: Thong Thai <thong.thai at amd.com>
Reviewed-by: Leo Liu <leo.liu at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5942>
---
src/gallium/frontends/va/image.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/gallium/frontends/va/image.c b/src/gallium/frontends/va/image.c
index 3a6a7e83d14..bda08ae4314 100644
--- a/src/gallium/frontends/va/image.c
+++ b/src/gallium/frontends/va/image.c
@@ -262,11 +262,15 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image)
offset = 0;
}
+ img->num_planes = 1;
+ img->offsets[0] = offset;
+
switch (img->format.fourcc) {
case VA_FOURCC('U','Y','V','Y'):
case VA_FOURCC('Y','U','Y','V'):
img->pitches[0] = stride > 0 ? stride : w * 2;
assert(img->pitches[0] >= (w * 2));
+ img->data_size = img->pitches[0] * h;
break;
case VA_FOURCC('B','G','R','A'):
@@ -275,6 +279,17 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image)
case VA_FOURCC('R','G','B','X'):
img->pitches[0] = stride > 0 ? stride : w * 4;
assert(img->pitches[0] >= (w * 4));
+ img->data_size = img->pitches[0] * h;
+ break;
+
+ case VA_FOURCC('N','V','1','2'):
+ case VA_FOURCC('P','0','1','0'):
+ case VA_FOURCC('P','0','1','6'):
+ img->num_planes = 2;
+ img->pitches[0] = stride > 0 ? stride : w;
+ img->pitches[1] = stride > 0 ? stride : w;
+ img->offsets[1] = (stride > 0 ? stride : w) * h;
+ img->data_size = (stride > 0 ? stride : w) * h * 3 / 2;
break;
default:
@@ -285,10 +300,6 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image)
return VA_STATUS_ERROR_OPERATION_FAILED;
}
- img->num_planes = 1;
- img->offsets[0] = offset;
- img->data_size = img->pitches[0] * h;
-
img_buf = CALLOC(1, sizeof(vlVaBuffer));
if (!img_buf) {
FREE(img);
More information about the mesa-commit
mailing list