Commit 5ebd469c authored by Xiang, Haihao's avatar Xiang, Haihao

i965_drv_video: fix graphics memory usage

parent 6da7b5d6
This diff is collapsed.
...@@ -29,12 +29,7 @@ ...@@ -29,12 +29,7 @@
#ifndef __I965_AVC_BSD_H__ #ifndef __I965_AVC_BSD_H__
#define __I965_AVC_BSD_H__ #define __I965_AVC_BSD_H__
struct i965_avc_bsd_surface #define DMV_SIZE 0x88000 /* 557056 bytes for a frame */
{
dri_bo *direct_mv_wr_top_bo;
dri_bo *direct_mv_wr_bottom_bo;
int direct_mv_flag;
};
struct i965_avc_bsd_context struct i965_avc_bsd_context
{ {
...@@ -46,14 +41,15 @@ struct i965_avc_bsd_context ...@@ -46,14 +41,15 @@ struct i965_avc_bsd_context
dri_bo *bo; dri_bo *bo;
} mpr_row_store; } mpr_row_store;
struct { int init;
dri_bo *bo; };
} avc_it_command_mb_info;
struct { struct i965_avc_bsd_surface
dri_bo *bo; {
long write_offset; struct i965_avc_bsd_context *ctx;
} avc_it_data; dri_bo *dmv_top;
dri_bo *dmv_bottom;
int dmv_bottom_flag;
}; };
void i965_avc_bsd_pipeline(VADriverContextP, struct decode_state *); void i965_avc_bsd_pipeline(VADriverContextP, struct decode_state *);
......
...@@ -176,11 +176,15 @@ i965_avc_hw_scoreboard_upload_constants(struct i965_avc_hw_scoreboard_context *a ...@@ -176,11 +176,15 @@ i965_avc_hw_scoreboard_upload_constants(struct i965_avc_hw_scoreboard_context *a
{ {
unsigned char *constant_buffer; unsigned char *constant_buffer;
if (avc_hw_scoreboard_context->curbe.upload)
return;
dri_bo_map(avc_hw_scoreboard_context->curbe.bo, 1); dri_bo_map(avc_hw_scoreboard_context->curbe.bo, 1);
assert(avc_hw_scoreboard_context->curbe.bo->virtual); assert(avc_hw_scoreboard_context->curbe.bo->virtual);
constant_buffer = avc_hw_scoreboard_context->curbe.bo->virtual; constant_buffer = avc_hw_scoreboard_context->curbe.bo->virtual;
memcpy(constant_buffer, avc_hw_scoreboard_constants, sizeof(avc_hw_scoreboard_constants)); memcpy(constant_buffer, avc_hw_scoreboard_constants, sizeof(avc_hw_scoreboard_constants));
dri_bo_unmap(avc_hw_scoreboard_context->curbe.bo); dri_bo_unmap(avc_hw_scoreboard_context->curbe.bo);
avc_hw_scoreboard_context->curbe.upload = 1;
} }
static void static void
...@@ -358,12 +362,14 @@ i965_avc_hw_scoreboard_decode_init(VADriverContextP ctx) ...@@ -358,12 +362,14 @@ i965_avc_hw_scoreboard_decode_init(VADriverContextP ctx)
struct i965_avc_hw_scoreboard_context *avc_hw_scoreboard_context = &i965_h264_context->avc_hw_scoreboard_context; struct i965_avc_hw_scoreboard_context *avc_hw_scoreboard_context = &i965_h264_context->avc_hw_scoreboard_context;
dri_bo *bo; dri_bo *bo;
dri_bo_unreference(avc_hw_scoreboard_context->curbe.bo); if (avc_hw_scoreboard_context->curbe.bo == NULL) {
bo = dri_bo_alloc(i965->intel.bufmgr, bo = dri_bo_alloc(i965->intel.bufmgr,
"constant buffer", "constant buffer",
4096, 64); 4096, 64);
assert(bo); assert(bo);
avc_hw_scoreboard_context->curbe.bo = bo; avc_hw_scoreboard_context->curbe.bo = bo;
avc_hw_scoreboard_context->curbe.upload = 0;
}
dri_bo_unreference(avc_hw_scoreboard_context->surface.s_bo); dri_bo_unreference(avc_hw_scoreboard_context->surface.s_bo);
avc_hw_scoreboard_context->surface.s_bo = i965_h264_context->avc_it_command_mb_info.bo; avc_hw_scoreboard_context->surface.s_bo = i965_h264_context->avc_it_command_mb_info.bo;
......
...@@ -57,6 +57,7 @@ struct i965_avc_hw_scoreboard_context ...@@ -57,6 +57,7 @@ struct i965_avc_hw_scoreboard_context
struct { struct {
dri_bo *bo; dri_bo *bo;
int upload;
} curbe; } curbe;
struct { struct {
......
...@@ -367,11 +367,8 @@ i965_CreateSurfaces(VADriverContextP ctx, ...@@ -367,11 +367,8 @@ i965_CreateSurfaces(VADriverContextP ctx,
obj_surface->width = ALIGN(width, 16); obj_surface->width = ALIGN(width, 16);
obj_surface->height = ALIGN(height, 16); obj_surface->height = ALIGN(height, 16);
obj_surface->size = SIZE_YUV420(obj_surface->width, obj_surface->height); obj_surface->size = SIZE_YUV420(obj_surface->width, obj_surface->height);
obj_surface->bo = dri_bo_alloc(i965->intel.bufmgr, obj_surface->flags = SURFACE_REFERENCED;
"vaapi surface", obj_surface->bo = NULL;
obj_surface->size,
64);
assert(obj_surface->bo);
obj_surface->private_data = NULL; obj_surface->private_data = NULL;
obj_surface->free_private_data = NULL; obj_surface->free_private_data = NULL;
} }
...@@ -422,16 +419,16 @@ i965_QueryImageFormats(VADriverContextP ctx, ...@@ -422,16 +419,16 @@ i965_QueryImageFormats(VADriverContextP ctx,
VAStatus VAStatus
i965_PutImage(VADriverContextP ctx, i965_PutImage(VADriverContextP ctx,
VASurfaceID surface, VASurfaceID surface,
VAImageID image, VAImageID image,
int src_x, int src_x,
int src_y, int src_y,
unsigned int src_width, unsigned int src_width,
unsigned int src_height, unsigned int src_height,
int dest_x, int dest_x,
int dest_y, int dest_y,
unsigned int dest_width, unsigned int dest_width,
unsigned int dest_height) unsigned int dest_height)
{ {
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
...@@ -474,7 +471,7 @@ i965_CreateSubpicture(VADriverContextP ctx, ...@@ -474,7 +471,7 @@ i965_CreateSubpicture(VADriverContextP ctx,
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
VASubpictureID subpicID = NEW_SUBPIC_ID() VASubpictureID subpicID = NEW_SUBPIC_ID()
struct object_subpic *obj_subpic = SUBPIC(subpicID); struct object_subpic *obj_subpic = SUBPIC(subpicID);
if (!obj_subpic) if (!obj_subpic)
return VA_STATUS_ERROR_ALLOCATION_FAILED; return VA_STATUS_ERROR_ALLOCATION_FAILED;
...@@ -794,8 +791,8 @@ i965_CreateBuffer(VADriverContextP ctx, ...@@ -794,8 +791,8 @@ i965_CreateBuffer(VADriverContextP ctx,
if (type == VASliceDataBufferType || type == VAImageBufferType) { if (type == VASliceDataBufferType || type == VAImageBufferType) {
buffer_store->bo = dri_bo_alloc(i965->intel.bufmgr, buffer_store->bo = dri_bo_alloc(i965->intel.bufmgr,
"Buffer", "Buffer",
size * num_elements, 64); size * num_elements, 64);
assert(buffer_store->bo); assert(buffer_store->bo);
if (data) if (data)
...@@ -977,7 +974,7 @@ i965_render_bit_plane_buffer(VADriverContextP ctx, ...@@ -977,7 +974,7 @@ i965_render_bit_plane_buffer(VADriverContextP ctx,
assert(obj_buffer->buffer_store->buffer); assert(obj_buffer->buffer_store->buffer);
i965_release_buffer_store(&obj_context->decode_state.bit_plane); i965_release_buffer_store(&obj_context->decode_state.bit_plane);
i965_reference_buffer_store(&obj_context->decode_state.bit_plane, i965_reference_buffer_store(&obj_context->decode_state.bit_plane,
obj_buffer->buffer_store); obj_buffer->buffer_store);
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
...@@ -992,7 +989,7 @@ i965_render_slice_parameter_buffer(VADriverContextP ctx, ...@@ -992,7 +989,7 @@ i965_render_slice_parameter_buffer(VADriverContextP ctx,
if (obj_context->decode_state.num_slice_params == obj_context->decode_state.max_slice_params) { if (obj_context->decode_state.num_slice_params == obj_context->decode_state.max_slice_params) {
obj_context->decode_state.slice_params = realloc(obj_context->decode_state.slice_params, obj_context->decode_state.slice_params = realloc(obj_context->decode_state.slice_params,
(obj_context->decode_state.max_slice_params + NUM_SLICES) * sizeof(*obj_context->decode_state.slice_params)); (obj_context->decode_state.max_slice_params + NUM_SLICES) * sizeof(*obj_context->decode_state.slice_params));
memset(obj_context->decode_state.slice_params + obj_context->decode_state.max_slice_params, 0, NUM_SLICES * sizeof(*obj_context->decode_state.slice_params)); memset(obj_context->decode_state.slice_params + obj_context->decode_state.max_slice_params, 0, NUM_SLICES * sizeof(*obj_context->decode_state.slice_params));
obj_context->decode_state.max_slice_params += NUM_SLICES; obj_context->decode_state.max_slice_params += NUM_SLICES;
} }
...@@ -1327,7 +1324,7 @@ i965_CreateImage(VADriverContextP ctx, ...@@ -1327,7 +1324,7 @@ i965_CreateImage(VADriverContextP ctx,
*out_image = *image; *out_image = *image;
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
error: error:
i965_DestroyImage(ctx, image_id); i965_DestroyImage(ctx, image_id);
return va_status; return va_status;
} }
...@@ -1393,7 +1390,7 @@ i965_SetImagePalette(VADriverContextP ctx, ...@@ -1393,7 +1390,7 @@ i965_SetImagePalette(VADriverContextP ctx,
for (i = 0; i < obj_image->image.num_palette_entries; i++) for (i = 0; i < obj_image->image.num_palette_entries; i++)
obj_image->palette[i] = (((unsigned int)palette[3*i + 0] << 16) | obj_image->palette[i] = (((unsigned int)palette[3*i + 0] << 16) |
((unsigned int)palette[3*i + 1] << 8) | ((unsigned int)palette[3*i + 1] << 8) |
(unsigned int)palette[3*i + 2]); (unsigned int)palette[3*i + 2]);
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
...@@ -1432,13 +1429,20 @@ i965_PutSurface(VADriverContextP ctx, ...@@ -1432,13 +1429,20 @@ i965_PutSurface(VADriverContextP ctx,
union dri_buffer *buffer; union dri_buffer *buffer;
struct intel_region *dest_region; struct intel_region *dest_region;
struct object_surface *obj_surface; struct object_surface *obj_surface;
int ret; int ret;
uint32_t name; uint32_t name;
Bool new_region = False; Bool new_region = False;
/* Currently don't support DRI1 */ /* Currently don't support DRI1 */
if (dri_state->driConnectedFlag != VA_DRI2) if (dri_state->driConnectedFlag != VA_DRI2)
return VA_STATUS_ERROR_UNKNOWN; return VA_STATUS_ERROR_UNKNOWN;
/* Some broken sources such as H.264 conformance case FM2_SVA_C
* will get here
*/
obj_surface = SURFACE(surface);
if (obj_surface->bo == NULL)
return VA_STATUS_SUCCESS;
dri_drawable = dri_get_drawable(ctx, draw); dri_drawable = dri_get_drawable(ctx, draw);
assert(dri_drawable); assert(dri_drawable);
...@@ -1480,13 +1484,24 @@ i965_PutSurface(VADriverContextP ctx, ...@@ -1480,13 +1484,24 @@ i965_PutSurface(VADriverContextP ctx,
i965_render_put_surface(ctx, surface, i965_render_put_surface(ctx, surface,
srcx, srcy, srcw, srch, srcx, srcy, srcw, srch,
destx, desty, destw, desth); destx, desty, destw, desth);
obj_surface = SURFACE(surface);
if(obj_surface->subpic != VA_INVALID_ID) { if(obj_surface->subpic != VA_INVALID_ID) {
i965_render_put_subpic(ctx, surface, i965_render_put_subpic(ctx, surface,
srcx, srcy, srcw, srch, srcx, srcy, srcw, srch,
destx, desty, destw, desth); destx, desty, destw, desth);
} }
dri_swap_buffer(ctx, dri_drawable); dri_swap_buffer(ctx, dri_drawable);
obj_surface->flags |= SURFACE_DISPLAYED;
if (!(obj_surface->flags & SURFACE_REFERENCED)) {
dri_bo_unreference(obj_surface->bo);
obj_surface->bo = NULL;
obj_surface->flags = 0;
if (obj_surface->free_private_data)
obj_surface->free_private_data(&obj_surface->private_data);
}
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
...@@ -1610,6 +1625,6 @@ __vaDriverInit_0_31( VADriverContextP ctx ) ...@@ -1610,6 +1625,6 @@ __vaDriverInit_0_31( VADriverContextP ctx )
sizeof(struct object_subpic), sizeof(struct object_subpic),
SUBPIC_ID_OFFSET); SUBPIC_ID_OFFSET);
assert(result == 0); assert(result == 0);
return i965_Init(ctx); return i965_Init(ctx);
} }
...@@ -94,6 +94,9 @@ struct object_context ...@@ -94,6 +94,9 @@ struct object_context
struct decode_state decode_state; struct decode_state decode_state;
}; };
#define SURFACE_REFERENCED (1 << 0)
#define SURFACE_DISPLAYED (1 << 1)
struct object_surface struct object_surface
{ {
struct object_base base; struct object_base base;
...@@ -102,6 +105,7 @@ struct object_surface ...@@ -102,6 +105,7 @@ struct object_surface
int width; int width;
int height; int height;
int size; int size;
int flags;
dri_bo *bo; dri_bo *bo;
void (*free_private_data)(void **data); void (*free_private_data)(void **data);
void *private_data; void *private_data;
...@@ -137,8 +141,6 @@ struct object_subpic ...@@ -137,8 +141,6 @@ struct object_subpic
dri_bo *bo; dri_bo *bo;
}; };
struct i965_driver_data struct i965_driver_data
{ {
struct intel_driver_data intel; struct intel_driver_data intel;
......
...@@ -199,7 +199,7 @@ i965_media_pipeline_setup(VADriverContextP ctx, struct decode_state *decode_stat ...@@ -199,7 +199,7 @@ i965_media_pipeline_setup(VADriverContextP ctx, struct decode_state *decode_stat
} }
static void static void
i965_media_decode_init(VADriverContextP ctx, VAProfile profile) i965_media_decode_init(VADriverContextP ctx, VAProfile profile, struct decode_state *decode_state)
{ {
int i; int i;
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
...@@ -250,13 +250,13 @@ i965_media_decode_init(VADriverContextP ctx, VAProfile profile) ...@@ -250,13 +250,13 @@ i965_media_decode_init(VADriverContextP ctx, VAProfile profile)
switch (profile) { switch (profile) {
case VAProfileMPEG2Simple: case VAProfileMPEG2Simple:
case VAProfileMPEG2Main: case VAProfileMPEG2Main:
i965_media_mpeg2_decode_init(ctx); i965_media_mpeg2_decode_init(ctx, decode_state);
break; break;
case VAProfileH264Baseline: case VAProfileH264Baseline:
case VAProfileH264Main: case VAProfileH264Main:
case VAProfileH264High: case VAProfileH264High:
i965_media_h264_decode_init(ctx); i965_media_h264_decode_init(ctx, decode_state);
break; break;
default: default:
...@@ -273,7 +273,7 @@ i965_media_decode_picture(VADriverContextP ctx, ...@@ -273,7 +273,7 @@ i965_media_decode_picture(VADriverContextP ctx,
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_media_state *media_state = &i965->media_state; struct i965_media_state *media_state = &i965->media_state;
i965_media_decode_init(ctx, profile); i965_media_decode_init(ctx, profile, decode_state);
assert(media_state->media_states_setup); assert(media_state->media_states_setup);
media_state->media_states_setup(ctx, decode_state); media_state->media_states_setup(ctx, decode_state);
i965_media_pipeline_setup(ctx, decode_state); i965_media_pipeline_setup(ctx, decode_state);
......
...@@ -702,21 +702,9 @@ i965_media_h264_states_setup(VADriverContextP ctx, struct decode_state *decode_s ...@@ -702,21 +702,9 @@ i965_media_h264_states_setup(VADriverContextP ctx, struct decode_state *decode_s
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_media_state *media_state = &i965->media_state; struct i965_media_state *media_state = &i965->media_state;
struct i965_h264_context *i965_h264_context; struct i965_h264_context *i965_h264_context;
VAPictureParameterBufferH264 *pic_param;
assert(media_state->private_context); assert(media_state->private_context);
i965_h264_context = (struct i965_h264_context *)media_state->private_context; i965_h264_context = (struct i965_h264_context *)media_state->private_context;
assert(decode_state->pic_param && decode_state->pic_param->buffer);
pic_param = (VAPictureParameterBufferH264 *)decode_state->pic_param->buffer;
i965_h264_context->picture.width_in_mbs = ((pic_param->picture_width_in_mbs_minus1 + 1) & 0xff);
i965_h264_context->picture.height_in_mbs = ((pic_param->picture_height_in_mbs_minus1 + 1) & 0xff) /
(1 + !!pic_param->pic_fields.bits.field_pic_flag); /* picture height */
i965_h264_context->picture.mbaff_frame_flag = (pic_param->seq_fields.bits.mb_adaptive_frame_field_flag &&
!pic_param->pic_fields.bits.field_pic_flag);
i965_h264_context->avc_it_command_mb_info.mbs = (i965_h264_context->picture.width_in_mbs *
i965_h264_context->picture.height_in_mbs);
i965_avc_bsd_pipeline(ctx, decode_state); i965_avc_bsd_pipeline(ctx, decode_state);
...@@ -792,13 +780,14 @@ i965_media_h264_free_private_context(void **data) ...@@ -792,13 +780,14 @@ i965_media_h264_free_private_context(void **data)
} }
void void
i965_media_h264_decode_init(VADriverContextP ctx) i965_media_h264_decode_init(VADriverContextP ctx, struct decode_state *decode_state)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_media_state *media_state = &i965->media_state; struct i965_media_state *media_state = &i965->media_state;
struct i965_h264_context *i965_h264_context; struct i965_h264_context *i965_h264_context;
dri_bo *bo; dri_bo *bo;
int i; int i;
VAPictureParameterBufferH264 *pic_param;
i965_h264_context = media_state->private_context; i965_h264_context = media_state->private_context;
...@@ -829,7 +818,7 @@ i965_media_h264_decode_init(VADriverContextP ctx) ...@@ -829,7 +818,7 @@ i965_media_h264_decode_init(VADriverContextP ctx)
struct media_kernel *kernel = &h264_avc_kernels[i]; struct media_kernel *kernel = &h264_avc_kernels[i];
kernel->bo = dri_bo_alloc(i965->intel.bufmgr, kernel->bo = dri_bo_alloc(i965->intel.bufmgr,
kernel->name, kernel->name,
kernel->size, 64); kernel->size, 0x1000);
assert(kernel->bo); assert(kernel->bo);
dri_bo_subdata(kernel->bo, 0, kernel->size, kernel->bin); dri_bo_subdata(kernel->bo, 0, kernel->size, kernel->bin);
} }
...@@ -865,12 +854,20 @@ i965_media_h264_decode_init(VADriverContextP ctx) ...@@ -865,12 +854,20 @@ i965_media_h264_decode_init(VADriverContextP ctx)
media_state->media_objects = i965_media_h264_objects; media_state->media_objects = i965_media_h264_objects;
} }
i965_h264_context->enable_avc_ildb = 0; assert(decode_state->pic_param && decode_state->pic_param->buffer);
pic_param = (VAPictureParameterBufferH264 *)decode_state->pic_param->buffer;
i965_h264_context->picture.width_in_mbs = ((pic_param->picture_width_in_mbs_minus1 + 1) & 0xff);
i965_h264_context->picture.height_in_mbs = ((pic_param->picture_height_in_mbs_minus1 + 1) & 0xff) /
(1 + !!pic_param->pic_fields.bits.field_pic_flag); /* picture height */
i965_h264_context->picture.mbaff_frame_flag = (pic_param->seq_fields.bits.mb_adaptive_frame_field_flag &&
!pic_param->pic_fields.bits.field_pic_flag);
i965_h264_context->avc_it_command_mb_info.mbs = (i965_h264_context->picture.width_in_mbs *
i965_h264_context->picture.height_in_mbs);
dri_bo_unreference(i965_h264_context->avc_it_command_mb_info.bo); dri_bo_unreference(i965_h264_context->avc_it_command_mb_info.bo);
bo = dri_bo_alloc(i965->intel.bufmgr, bo = dri_bo_alloc(i965->intel.bufmgr,
"avc it command mb info", "avc it command mb info",
0x80000 * (1 + i965_h264_context->use_avc_hw_scoreboard), /* at least 522240 bytes */ i965_h264_context->avc_it_command_mb_info.mbs * MB_CMD_IN_BYTES * (1 + i965_h264_context->use_avc_hw_scoreboard) + 4,
0x1000); 0x1000);
assert(bo); assert(bo);
i965_h264_context->avc_it_command_mb_info.bo = bo; i965_h264_context->avc_it_command_mb_info.bo = bo;
...@@ -878,8 +875,10 @@ i965_media_h264_decode_init(VADriverContextP ctx) ...@@ -878,8 +875,10 @@ i965_media_h264_decode_init(VADriverContextP ctx)
dri_bo_unreference(i965_h264_context->avc_it_data.bo); dri_bo_unreference(i965_h264_context->avc_it_data.bo);
bo = dri_bo_alloc(i965->intel.bufmgr, bo = dri_bo_alloc(i965->intel.bufmgr,
"avc it data", "avc it data",
0x1000000, /* at least 16711680 bytes */ i965_h264_context->avc_it_command_mb_info.mbs *
4096); 0x800 *
(1 + !!pic_param->pic_fields.bits.field_pic_flag),
0x1000);
assert(bo); assert(bo);
i965_h264_context->avc_it_data.bo = bo; i965_h264_context->avc_it_data.bo = bo;
i965_h264_context->avc_it_data.write_offset = 0; i965_h264_context->avc_it_data.write_offset = 0;
...@@ -891,8 +890,8 @@ i965_media_h264_decode_init(VADriverContextP ctx) ...@@ -891,8 +890,8 @@ i965_media_h264_decode_init(VADriverContextP ctx)
dri_bo_unreference(i965_h264_context->avc_ildb_data.bo); dri_bo_unreference(i965_h264_context->avc_ildb_data.bo);
bo = dri_bo_alloc(i965->intel.bufmgr, bo = dri_bo_alloc(i965->intel.bufmgr,
"AVC-ILDB Data Buffer", "AVC-ILDB Data Buffer",
0x100000, /* at least 1044480 bytes */ i965_h264_context->avc_it_command_mb_info.mbs * 64 * 2,
64); 0x1000);
assert(bo); assert(bo);
i965_h264_context->avc_ildb_data.bo = bo; i965_h264_context->avc_ildb_data.bo = bo;
......
...@@ -60,6 +60,6 @@ struct i965_h264_context ...@@ -60,6 +60,6 @@ struct i965_h264_context
} fsid_list[16]; } fsid_list[16];
}; };
void i965_media_h264_decode_init(VADriverContextP ctx); void i965_media_h264_decode_init(VADriverContextP ctx, struct decode_state *decode_state);
#endif /* _I965_MEDIA_H264_H_ */ #endif /* _I965_MEDIA_H264_H_ */
...@@ -518,6 +518,15 @@ i965_media_mpeg2_surface_setup(VADriverContextP ctx, ...@@ -518,6 +518,15 @@ i965_media_mpeg2_surface_setup(VADriverContextP ctx,
int w = obj_surface->width; int w = obj_surface->width;
int h = obj_surface->height; int h = obj_surface->height;
if (obj_surface->bo == NULL) {
struct i965_driver_data *i965 = i965_driver_data(ctx);
obj_surface->bo = dri_bo_alloc(i965->intel.bufmgr,
"vaapi surface",
obj_surface->size,
0x1000);
}
if (picture_structure == MPEG_FRAME) { if (picture_structure == MPEG_FRAME) {
i965_media_mpeg2_surface_state(ctx, base_index + 0, obj_surface, i965_media_mpeg2_surface_state(ctx, base_index + 0, obj_surface,
0, w, h, 0, w, h,
...@@ -897,7 +906,7 @@ i965_media_mpeg2_free_private_context(void **data) ...@@ -897,7 +906,7 @@ i965_media_mpeg2_free_private_context(void **data)
} }
void void
i965_media_mpeg2_decode_init(VADriverContextP ctx) i965_media_mpeg2_decode_init(VADriverContextP ctx, struct decode_state *decode_state)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_media_state *media_state = &i965->media_state; struct i965_media_state *media_state = &i965->media_state;
......
...@@ -39,6 +39,6 @@ ...@@ -39,6 +39,6 @@
struct decode_state; struct decode_state;
void i965_media_mpeg2_decode_init(VADriverContextP ctx); void i965_media_mpeg2_decode_init(VADriverContextP ctx, struct decode_state * decode_state);
#endif /* _I965_MEDIA_MPEG2_H_ */ #endif /* _I965_MEDIA_MPEG2_H_ */
...@@ -921,6 +921,9 @@ i965_render_upload_constants(VADriverContextP ctx) ...@@ -921,6 +921,9 @@ i965_render_upload_constants(VADriverContextP ctx)
struct i965_render_state *render_state = &i965->render_state; struct i965_render_state *render_state = &i965->render_state;
unsigned short *constant_buffer; unsigned short *constant_buffer;
if (render_state->curbe.upload)
return;
dri_bo_map(render_state->curbe.bo, 1); dri_bo_map(render_state->curbe.bo, 1);
assert(render_state->curbe.bo->virtual); assert(render_state->curbe.bo->virtual);
constant_buffer = render_state->curbe.bo->virtual; constant_buffer = render_state->curbe.bo->virtual;
...@@ -931,6 +934,7 @@ i965_render_upload_constants(VADriverContextP ctx) ...@@ -931,6 +934,7 @@ i965_render_upload_constants(VADriverContextP ctx)
*constant_buffer = 0; *constant_buffer = 0;
dri_bo_unmap(render_state->curbe.bo); dri_bo_unmap(render_state->curbe.bo);
render_state->curbe.upload = 1;
} }
static void static void
...@@ -1508,7 +1512,7 @@ i965_render_init(VADriverContextP ctx) ...@@ -1508,7 +1512,7 @@ i965_render_init(VADriverContextP ctx)
struct render_kernel *kernel = &render_kernels[i]; struct render_kernel *kernel = &render_kernels[i];
kernel->bo = dri_bo_alloc(i965->intel.bufmgr, kernel->bo = dri_bo_alloc(i965->intel.bufmgr,
kernel->name, kernel->name,
kernel->size, 64); kernel->size, 0x1000);
assert(kernel->bo); assert(kernel->bo);
dri_bo_subdata(kernel->bo, 0, kernel->size, kernel->bin); dri_bo_subdata(kernel->bo, 0, kernel->size, kernel->bin);
} }
...@@ -1518,6 +1522,7 @@ i965_render_init(VADriverContextP ctx) ...@@ -1518,6 +1522,7 @@ i965_render_init(VADriverContextP ctx)
"constant buffer", "constant buffer",
4096, 64); 4096, 64);
assert(render_state->curbe.bo); assert(render_state->curbe.bo);
render_state->curbe.upload = 0;
return True; return True;
} }
......
...@@ -43,7 +43,6 @@ struct i965_render_state ...@@ -43,7 +43,6 @@ struct i965_render_state
struct { struct {
dri_bo *state; dri_bo *state;
dri_bo *prog;
} sf; } sf;
struct { struct {
...@@ -52,7 +51,6 @@ struct i965_render_state ...@@ -52,7 +51,6 @@ struct i965_render_state
dri_bo *surface[MAX_RENDER_SURFACES]; dri_bo *surface[MAX_RENDER_SURFACES];
dri_bo *binding_table; dri_bo *binding_table;
dri_bo *state; dri_bo *state;
dri_bo *prog;
} wm; } wm;
struct { struct {
...@@ -62,6 +60,7 @@ struct i965_render_state ...@@ -62,6 +60,7 @@ struct i965_render_state
struct { struct {
dri_bo *bo; dri_bo *bo;
int upload;
} curbe; } curbe;
int interleaved_uv; int interleaved_uv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment