- update and sync patches with upstream
This commit is contained in:
Stephan Raue 2010-05-24 23:44:11 +02:00
parent 145bd5619b
commit 9b2c67883e
12 changed files with 28551 additions and 163 deletions

View File

@ -11,7 +11,7 @@ $SCRIPTS/build Mesa
cd $PKG_BUILD
libtoolize
autoreconf
autoreconf -vif
./configure --host=$TARGET_NAME \
--build=$HOST_NAME \
--prefix=/usr \

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,125 @@
commit 8ca9ac4f628ea3d01c570293b6fa904ce0bb607e
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Wed Apr 28 18:43:04 2010 +0200
[G45] Fix build without proper libdrm updates.
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index 369ebdf..a482848 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -134,9 +134,11 @@ i965_QueryConfigProfiles(VADriverContextP ctx,
profile_list[i++] = VAProfileMPEG2Simple;
profile_list[i++] = VAProfileMPEG2Main;
+#ifndef DISABLE_H264_DECODER
profile_list[i++] = VAProfileH264Baseline;
profile_list[i++] = VAProfileH264Main;
profile_list[i++] = VAProfileH264High;
+#endif
/* If the assert fails then I965_MAX_PROFILES needs to be bigger */
assert(i <= I965_MAX_PROFILES);
@@ -160,12 +162,14 @@ i965_QueryConfigEntrypoints(VADriverContextP ctx,
entrypoint_list[0] = VAEntrypointVLD;
break;
+#ifndef DISABLE_H264_DECODER
case VAProfileH264Baseline:
case VAProfileH264Main:
case VAProfileH264High:
*num_entrypoints = 1;
entrypoint_list[0] = VAEntrypointVLD;
break;
+#endif
default:
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
@@ -262,6 +266,7 @@ i965_CreateConfig(VADriverContextP ctx,
}
break;
+#ifndef DISABLE_H264_DECODER
case VAProfileH264Baseline:
case VAProfileH264Main:
case VAProfileH264High:
@@ -270,8 +275,8 @@ i965_CreateConfig(VADriverContextP ctx,
} else {
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
-
break;
+#endif
default:
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
@@ -983,11 +988,13 @@ i965_BeginPicture(VADriverContextP ctx,
vaStatus = VA_STATUS_SUCCESS;
break;
+#ifndef DISABLE_H264_DECODER
case VAProfileH264Baseline:
case VAProfileH264Main:
case VAProfileH264High:
vaStatus = VA_STATUS_SUCCESS;
break;
+#endif
default:
assert(0);
@@ -1156,12 +1163,13 @@ i965_EndPicture(VADriverContextP ctx, VAContextID context)
assert(obj_config);
switch (obj_config->profile) {
+#ifndef DISABLE_H264_DECODER
case VAProfileH264Baseline:
case VAProfileH264Main:
case VAProfileH264High:
render_state->interleaved_uv = 1;
break;
-
+#endif
default:
render_state->interleaved_uv = 0;
}
diff --git a/i965_drv_video/intel_batchbuffer.c b/i965_drv_video/intel_batchbuffer.c
index 4c622d6..455c6a1 100644
--- a/i965_drv_video/intel_batchbuffer.c
+++ b/i965_drv_video/intel_batchbuffer.c
@@ -33,6 +33,16 @@
#include "intel_batchbuffer.h"
+#ifdef DISABLE_H264_DECODER
+#define drm_intel_bo_mrb_exec local_drm_intel_bo_mrb_exec
+static int drm_intel_bo_mrb_exec(drm_intel_bo *bo, int used,
+ drm_clip_rect_t * cliprects, int num_cliprects,
+ int DR4, int ring_flag)
+{
+ return drm_intel_bo_exec(bo, used, cliprects, num_cliprects, DR4);
+}
+#endif
+
static void
intel_batchbuffer_reset(struct intel_batchbuffer *batch)
{
diff --git a/i965_drv_video/intel_driver.h b/i965_drv_video/intel_driver.h
index e7cbaaa..8a3ce93 100644
--- a/i965_drv_video/intel_driver.h
+++ b/i965_drv_video/intel_driver.h
@@ -17,6 +17,15 @@
#define INLINE
#endif
+#ifndef ON_RENDER_RING
+#define ON_RENDER_RING (1 << 0)
+#define DISABLE_H264_DECODER
+#endif
+#ifndef ON_BSD_RING
+#define ON_BSD_RING (1 << 1)
+#define DISABLE_H264_DECODER
+#endif
+
#define BATCH_SIZE 0x100000
#define BATCH_RESERVED 0x10

View File

@ -1,19 +1,20 @@
commit c833a4ef4efa20ab8df18d13bdab1e5c5e4671a8
commit 446cd618ec79c55e0044c7bdd565a66a768d0e6e
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Wed Nov 4 13:16:34 2009 +0000
[G45] Implement vaGetImage() for full-sized surface readback.
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index ebaf1ae..59ebdd7 100644
index ad51b6c..80c61ca 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -1392,7 +1392,50 @@ i965_GetImage(VADriverContextP ctx,
@@ -1481,7 +1481,54 @@ 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)
@ -46,9 +47,12 @@ index ebaf1ae..59ebdd7 100644
+
+ 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;
+ memcpy(image_data, obj_surface->bo->virtual, obj_surface->bo->size);
+ break;
+ default:
+ operation_failed:
+ va_status = VA_STATUS_ERROR_OPERATION_FAILED;
+ break;
+ }

View File

@ -1,14 +1,14 @@
commit c00ac73b0fa1f5c4ff9cdc76b7556c5db03c5335
commit 3de13e8bda7efadbdb681299d0d161f383b7cb5b
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Wed Nov 4 13:36:39 2009 +0000
[G45] Implement vaPutImage() for full-sized surface uploads.
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index 59ebdd7..5c15439 100644
index 80c61ca..da2fbd6 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -443,22 +443,6 @@ i965_QueryImageFormats(VADriverContextP ctx,
@@ -472,22 +472,6 @@ i965_QueryImageFormats(VADriverContextP ctx,
}
VAStatus
@ -31,7 +31,7 @@ index 59ebdd7..5c15439 100644
i965_QuerySubpictureFormats(VADriverContextP ctx,
VAImageFormat *format_list, /* out */
unsigned int *flags, /* out */
@@ -1439,6 +1423,68 @@ i965_GetImage(VADriverContextP ctx,
@@ -1532,6 +1516,72 @@ i965_GetImage(VADriverContextP ctx,
}
VAStatus
@ -48,6 +48,7 @@ index 59ebdd7..5c15439 100644
+ unsigned int dest_height)
+{
+ 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)
@ -83,9 +84,12 @@ index 59ebdd7..5c15439 100644
+
+ 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;
+ memcpy(obj_surface->bo->virtual, image_data, obj_surface->bo->size);
+ break;
+ default:
+ operation_failed:
+ va_status = VA_STATUS_ERROR_OPERATION_FAILED;
+ break;
+ }

View File

@ -1,14 +1,14 @@
commit ab248483d89c6cf7beb7a3a87c9b9a55464023cc
commit c31ffe80157a4e0604d2070f6014cab9f2c8309b
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Wed Nov 4 17:34:53 2009 +0000
[G45] Handle cliprects in vaPutSurface().
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index 5c15439..d4ad6e1 100644
index da2fbd6..8669a4e 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -1507,13 +1507,23 @@ i965_PutSurface(VADriverContextP ctx,
@@ -1604,13 +1604,23 @@ i965_PutSurface(VADriverContextP ctx,
union dri_buffer *buffer;
struct intel_region *dest_region;
struct object_surface *obj_surface;
@ -33,7 +33,7 @@ index 5c15439..d4ad6e1 100644
dri_drawable = dri_get_drawable(ctx, draw);
assert(dri_drawable);
@@ -1552,17 +1562,24 @@ i965_PutSurface(VADriverContextP ctx,
@@ -1649,17 +1659,24 @@ i965_PutSurface(VADriverContextP ctx,
assert(ret == 0);
}
@ -69,10 +69,10 @@ index 5c15439..d4ad6e1 100644
}
diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c
index c738d22..301d51d 100644
index 1ae6483..163bff6 100644
--- a/i965_drv_video/i965_render.c
+++ b/i965_drv_video/i965_render.c
@@ -788,13 +788,81 @@ i965_render_binding_table(VADriverContextP ctx)
@@ -796,13 +796,81 @@ i965_render_binding_table(VADriverContextP ctx)
dri_bo_unmap(render_state->wm.binding_table);
}
@ -158,7 +158,7 @@ index c738d22..301d51d 100644
struct object_surface *obj_surface = SURFACE(surface);
struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic);
@@ -804,8 +872,6 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx,
@@ -812,8 +880,6 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx,
const float ssy = (float)output_rect->height / (float)obj_surface->height;
const float sx = psx * ssx;
const float sy = psy * ssy;
@ -167,7 +167,7 @@ index c738d22..301d51d 100644
VARectangle dst_rect;
dst_rect.x = output_rect->x + sx * (float)obj_subpic->dst_rect.x;
@@ -813,106 +879,38 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx,
@@ -821,93 +887,29 @@ i965_subpic_render_upload_vertex(VADriverContextP ctx,
dst_rect.width = sx * (float)obj_subpic->dst_rect.width;
dst_rect.height = sy * (float)obj_subpic->dst_rect.height;
@ -276,6 +276,11 @@ index c738d22..301d51d 100644
+ cliprects, num_cliprects);
}
static void
@@ -929,17 +931,13 @@ i965_render_upload_constants(VADriverContextP ctx)
dri_bo_unmap(render_state->curbe.bo);
}
-static void
+static unsigned int
i965_surface_render_state_setup(VADriverContextP ctx,
@ -296,18 +301,18 @@ index c738d22..301d51d 100644
{
i965_render_vs_unit(ctx);
i965_render_sf_unit(ctx);
@@ -923,21 +921,17 @@ i965_surface_render_state_setup(VADriverContextP ctx,
i965_render_cc_viewport(ctx);
@@ -951,22 +949,17 @@ i965_surface_render_state_setup(VADriverContextP ctx,
i965_render_cc_unit(ctx);
i965_render_binding_table(ctx);
i965_render_upload_constants(ctx);
- i965_render_upload_vertex(ctx, surface,
- srcx, srcy, srcw, srch,
- destx, desty, destw, desth);
+ return i965_render_upload_vertex(ctx, surface, src_rect, dst_rect,
+ cliprects, num_cliprects);
}
-static void
+
+static unsigned int
i965_subpic_render_state_setup(VADriverContextP ctx,
- VASurfaceID surface,
@ -327,7 +332,7 @@ index c738d22..301d51d 100644
{
i965_render_vs_unit(ctx);
i965_render_sf_unit(ctx);
@@ -948,16 +942,10 @@ i965_subpic_render_state_setup(VADriverContextP ctx,
@@ -977,13 +970,8 @@ i965_subpic_render_state_setup(VADriverContextP ctx,
i965_render_cc_viewport(ctx);
i965_subpic_render_cc_unit(ctx);
i965_render_binding_table(ctx);
@ -342,11 +347,8 @@ index c738d22..301d51d 100644
+ cliprects, num_cliprects);
}
-
static void
i965_render_pipeline_select(VADriverContextP ctx)
{
@@ -1193,7 +1181,7 @@ i965_render_upload_image_palette(
@@ -1235,7 +1223,7 @@ i965_render_upload_image_palette(
}
static void
@ -355,16 +357,16 @@ index c738d22..301d51d 100644
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_render_state *render_state = &i965->render_state;
@@ -1204,7 +1192,7 @@ i965_render_startup(VADriverContextP ctx)
@@ -1246,7 +1234,7 @@ i965_render_startup(VADriverContextP ctx)
(0 << VB0_BUFFER_INDEX_SHIFT) |
VB0_VERTEXDATA |
((4 * 4) << VB0_BUFFER_PITCH_SHIFT));
- OUT_RELOC(ctx, render_state->vb.vertex_buffer, I915_GEM_DOMAIN_VERTEX, 0, 0);
+ OUT_RELOC(ctx, render_state->vb.vertex_buffer, I915_GEM_DOMAIN_VERTEX, 0, vb_offset);
if (IS_IGDNG(i965->intel.device_id))
if (IS_IRONLAKE(i965->intel.device_id))
OUT_RELOC(ctx, render_state->vb.vertex_buffer, I915_GEM_DOMAIN_VERTEX, 0, 12 * 4);
@@ -1269,8 +1257,10 @@ i965_clear_dest_region(VADriverContextP ctx)
@@ -1311,8 +1299,10 @@ i965_clear_dest_region(VADriverContextP ctx)
}
static void
@ -376,8 +378,8 @@ index c738d22..301d51d 100644
intel_batchbuffer_start_atomic(ctx, 0x1000);
intel_batchbuffer_emit_mi_flush(ctx);
i965_clear_dest_region(ctx);
@@ -1284,13 +1274,16 @@ i965_surface_render_pipeline_setup(VADriverContextP ctx)
i965_render_cs_urb_layout(ctx);
@@ -1327,13 +1317,16 @@ i965_surface_render_pipeline_setup(VADriverContextP ctx)
i965_render_constant_buffer(ctx);
i965_render_drawing_rectangle(ctx);
i965_render_vertex_elements(ctx);
- i965_render_startup(ctx);
@ -395,7 +397,7 @@ index c738d22..301d51d 100644
intel_batchbuffer_start_atomic(ctx, 0x1000);
intel_batchbuffer_emit_mi_flush(ctx);
i965_render_pipeline_select(ctx);
@@ -1303,7 +1296,8 @@ i965_subpic_render_pipeline_setup(VADriverContextP ctx)
@@ -1346,7 +1339,8 @@ i965_subpic_render_pipeline_setup(VADriverContextP ctx)
i965_render_cs_urb_layout(ctx);
i965_render_drawing_rectangle(ctx);
i965_render_vertex_elements(ctx);
@ -405,7 +407,7 @@ index c738d22..301d51d 100644
intel_batchbuffer_end_atomic(ctx);
}
@@ -1397,45 +1391,39 @@ i965_render_initialize(VADriverContextP ctx)
@@ -1440,45 +1434,39 @@ i965_render_initialize(VADriverContextP ctx)
void
i965_render_put_surface(VADriverContextP ctx,
VASurfaceID surface,
@ -471,7 +473,7 @@ index c738d22..301d51d 100644
intel_batchbuffer_flush(ctx);
}
diff --git a/i965_drv_video/i965_render.h b/i965_drv_video/i965_render.h
index e3dce02..d2e23f1 100644
index 2643285..d1052d4 100644
--- a/i965_drv_video/i965_render.h
+++ b/i965_drv_video/i965_render.h
@@ -28,6 +28,7 @@
@ -482,7 +484,7 @@ index e3dce02..d2e23f1 100644
#define MAX_RENDER_SURFACES 16
#define MAX_SAMPLERS 16
@@ -65,27 +66,20 @@ struct i965_render_state
@@ -70,27 +71,20 @@ struct i965_render_state
Bool i965_render_init(VADriverContextP ctx);
Bool i965_render_terminate(VADriverContextP ctx);

View File

@ -1,14 +1,36 @@
commit 1eb1e3e56d3c7a83aea7361a02167d382619fea8
commit e435677c2c9228eed9df09a41c8ffeedc5665401
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Mon Mar 8 17:22:06 2010 +0100
[G45] Implement vaDeriveImage().
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index eb3b49d..98a824f 100644
index 8669a4e..aad947a 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -336,12 +336,27 @@ VAStatus i965_QueryConfigAttributes(VADriverContextP ctx,
@@ -66,19 +66,12 @@ i965_image_formats_map[I965_MAX_IMAGE_FORMATS + 1] = {
{ VA_FOURCC('Y','V','1','2'), VA_LSB_FIRST, 12, } },
};
-static const i965_image_format_map_t *
-get_image_format(const VAImageFormat *va_format)
+static const i965_image_format_map_t *get_image_format(unsigned int fourcc)
{
unsigned int i;
for (i = 0; i965_image_formats_map[i].type != 0; i++) {
const i965_image_format_map_t * const m = &i965_image_formats_map[i];
- if (m->va_format.fourcc == va_format->fourcc &&
- (m->type == I965_SURFACETYPE_RGBA ?
- (m->va_format.byte_order == va_format->byte_order &&
- m->va_format.red_mask == va_format->red_mask &&
- m->va_format.green_mask == va_format->green_mask &&
- m->va_format.blue_mask == va_format->blue_mask &&
- m->va_format.alpha_mask == va_format->alpha_mask) : 1))
+ if (m->va_format.fourcc == fourcc)
return m;
}
return NULL;
@@ -357,12 +350,27 @@ VAStatus i965_QueryConfigAttributes(VADriverContextP ctx,
return vaStatus;
}
@ -35,23 +57,9 @@ index eb3b49d..98a824f 100644
- dri_bo_unreference(obj_surface->bo);
obj_surface->bo = NULL;
object_heap_free(heap, obj);
}
@@ -358,6 +373,13 @@ i965_CreateSurfaces(VADriverContextP ctx,
int i;
VAStatus vaStatus = VA_STATUS_SUCCESS;
+ /* Internal format: linear I420 (compatible with YV12 VA image) */
+ static const VAImageFormat vaFormat = {
+ .fourcc = VA_FOURCC('Y','V','1','2'),
+ .byte_order = VA_LSB_FIRST,
+ .bits_per_pixel = 12
+ };
+
/* We only support one format */
if (VA_RT_FORMAT_YUV420 != format) {
return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
@@ -366,28 +388,36 @@ i965_CreateSurfaces(VADriverContextP ctx,
if (obj_surface->free_private_data != NULL) {
@@ -393,6 +401,8 @@ i965_CreateSurfaces(VADriverContextP ctx,
for (i = 0; i < num_surfaces; i++) {
int surfaceID = NEW_SURFACE_ID();
struct object_surface *obj_surface = SURFACE(surfaceID);
@ -60,28 +68,11 @@ index eb3b49d..98a824f 100644
if (NULL == obj_surface) {
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
break;
}
+ obj_image = i965_CreateImage_impl(ctx, &vaFormat, width, height, surfaceID);
+ if (!obj_image) {
+ vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+ break;
+ }
+
+ obj_buffer = BUFFER(obj_image->image.buf);
+ if (!obj_buffer) {
+ vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+ break;
+ }
+ assert(obj_buffer->buffer_store);
+
surfaces[i] = surfaceID;
obj_surface->status = VASurfaceReady;
@@ -404,19 +414,25 @@ i965_CreateSurfaces(VADriverContextP ctx,
obj_surface->subpic = VA_INVALID_ID;
obj_surface->width = width;
obj_surface->height = height;
obj_surface->size = SIZE_YUV420(width, height);
obj_surface->width = ALIGN(width, 16);
obj_surface->height = ALIGN(height, 16);
- obj_surface->size = SIZE_YUV420(obj_surface->width, obj_surface->height);
- obj_surface->bo = dri_bo_alloc(i965->intel.bufmgr,
- "vaapi surface",
- obj_surface->size,
@ -92,13 +83,29 @@ index eb3b49d..98a824f 100644
- vaStatus = VA_STATUS_ERROR_UNKNOWN;
- break;
- }
+ obj_surface->image = obj_image->image;
+ obj_surface->is_derived = 0;
obj_surface->private_data = NULL;
obj_surface->free_private_data = NULL;
+
+ obj_image = i965_CreateImage_impl(ctx, NULL, obj_surface->width, obj_surface->height, surfaceID);
+ if (!obj_image) {
+ vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+ break;
+ }
+ obj_surface->size = obj_image->image.data_size;
+ obj_surface->image = obj_image->image;
+
+ obj_buffer = BUFFER(obj_image->image.buf);
+ if (!obj_buffer) {
+ vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+ break;
+ }
+ assert(obj_buffer->buffer_store);
+ obj_surface->bo = obj_buffer->buffer_store->bo;
}
/* Error recovery */
@@ -417,6 +447,7 @@ i965_DestroySurfaces(VADriverContextP ctx,
@@ -446,6 +462,7 @@ i965_DestroySurfaces(VADriverContextP ctx,
struct object_surface *obj_surface = SURFACE(surface_list[i]);
assert(obj_surface);
@ -106,7 +113,7 @@ index eb3b49d..98a824f 100644
i965_destroy_surface(&i965->surface_heap, (struct object_base *)obj_surface);
}
@@ -1200,29 +1231,28 @@ i965_destroy_heap(struct object_heap *heap,
@@ -1289,46 +1306,22 @@ i965_destroy_heap(struct object_heap *heap,
VAStatus
i965_DestroyImage(VADriverContextP ctx, VAImageID image);
@ -116,6 +123,65 @@ index eb3b49d..98a824f 100644
- int width,
- int height,
- VAImage *out_image) /* out */
+static int
+setup_image_format(
+ VAImage *image,
+ unsigned int fourcc,
+ unsigned int width,
+ unsigned int height
+)
{
- struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct object_image *obj_image;
- VAStatus va_status = VA_STATUS_ERROR_OPERATION_FAILED;
- VAImageID image_id;
unsigned int width2, height2, size2, size;
- out_image->image_id = VA_INVALID_ID;
- out_image->buf = VA_INVALID_ID;
-
- image_id = NEW_IMAGE_ID();
- if (image_id == VA_INVALID_ID)
- return VA_STATUS_ERROR_ALLOCATION_FAILED;
-
- obj_image = IMAGE(image_id);
- if (!obj_image)
- return VA_STATUS_ERROR_ALLOCATION_FAILED;
- obj_image->bo = NULL;
- obj_image->palette = NULL;
-
- VAImage * const image = &obj_image->image;
- image->image_id = image_id;
- image->buf = VA_INVALID_ID;
-
size = width * height;
width2 = (width + 1) / 2;
height2 = (height + 1) / 2;
size2 = width2 * height2;
- image->num_palette_entries = 0;
- image->entry_bytes = 0;
- memset(image->component_order, 0, sizeof(image->component_order));
-
- switch (format->fourcc) {
+ switch (fourcc) {
case VA_FOURCC('I','A','4','4'):
case VA_FOURCC('A','I','4','4'):
image->num_planes = 1;
@@ -1361,15 +1354,56 @@ i965_CreateImage(VADriverContextP ctx,
image->data_size = size + 2 * size2;
break;
default:
- goto error;
+ return 0;
}
+ return 1;
+}
- va_status = i965_CreateBuffer(ctx, 0, VAImageBufferType,
- image->data_size, 1, NULL, &image->buf);
- if (va_status != VA_STATUS_SUCCESS)
- goto error;
+static struct object_image *
+i965_CreateImage_impl(
+ VADriverContextP ctx,
@ -124,49 +190,63 @@ index eb3b49d..98a824f 100644
+ unsigned int height,
+ VASurfaceID surface
+)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_image *obj_image;
- VAStatus va_status = VA_STATUS_ERROR_OPERATION_FAILED;
VAImageID image_id;
unsigned int width2, height2, size2, size;
+{
+ struct i965_driver_data *i965 = i965_driver_data(ctx);
+ struct object_image *obj_image;
+ VAImageID image_id;
- out_image->image_id = VA_INVALID_ID;
- out_image->buf = VA_INVALID_ID;
-
image_id = NEW_IMAGE_ID();
if (image_id == VA_INVALID_ID)
- return VA_STATUS_ERROR_ALLOCATION_FAILED;
- obj_image->bo = BUFFER(image->buf)->buffer_store->bo;
+ image_id = NEW_IMAGE_ID();
+ if (image_id == VA_INVALID_ID)
+ return NULL;
obj_image = IMAGE(image_id);
if (!obj_image)
- return VA_STATUS_ERROR_ALLOCATION_FAILED;
+
+ obj_image = IMAGE(image_id);
+ if (!obj_image)
+ return NULL;
+ obj_image->surface = surface;
obj_image->bo = NULL;
obj_image->palette = NULL;
+ obj_image->bo = NULL;
+ obj_image->palette = NULL;
+
+ VAImage * const image = &obj_image->image;
+ image->image_id = image_id;
+ image->buf = VA_INVALID_ID;
+
+ image->num_palette_entries = 0;
+ image->entry_bytes = 0;
+ memset(image->component_order, 0, sizeof(image->component_order));
+
+ if (surface == VA_INVALID_ID) {
+ if (!setup_image_format(image, format->fourcc, width, height))
+ goto error;
+ image->format = *format;
+ }
+ else {
+ /* VA image format will be initialized through first vaDeriveImage() */
+ if (!setup_image_format(image, VA_FOURCC_YV12, width, height))
+ goto error;
+ memset(&image->format, 0, sizeof(image->format));
+ }
+ image->width = width;
+ image->height = height;
@@ -1275,9 +1305,9 @@ i965_CreateImage(VADriverContextP ctx,
goto error;
if (image->num_palette_entries > 0 && image->entry_bytes > 0) {
obj_image->palette = malloc(image->num_palette_entries * sizeof(obj_image->palette));
@@ -1377,25 +1411,66 @@ i965_CreateImage(VADriverContextP ctx,
goto error;
}
- va_status = i965_CreateBuffer(ctx, 0, VAImageBufferType,
- image->data_size, 1, NULL, &image->buf);
- if (va_status != VA_STATUS_SUCCESS)
- image->image_id = image_id;
- image->format = *format;
- image->width = width;
- image->height = height;
+ if (i965_CreateBuffer(ctx, 0, VAImageBufferType,
+ image->data_size, 1, NULL,
+ &image->buf) != VA_STATUS_SUCCESS)
goto error;
+ goto error;
obj_image->bo = BUFFER(image->buf)->buffer_store->bo;
@@ -1292,21 +1322,47 @@ i965_CreateImage(VADriverContextP ctx,
image->format = *format;
image->width = width;
image->height = height;
-
- *out_image = *image;
- return VA_STATUS_SUCCESS;
+ obj_image->bo = BUFFER(image->buf)->buffer_store->bo;
+ return obj_image;
error:
@ -200,6 +280,7 @@ index eb3b49d..98a824f 100644
- /* TODO */
- return VA_STATUS_ERROR_OPERATION_FAILED;
+ 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)
@ -209,13 +290,25 @@ index eb3b49d..98a824f 100644
+ if (!obj_image)
+ return VA_STATUS_ERROR_INVALID_IMAGE;
+
+ obj_surface->is_derived = 1;
+ if (!obj_surface->is_derived) {
+ /* Reset VA image format on each call so that a VA surface can
+ be re-used with another context (and internal surface format) */
+ VAImage * const image = &obj_surface->image;
+ const i965_image_format_map_t *m;
+ m = get_image_format(render_state->interleaved_uv ? VA_FOURCC_NV12 : VA_FOURCC_YV12);
+ if (!m)
+ return VA_STATUS_ERROR_OPERATION_FAILED;
+ if (!setup_image_format(image, m->va_format.fourcc, image->width, image->height))
+ return VA_STATUS_ERROR_OPERATION_FAILED;
+ image->format = m->va_format;
+ obj_surface->is_derived = 1;
+ }
+ *image = obj_surface->image;
+ return VA_STATUS_SUCCESS;
}
static void
@@ -1315,15 +1371,24 @@ i965_destroy_image(struct object_heap *heap, struct object_base *obj)
@@ -1404,15 +1479,24 @@ i965_destroy_image(struct object_heap *heap, struct object_base *obj)
object_heap_free(heap, obj);
}
@ -246,7 +339,7 @@ index eb3b49d..98a824f 100644
if (obj_image->image.buf != VA_INVALID_ID) {
i965_DestroyBuffer(ctx, obj_image->image.buf);
@@ -1336,6 +1401,15 @@ i965_DestroyImage(VADriverContextP ctx, VAImageID image)
@@ -1425,6 +1509,15 @@ i965_DestroyImage(VADriverContextP ctx, VAImageID image)
}
i965_destroy_image(&i965->image_heap, (struct object_base *)obj_image);
@ -262,7 +355,7 @@ index eb3b49d..98a824f 100644
return VA_STATUS_SUCCESS;
}
@@ -1382,6 +1456,9 @@ i965_GetImage(VADriverContextP ctx,
@@ -1472,6 +1565,9 @@ i965_GetImage(VADriverContextP ctx,
if (!obj_surface)
return VA_STATUS_ERROR_INVALID_SURFACE;
@ -272,7 +365,7 @@ index eb3b49d..98a824f 100644
struct object_image *obj_image = IMAGE(image);
if (!obj_image)
return VA_STATUS_ERROR_INVALID_IMAGE;
@@ -1441,6 +1518,9 @@ i965_PutImage(VADriverContextP ctx,
@@ -1535,6 +1631,9 @@ i965_PutImage(VADriverContextP ctx,
if (!obj_surface)
return VA_STATUS_ERROR_INVALID_SURFACE;
@ -283,19 +376,19 @@ index eb3b49d..98a824f 100644
if (!obj_image)
return VA_STATUS_ERROR_INVALID_IMAGE;
diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h
index be253ed..7f410ab 100644
index 0a839e6..c05ed34 100644
--- a/i965_drv_video/i965_drv_video.h
+++ b/i965_drv_video/i965_drv_video.h
@@ -96,6 +96,8 @@ struct object_surface
@@ -102,6 +102,8 @@ struct object_surface
int width;
int height;
int size;
+ VAImage image;
+ int is_derived;
dri_bo *bo;
};
@@ -113,6 +115,7 @@ struct object_image
void (*free_private_data)(void **data);
void *private_data;
@@ -121,6 +123,7 @@ struct object_image
{
struct object_base base;
VAImage image;

View File

@ -1,11 +1,11 @@
commit 0b18b60ccc4df5e2dc30ad301451c3bd8b55b49d
commit c6912e0d320c1692cd4331ec90193a96e6ef21fe
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Thu Mar 18 12:25:20 2010 +0100
[G45] Add I420 image format.
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index 98a824f..7b3a206 100644
index d5b88d0..ddb9ae9 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
@ -17,7 +17,7 @@ index 98a824f..7b3a206 100644
};
static const i965_image_format_map_t *
@@ -1301,6 +1303,16 @@ i965_CreateImage_impl(
@@ -1390,6 +1392,16 @@ i965_CreateImage_impl(
image->offsets[2] = size;
image->data_size = size + 2 * size2;
break;
@ -34,28 +34,30 @@ index 98a824f..7b3a206 100644
default:
goto error;
}
@@ -1485,7 +1497,8 @@ i965_GetImage(VADriverContextP ctx,
@@ -1575,7 +1587,9 @@ i965_GetImage(VADriverContextP ctx,
dri_bo_map(obj_surface->bo, 0);
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 here */
+ case VA_FOURCC('I','4','2','0'):
+ /* I420 is native format for MPEG-2 decoded surfaces */
if (render_state->interleaved_uv)
goto operation_failed;
memcpy(image_data, obj_surface->bo->virtual, obj_surface->bo->size);
break;
default:
@@ -1550,7 +1563,8 @@ i965_PutImage(VADriverContextP ctx,
@@ -1644,7 +1658,9 @@ i965_PutImage(VADriverContextP ctx,
dri_bo_map(obj_surface->bo, 1);
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 here */
+ case VA_FOURCC('I','4','2','0'):
+ /* I420 is native format for MPEG-2 decoded surfaces */
if (render_state->interleaved_uv)
goto operation_failed;
memcpy(obj_surface->bo->virtual, image_data, obj_surface->bo->size);
break;
default:
diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h
index 7f410ab..9e5707b 100644
index c05ed34..f2a20f2 100644
--- a/i965_drv_video/i965_drv_video.h
+++ b/i965_drv_video/i965_drv_video.h
@@ -43,7 +43,7 @@

View File

@ -0,0 +1,35 @@
commit acd21062fe185d9c49df3d493955343e5fb52783
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Mon Apr 19 14:01:55 2010 +0200
[G45] Don't export internal symbols as they can be mixed up with
those from the system i965_dri.so.
diff --git a/i965_drv_video/Makefile.am b/i965_drv_video/Makefile.am
index 88b5590..6421107 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)/va -I$(top_srcdir)/va/x11 @DRM_CFLAGS@ -fvisibility=hidden
i965_drv_video_la_LTLIBRARIES = i965_drv_video.la
i965_drv_video_ladir = @LIBVA_DRIVERS_PATH@
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index 7b3a206..f0c3bc1 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -1706,6 +1706,10 @@ i965_Terminate(VADriverContextP ctx)
VAStatus
__vaDriverInit_0_31( VADriverContextP ctx )
+ __attribute__((__visibility__("default")));
+
+VAStatus
+__vaDriverInit_0_31( VADriverContextP ctx )
{
struct i965_driver_data *i965;
int result;

View File

@ -0,0 +1,73 @@
commit 3e0d91566ca828f0a40013704a90369a11a631ef
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Wed Apr 28 15:27:21 2010 +0200
[G45] Add NV12 image format.
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index ddb9ae9..f2f4c25 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, } },
};
static const i965_image_format_map_t *
@@ -1402,6 +1404,14 @@ i965_CreateImage_impl(
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;
}
@@ -1594,6 +1604,12 @@ i965_GetImage(VADriverContextP ctx,
goto operation_failed;
memcpy(image_data, obj_surface->bo->virtual, obj_surface->bo->size);
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;
+ memcpy(image_data, obj_surface->bo->virtual, obj_surface->bo->size);
+ break;
default:
operation_failed:
va_status = VA_STATUS_ERROR_OPERATION_FAILED;
@@ -1665,6 +1681,12 @@ i965_PutImage(VADriverContextP ctx,
goto operation_failed;
memcpy(obj_surface->bo->virtual, image_data, obj_surface->bo->size);
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;
+ memcpy(obj_surface->bo->virtual, image_data, obj_surface->bo->size);
+ 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 f2a20f2..d762a47 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"

View File

@ -1,6 +1,6 @@
commit acf3ec6b5176bf4cd09136a1d8c9bc3ff63f9d4e
commit 80ae27a4546b90faaa29bd3e77f5fa91a89b1b16
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Sun Apr 4 08:06:59 2010 +0200
Date: Tue Apr 13 04:54:11 2010 +0200
Add OpenGL extensions (v3) and generic implementation with TFP and FBO.
@ -417,10 +417,10 @@ index 0000000..1a0624d
+#endif /* VA_GLX_H */
diff --git a/va/glx/va_glx_impl.c b/va/glx/va_glx_impl.c
new file mode 100644
index 0000000..7c26648
index 0000000..adc4560
--- /dev/null
+++ b/va/glx/va_glx_impl.c
@@ -0,0 +1,1050 @@
@@ -0,0 +1,1078 @@
+/*
+ * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
+ *
@ -714,7 +714,6 @@ index 0000000..7c26648
+struct OpenGLContextState {
+ Display *display;
+ Window window;
+ XVisualInfo *visual;
+ GLXContext context;
+};
+
@ -724,11 +723,6 @@ index 0000000..7c26648
+ if (!cs)
+ return;
+
+ if (cs->visual) {
+ XFree(cs->visual);
+ cs->visual = NULL;
+ }
+
+ if (cs->display && cs->context) {
+ if (glXGetCurrentContext() == cs->context)
+ glXMakeCurrent(cs->display, None, NULL);
@ -744,15 +738,16 @@ index 0000000..7c26648
+{
+ OpenGLContextStateP cs;
+ GLXFBConfig *fbconfigs = NULL;
+ int n_fbconfigs;
+ int fbconfig_id, val, n, n_fbconfigs;
+ Status status;
+
+ static GLint fbconfig_attrs[] = {
+ GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
+ GLX_RENDER_TYPE, GLX_RGBA_BIT,
+ GLX_DOUBLEBUFFER, True,
+ GLX_RED_SIZE, 1,
+ GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1,
+ GLX_RED_SIZE, 8,
+ GLX_GREEN_SIZE, 8,
+ GLX_BLUE_SIZE, 8,
+ None
+ };
+
@ -762,25 +757,58 @@ index 0000000..7c26648
+
+ cs->display = ctx->x11_dpy;
+ cs->window = parent ? parent->window : None;
+ cs->visual = NULL;
+ cs->context = NULL;
+
+ fbconfigs = glXChooseFBConfig(
+ ctx->x11_dpy,
+ ctx->x11_screen,
+ fbconfig_attrs,
+ &n_fbconfigs
+ );
+ if (!fbconfigs)
+ goto error;
+ if (parent && parent->context) {
+ status = glXQueryContext(
+ parent->display,
+ parent->context,
+ GLX_FBCONFIG_ID, &fbconfig_id
+ );
+ if (status != Success)
+ goto error;
+
+ cs->visual = glXGetVisualFromFBConfig(ctx->x11_dpy, fbconfigs[0]);
+ if (!cs->visual)
+ goto error;
+ if (fbconfig_id == GLX_DONT_CARE)
+ goto choose_fbconfig;
+
+ fbconfigs = glXGetFBConfigs(
+ ctx->x11_dpy,
+ ctx->x11_screen,
+ &n_fbconfigs
+ );
+ if (!fbconfigs)
+ goto error;
+
+ /* Find out a GLXFBConfig compatible with the parent context */
+ for (n = 0; n < n_fbconfigs; n++) {
+ status = glXGetFBConfigAttrib(
+ ctx->x11_dpy,
+ fbconfigs[n],
+ GLX_FBCONFIG_ID, &val
+ );
+ if (status == Success && val == fbconfig_id)
+ break;
+ }
+ if (n == n_fbconfigs)
+ goto error;
+ }
+ else {
+ choose_fbconfig:
+ fbconfigs = glXChooseFBConfig(
+ ctx->x11_dpy,
+ ctx->x11_screen,
+ fbconfig_attrs, &n_fbconfigs
+ );
+ if (!fbconfigs)
+ goto error;
+
+ /* Select the first one */
+ n = 0;
+ }
+
+ cs->context = glXCreateNewContext(
+ ctx->x11_dpy,
+ fbconfigs[0],
+ fbconfigs[n],
+ GLX_RGBA_TYPE,
+ parent ? parent->context : NULL,
+ True

View File

@ -1,4 +1,4 @@
commit 94db34ae392a7787afac9087799bb0421c844b83
commit 66831a1b979798ee34bb379d2d2a5163dc65c62e
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Wed Jun 24 11:40:56 2009 +0000
@ -12,10 +12,10 @@ diff --git a/va/va_backend.h b/va/va_backend.h
index 06fef7f..9cf8911 100644
diff --git a/va/va_compat.c b/va/va_compat.c
new file mode 100644
index 0000000..af43188
index 0000000..c47428c
--- /dev/null
+++ b/va/va_compat.c
@@ -0,0 +1,1178 @@
@@ -0,0 +1,1184 @@
+/*
+ * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
+ *
@ -366,12 +366,18 @@ index 0000000..af43188
+ /* XXX: this allocation strategy is not really space efficient... */
+ if (index >= compat->buffers_count_max)
+ {
+ compat->buffers_count_max = index + 1;
+ compat->buffers = realloc(compat->buffers,
+ (compat->buffers_count_max *
+ sizeof(VABufferCompat)));
+ compat->buffers = realloc(
+ compat->buffers,
+ ((index + 1) * sizeof(VABufferCompat))
+ );
+ if (compat->buffers == NULL)
+ return VA_STATUS_ERROR_ALLOCATION_FAILED;
+ memset(
+ &compat->buffers[compat->buffers_count_max],
+ 0,
+ (index + 1 - compat->buffers_count_max) * sizeof(compat->buffers[0])
+ );
+ compat->buffers_count_max = index + 1;
+ }
+
+ compat_buffer = &compat->buffers[index];
@ -1166,7 +1172,7 @@ index 0000000..af43188
+ {
+ for (i = 0; i < compat->buffers_count_max; i++)
+ {
+ if (compat->buffers[i].id)
+ if (compat->buffers[i].id && compat->buffers[i].size > 0)
+ va_DestroyBufferCompat(ctx, compat->buffers[i].id);
+ }
+ free(compat->buffers);