[Libva] [PATCH 2/2] Use VA surface format to determine interleaved_uv.
Gwenole Beauchesne
gb.devel at gmail.com
Mon Sep 5 06:22:14 PDT 2011
i.e. fix vaPutImage() when no VA context is created for decoding.
This should also allow for creating I420 + NV12 surfaces while making
it possible to render both correctly as it would not depend on a
global flag.
---
src/i965_render.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/i965_render.c b/src/i965_render.c
index ad8de1e..5c9e7f5 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -975,7 +975,7 @@ i965_render_upload_vertex(
}
static void
-i965_render_upload_constants(VADriverContextP ctx)
+i965_render_upload_constants(VADriverContextP ctx, unsigned int fourcc)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_render_state *render_state = &i965->render_state;
@@ -987,12 +987,7 @@ i965_render_upload_constants(VADriverContextP ctx)
dri_bo_map(render_state->curbe.bo, 1);
assert(render_state->curbe.bo->virtual);
constant_buffer = render_state->curbe.bo->virtual;
-
- if (render_state->interleaved_uv)
- *constant_buffer = 1;
- else
- *constant_buffer = 0;
-
+ *constant_buffer = (fourcc == VA_FOURCC_NV12); /* interleaved_uv */
dri_bo_unmap(render_state->curbe.bo);
render_state->curbe.upload = 1;
}
@@ -1005,6 +1000,9 @@ i965_surface_render_state_setup(
const VARectangle *dst_rect
)
{
+ struct i965_driver_data * const i965 = i965_driver_data(ctx);
+ struct object_surface * const obj_surface = SURFACE(surface);
+
i965_render_vs_unit(ctx);
i965_render_sf_unit(ctx);
i965_render_dest_surface_state(ctx, 0);
@@ -1014,8 +1012,9 @@ i965_surface_render_state_setup(
i965_render_cc_viewport(ctx);
i965_render_cc_unit(ctx);
i965_render_upload_vertex(ctx, surface, src_rect, dst_rect);
- i965_render_upload_constants(ctx);
+ i965_render_upload_constants(ctx, obj_surface->fourcc);
}
+
static void
i965_subpic_render_state_setup(
VADriverContextP ctx,
@@ -1689,6 +1688,9 @@ gen6_render_setup_states(
const VARectangle *dst_rect
)
{
+ struct i965_driver_data * const i965 = i965_driver_data(ctx);
+ struct object_surface * const obj_surface = SURFACE(surface);
+
i965_render_dest_surface_state(ctx, 0);
i965_render_src_surfaces_state(ctx, surface);
i965_render_sampler(ctx);
@@ -1696,7 +1698,7 @@ gen6_render_setup_states(
gen6_render_color_calc_state(ctx);
gen6_render_blend_state(ctx);
gen6_render_depth_stencil_state(ctx);
- i965_render_upload_constants(ctx);
+ i965_render_upload_constants(ctx, obj_surface->fourcc);
i965_render_upload_vertex(ctx, surface, src_rect, dst_rect);
}
@@ -2281,6 +2283,9 @@ gen7_render_setup_states(
const VARectangle *dst_rect
)
{
+ struct i965_driver_data * const i965 = i965_driver_data(ctx);
+ struct object_surface * const obj_surface = SURFACE(surface);
+
i965_render_dest_surface_state(ctx, 0);
i965_render_src_surfaces_state(ctx, surface);
gen7_render_sampler(ctx);
@@ -2288,7 +2293,7 @@ gen7_render_setup_states(
gen7_render_color_calc_state(ctx);
gen7_render_blend_state(ctx);
gen7_render_depth_stencil_state(ctx);
- i965_render_upload_constants(ctx);
+ i965_render_upload_constants(ctx, obj_surface->fourcc);
i965_render_upload_vertex(ctx, surface, src_rect, dst_rect);
}
--
1.7.4.1
More information about the Libva
mailing list