From 5ab4bfbf4569a71fa883e8f63b61dacbb6ef31b4 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 4 Nov 2009 12:13:41 +0000 Subject: Fix subpictures formats array terminator. --- i965_drv_video/i965_drv_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index ace2181..40b1d81 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -76,7 +76,7 @@ static const i965_subpic_format_map_t * get_subpic_format(const VAImageFormat *va_format) { unsigned int i; - for (i = 0; i < sizeof(i965_subpic_formats_map)/sizeof(i965_subpic_formats_map[0]); i++) { + for (i = 0; i965_subpic_formats_map[i].type != 0; i++) { const i965_subpic_format_map_t * const m = &i965_subpic_formats_map[i]; if (m->va_format.fourcc == va_format->fourcc && (m->type == I965_SURFACETYPE_RGBA ? -- cgit v1.2.3 From 141a6f72e4dedebd8aaf5a2949bf94a683e50af2 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 4 Nov 2009 10:56:54 +0000 Subject: Add RGBA subpictures. --- i965_drv_video/i965_drv_video.c | 18 ++++++++++++++++++ i965_drv_video/i965_drv_video.h | 3 ++- i965_drv_video/i965_render.c | 8 ++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index 40b1d81..c127ce6 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -70,6 +70,14 @@ i965_subpic_formats_map[I965_MAX_SUBPIC_FORMATS + 1] = { { I965_SURFACETYPE_INDEXED, I965_SURFACEFORMAT_A4P4_UNORM, { VA_FOURCC('A','I','4','4'), VA_MSB_FIRST, 8, }, 0 }, + { I965_SURFACETYPE_RGBA, I965_SURFACEFORMAT_B8G8R8A8_UNORM, + { VA_FOURCC('B','G','R','A'), VA_LSB_FIRST, 32, + 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }, + 0 }, + { I965_SURFACETYPE_RGBA, I965_SURFACEFORMAT_R8G8B8A8_UNORM, + { VA_FOURCC('R','G','B','A'), VA_LSB_FIRST, 32, + 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }, + 0 }, }; static const i965_subpic_format_map_t * @@ -488,6 +496,7 @@ i965_CreateSubpicture(VADriverContextP ctx, obj_subpic->format = m->format; obj_subpic->width = obj_image->image.width; obj_subpic->height = obj_image->image.height; + obj_subpic->pitch = obj_image->image.pitches[0]; obj_subpic->bo = obj_image->bo; return VA_STATUS_SUCCESS; } @@ -1299,6 +1308,15 @@ i965_CreateImage(VADriverContextP ctx, image->component_order[1] = 'G'; image->component_order[2] = 'B'; break; + case VA_FOURCC('A','R','G','B'): + case VA_FOURCC('A','B','G','R'): + case VA_FOURCC('B','G','R','A'): + case VA_FOURCC('R','G','B','A'): + image->num_planes = 1; + image->pitches[0] = width * 4; + image->offsets[0] = 0; + image->data_size = image->offsets[0] + image->pitches[0] * height; + break; default: goto error; } diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h index b4a1576..22a1650 100644 --- a/i965_drv_video/i965_drv_video.h +++ b/i965_drv_video/i965_drv_video.h @@ -44,7 +44,7 @@ #define I965_MAX_ENTRYPOINTS 5 #define I965_MAX_CONFIG_ATTRIBUTES 10 #define I965_MAX_IMAGE_FORMATS 10 -#define I965_MAX_SUBPIC_FORMATS 2 +#define I965_MAX_SUBPIC_FORMATS 4 #define I965_MAX_DISPLAY_ATTRIBUTES 4 #define I965_STR_VENDOR "i965 Driver 0.1" @@ -138,6 +138,7 @@ struct object_subpic unsigned int format; int width; int height; + int pitch; dri_bo *bo; }; diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c index 720bb53..4680ced 100644 --- a/i965_drv_video/i965_render.c +++ b/i965_drv_video/i965_render.c @@ -592,7 +592,7 @@ i965_subpic_render_src_surface_state(VADriverContextP ctx, int index, dri_bo *region, unsigned long offset, - int w, int h, int format) + int w, int h, int p, int format) { struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_render_state *render_state = &i965->render_state; @@ -626,7 +626,7 @@ i965_subpic_render_src_surface_state(VADriverContextP ctx, ss->ss2.mip_count = 0; ss->ss2.render_target_rotation = 0; - ss->ss3.pitch = w - 1; + ss->ss3.pitch = p - 1; dri_bo_emit_reloc(ss_bo, I915_GEM_DOMAIN_SAMPLER, 0, @@ -691,8 +691,8 @@ i965_subpic_render_src_surfaces_state(VADriverContextP ctx, region = obj_surface->bo; subpic_region = obj_image->bo; /*subpicture surface*/ - i965_subpic_render_src_surface_state(ctx, 1, subpic_region, 0, obj_subpic->width, obj_subpic->height, obj_subpic->format); - i965_subpic_render_src_surface_state(ctx, 2, subpic_region, 0, obj_subpic->width, obj_subpic->height, obj_subpic->format); + i965_subpic_render_src_surface_state(ctx, 1, subpic_region, 0, obj_subpic->width, obj_subpic->height, obj_subpic->pitch, obj_subpic->format); + i965_subpic_render_src_surface_state(ctx, 2, subpic_region, 0, obj_subpic->width, obj_subpic->height, obj_subpic->pitch, obj_subpic->format); } static void -- cgit v1.2.3 From 4119b70ed61e10aa51ad57161a19204597e3d47c Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 4 Nov 2009 13:23:40 +0000 Subject: Don't return VA_STATUS_SUCCESS for unimplemented functions. --- i965_drv_video/i965_drv_video.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index c127ce6..688d41b 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -517,7 +517,8 @@ i965_SetSubpictureImage(VADriverContextP ctx, VASubpictureID subpicture, VAImageID image) { - return VA_STATUS_SUCCESS; + /* TODO */ + return VA_STATUS_ERROR_UNIMPLEMENTED; } VAStatus @@ -527,7 +528,8 @@ i965_SetSubpictureChromakey(VADriverContextP ctx, unsigned int chromakey_max, unsigned int chromakey_mask) { - return VA_STATUS_SUCCESS; + /* TODO */ + return VA_STATUS_ERROR_UNIMPLEMENTED; } VAStatus @@ -535,7 +537,8 @@ i965_SetSubpictureGlobalAlpha(VADriverContextP ctx, VASubpictureID subpicture, float global_alpha) { - return VA_STATUS_SUCCESS; + /* TODO */ + return VA_STATUS_ERROR_UNIMPLEMENTED; } VAStatus @@ -1184,7 +1187,7 @@ i965_GetDisplayAttributes(VADriverContextP ctx, int num_attributes) { /* TODO */ - return VA_STATUS_ERROR_UNKNOWN; + return VA_STATUS_ERROR_UNIMPLEMENTED; } /* @@ -1199,7 +1202,7 @@ i965_SetDisplayAttributes(VADriverContextP ctx, int num_attributes) { /* TODO */ - return VA_STATUS_ERROR_UNKNOWN; + return VA_STATUS_ERROR_UNIMPLEMENTED; } VAStatus @@ -1209,7 +1212,7 @@ i965_DbgCopySurfaceToBuffer(VADriverContextP ctx, unsigned int *stride) /* out */ { /* TODO */ - return VA_STATUS_ERROR_UNKNOWN; + return VA_STATUS_ERROR_UNIMPLEMENTED; } static VAStatus @@ -1351,7 +1354,8 @@ VAStatus i965_DeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image) /* out */ { - return VA_STATUS_SUCCESS; + /* TODO */ + return VA_STATUS_ERROR_OPERATION_FAILED; } static void -- cgit v1.2.3 From 835603e68e1b5c9a2fc1805bcc380b7d98185037 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 4 Nov 2009 13:01:44 +0000 Subject: Add YV12 image format. --- i965_drv_video/i965_drv_video.c | 32 +++++++++++++++++++++++++++++++- i965_drv_video/i965_drv_video.h | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index 688d41b..36963d8 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -54,6 +54,18 @@ enum { I965_SURFACETYPE_INDEXED }; +/* List of supported image formats */ +typedef struct { + unsigned int type; + VAImageFormat va_format; +} i965_image_format_map_t; + +static const i965_image_format_map_t +i965_image_formats_map[I965_MAX_IMAGE_FORMATS + 1] = { + { I965_SURFACETYPE_YUV, + { VA_FOURCC('Y','V','1','2'), VA_LSB_FIRST, 12, } }, +}; + /* List of supported subpicture formats */ typedef struct { unsigned int type; @@ -419,8 +431,16 @@ i965_QueryImageFormats(VADriverContextP ctx, VAImageFormat *format_list, /* out */ int *num_formats) /* out */ { + int n; + + for (n = 0; i965_image_formats_map[n].va_format.fourcc != 0; n++) { + const i965_image_format_map_t * const m = &i965_image_formats_map[n]; + if (format_list) + format_list[n] = m->va_format; + } + if (num_formats) - *num_formats = 0; + *num_formats = n; return VA_STATUS_SUCCESS; } @@ -1320,6 +1340,16 @@ i965_CreateImage(VADriverContextP ctx, image->offsets[0] = 0; image->data_size = image->offsets[0] + image->pitches[0] * height; break; + case VA_FOURCC('Y','V','1','2'): + image->num_planes = 3; + image->pitches[0] = width; + image->offsets[0] = 0; + image->pitches[1] = width2; + image->offsets[1] = size + size2; + image->pitches[2] = width2; + image->offsets[2] = size; + image->data_size = size + 2 * size2; + break; default: goto error; } diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h index 22a1650..41060d1 100644 --- a/i965_drv_video/i965_drv_video.h +++ b/i965_drv_video/i965_drv_video.h @@ -43,7 +43,7 @@ #define I965_MAX_PROFILES 11 #define I965_MAX_ENTRYPOINTS 5 #define I965_MAX_CONFIG_ATTRIBUTES 10 -#define I965_MAX_IMAGE_FORMATS 10 +#define I965_MAX_IMAGE_FORMATS 1 #define I965_MAX_SUBPIC_FORMATS 4 #define I965_MAX_DISPLAY_ATTRIBUTES 4 #define I965_STR_VENDOR "i965 Driver 0.1" -- cgit v1.2.3 From 6cb2cd5b8b74844ce2f36449b14d2043b3a683a6 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 4 Nov 2009 13:16:34 +0000 Subject:  Implement vaGetImage(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i965_drv_video/i965_drv_video.c | 106 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index 36963d8..ccecf8a 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -1446,6 +1446,66 @@ i965_SetImagePalette(VADriverContextP ctx, return VA_STATUS_SUCCESS; } +static void +get_image_yv12(struct object_image *obj_image, uint8_t *image_data, + struct object_surface *obj_surface, + const VARectangle *rect) +{ + uint8_t *dst[3], *src[3]; + int i, x, y, w, h; + + if (!obj_surface->bo) + return; + + dri_bo_map(obj_surface->bo, 0); + + if (!obj_surface->bo->virtual) + return; + + x = rect->x; + y = rect->y; + w = rect->width; + h = rect->height; + + dst[0] = image_data + obj_image->image.offsets[0]; + src[0] = (uint8_t *)obj_surface->bo->virtual; + dst[1] = image_data + obj_image->image.offsets[1]; + src[1] = src[0] + obj_surface->width * obj_surface->height; + dst[2] = image_data + obj_image->image.offsets[2]; + src[2] = src[1] + (obj_surface->width / 2) * (obj_surface->height / 2); + + dst[0] += y * obj_image->image.pitches[0] + x; + src[0] += y * obj_surface->width + x; + for (i = 0; i < h; i++) { + memcpy(dst[0], src[0], w); + dst[0] += obj_image->image.pitches[0]; + src[0] += obj_surface->width; + } + + x /= 2; + y /= 2; + w /= 2; + h /= 2; + + dst[1] += y * obj_image->image.pitches[1] + x; + src[1] += y * obj_surface->width / 2 + x; + for (i = 0; i < h; i++) { + memcpy(dst[1], src[1], w); + dst[1] += obj_image->image.pitches[1]; + src[1] += obj_surface->width / 2; + } + + dst[2] += y * obj_image->image.pitches[2] + y; + src[2] += y * obj_surface->width / 2 + x; + for (i = 0; i < h; i++) { + memcpy(dst[2], src[2], w); + dst[2] += obj_image->image.pitches[2]; + src[2] += obj_surface->width / 2; + } + + dri_bo_unmap(obj_surface->bo); +} + VAStatus i965_GetImage(VADriverContextP ctx, VASurfaceID surface, @@ -1455,7 +1515,51 @@ i965_GetImage(VADriverContextP ctx, unsigned int height, VAImageID image) { - return VA_STATUS_SUCCESS; + struct i965_driver_data *i965 = i965_driver_data(ctx); + struct i965_render_state *render_state = &i965->render_state; + + struct object_surface *obj_surface = SURFACE(surface); + if (!obj_surface) + return VA_STATUS_ERROR_INVALID_SURFACE; + + struct object_image *obj_image = IMAGE(image); + if (!obj_image) + return VA_STATUS_ERROR_INVALID_IMAGE; + + if (x < 0 || y < 0) + return VA_STATUS_ERROR_INVALID_PARAMETER; + if (width > obj_surface->width || height > obj_surface->height) + return VA_STATUS_ERROR_INVALID_PARAMETER; + if (width > obj_image->image.width || height > obj_image->image.height) + return VA_STATUS_ERROR_INVALID_PARAMETER; + + VAStatus va_status; + void *image_data = NULL; + + va_status = i965_MapBuffer(ctx, obj_image->image.buf, &image_data); + if (va_status != VA_STATUS_SUCCESS) + return va_status; + + VARectangle rect; + rect.x = x; + rect.y = y; + rect.width = width; + rect.height = height; + + switch (obj_image->image.format.fourcc) { + case VA_FOURCC('Y','V','1','2'): /* YV12 is native format here */ + if (render_state->interleaved_uv) + goto operation_failed; + get_image_yv12(obj_image, image_data, obj_surface, &rect); + break; + default: + operation_failed: + va_status = VA_STATUS_ERROR_OPERATION_FAILED; + break; + } + + i965_UnmapBuffer(ctx, obj_image->image.buf); + return va_status; } VAStatus -- cgit v1.2.3 From dd9c332de70aaf8aedec5ea78f94606e151c2d23 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 9 Jun 2010 08:30:17 +0200 Subject: Fix vaTerminate(). --- i965_drv_video/i965_media.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i965_drv_video/i965_media.c b/i965_drv_video/i965_media.c index 31a8fbe..8945444 100644 --- a/i965_drv_video/i965_media.c +++ b/i965_drv_video/i965_media.c @@ -292,8 +292,8 @@ i965_media_terminate(VADriverContextP ctx) struct i965_media_state *media_state = &i965->media_state; int i; - assert(media_state->free_private_context); - media_state->free_private_context(&media_state->private_context); + if (media_state->free_private_context) + media_state->free_private_context(&media_state->private_context); for (i = 0; i < MAX_MEDIA_SURFACES; i++) { dri_bo_unreference(media_state->surface_state[i].bo); -- cgit v1.2.3 From 252dd7c61f2a38af61ddc7906cf163c71fed4a82 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Mon, 12 Jul 2010 14:26:06 +0800 Subject: i965_drv_video: use original widht/height for rendering --- i965_drv_video/i965_drv_video.c | 6 ++++-- i965_drv_video/i965_drv_video.h | 2 ++ i965_drv_video/i965_render.c | 23 +++++++++++++---------- 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; -- cgit v1.2.3 From d58c6d4b05a42153384133288c4ecedc1a9be14d Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Thu, 3 Jun 2010 08:54:55 +0200 Subject: Add I420 image format. --- i965_drv_video/i965_drv_video.c | 16 +++++++++++++++- i965_drv_video/i965_drv_video.h | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index 6a020eb..c5fc2a5 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -64,6 +64,8 @@ static const i965_image_format_map_t i965_image_formats_map[I965_MAX_IMAGE_FORMATS + 1] = { { I965_SURFACETYPE_YUV, { VA_FOURCC('Y','V','1','2'), VA_LSB_FIRST, 12, } }, + { I965_SURFACETYPE_YUV, + { VA_FOURCC('I','4','2','0'), VA_LSB_FIRST, 12, } }, }; /* List of supported subpicture formats */ @@ -1352,6 +1354,16 @@ i965_CreateImage(VADriverContextP ctx, image->offsets[2] = size; image->data_size = size + 2 * size2; break; + case VA_FOURCC('I','4','2','0'): + image->num_planes = 3; + image->pitches[0] = width; + image->offsets[0] = 0; + image->pitches[1] = width2; + image->offsets[1] = size; + image->pitches[2] = width2; + image->offsets[2] = size + size2; + image->data_size = size + 2 * size2; + break; default: goto error; } @@ -1549,7 +1561,9 @@ i965_GetImage(VADriverContextP ctx, rect.height = height; switch (obj_image->image.format.fourcc) { - case VA_FOURCC('Y','V','1','2'): /* YV12 is native format here */ + case VA_FOURCC('Y','V','1','2'): + case VA_FOURCC('I','4','2','0'): + /* I420 is native format for MPEG-2 decoded surfaces */ if (render_state->interleaved_uv) goto operation_failed; get_image_yv12(obj_image, image_data, obj_surface, &rect); diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h index 54bc35d..e2cd77f 100644 --- a/i965_drv_video/i965_drv_video.h +++ b/i965_drv_video/i965_drv_video.h @@ -43,7 +43,7 @@ #define I965_MAX_PROFILES 11 #define I965_MAX_ENTRYPOINTS 5 #define I965_MAX_CONFIG_ATTRIBUTES 10 -#define I965_MAX_IMAGE_FORMATS 1 +#define I965_MAX_IMAGE_FORMATS 2 #define I965_MAX_SUBPIC_FORMATS 4 #define I965_MAX_DISPLAY_ATTRIBUTES 4 #define I965_STR_VENDOR "i965 Driver 0.1" -- cgit v1.2.3 From 5438f92bc0fa803a33f59ff5ff11cee5d7b0f066 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Tue, 18 May 2010 17:16:57 +0200 Subject: Fix out-of-source builds. --- i965_drv_video/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i965_drv_video/Makefile.am b/i965_drv_video/Makefile.am index cdf9d95..058b525 100644 --- a/i965_drv_video/Makefile.am +++ b/i965_drv_video/Makefile.am @@ -22,7 +22,7 @@ SUBDIRS = shaders -AM_CFLAGS = -Wall -I$(top_srcdir)/va -I$(top_srcdir)/va/x11 @DRM_CFLAGS@ +AM_CFLAGS = -Wall -I$(top_srcdir) -I$(top_srcdir)/va -I$(top_srcdir)/va/x11 @DRM_CFLAGS@ i965_drv_video_la_LTLIBRARIES = i965_drv_video.la i965_drv_video_ladir = @LIBVA_DRIVERS_PATH@ -- cgit v1.2.3 From 777c69c2394eeb37dfe6143de80c3d6e05579aac Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Sun, 11 Jul 2010 17:05:12 +0200 Subject: Move initialization of render_state->interleaved_uv to vaCreateContext(). --- i965_drv_video/i965_drv_video.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index c5fc2a5..8f893a1 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -697,6 +697,7 @@ i965_CreateContext(VADriverContextP ctx, VAContextID *context) /* out */ { struct i965_driver_data *i965 = i965_driver_data(ctx); + struct i965_render_state *render_state = &i965->render_state; struct object_config *obj_config = CONFIG(config_id); struct object_context *obj_context = NULL; VAStatus vaStatus = VA_STATUS_SUCCESS; @@ -718,6 +719,16 @@ i965_CreateContext(VADriverContextP ctx, return vaStatus; } + switch (obj_config->profile) { + case VAProfileH264Baseline: + case VAProfileH264Main: + case VAProfileH264High: + render_state->interleaved_uv = 1; + break; + default: + render_state->interleaved_uv = 0; + } + obj_context->context_id = contextID; *context = contextID; memset(&obj_context->decode_state, 0, sizeof(obj_context->decode_state)); @@ -1112,7 +1123,6 @@ VAStatus i965_EndPicture(VADriverContextP ctx, VAContextID context) { struct i965_driver_data *i965 = i965_driver_data(ctx); - struct i965_render_state *render_state = &i965->render_state; struct object_context *obj_context = CONTEXT(context); struct object_config *obj_config; VAContextID config; @@ -1128,17 +1138,6 @@ i965_EndPicture(VADriverContextP ctx, VAContextID context) obj_config = CONFIG(config); assert(obj_config); - switch (obj_config->profile) { - case VAProfileH264Baseline: - case VAProfileH264Main: - case VAProfileH264High: - render_state->interleaved_uv = 1; - break; - - default: - render_state->interleaved_uv = 0; - } - i965_media_decode_picture(ctx, obj_config->profile, &obj_context->decode_state); obj_context->decode_state.current_render_target = -1; obj_context->decode_state.num_slice_params = 0; -- cgit v1.2.3 From e9c00fc43ecc7ccf54b53e36c29bc53fd2eca189 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Mon, 12 Jul 2010 08:34:37 +0200 Subject: Fix vaGetImage() bounds checking code. --- i965_drv_video/i965_drv_video.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index 8f893a1..b8d622d 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -1541,9 +1541,11 @@ i965_GetImage(VADriverContextP ctx, if (x < 0 || y < 0) return VA_STATUS_ERROR_INVALID_PARAMETER; - if (width > obj_surface->width || height > obj_surface->height) + if (x + width > obj_surface->orig_width || + y + height > obj_surface->orig_height) return VA_STATUS_ERROR_INVALID_PARAMETER; - if (width > obj_image->image.width || height > obj_image->image.height) + if (x + width > obj_image->image.width || + y + height > obj_image->image.height) return VA_STATUS_ERROR_INVALID_PARAMETER; VAStatus va_status; -- cgit v1.2.3 From 501074896a0a48162224717b09db7be9e29aa84e Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Thu, 3 Jun 2010 08:57:45 +0200 Subject: Add NV12 image format. --- i965_drv_video/i965_drv_video.c | 60 +++++++++++++++++++++++++++++++++++++++++ i965_drv_video/i965_drv_video.h | 2 +- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index b8d622d..7ca3858 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -66,6 +66,8 @@ i965_image_formats_map[I965_MAX_IMAGE_FORMATS + 1] = { { VA_FOURCC('Y','V','1','2'), VA_LSB_FIRST, 12, } }, { I965_SURFACETYPE_YUV, { VA_FOURCC('I','4','2','0'), VA_LSB_FIRST, 12, } }, + { I965_SURFACETYPE_YUV, + { VA_FOURCC('N','V','1','2'), VA_LSB_FIRST, 12, } }, }; /* List of supported subpicture formats */ @@ -1363,6 +1365,14 @@ i965_CreateImage(VADriverContextP ctx, image->offsets[2] = size + size2; image->data_size = size + 2 * size2; break; + case VA_FOURCC('N','V','1','2'): + image->num_planes = 2; + image->pitches[0] = width; + image->offsets[0] = 0; + image->pitches[1] = width; + image->offsets[1] = size; + image->data_size = size + 2 * size2; + break; default: goto error; } @@ -1519,6 +1529,50 @@ get_image_yv12(struct object_image *obj_image, uint8_t *image_data, dri_bo_unmap(obj_surface->bo); } +static void +get_image_nv12(struct object_image *obj_image, uint8_t *image_data, + struct object_surface *obj_surface, + const VARectangle *rect) +{ + uint8_t *dst, *src; + int i, x, y, w, h; + + if (!obj_surface->bo) + return; + + dri_bo_map(obj_surface->bo, 0); + + if (!obj_surface->bo->virtual) + return; + + x = rect->x; + y = rect->y; + w = rect->width; + h = rect->height; + + dst = image_data + obj_image->image.offsets[0] + y * obj_image->image.pitches[0] + x; + src = (uint8_t *)obj_surface->bo->virtual + y * obj_surface->width + x; + for (i = 0; i < h; i++) { + memcpy(dst, src, w); + dst += obj_image->image.pitches[0]; + src += obj_surface->width; + } + + x /= 2; + y /= 2; + h /= 2; + + dst = image_data + obj_image->image.offsets[1] + y * obj_image->image.pitches[1] + x * 2; + src = (uint8_t *)obj_surface->bo->virtual + obj_surface->width * obj_surface->height + y * obj_surface->width + x * 2; + for (i = 0; i < h; i++) { + memcpy(dst, src, w); + dst += obj_image->image.pitches[1]; + src += obj_surface->width; + } + + dri_bo_unmap(obj_surface->bo); +} + VAStatus i965_GetImage(VADriverContextP ctx, VASurfaceID surface, @@ -1569,6 +1623,12 @@ i965_GetImage(VADriverContextP ctx, goto operation_failed; get_image_yv12(obj_image, image_data, obj_surface, &rect); break; + case VA_FOURCC('N','V','1','2'): + /* NV12 is native format for H.264 decoded surfaces */ + if (!render_state->interleaved_uv) + goto operation_failed; + get_image_nv12(obj_image, image_data, obj_surface, &rect); + break; default: operation_failed: va_status = VA_STATUS_ERROR_OPERATION_FAILED; diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h index e2cd77f..8643bd6 100644 --- a/i965_drv_video/i965_drv_video.h +++ b/i965_drv_video/i965_drv_video.h @@ -43,7 +43,7 @@ #define I965_MAX_PROFILES 11 #define I965_MAX_ENTRYPOINTS 5 #define I965_MAX_CONFIG_ATTRIBUTES 10 -#define I965_MAX_IMAGE_FORMATS 2 +#define I965_MAX_IMAGE_FORMATS 3 #define I965_MAX_SUBPIC_FORMATS 4 #define I965_MAX_DISPLAY_ATTRIBUTES 4 #define I965_STR_VENDOR "i965 Driver 0.1" -- cgit v1.2.3 From eb3dd03bfabdb918a0e7667727411d6faf87d754 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Mon, 12 Jul 2010 23:57:23 +0200 Subject: Fix vaGetImage() to wait for pending operations to complete. --- i965_drv_video/i965_drv_video.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index 7ca3858..63cd917 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -1602,6 +1602,9 @@ i965_GetImage(VADriverContextP ctx, y + height > obj_image->image.height) return VA_STATUS_ERROR_INVALID_PARAMETER; + /* Commit pending operations to the HW */ + intel_batchbuffer_flush(ctx); + VAStatus va_status; void *image_data = NULL; -- cgit v1.2.3 From 558b07976c56ad73f3d6fb87aa925016edf4fa2b Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Tue, 13 Jul 2010 00:23:55 +0200 Subject: Simplify vaGetImage(). --- i965_drv_video/i965_drv_video.c | 116 +++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 60 deletions(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index 63cd917..87978a8 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -1469,13 +1469,26 @@ i965_SetImagePalette(VADriverContextP ctx, return VA_STATUS_SUCCESS; } +static inline void +memcpy_pic(uint8_t *dst, unsigned int dst_stride, + const uint8_t *src, unsigned int src_stride, + unsigned int len, unsigned int height) +{ + unsigned int i; + + for (i = 0; i < height; i++) { + memcpy(dst, src, len); + dst += dst_stride; + src += src_stride; + } +} + static void -get_image_yv12(struct object_image *obj_image, uint8_t *image_data, +get_image_i420(struct object_image *obj_image, uint8_t *image_data, struct object_surface *obj_surface, const VARectangle *rect) { uint8_t *dst[3], *src[3]; - int i, x, y, w, h; if (!obj_surface->bo) return; @@ -1485,11 +1498,8 @@ get_image_yv12(struct object_image *obj_image, uint8_t *image_data, if (!obj_surface->bo->virtual) return; - x = rect->x; - y = rect->y; - w = rect->width; - h = rect->height; - + /* Dest VA image has either I420 or YV12 format. + Source VA surface alway has I420 format */ dst[0] = image_data + obj_image->image.offsets[0]; src[0] = (uint8_t *)obj_surface->bo->virtual; dst[1] = image_data + obj_image->image.offsets[1]; @@ -1497,34 +1507,26 @@ get_image_yv12(struct object_image *obj_image, uint8_t *image_data, dst[2] = image_data + obj_image->image.offsets[2]; src[2] = src[1] + (obj_surface->width / 2) * (obj_surface->height / 2); - dst[0] += y * obj_image->image.pitches[0] + x; - src[0] += y * obj_surface->width + x; - for (i = 0; i < h; i++) { - memcpy(dst[0], src[0], w); - dst[0] += obj_image->image.pitches[0]; - src[0] += obj_surface->width; - } - - x /= 2; - y /= 2; - w /= 2; - h /= 2; - - dst[1] += y * obj_image->image.pitches[1] + x; - src[1] += y * obj_surface->width / 2 + x; - for (i = 0; i < h; i++) { - memcpy(dst[1], src[1], w); - dst[1] += obj_image->image.pitches[1]; - src[1] += obj_surface->width / 2; - } - - dst[2] += y * obj_image->image.pitches[2] + y; - src[2] += y * obj_surface->width / 2 + x; - for (i = 0; i < h; i++) { - memcpy(dst[2], src[2], w); - dst[2] += obj_image->image.pitches[2]; - src[2] += obj_surface->width / 2; - } + /* Y plane */ + dst[0] += rect->y * obj_image->image.pitches[0] + rect->x; + src[0] += rect->y * obj_surface->width + rect->x; + memcpy_pic(dst[0], obj_image->image.pitches[0], + src[0], obj_surface->width, + rect->width, rect->height); + + /* U plane */ + dst[1] += (rect->y / 2) * obj_image->image.pitches[1] + rect->x / 2; + src[1] += (rect->y / 2) * obj_surface->width / 2 + rect->x / 2; + memcpy_pic(dst[1], obj_image->image.pitches[1], + src[1], obj_surface->width / 2, + rect->width / 2, rect->height / 2); + + /* V plane */ + dst[2] += (rect->y / 2) * obj_image->image.pitches[2] + rect->x / 2; + src[2] += (rect->y / 2) * obj_surface->width / 2 + rect->x / 2; + memcpy_pic(dst[2], obj_image->image.pitches[2], + src[2], obj_surface->width / 2, + rect->width / 2, rect->height / 2); dri_bo_unmap(obj_surface->bo); } @@ -1534,8 +1536,7 @@ get_image_nv12(struct object_image *obj_image, uint8_t *image_data, struct object_surface *obj_surface, const VARectangle *rect) { - uint8_t *dst, *src; - int i, x, y, w, h; + uint8_t *dst[2], *src[2]; if (!obj_surface->bo) return; @@ -1545,30 +1546,25 @@ get_image_nv12(struct object_image *obj_image, uint8_t *image_data, if (!obj_surface->bo->virtual) return; - x = rect->x; - y = rect->y; - w = rect->width; - h = rect->height; - - dst = image_data + obj_image->image.offsets[0] + y * obj_image->image.pitches[0] + x; - src = (uint8_t *)obj_surface->bo->virtual + y * obj_surface->width + x; - for (i = 0; i < h; i++) { - memcpy(dst, src, w); - dst += obj_image->image.pitches[0]; - src += obj_surface->width; - } + /* Both dest VA image and source surface have NV12 format */ + dst[0] = image_data + obj_image->image.offsets[0]; + src[0] = (uint8_t *)obj_surface->bo->virtual; + dst[1] = image_data + obj_image->image.offsets[1]; + src[1] = src[0] + obj_surface->width * obj_surface->height; - x /= 2; - y /= 2; - h /= 2; + /* Y plane */ + dst[0] += rect->y * obj_image->image.pitches[0] + rect->x; + src[0] += rect->y * obj_surface->width + rect->x; + memcpy_pic(dst[0], obj_image->image.pitches[0], + src[0], obj_surface->width, + rect->width, rect->height); - dst = image_data + obj_image->image.offsets[1] + y * obj_image->image.pitches[1] + x * 2; - src = (uint8_t *)obj_surface->bo->virtual + obj_surface->width * obj_surface->height + y * obj_surface->width + x * 2; - for (i = 0; i < h; i++) { - memcpy(dst, src, w); - dst += obj_image->image.pitches[1]; - src += obj_surface->width; - } + /* UV plane */ + dst[1] += (rect->y / 2) * obj_image->image.pitches[1] + (rect->x & -2); + src[1] += (rect->y / 2) * obj_surface->width + (rect->x & -2); + memcpy_pic(dst[1], obj_image->image.pitches[1], + src[1], obj_surface->width, + rect->width, rect->height / 2); dri_bo_unmap(obj_surface->bo); } @@ -1624,7 +1620,7 @@ i965_GetImage(VADriverContextP ctx, /* I420 is native format for MPEG-2 decoded surfaces */ if (render_state->interleaved_uv) goto operation_failed; - get_image_yv12(obj_image, image_data, obj_surface, &rect); + get_image_i420(obj_image, image_data, obj_surface, &rect); break; case VA_FOURCC('N','V','1','2'): /* NV12 is native format for H.264 decoded surfaces */ -- cgit v1.2.3 From a02d3c7fa508a8ef4e08399170bba96dd0bf8b6e Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Tue, 13 Jul 2010 01:02:19 +0200 Subject: Fix vaGetImage() for YV12 format. --- i965_drv_video/i965_drv_video.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c index 87978a8..104c105 100644 --- a/i965_drv_video/i965_drv_video.c +++ b/i965_drv_video/i965_drv_video.c @@ -1489,6 +1489,9 @@ get_image_i420(struct object_image *obj_image, uint8_t *image_data, const VARectangle *rect) { uint8_t *dst[3], *src[3]; + const int Y = 0; + const int U = obj_image->image.format.fourcc == VA_FOURCC_YV12 ? 2 : 1; + const int V = obj_image->image.format.fourcc == VA_FOURCC_YV12 ? 1 : 2; if (!obj_surface->bo) return; @@ -1500,31 +1503,31 @@ get_image_i420(struct object_image *obj_image, uint8_t *image_data, /* Dest VA image has either I420 or YV12 format. Source VA surface alway has I420 format */ - dst[0] = image_data + obj_image->image.offsets[0]; + dst[Y] = image_data + obj_image->image.offsets[Y]; src[0] = (uint8_t *)obj_surface->bo->virtual; - dst[1] = image_data + obj_image->image.offsets[1]; + dst[U] = image_data + obj_image->image.offsets[U]; src[1] = src[0] + obj_surface->width * obj_surface->height; - dst[2] = image_data + obj_image->image.offsets[2]; + dst[V] = image_data + obj_image->image.offsets[V]; src[2] = src[1] + (obj_surface->width / 2) * (obj_surface->height / 2); /* Y plane */ - dst[0] += rect->y * obj_image->image.pitches[0] + rect->x; + dst[Y] += rect->y * obj_image->image.pitches[Y] + rect->x; src[0] += rect->y * obj_surface->width + rect->x; - memcpy_pic(dst[0], obj_image->image.pitches[0], + memcpy_pic(dst[Y], obj_image->image.pitches[Y], src[0], obj_surface->width, rect->width, rect->height); /* U plane */ - dst[1] += (rect->y / 2) * obj_image->image.pitches[1] + rect->x / 2; + dst[U] += (rect->y / 2) * obj_image->image.pitches[U] + rect->x / 2; src[1] += (rect->y / 2) * obj_surface->width / 2 + rect->x / 2; - memcpy_pic(dst[1], obj_image->image.pitches[1], + memcpy_pic(dst[U], obj_image->image.pitches[U], src[1], obj_surface->width / 2, rect->width / 2, rect->height / 2); /* V plane */ - dst[2] += (rect->y / 2) * obj_image->image.pitches[2] + rect->x / 2; + dst[V] += (rect->y / 2) * obj_image->image.pitches[V] + rect->x / 2; src[2] += (rect->y / 2) * obj_surface->width / 2 + rect->x / 2; - memcpy_pic(dst[2], obj_image->image.pitches[2], + memcpy_pic(dst[V], obj_image->image.pitches[V], src[2], obj_surface->width / 2, rect->width / 2, rect->height / 2); -- cgit v1.2.3 From baeeaf9e30a33f52afc08e53ea575ab00d11992a Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Tue, 13 Jul 2010 16:55:29 +0200 Subject: Fix rendering of subpictures. --- i965_drv_video/i965_render.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c index ed1450d..c4e8ed8 100644 --- a/i965_drv_video/i965_render.c +++ b/i965_drv_video/i965_render.c @@ -813,12 +813,8 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx, struct object_surface *obj_surface = SURFACE(surface); struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic); - const float psx = (float)obj_surface->width / (float)obj_subpic->width; - const float psy = (float)obj_surface->height / (float)obj_subpic->height; - const float ssx = (float)output_rect->width / (float)obj_surface->width; - const float ssy = (float)output_rect->height / (float)obj_surface->height; - const float sx = psx * ssx; - const float sy = psy * ssy; + const float sx = (float)output_rect->width / (float)obj_surface->orig_width; + const float sy = (float)output_rect->height / (float)obj_surface->orig_height; float *vb, tx1, tx2, ty1, ty2, x1, x2, y1, y2; int i = 0; -- cgit v1.2.3 From fb9d9c2033b2e2fdb7da0c2e5e6741fc2e6123fb Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Wed, 21 Jul 2010 10:49:59 +0800 Subject: Fix to require libdrm 2.4.21 or newer for i965 video driver. This is necessary to support BSD command --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index fce164c..c3fa124 100644 --- a/configure.ac +++ b/configure.ac @@ -103,9 +103,9 @@ PKG_CHECK_MODULES([DRM], [libdrm]) PKG_CHECK_MODULES(GEN4ASM, [intel-gen4asm >= 1.0], [gen4asm=yes], [gen4asm=no]) AM_CONDITIONAL(HAVE_GEN4ASM, test x$gen4asm = xyes) -# Check for libdrm >= 2.4 (needed for i965_drv_video.so) -if test x$enable_i965_driver = xyes && ! $PKG_CONFIG --atleast-version=2.4 libdrm; then - AC_MSG_WARN([libdrm < 2.4 found, disabling build of i965 video driver]) +# Check for libdrm >= 2.4.21 (needed for i965_drv_video.so) +if test x$enable_i965_driver = xyes && ! $PKG_CONFIG --atleast-version=2.4.21 libdrm; then + AC_MSG_WARN([libdrm < 2.4.21 found, disabling build of i965 video driver]) enable_i965_driver=no fi AM_CONDITIONAL(BUILD_I965_DRIVER, test x$enable_i965_driver = xyes) -- cgit v1.2.3 From a6142c41ccdfdf4970d194e51bb55b5faf32b33b Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 23 Jul 2010 13:27:15 +0200 Subject: Fix VA trace warnings. Missing declarations, wrong return values, if any, etc. --- va/va.c | 1 + va/va_trace.c | 76 +++++++++++++++++++++++++++++++------------------------- va/va_trace.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 34 deletions(-) create mode 100644 va/va_trace.h diff --git a/va/va.c b/va/va.c index e143c7b..c0722ba 100644 --- a/va/va.c +++ b/va/va.c @@ -25,6 +25,7 @@ #define _GNU_SOURCE 1 #include "va.h" #include "va_backend.h" +#include "va_trace.h" #include "config.h" #include diff --git a/va/va_trace.c b/va/va_trace.c index 1713f27..4589a48 100644 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -25,6 +25,7 @@ #define _GNU_SOURCE 1 #include "va.h" #include "va_backend.h" +#include "va_trace.h" #include #include @@ -48,7 +49,34 @@ static unsigned int trace_slice; static unsigned int trace_width; static unsigned int trace_height; -int va_TraceInit(void) +/* Prototypes (functions defined in va.c) */ +VAStatus vaBufferInfo ( + VADisplay dpy, + VAContextID context, /* in */ + VABufferID buf_id, /* in */ + VABufferType *type, /* out */ + unsigned int *size, /* out */ + unsigned int *num_elements /* out */ +); + +VAStatus vaLockSurface(VADisplay dpy, + VASurfaceID surface, + unsigned int *fourcc, /* following are output argument */ + unsigned int *luma_stride, + unsigned int *chroma_u_stride, + unsigned int *chroma_v_stride, + unsigned int *luma_offset, + unsigned int *chroma_u_offset, + unsigned int *chroma_v_offset, + unsigned int *buffer_name, + void **buffer +); + +VAStatus vaUnlockSurface(VADisplay dpy, + VASurfaceID surface +); + +void va_TraceInit(void) { trace_file = (const char *)getenv("LIBVA_TRACE"); if (trace_file) { @@ -58,7 +86,7 @@ int va_TraceInit(void) } } -int va_TraceEnd(void) +void va_TraceEnd(void) { if (trace_file && trace_fp) { fclose(trace_fp); @@ -73,7 +101,7 @@ int va_TraceEnd(void) } } -int va_TraceMsg(const char *msg, ...) +void va_TraceMsg(const char *msg, ...) { va_list args; @@ -87,7 +115,7 @@ int va_TraceMsg(const char *msg, ...) } -int va_TraceCreateConfig( +void va_TraceCreateConfig( VADisplay dpy, VAProfile profile, VAEntrypoint entrypoint, @@ -110,7 +138,7 @@ int va_TraceCreateConfig( } -int va_TraceCreateSurface( +void va_TraceCreateSurface( VADisplay dpy, int width, int height, @@ -131,7 +159,7 @@ int va_TraceCreateSurface( } -int va_TraceCreateContext( +void va_TraceCreateContext( VADisplay dpy, VAConfigID config_id, int picture_width, @@ -721,7 +749,7 @@ static void va_TraceVASliceParameterBufferVC1( va_TraceMsg (" slice_vertical_position = %d\n", p->slice_vertical_position); } -int va_TraceBeginPicture( +void va_TraceBeginPicture( VADisplay dpy, VAContextID context, VASurfaceID render_target @@ -738,16 +766,7 @@ int va_TraceBeginPicture( trace_slice = 0; } -VAStatus vaBufferInfo ( - VADisplay dpy, - VAContextID context, /* in */ - VABufferID buf_id, /* in */ - VABufferType *type, /* out */ - unsigned int *size, /* out */ - unsigned int *num_elements /* out */ -); - -static int va_TraceMPEG2Buf( +static void va_TraceMPEG2Buf( VADisplay dpy, VAContextID context, VABufferID buffer, @@ -798,12 +817,9 @@ static int va_TraceMPEG2Buf( case VAEncH264SEIBufferType: break; } - - return 0; } - -static int va_TraceMPEG4Buf( +static void va_TraceMPEG4Buf( VADisplay dpy, VAContextID context, VABufferID buffer, @@ -856,13 +872,10 @@ static int va_TraceMPEG4Buf( default: break; } - - - return 0; } -static int va_TraceH264Buf( +static void va_TraceH264Buf( VADisplay dpy, VAContextID context, VABufferID buffer, @@ -915,13 +928,10 @@ static int va_TraceH264Buf( default: break; } - - - return 0; } -static int va_TraceVC1Buf( +static void va_TraceVC1Buf( VADisplay dpy, VAContextID context, VABufferID buffer, @@ -974,11 +984,9 @@ static int va_TraceVC1Buf( default: break; } - - return 0; } -int va_TraceRenderPicture( +void va_TraceRenderPicture( VADisplay dpy, VAContextID context, VABufferID *buffers, @@ -1035,7 +1043,7 @@ int va_TraceRenderPicture( } -int va_TraceEndPicture( +void va_TraceEndPicture( VADisplay dpy, VAContextID context ) @@ -1066,7 +1074,7 @@ int va_TraceEndPicture( &luma_offset, &chroma_u_offset, &chroma_v_offset, &buffer_name, &buffer); if (va_status != VA_STATUS_SUCCESS) - return va_status; + return; va_TraceMsg("\tfourcc=0x%08x\n", fourcc); va_TraceMsg("\twidth=%d\n", trace_width); diff --git a/va/va_trace.h b/va/va_trace.h new file mode 100644 index 0000000..1c860e3 --- /dev/null +++ b/va/va_trace.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2009 Intel Corporation. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef VA_TRACE_H +#define VA_TRACE_H + +void va_TraceInit(void); +void va_TraceEnd(void); + +void va_TraceMsg(const char *msg, ...); + +void va_TraceCreateConfig( + VADisplay dpy, + VAProfile profile, + VAEntrypoint entrypoint, + VAConfigAttrib *attrib_list, + int num_attribs, + VAConfigID *config_id /* out */ +); + +void va_TraceCreateSurface( + VADisplay dpy, + int width, + int height, + int format, + int num_surfaces, + VASurfaceID *surfaces /* out */ +); + +void va_TraceCreateContext( + VADisplay dpy, + VAConfigID config_id, + int picture_width, + int picture_height, + int flag, + VASurfaceID *render_targets, + int num_render_targets, + VAContextID *context /* out */ +); + +void va_TraceBeginPicture( + VADisplay dpy, + VAContextID context, + VASurfaceID render_target +); + +void va_TraceRenderPicture( + VADisplay dpy, + VAContextID context, + VABufferID *buffers, + int num_buffers +); + +void va_TraceEndPicture( + VADisplay dpy, + VAContextID context +); + +#endif /* VA_TRACE_H */ -- cgit v1.2.3 From 6dc2d5c59b8578da7d9dc9c7818f94eabfd13800 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 23 Jul 2010 13:28:29 +0200 Subject: Fix va_TraceEndPicture() to unlock the VA surface. --- va/va_trace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/va/va_trace.c b/va/va_trace.c index 4589a48..17dc2f8 100644 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -1086,8 +1086,10 @@ void va_TraceEndPicture( va_TraceMsg("\tchroma_u_offset=%d\n", chroma_u_offset); va_TraceMsg("\tchroma_v_offset=%d\n", chroma_v_offset); - if (!buffer) + if (!buffer) { + vaUnlockSurface(dpy, trace_rendertarget); return; + } Y_data = buffer; UV_data = buffer + luma_offset; @@ -1120,4 +1122,6 @@ void va_TraceEndPicture( tmp = UV_data + i * chroma_u_stride; } } + + vaUnlockSurface(dpy, trace_rendertarget); } -- cgit v1.2.3 From 0685f0708277e2ff37d7209eaad1aeddefceacb2 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 23 Jul 2010 13:29:47 +0200 Subject: Fix H.264 PicParam buffer trace. --- va/va_trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/va/va_trace.c b/va/va_trace.c index 17dc2f8..4ec9195 100644 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -887,7 +887,7 @@ static void va_TraceH264Buf( { switch (type) { case VAPictureParameterBufferType: - va_TraceVAPictureParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf); + va_TraceVAPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); break; case VAIQMatrixBufferType: va_TraceVAIQMatrixBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); -- cgit v1.2.3 From 2224d4c74fd098d1d6c29066eb99ded8f5967d08 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Mon, 12 Jul 2010 13:11:08 +0200 Subject: Fix detection of fglrx. --- va/Makefile.am | 2 +- va/x11/Makefile.am | 4 +- va/x11/va_fglrx.c | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++++ va/x11/va_fglrx.h | 34 ++++++++ va/x11/va_x11.c | 22 +++++- 5 files changed, 283 insertions(+), 4 deletions(-) create mode 100644 va/x11/va_fglrx.c create mode 100644 va/x11/va_fglrx.h diff --git a/va/Makefile.am b/va/Makefile.am index 2ff3a23..8451a38 100644 --- a/va/Makefile.am +++ b/va/Makefile.am @@ -43,7 +43,7 @@ libva_x11_backend = libva-x11.la libva_x11_backenddir = x11 libva_x11_la_SOURCES = -libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(DRM_LIBS) $(XFIXES_LIBS) +libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(DRM_LIBS) $(XFIXES_LIBS) -ldl libva_x11_la_LDFLAGS = $(LDADD) libva_x11_la_DEPENDENCIES = $(libvacorelib) x11/libva_x11.la diff --git a/va/x11/Makefile.am b/va/x11/Makefile.am index 40346f1..2e3619c 100644 --- a/va/x11/Makefile.am +++ b/va/x11/Makefile.am @@ -25,6 +25,6 @@ noinst_LTLIBRARIES = libva_x11.la libva_x11includedir = ${includedir}/va libva_x11include_HEADERS = va_dri.h va_dri2.h va_dricommon.h -libva_x11_la_SOURCES = va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c +libva_x11_la_SOURCES = va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c va_fglrx.c -EXTRA_DIST = va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h +EXTRA_DIST = va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h va_fglrx.h diff --git a/va/x11/va_fglrx.c b/va/x11/va_fglrx.c new file mode 100644 index 0000000..5be0256 --- /dev/null +++ b/va/x11/va_fglrx.c @@ -0,0 +1,225 @@ +/* + * Copyright (C) 2010 Splitted-Desktop Systems. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include + +#define ADL_OK 0 +#define ADL_MAX_PATH 256 + +/* + * Based on public AMD Display Library (ADL) SDK: + * + */ +typedef struct AdapterInfo { + int iSize; + int iAdapterIndex; + char strUDID[ADL_MAX_PATH]; + int iBusNumber; + int iDeviceNumber; + int iFunctionNumber; + int iVendorID; + char strAdapterName[ADL_MAX_PATH]; + char strDisplayName[ADL_MAX_PATH]; + int iPresent; + int iXScreenNum; + int iDrvIndex; + char strXScreenConfigName[ADL_MAX_PATH]; +} AdapterInfo, *LPAdapterInfo; + +typedef struct XScreenInfo { + int iXScreenNum; + char strXScreenConfigName[ADL_MAX_PATH]; +} XScreenInfo, *LPXScreenInfo; + +typedef void *(*ADL_MAIN_MALLOC_CALLBACK)(int); +typedef int (*ADL_MAIN_CONTROL_CREATE)(ADL_MAIN_MALLOC_CALLBACK, int); +typedef int (*ADL_MAIN_CONTROL_DESTROY)(void); +typedef int (*ADL_ADAPTER_NUMBEROFADAPTERS_GET)(int *); +typedef int (*ADL_ADAPTER_ADAPTERINFO_GET)(LPAdapterInfo, int); +typedef int (*ADL_ADAPTER_XSCREENINFO_GET)(LPXScreenInfo, int); + +static void *ADL_Main_Memory_Alloc(int iSize) +{ + return malloc(iSize); +} + +static void ADL_Main_Memory_Free(void *arg) +{ + void ** const lpBuffer = arg; + + if (lpBuffer && *lpBuffer) { + free(*lpBuffer); + *lpBuffer = NULL; + } +} + +static int match_display(Display *x11_dpy, const char *display_name) +{ + Display *test_dpy; + char *test_dpy_name, *x11_dpy_name; + int m; + + test_dpy = XOpenDisplay(display_name); + if (!test_dpy) + return 0; + + test_dpy_name = XDisplayString(test_dpy); + x11_dpy_name = XDisplayString(x11_dpy); + + if (x11_dpy_name && test_dpy_name) + m = strcmp(x11_dpy_name, test_dpy_name) == 0; + else + m = !x11_dpy_name && !test_dpy_name; + + XCloseDisplay(test_dpy); + return m; +} + +Bool VA_FGLRXGetClientDriverName( Display *dpy, int screen, + int *ddxDriverMajorVersion, int *ddxDriverMinorVersion, + int *ddxDriverPatchVersion, char **clientDriverName ) +{ + ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create; + ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy; + ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get; + ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get; + ADL_ADAPTER_XSCREENINFO_GET ADL_Adapter_XScreenInfo_Get; + + LPAdapterInfo lpAdapterInfo = NULL; + LPXScreenInfo lpXScreenInfo = NULL; + void *libadl_handle = NULL; + Bool success = False; + int is_adl_initialized = 0; + int i, num_adapters, lpAdapterInfo_size, lpXScreenInfo_size; + + if (ddxDriverMajorVersion) + *ddxDriverMajorVersion = 0; + if (ddxDriverMinorVersion) + *ddxDriverMinorVersion = 0; + if (ddxDriverPatchVersion) + *ddxDriverPatchVersion = 0; + if (clientDriverName) + *clientDriverName = NULL; + + libadl_handle = dlopen("libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL); + if (!libadl_handle) + goto end; + + dlerror(); + ADL_Main_Control_Create = (ADL_MAIN_CONTROL_CREATE) + dlsym(libadl_handle,"ADL_Main_Control_Create"); + if (dlerror()) + goto end; + + ADL_Main_Control_Destroy = (ADL_MAIN_CONTROL_DESTROY) + dlsym(libadl_handle,"ADL_Main_Control_Destroy"); + if (dlerror()) + goto end; + + ADL_Adapter_NumberOfAdapters_Get = (ADL_ADAPTER_NUMBEROFADAPTERS_GET) + dlsym(libadl_handle,"ADL_Adapter_NumberOfAdapters_Get"); + if (dlerror()) + goto end; + + ADL_Adapter_AdapterInfo_Get = (ADL_ADAPTER_ADAPTERINFO_GET) + dlsym(libadl_handle,"ADL_Adapter_AdapterInfo_Get"); + if (dlerror()) + goto end; + + ADL_Adapter_XScreenInfo_Get = (ADL_ADAPTER_XSCREENINFO_GET) + dlsym(libadl_handle,"ADL_Adapter_XScreenInfo_Get"); + if (dlerror()) + goto end; + + if (ADL_Main_Control_Create(ADL_Main_Memory_Alloc, 1) != ADL_OK) + goto end; + is_adl_initialized = 1; + + if (ADL_Adapter_NumberOfAdapters_Get(&num_adapters) != ADL_OK) + goto end; + if (num_adapters <= 0) + goto end; + + lpAdapterInfo_size = num_adapters * sizeof(*lpAdapterInfo); + lpAdapterInfo = ADL_Main_Memory_Alloc(lpAdapterInfo_size); + if (!lpAdapterInfo) + goto end; + memset(lpAdapterInfo, 0, lpAdapterInfo_size); + + for (i = 0; i < num_adapters; i++) + lpAdapterInfo[i].iSize = sizeof(lpAdapterInfo[i]); + + lpXScreenInfo_size = num_adapters * sizeof(*lpXScreenInfo); + lpXScreenInfo = ADL_Main_Memory_Alloc(lpXScreenInfo_size); + if (!lpXScreenInfo) + goto end; + memset(lpXScreenInfo, 0, lpXScreenInfo_size); + + if (ADL_Adapter_AdapterInfo_Get(lpAdapterInfo, lpAdapterInfo_size) != ADL_OK) + goto end; + + if (ADL_Adapter_XScreenInfo_Get(lpXScreenInfo, lpXScreenInfo_size) != ADL_OK) + goto end; + + for (i = 0; i < num_adapters; i++) { + LPXScreenInfo const lpCurrXScreenInfo = &lpXScreenInfo[i]; + LPAdapterInfo const lpCurrAdapterInfo = &lpAdapterInfo[i]; + if (!lpCurrAdapterInfo->iPresent) + continue; +#if 0 + printf("Adapter %d:\n", i); + printf(" iAdapterIndex: %d\n", lpCurrAdapterInfo->iAdapterIndex); + printf(" strUDID: '%s'\n", lpCurrAdapterInfo->strUDID); + printf(" iBusNumber: %d\n", lpCurrAdapterInfo->iBusNumber); + printf(" iDeviceNumber: %d\n", lpCurrAdapterInfo->iDeviceNumber); + printf(" iFunctionNumber: %d\n", lpCurrAdapterInfo->iFunctionNumber); + printf(" iVendorID: 0x%04x\n", lpCurrAdapterInfo->iVendorID); + printf(" strAdapterName: '%s'\n", lpCurrAdapterInfo->strAdapterName); + printf(" strDisplayName: '%s'\n", lpCurrAdapterInfo->strDisplayName); + printf(" iPresent: %d\n", lpCurrAdapterInfo->iPresent); + printf(" iXScreenNum: %d\n", lpCurrXScreenInfo->iXScreenNum); +#endif + if (match_display(dpy, lpCurrAdapterInfo->strDisplayName) && + screen == lpCurrXScreenInfo->iXScreenNum) { + *clientDriverName = strdup("fglrx"); + break; + } + } + + success = True; +end: + if (lpXScreenInfo) + ADL_Main_Memory_Free(&lpXScreenInfo); + if (lpAdapterInfo) + ADL_Main_Memory_Free(&lpAdapterInfo); + if (is_adl_initialized) + ADL_Main_Control_Destroy(); + if (libadl_handle) + dlclose(libadl_handle); + return success; +} diff --git a/va/x11/va_fglrx.h b/va/x11/va_fglrx.h new file mode 100644 index 0000000..6616044 --- /dev/null +++ b/va/x11/va_fglrx.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2010 Splitted-Desktop Systems. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef VA_FGLRX_H +#define VA_FGLRX_H + +#include + +Bool VA_FGLRXGetClientDriverName( Display *dpy, int screen, + int *ddxDriverMajorVersion, int *ddxDriverMinorVersion, + int *ddxDriverPatchVersion, char **clientDriverName ); + +#endif /* VA_FGLRX_H */ diff --git a/va/x11/va_x11.c b/va/x11/va_x11.c index 7f8fbd6..cbd2614 100644 --- a/va/x11/va_x11.c +++ b/va/x11/va_x11.c @@ -31,6 +31,7 @@ #include "va_dri2.h" #include "va_dricommon.h" #include "va_nvctrl.h" +#include "va_fglrx.h" #include #include #include @@ -130,6 +131,24 @@ static VAStatus va_NVCTRL_GetDriverName ( return VA_STATUS_SUCCESS; } +static VAStatus va_FGLRX_GetDriverName ( + VADisplayContextP pDisplayContext, + char **driver_name +) +{ + VADriverContextP ctx = pDisplayContext->pDriverContext; + int driver_major, driver_minor, driver_patch; + Bool result; + + result = VA_FGLRXGetClientDriverName(ctx->native_dpy, ctx->x11_screen, + &driver_major, &driver_minor, + &driver_patch, driver_name); + if (!result) + return VA_STATUS_ERROR_UNKNOWN; + + return VA_STATUS_SUCCESS; +} + static VAStatus va_DisplayContextGetDriverName ( VADisplayContextP pDisplayContext, char **driver_name @@ -145,7 +164,8 @@ static VAStatus va_DisplayContextGetDriverName ( vaStatus = va_DRIGetDriverName(pDisplayContext, driver_name); if (vaStatus != VA_STATUS_SUCCESS) vaStatus = va_NVCTRL_GetDriverName(pDisplayContext, driver_name); - + if (vaStatus != VA_STATUS_SUCCESS) + vaStatus = va_FGLRX_GetDriverName(pDisplayContext, driver_name); return vaStatus; } -- cgit v1.2.3 From 923238f0b323ac934134a899c0907fd8674b5908 Mon Sep 17 00:00:00 2001 From: Austin Yuan Date: Mon, 26 Jul 2010 10:23:34 +0800 Subject: remove VADisplayAttribCSC* which is duplicated, and add VADisplayAttribCSCMatrix for customized CSC matrix Signed-off-by: Austin Yuan --- dummy_drv_video/dummy_drv_video.c | 6 +++++- va/va.h | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/dummy_drv_video/dummy_drv_video.c b/dummy_drv_video/dummy_drv_video.c index ed72824..90eb9c6 100644 --- a/dummy_drv_video/dummy_drv_video.c +++ b/dummy_drv_video/dummy_drv_video.c @@ -1040,7 +1040,7 @@ VAStatus dummy_QuerySurfaceStatus( VAStatus dummy_PutSurface( VADriverContextP ctx, VASurfaceID surface, - Drawable draw, /* X Drawable */ + void *draw, /* X Drawable */ short srcx, short srcy, unsigned short srcw, @@ -1055,6 +1055,10 @@ VAStatus dummy_PutSurface( ) { /* TODO */ + Drawable drawable = (Drawable)draw; + + (void)drawable; + return VA_STATUS_ERROR_UNKNOWN; } diff --git a/va/va.h b/va/va.h index e350f74..76c5708 100644 --- a/va/va.h +++ b/va/va.h @@ -1721,6 +1721,9 @@ typedef enum * then the value for this attribute will be set to 1 so that the client * will not attempt to re-use the surface right after returning from a call * to PutSurface. + * + * Don't use it, use flag VASurfaceDisplaying of vaQuerySurfaceStatus since + * driver may use overlay or GPU alternatively */ VADisplayAttribDirectSurface = 5, VADisplayAttribRotation = 6, @@ -1731,11 +1734,11 @@ typedef enum VADisplayAttribBLEWhiteMode = 9, VADisplayAttribBlueStretch = 10, VADisplayAttribSkinColorCorrection = 11, - VADisplayAttribCSCInputColorFormat = 12, - VADisplayAttribCSCHue = 13, - VADisplayAttribCSCSaturation = 14, - VADisplayAttribCSCBrightness = 15, - VADisplayAttribCSCContrast = 16, + /* + * For type VADisplayAttribCSCMatrix, "value" field is a pointer to the color + * conversion matrix. Each element in the matrix is float-point + */ + VADisplayAttribCSCMatrix = 12 } VADisplayAttribType; /* flags for VADisplayAttribute */ -- cgit v1.2.3 From 6772bdb4406edaf55da2e3604003c9eafff31c36 Mon Sep 17 00:00:00 2001 From: Austin Yuan Date: Mon, 26 Jul 2010 10:59:14 +0800 Subject: Bump to 1.0.4 Signed-off-by: Austin Yuan --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c3fa124..8792dcc 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ m4_define([libva_version], [libva_major_version.libva_minor_version.libva_micro_version]) # if the library source code has changed, increment revision -m4_define([libva_lt_revision], [3]) +m4_define([libva_lt_revision], [4]) # if any interface was added/removed/changed, then inc current, reset revision m4_define([libva_lt_current], [1]) # if any interface was added since last public release, then increment age -- cgit v1.2.3