[Libva] [PATCH v3 intel-driver 2/8] surface: fix geometry (size, layout) of grayscale surfaces.
Gwenole Beauchesne
gb.devel at gmail.com
Thu May 15 03:07:52 PDT 2014
Fix size of the allocated buffer used to represent grayscale (Y800)
surfaces. Only the luminance component is needed, thus implying a
single plane.
Likewise, update render routines to only submit the first plane.
The existing render kernels readily only care about that single
plane.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
src/gen8_render.c | 3 +++
src/i965_drv_video.c | 9 +++++----
src/i965_render.c | 3 +++
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/gen8_render.c b/src/gen8_render.c
index 90f278e..71ff0fd 100644
--- a/src/gen8_render.c
+++ b/src/gen8_render.c
@@ -276,6 +276,9 @@ gen8_render_src_surfaces_state(
gen8_render_src_surface_state(ctx, 1, region, 0, rw, rh, region_pitch, I965_SURFACEFORMAT_R8_UNORM, flags); /* Y */
gen8_render_src_surface_state(ctx, 2, region, 0, rw, rh, region_pitch, I965_SURFACEFORMAT_R8_UNORM, flags);
+ if (obj_surface->fourcc == VA_FOURCC_Y800) /* single plane for grayscale */
+ return;
+
if (obj_surface->fourcc == VA_FOURCC_NV12) {
gen8_render_src_surface_state(ctx, 3, region,
region_pitch * obj_surface->y_cb_offset,
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index c700776..064cb26 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -1007,6 +1007,7 @@ bpp_1stplane_by_fourcc(unsigned int fourcc)
case VA_FOURCC_YUY2:
return 2;
+ case VA_FOURCC_Y800:
case VA_FOURCC_YV12:
case VA_FOURCC_IMC3:
case VA_FOURCC_IYUV:
@@ -3012,13 +3013,13 @@ i965_check_alloc_surface_bo(VADriverContextP ctx,
case VA_FOURCC_Y800:
assert(subsampling == SUBSAMPLE_YUV400);
- obj_surface->cb_cr_pitch = obj_surface->width;
+ obj_surface->cb_cr_pitch = 0;
obj_surface->cb_cr_width = 0;
obj_surface->cb_cr_height = 0;
- obj_surface->y_cb_offset = obj_surface->height;
- obj_surface->y_cr_offset = obj_surface->y_cb_offset + ALIGN(obj_surface->cb_cr_height, 32);
+ obj_surface->y_cb_offset = 0;
+ obj_surface->y_cr_offset = 0;
region_width = obj_surface->width;
- region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32) * 2;
+ region_height = obj_surface->height;
break;
diff --git a/src/i965_render.c b/src/i965_render.c
index 6520ce3..c5c224e 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -876,6 +876,9 @@ i965_render_src_surfaces_state(
i965_render_src_surface_state(ctx, 1, region, 0, rw, rh, region_pitch, I965_SURFACEFORMAT_R8_UNORM, flags); /* Y */
i965_render_src_surface_state(ctx, 2, region, 0, rw, rh, region_pitch, I965_SURFACEFORMAT_R8_UNORM, flags);
+ if (obj_surface->fourcc == VA_FOURCC_Y800) /* single plane for grayscale */
+ return;
+
if (obj_surface->fourcc == VA_FOURCC_NV12) {
i965_render_src_surface_state(ctx, 3, region,
region_pitch * obj_surface->y_cb_offset,
--
1.9.1
More information about the Libva
mailing list