summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2011-02-15 16:07:04 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2011-03-10 13:46:47 +0800
commit334eaa3ffa1be8d23bbbe5f74fee08afedbf09bf (patch)
tree860ef893cc6e5d9c37a6e8f6012ef3dbeaddc8ac
parent68d0d264efc02dffc08a8b6afc296b8bc53efeee (diff)
downloadlibva-334eaa3ffa1be8d23bbbe5f74fee08afedbf09bf.tar.gz
i965_drv_video: move pp_context to i965_driver_data and make it a pointer.
Later media_state/render_state/pp_context will be moved to object_context. Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
-rw-r--r--i965_drv_video/i965_drv_video.c6
-rw-r--r--i965_drv_video/i965_drv_video.h1
-rw-r--r--i965_drv_video/i965_post_processing.c130
-rw-r--r--i965_drv_video/i965_post_processing.h4
-rw-r--r--i965_drv_video/i965_render.c4
5 files changed, 81 insertions, 64 deletions
diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index 6a44403..2fc2378 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -1369,6 +1369,9 @@ i965_Init(VADriverContextP ctx)
if (i965_media_init(ctx) == False)
return VA_STATUS_ERROR_UNKNOWN;
+ if (i965_post_processing_init(ctx) == False)
+ return VA_STATUS_ERROR_UNKNOWN;
+
if (i965_render_init(ctx) == False)
return VA_STATUS_ERROR_UNKNOWN;
@@ -2016,6 +2019,9 @@ i965_Terminate(VADriverContextP ctx)
if (i965_render_terminate(ctx) == False)
return VA_STATUS_ERROR_UNKNOWN;
+ if (i965_post_processing_terminate(ctx) == False)
+ return VA_STATUS_ERROR_UNKNOWN;
+
if (i965_media_terminate(ctx) == False)
return VA_STATUS_ERROR_UNKNOWN;
diff --git a/i965_drv_video/i965_drv_video.h b/i965_drv_video/i965_drv_video.h
index a62e472..16694d0 100644
--- a/i965_drv_video/i965_drv_video.h
+++ b/i965_drv_video/i965_drv_video.h
@@ -167,6 +167,7 @@ struct i965_driver_data
struct object_heap subpic_heap;
struct i965_media_state media_state;
struct i965_render_state render_state;
+ void *pp_context;
};
#define NEW_CONFIG_ID() object_heap_allocate(&i965->config_heap);
diff --git a/i965_drv_video/i965_post_processing.c b/i965_drv_video/i965_post_processing.c
index 633100c..f2d0b9c 100644
--- a/i965_drv_video/i965_post_processing.c
+++ b/i965_drv_video/i965_post_processing.c
@@ -471,7 +471,7 @@ static void
ironlake_pp_states_setup(VADriverContextP ctx)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct i965_post_processing_context *pp_context = &i965->render_state.pp_context;
+ struct i965_post_processing_context *pp_context = i965->pp_context;
ironlake_pp_surface_state(pp_context);
ironlake_pp_binding_table(pp_context);
@@ -583,7 +583,7 @@ static void
ironlake_pp_pipeline_setup(VADriverContextP ctx)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct i965_post_processing_context *pp_context = &i965->render_state.pp_context;
+ struct i965_post_processing_context *pp_context = i965->pp_context;
intel_batchbuffer_start_atomic(ctx, 0x1000);
intel_batchbuffer_emit_mi_flush(ctx);
@@ -621,7 +621,7 @@ ironlake_pp_null_initialize(VADriverContextP ctx, VASurfaceID surface, int input
unsigned short destw, unsigned short desth)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct i965_post_processing_context *pp_context = &i965->render_state.pp_context;
+ struct i965_post_processing_context *pp_context = i965->pp_context;
struct object_surface *obj_surface;
/* surface */
@@ -672,7 +672,7 @@ ironlake_pp_nv12_load_save_initialize(VADriverContextP ctx, VASurfaceID surface,
unsigned short destw, unsigned short desth)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct i965_post_processing_context *pp_context = &i965->render_state.pp_context;
+ struct i965_post_processing_context *pp_context = i965->pp_context;
struct pp_load_save_context *pp_load_save_context = (struct pp_load_save_context *)&pp_context->private_context;
struct object_surface *obj_surface;
struct i965_surface_state *ss;
@@ -855,7 +855,7 @@ ironlake_pp_nv12_scaling_initialize(VADriverContextP ctx, VASurfaceID surface, i
unsigned short destw, unsigned short desth)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct i965_post_processing_context *pp_context = &i965->render_state.pp_context;
+ struct i965_post_processing_context *pp_context = i965->pp_context;
struct pp_scaling_context *pp_scaling_context = (struct pp_scaling_context *)&pp_context->private_context;
struct object_surface *obj_surface;
struct i965_sampler_state *sampler_state;
@@ -1153,7 +1153,7 @@ ironlake_pp_nv12_avs_initialize(VADriverContextP ctx, VASurfaceID surface, int i
unsigned short destw, unsigned short desth)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct i965_post_processing_context *pp_context = &i965->render_state.pp_context;
+ struct i965_post_processing_context *pp_context = i965->pp_context;
struct pp_avs_context *pp_avs_context = (struct pp_avs_context *)&pp_context->private_context;
struct object_surface *obj_surface;
struct i965_surface_state *ss;
@@ -1525,7 +1525,7 @@ void ironlake_pp_nv12_dndi_initialize(VADriverContextP ctx, VASurfaceID surface,
unsigned short destw, unsigned short desth)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct i965_post_processing_context *pp_context = &i965->render_state.pp_context;
+ struct i965_post_processing_context *pp_context = i965->pp_context;
struct pp_dndi_context *pp_dndi_context = (struct pp_dndi_context *)&pp_context->private_context;
struct object_surface *obj_surface;
struct i965_surface_state *ss;
@@ -1803,7 +1803,7 @@ ironlake_pp_initialize(VADriverContextP ctx,
int pp_index)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct i965_post_processing_context *pp_context = &i965->render_state.pp_context;
+ struct i965_post_processing_context *pp_context = i965->pp_context;
struct pp_module *pp_module;
dri_bo *bo;
int i;
@@ -1946,13 +1946,73 @@ i965_post_processing(VADriverContextP ctx,
}
}
-void
-i965_post_processing_once_init(VADriverContextP ctx)
+Bool
+i965_post_processing_terminate(VADriverContextP ctx)
+{
+ struct i965_driver_data *i965 = i965_driver_data(ctx);
+ struct i965_post_processing_context *pp_context = i965->pp_context;
+ int i;
+
+ if (pp_context) {
+ dri_bo_unreference(pp_context->curbe.bo);
+ pp_context->curbe.bo = NULL;
+
+ for (i = 0; i < MAX_PP_SURFACES; i++) {
+ dri_bo_unreference(pp_context->surfaces[i].ss_bo);
+ pp_context->surfaces[i].ss_bo = NULL;
+
+ dri_bo_unreference(pp_context->surfaces[i].s_bo);
+ pp_context->surfaces[i].s_bo = NULL;
+ }
+
+ dri_bo_unreference(pp_context->sampler_state_table.bo);
+ pp_context->sampler_state_table.bo = NULL;
+
+ dri_bo_unreference(pp_context->sampler_state_table.bo_8x8);
+ pp_context->sampler_state_table.bo_8x8 = NULL;
+
+ dri_bo_unreference(pp_context->sampler_state_table.bo_8x8_uv);
+ pp_context->sampler_state_table.bo_8x8_uv = NULL;
+
+ dri_bo_unreference(pp_context->binding_table.bo);
+ pp_context->binding_table.bo = NULL;
+
+ dri_bo_unreference(pp_context->idrt.bo);
+ pp_context->idrt.bo = NULL;
+
+ dri_bo_unreference(pp_context->vfe_state.bo);
+ pp_context->vfe_state.bo = NULL;
+
+ dri_bo_unreference(pp_context->stmm.bo);
+ pp_context->stmm.bo = NULL;
+
+ free(pp_context);
+ }
+
+ i965->pp_context = NULL;
+
+ for (i = 0; i < NUM_PP_MODULES && pp_modules; i++) {
+ struct pp_module *pp_module = &pp_modules[i];
+
+ dri_bo_unreference(pp_module->bo);
+ pp_module->bo = NULL;
+ }
+
+ return True;
+}
+
+Bool
+i965_post_processing_init(VADriverContextP ctx)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct i965_post_processing_context *pp_context = &i965->render_state.pp_context;
+ struct i965_post_processing_context *pp_context = i965->pp_context;
int i;
+ if (pp_context == NULL) {
+ pp_context = calloc(1, sizeof(*pp_context));
+ i965->pp_context = pp_context;
+ }
+
pp_context->urb.size = URB_SIZE((&i965->intel));
pp_context->urb.num_vfe_entries = 32;
pp_context->urb.size_vfe_entry = 1;
@@ -1970,6 +2030,7 @@ i965_post_processing_once_init(VADriverContextP ctx)
for (i = 0; i < NUM_PP_MODULES && pp_modules; i++) {
struct pp_module *pp_module = &pp_modules[i];
+ dri_bo_unreference(pp_module->bo);
pp_module->bo = dri_bo_alloc(i965->intel.bufmgr,
pp_module->name,
pp_module->size,
@@ -1977,53 +2038,6 @@ i965_post_processing_once_init(VADriverContextP ctx)
assert(pp_module->bo);
dri_bo_subdata(pp_module->bo, 0, pp_module->size, pp_module->bin);
}
-}
-
-Bool
-i965_post_processing_terminate(VADriverContextP ctx)
-{
- struct i965_driver_data *i965 = i965_driver_data(ctx);
- struct i965_post_processing_context *pp_context = &i965->render_state.pp_context;
- int i;
-
- dri_bo_unreference(pp_context->curbe.bo);
- pp_context->curbe.bo = NULL;
-
- for (i = 0; i < MAX_PP_SURFACES; i++) {
- dri_bo_unreference(pp_context->surfaces[i].ss_bo);
- pp_context->surfaces[i].ss_bo = NULL;
-
- dri_bo_unreference(pp_context->surfaces[i].s_bo);
- pp_context->surfaces[i].s_bo = NULL;
- }
-
- dri_bo_unreference(pp_context->sampler_state_table.bo);
- pp_context->sampler_state_table.bo = NULL;
-
- dri_bo_unreference(pp_context->sampler_state_table.bo_8x8);
- pp_context->sampler_state_table.bo_8x8 = NULL;
-
- dri_bo_unreference(pp_context->sampler_state_table.bo_8x8_uv);
- pp_context->sampler_state_table.bo_8x8_uv = NULL;
-
- dri_bo_unreference(pp_context->binding_table.bo);
- pp_context->binding_table.bo = NULL;
-
- dri_bo_unreference(pp_context->idrt.bo);
- pp_context->idrt.bo = NULL;
-
- dri_bo_unreference(pp_context->vfe_state.bo);
- pp_context->vfe_state.bo = NULL;
-
- dri_bo_unreference(pp_context->stmm.bo);
- pp_context->stmm.bo = NULL;
-
- for (i = 0; i < NUM_PP_MODULES && pp_modules; i++) {
- struct pp_module *pp_module = &pp_modules[i];
-
- dri_bo_unreference(pp_module->bo);
- pp_module->bo = NULL;
- }
return True;
}
diff --git a/i965_drv_video/i965_post_processing.h b/i965_drv_video/i965_post_processing.h
index 360ded4..a0745f2 100644
--- a/i965_drv_video/i965_post_processing.h
+++ b/i965_drv_video/i965_post_processing.h
@@ -142,9 +142,9 @@ i965_post_processing(VADriverContextP ctx,
unsigned short destw,
unsigned short desth,
unsigned int pp_index);
-void
-i965_post_processing_once_init(VADriverContextP ctx);
Bool
i965_post_processing_terminate(VADriverContextP ctx);
+Bool
+i965_post_processing_init(VADriverContextP ctx);
#endif /* __I965_POST_PROCESSING_H__ */
diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c
index 9a713f6..64d3c2a 100644
--- a/i965_drv_video/i965_render.c
+++ b/i965_drv_video/i965_render.c
@@ -2099,8 +2099,6 @@ i965_render_init(VADriverContextP ctx)
assert(render_state->curbe.bo);
render_state->curbe.upload = 0;
- i965_post_processing_once_init(ctx);
-
return True;
}
@@ -2111,8 +2109,6 @@ i965_render_terminate(VADriverContextP ctx)
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_render_state *render_state = &i965->render_state;
- i965_post_processing_terminate(ctx);
-
dri_bo_unreference(render_state->curbe.bo);
render_state->curbe.bo = NULL;