summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i965_drv_video.c54
-rw-r--r--i965_render.c23
-rw-r--r--i965_render.h3
3 files changed, 51 insertions, 29 deletions
diff --git a/i965_drv_video.c b/i965_drv_video.c
index 766d513..aa746f2 100644
--- a/i965_drv_video.c
+++ b/i965_drv_video.c
@@ -788,6 +788,8 @@ i965_CreateContext(VADriverContextP ctx,
return vaStatus;
}
+ render_state->inited = 1;
+
switch (obj_config->profile) {
case VAProfileH264Baseline:
case VAProfileH264Main:
@@ -1652,26 +1654,39 @@ VAStatus i965_DeriveImage(VADriverContextP ctx,
image->height = obj_surface->orig_height;
image->data_size = data_size;
- if (render_state->interleaved_uv) {
- image->format.fourcc = VA_FOURCC('N','V','1','2');
- image->format.byte_order = VA_LSB_FIRST;
- image->format.bits_per_pixel = 12;
- image->num_planes = 2;
- image->pitches[0] = w_pitch;
- image->offsets[0] = 0;
- image->pitches[1] = w_pitch;
- image->offsets[1] = w_pitch * h_pitch;
+ if (!render_state->inited) {
+ image->format.fourcc = VA_FOURCC('Y','V','1','2');
+ image->format.byte_order = VA_LSB_FIRST;
+ image->format.bits_per_pixel = 12;
+ image->num_planes = 3;
+ image->pitches[0] = w_pitch;
+ image->offsets[0] = 0;
+ image->pitches[1] = w_pitch / 2;
+ image->offsets[1] = w_pitch * h_pitch;
+ image->pitches[2] = w_pitch / 2;
+ image->offsets[2] = w_pitch * h_pitch + (w_pitch / 2) * (h_pitch / 2);
} else {
- image->format.fourcc = VA_FOURCC('Y','V','1','2');
- image->format.byte_order = VA_LSB_FIRST;
- image->format.bits_per_pixel = 12;
- image->num_planes = 3;
- image->pitches[0] = w_pitch;
- image->offsets[0] = 0;
- image->pitches[1] = w_pitch / 2;
- image->offsets[1] = w_pitch * h_pitch;
- image->pitches[2] = w_pitch / 2;
- image->offsets[2] = w_pitch * h_pitch + (w_pitch / 2) * (h_pitch / 2);
+ if (render_state->interleaved_uv) {
+ image->format.fourcc = VA_FOURCC('N','V','1','2');
+ image->format.byte_order = VA_LSB_FIRST;
+ image->format.bits_per_pixel = 12;
+ image->num_planes = 2;
+ image->pitches[0] = w_pitch;
+ image->offsets[0] = 0;
+ image->pitches[1] = w_pitch;
+ image->offsets[1] = w_pitch * h_pitch;
+ } else {
+ image->format.fourcc = VA_FOURCC('I','4','2','0');
+ image->format.byte_order = VA_LSB_FIRST;
+ image->format.bits_per_pixel = 12;
+ image->num_planes = 3;
+ image->pitches[0] = w_pitch;
+ image->offsets[0] = 0;
+ image->pitches[1] = w_pitch / 2;
+ image->offsets[1] = w_pitch * h_pitch;
+ image->pitches[2] = w_pitch / 2;
+ image->offsets[2] = w_pitch * h_pitch + (w_pitch / 2) * (h_pitch / 2);
+ }
}
if (obj_surface->bo == NULL) {
@@ -1718,6 +1733,7 @@ VAStatus i965_DeriveImage(VADriverContextP ctx,
*out_image = *image;
obj_surface->flags |= SURFACE_DERIVED;
+ obj_image->derived_surface = surface;
return VA_STATUS_SUCCESS;
diff --git a/i965_render.c b/i965_render.c
index 3092195..efed4c3 100644
--- a/i965_render.c
+++ b/i965_render.c
@@ -681,20 +681,25 @@ i965_render_src_surfaces_state(VADriverContextP ctx,
i965_render_src_surface_state(ctx, 1, region, 0, rw, rh, w, I965_SURFACEFORMAT_R8_UNORM); /* Y */
i965_render_src_surface_state(ctx, 2, region, 0, rw, rh, w, I965_SURFACEFORMAT_R8_UNORM);
- if (render_state->interleaved_uv) {
- i965_render_src_surface_state(ctx, 3, region, w * h, rw / 2, rh / 2, w, I965_SURFACEFORMAT_R8G8_UNORM); /* UV */
- i965_render_src_surface_state(ctx, 4, region, w * h, rw / 2, rh / 2, w, I965_SURFACEFORMAT_R8G8_UNORM);
- } else {
- int u3 = 3, u4 = 4, v5 = 5, v6 = 6;
+ if (!render_state->inited) {
+ int u3 = 5, u4 = 6, v5 = 3, v6 = 4;
- if (obj_surface->flags & SURFACE_DERIVED) {
- u3 = 5, u4 = 6, v5 = 3, v6 = 4;
- }
-
i965_render_src_surface_state(ctx, u3, region, w * h, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM); /* U */
i965_render_src_surface_state(ctx, u4, region, w * h, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM);
i965_render_src_surface_state(ctx, v5, region, w * h + w * h / 4, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM); /* V */
i965_render_src_surface_state(ctx, v6, region, w * h + w * h / 4, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM);
+ } else {
+ if (render_state->interleaved_uv) {
+ i965_render_src_surface_state(ctx, 3, region, w * h, rw / 2, rh / 2, w, I965_SURFACEFORMAT_R8G8_UNORM); /* UV */
+ i965_render_src_surface_state(ctx, 4, region, w * h, rw / 2, rh / 2, w, I965_SURFACEFORMAT_R8G8_UNORM);
+ } else {
+ int u3 = 3, u4 = 4, v5 = 5, v6 = 6;
+
+ i965_render_src_surface_state(ctx, u3, region, w * h, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM); /* U */
+ i965_render_src_surface_state(ctx, u4, region, w * h, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM);
+ i965_render_src_surface_state(ctx, v5, region, w * h + w * h / 4, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM); /* V */
+ i965_render_src_surface_state(ctx, v6, region, w * h + w * h / 4, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM);
+ }
}
}
diff --git a/i965_render.h b/i965_render.h
index 8ff4fe2..dc7bcc2 100644
--- a/i965_render.h
+++ b/i965_render.h
@@ -66,7 +66,8 @@ struct i965_render_state
int upload;
} curbe;
- int interleaved_uv;
+ unsigned short interleaved_uv;
+ unsigned short inited;
struct intel_region *draw_region;
int pp_flag; /* 0: disable, 1: enable */