Commit bcb8dc4a authored by Xiang, Haihao's avatar Xiang, Haihao

i965_drv_video: fix the format of a derived image for MPEG2 on ILK

The native format used for MPEG2 decoding on ILK is I420
parent 23868d8b
...@@ -775,6 +775,8 @@ i965_CreateContext(VADriverContextP ctx, ...@@ -775,6 +775,8 @@ i965_CreateContext(VADriverContextP ctx,
return vaStatus; return vaStatus;
} }
render_state->inited = 1;
switch (obj_config->profile) { switch (obj_config->profile) {
case VAProfileH264Baseline: case VAProfileH264Baseline:
case VAProfileH264Main: case VAProfileH264Main:
...@@ -1572,26 +1574,39 @@ VAStatus i965_DeriveImage(VADriverContextP ctx, ...@@ -1572,26 +1574,39 @@ VAStatus i965_DeriveImage(VADriverContextP ctx,
image->height = obj_surface->orig_height; image->height = obj_surface->orig_height;
image->data_size = data_size; image->data_size = data_size;
if (render_state->interleaved_uv) { if (!render_state->inited) {
image->format.fourcc = VA_FOURCC('N','V','1','2'); image->format.fourcc = VA_FOURCC('Y','V','1','2');
image->format.byte_order = VA_LSB_FIRST; image->format.byte_order = VA_LSB_FIRST;
image->format.bits_per_pixel = 12; image->format.bits_per_pixel = 12;
image->num_planes = 2; image->num_planes = 3;
image->pitches[0] = w_pitch; image->pitches[0] = w_pitch;
image->offsets[0] = 0; image->offsets[0] = 0;
image->pitches[1] = w_pitch; image->pitches[1] = w_pitch / 2;
image->offsets[1] = w_pitch * h_pitch; 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 { } else {
image->format.fourcc = VA_FOURCC('Y','V','1','2'); if (render_state->interleaved_uv) {
image->format.byte_order = VA_LSB_FIRST; image->format.fourcc = VA_FOURCC('N','V','1','2');
image->format.bits_per_pixel = 12; image->format.byte_order = VA_LSB_FIRST;
image->num_planes = 3; image->format.bits_per_pixel = 12;
image->pitches[0] = w_pitch; image->num_planes = 2;
image->offsets[0] = 0; image->pitches[0] = w_pitch;
image->pitches[1] = w_pitch / 2; image->offsets[0] = 0;
image->offsets[1] = w_pitch * h_pitch; image->pitches[1] = w_pitch;
image->pitches[2] = w_pitch / 2; image->offsets[1] = w_pitch * h_pitch;
image->offsets[2] = w_pitch * h_pitch + (w_pitch / 2) * (h_pitch / 2); } 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) { if (obj_surface->bo == NULL) {
......
...@@ -681,20 +681,25 @@ i965_render_src_surfaces_state(VADriverContextP ctx, ...@@ -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, 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); i965_render_src_surface_state(ctx, 2, region, 0, rw, rh, w, I965_SURFACEFORMAT_R8_UNORM);
if (render_state->interleaved_uv) { if (!render_state->inited) {
i965_render_src_surface_state(ctx, 3, region, w * h, rw / 2, rh / 2, w, I965_SURFACEFORMAT_R8G8_UNORM); /* UV */ int u3 = 5, u4 = 6, v5 = 3, v6 = 4;
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 (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, 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, 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, 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); 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);
}
} }
} }
......
...@@ -66,7 +66,8 @@ struct i965_render_state ...@@ -66,7 +66,8 @@ struct i965_render_state
int upload; int upload;
} curbe; } curbe;
int interleaved_uv; unsigned short interleaved_uv;
unsigned short inited;
struct intel_region *draw_region; struct intel_region *draw_region;
int pp_flag; /* 0: disable, 1: enable */ int pp_flag; /* 0: disable, 1: enable */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment