summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2010-07-12 14:26:06 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2010-07-12 14:26:06 +0800
commit252dd7c61f2a38af61ddc7906cf163c71fed4a82 (patch)
tree1b01fda15c3966f8595d0f3b3bd7f8bb752ebdf9
parentdd9c332de70aaf8aedec5ea78f94606e151c2d23 (diff)
downloadlibva-252dd7c61f2a38af61ddc7906cf163c71fed4a82.tar.gz
i965_drv_video: use original widht/height for rendering
-rw-r--r--i965_drv_video/i965_drv_video.c6
-rw-r--r--i965_drv_video/i965_drv_video.h2
-rw-r--r--i965_drv_video/i965_render.c23
3 files changed, 19 insertions, 12 deletions
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index ccecf8a..6a020eb 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -384,8 +384,10 @@ i965_CreateSurfaces(VADriverContextP ctx,
surfaces[i] = surfaceID;
obj_surface->status = VASurfaceReady;
obj_surface->subpic = VA_INVALID_ID;
- obj_surface->width = ALIGN(width, 16);
- obj_surface->height = ALIGN(height, 16);
+ obj_surface->orig_width = width;
+ obj_surface->orig_height = height;
+ obj_surface->width = ALIGN(obj_surface->orig_width, 16);
+ obj_surface->height = ALIGN(obj_surface->orig_height, 16);
obj_surface->size = SIZE_YUV420(obj_surface->width, obj_surface->height);
obj_surface->flags = SURFACE_REFERENCED;
obj_surface->bo = NULL;
diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h
index 41060d1..54bc35d 100644
--- a/i965_drv_video/i965_drv_video.h
+++ b/i965_drv_video/i965_drv_video.h
@@ -105,6 +105,8 @@ struct object_surface
int width;
int height;
int size;
+ int orig_width;
+ int orig_height;
int flags;
dri_bo *bo;
void (*free_private_data)(void **data);
diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c
index 4680ced..ed1450d 100644
--- a/i965_drv_video/i965_render.c
+++ b/i965_drv_video/i965_render.c
@@ -650,6 +650,7 @@ i965_render_src_surfaces_state(VADriverContextP ctx,
struct i965_render_state *render_state = &i965->render_state;
struct object_surface *obj_surface;
int w, h;
+ int rw, rh;
dri_bo *region;
obj_surface = SURFACE(surface);
@@ -657,19 +658,21 @@ i965_render_src_surfaces_state(VADriverContextP ctx,
assert(obj_surface->bo);
w = obj_surface->width;
h = obj_surface->height;
+ rw = obj_surface->orig_width;
+ rh = obj_surface->orig_height;
region = obj_surface->bo;
- i965_render_src_surface_state(ctx, 1, region, 0, w, h, w, I965_SURFACEFORMAT_R8_UNORM); /* Y */
- i965_render_src_surface_state(ctx, 2, region, 0, w, h, w, I965_SURFACEFORMAT_R8_UNORM);
+ 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, w / 2, h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM); /* UV */
- i965_render_src_surface_state(ctx, 4, region, w * h, w / 2, h / 2, w, I965_SURFACEFORMAT_R8G8_UNORM);
+ 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 {
- i965_render_src_surface_state(ctx, 3, region, w * h, w / 2, h / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM); /* U */
- i965_render_src_surface_state(ctx, 4, region, w * h, w / 2, h / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM);
- i965_render_src_surface_state(ctx, 5, region, w * h + w * h / 4, w / 2, h / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM); /* V */
- i965_render_src_surface_state(ctx, 6, region, w * h + w * h / 4, w / 2, h / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM);
+ i965_render_src_surface_state(ctx, 3, region, w * h, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM); /* U */
+ i965_render_src_surface_state(ctx, 4, region, w * h, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM);
+ i965_render_src_surface_state(ctx, 5, region, w * h + w * h / 4, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM); /* V */
+ i965_render_src_surface_state(ctx, 6, region, w * h + w * h / 4, rw / 2, rh / 2, w / 2, I965_SURFACEFORMAT_R8_UNORM);
}
}
@@ -883,8 +886,8 @@ i965_render_upload_vertex(VADriverContextP ctx,
obj_surface = SURFACE(surface);
assert(surface);
- width = obj_surface->width;
- height = obj_surface->height;
+ width = obj_surface->orig_width;
+ height = obj_surface->orig_height;
u1 = (float)srcx / width;
v1 = (float)srcy / height;