summaryrefslogtreecommitdiff
path: root/i965_drv_video
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2011-06-27 18:30:21 -0700
committerXiang, Haihao <haihao.xiang@intel.com>2011-06-29 09:54:19 +0800
commit24ffa0da5cd2b922313783b33bdad6997d9467b7 (patch)
treec80b3639789239dd0eec58ee0a96c206ac405439 /i965_drv_video
parent6b7f6b5e8bb850428e3c86a3ca14d5c688d0a3ff (diff)
downloadlibva-24ffa0da5cd2b922313783b33bdad6997d9467b7.tar.gz
i965_drv_video: add support for VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD.
Diffstat (limited to 'i965_drv_video')
-rw-r--r--i965_drv_video/i965_drv_video.c9
-rw-r--r--i965_drv_video/i965_drv_video.h1
-rw-r--r--i965_drv_video/i965_render.c27
3 files changed, 21 insertions, 16 deletions
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index b147b84..39ec1ba 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -104,18 +104,18 @@ static const i965_subpic_format_map_t
i965_subpic_formats_map[I965_MAX_SUBPIC_FORMATS + 1] = {
{ I965_SURFACETYPE_INDEXED, I965_SURFACEFORMAT_P4A4_UNORM,
{ VA_FOURCC('I','A','4','4'), VA_MSB_FIRST, 8, },
- 0 },
+ VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD },
{ I965_SURFACETYPE_INDEXED, I965_SURFACEFORMAT_A4P4_UNORM,
{ VA_FOURCC('A','I','4','4'), VA_MSB_FIRST, 8, },
- 0 },
+ VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD },
{ I965_SURFACETYPE_RGBA, I965_SURFACEFORMAT_B8G8R8A8_UNORM,
{ VA_FOURCC('B','G','R','A'), VA_LSB_FIRST, 32,
32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 },
- 0 },
+ VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD },
{ I965_SURFACETYPE_RGBA, I965_SURFACEFORMAT_R8G8B8A8_UNORM,
{ VA_FOURCC('R','G','B','A'), VA_LSB_FIRST, 32,
32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 },
- 0 },
+ VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD },
};
static const i965_subpic_format_map_t *
@@ -695,6 +695,7 @@ i965_AssociateSubpicture(VADriverContextP ctx,
obj_subpic->dst_rect.y = dest_y;
obj_subpic->dst_rect.width = dest_width;
obj_subpic->dst_rect.height = dest_height;
+ obj_subpic->flags = flags;
for (i = 0; i < num_surfaces; i++) {
struct object_surface *obj_surface = SURFACE(target_surfaces[i]);
diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h
index 15be71c..94e7ed3 100644
--- a/i965_drv_video/i965_drv_video.h
+++ b/i965_drv_video/i965_drv_video.h
@@ -196,6 +196,7 @@ struct object_subpic
int height;
int pitch;
dri_bo *bo;
+ unsigned int flags;
};
struct hw_codec_info
diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c
index d387cb9..e86464c 100644
--- a/i965_drv_video/i965_render.c
+++ b/i965_drv_video/i965_render.c
@@ -883,26 +883,29 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx,
struct i965_render_state *render_state = &i965->render_state;
struct object_surface *obj_surface = SURFACE(surface);
struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic);
-
- const float sx = (float)output_rect->width / (float)obj_surface->orig_width;
- const float sy = (float)output_rect->height / (float)obj_surface->orig_height;
+ VARectangle dst_rect;
float *vb, tx1, tx2, ty1, ty2, x1, x2, y1, y2;
int i = 0;
- VARectangle dst_rect;
- dst_rect.x = output_rect->x + sx * (float)obj_subpic->dst_rect.x;
- dst_rect.y = output_rect->y + sy * (float)obj_subpic->dst_rect.y;
- dst_rect.width = sx * (float)obj_subpic->dst_rect.width;
- dst_rect.height = sy * (float)obj_subpic->dst_rect.height;
+ if (obj_subpic->flags & VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD)
+ dst_rect = obj_subpic->dst_rect;
+ else {
+ const float sx = (float)output_rect->width / obj_surface->orig_width;
+ const float sy = (float)output_rect->height / obj_surface->orig_height;
+ dst_rect.x = output_rect->x + sx * obj_subpic->dst_rect.x;
+ dst_rect.y = output_rect->y + sy * obj_subpic->dst_rect.y;
+ dst_rect.width = sx * obj_subpic->dst_rect.width;
+ dst_rect.height = sy * obj_subpic->dst_rect.height;
+ }
dri_bo_map(render_state->vb.vertex_buffer, 1);
assert(render_state->vb.vertex_buffer->virtual);
vb = render_state->vb.vertex_buffer->virtual;
- tx1 = (float)obj_subpic->src_rect.x / (float)obj_subpic->width;
- ty1 = (float)obj_subpic->src_rect.y / (float)obj_subpic->height;
- tx2 = (float)(obj_subpic->src_rect.x + obj_subpic->src_rect.width) / (float)obj_subpic->width;
- ty2 = (float)(obj_subpic->src_rect.y + obj_subpic->src_rect.height) / (float)obj_subpic->height;
+ tx1 = (float)obj_subpic->src_rect.x / obj_subpic->width;
+ ty1 = (float)obj_subpic->src_rect.y / obj_subpic->height;
+ tx2 = (float)(obj_subpic->src_rect.x + obj_subpic->src_rect.width) / obj_subpic->width;
+ ty2 = (float)(obj_subpic->src_rect.y + obj_subpic->src_rect.height) / obj_subpic->height;
x1 = (float)dst_rect.x;
y1 = (float)dst_rect.y;