diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2014-04-19 00:12:41 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2014-04-22 15:24:24 +0800 |
commit | 77b6a72504d917af9335ab94f6ecbefb8b087206 (patch) | |
tree | 9405c68988a31fc64525f4066d7cf92fb947bd07 | |
parent | f150fbf444ca63b5e9c3e8f7e17aa3386f7061fa (diff) |
posst_processing_context_init()/finalize() callback functions for each platform
It is to reduce the usage of IS_GENxxx() as well.
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
-rw-r--r-- | src/gen8_post_processing.c | 6 | ||||
-rw-r--r-- | src/i965_device_info.c | 9 | ||||
-rw-r--r-- | src/i965_drv_video.h | 1 | ||||
-rwxr-xr-x | src/i965_post_processing.c | 24 | ||||
-rwxr-xr-x | src/i965_post_processing.h | 10 |
5 files changed, 24 insertions, 26 deletions
diff --git a/src/gen8_post_processing.c b/src/gen8_post_processing.c index 4cd518f..b9a7268 100644 --- a/src/gen8_post_processing.c +++ b/src/gen8_post_processing.c @@ -1497,7 +1497,7 @@ gen8_post_processing( return va_status; } -void +static void gen8_post_processing_context_finalize(struct i965_post_processing_context *pp_context) { dri_bo_unreference(pp_context->surface_state_binding_table.bo); @@ -1534,7 +1534,7 @@ gen8_post_processing_context_finalize(struct i965_post_processing_context *pp_co void gen8_post_processing_context_init(VADriverContextP ctx, - struct i965_post_processing_context *pp_context, + void *data, struct intel_batchbuffer *batch) { struct i965_driver_data *i965 = i965_driver_data(ctx); @@ -1542,6 +1542,7 @@ gen8_post_processing_context_init(VADriverContextP ctx, unsigned int kernel_offset, end_offset; unsigned char *kernel_ptr; struct pp_module *pp_module; + struct i965_post_processing_context *pp_context = data; { pp_context->vfe_gpu_state.max_num_threads = 60; @@ -1552,6 +1553,7 @@ gen8_post_processing_context_init(VADriverContextP ctx, } pp_context->intel_post_processing = gen8_post_processing; + pp_context->finalize = gen8_post_processing_context_finalize; assert(NUM_PP_MODULES == ARRAY_ELEMS(pp_modules_gen8)); diff --git a/src/i965_device_info.c b/src/i965_device_info.c index d9b860a..35a75b4 100644 --- a/src/i965_device_info.c +++ b/src/i965_device_info.c @@ -36,6 +36,7 @@ static const struct hw_codec_info g4x_hw_codec_info = { .enc_hw_context_init = NULL, .proc_hw_context_init = NULL, .render_init = genx_render_init, + .post_processing_context_init = NULL, .max_width = 2048, .max_height = 2048, @@ -46,11 +47,14 @@ static const struct hw_codec_info g4x_hw_codec_info = { }; extern struct hw_context *ironlake_dec_hw_context_init(VADriverContextP, struct object_config *); +extern void i965_post_processing_context_init(VADriverContextP, void *, struct intel_batchbuffer *); + static const struct hw_codec_info ilk_hw_codec_info = { .dec_hw_context_init = ironlake_dec_hw_context_init, .enc_hw_context_init = NULL, .proc_hw_context_init = i965_proc_context_init, .render_init = genx_render_init, + .post_processing_context_init = i965_post_processing_context_init, .max_width = 2048, .max_height = 2048, @@ -70,6 +74,7 @@ static const struct hw_codec_info snb_hw_codec_info = { .enc_hw_context_init = gen6_enc_hw_context_init, .proc_hw_context_init = i965_proc_context_init, .render_init = genx_render_init, + .post_processing_context_init = i965_post_processing_context_init, .max_width = 2048, .max_height = 2048, @@ -98,6 +103,7 @@ static const struct hw_codec_info ivb_hw_codec_info = { .enc_hw_context_init = gen7_enc_hw_context_init, .proc_hw_context_init = i965_proc_context_init, .render_init = genx_render_init, + .post_processing_context_init = i965_post_processing_context_init, .max_width = 4096, .max_height = 4096, @@ -130,6 +136,7 @@ static const struct hw_codec_info hsw_hw_codec_info = { .enc_hw_context_init = gen75_enc_hw_context_init, .proc_hw_context_init = gen75_proc_context_init, .render_init = genx_render_init, + .post_processing_context_init = i965_post_processing_context_init, .max_width = 4096, .max_height = 4096, @@ -162,11 +169,13 @@ static const struct hw_codec_info hsw_hw_codec_info = { extern struct hw_context *gen8_dec_hw_context_init(VADriverContextP, struct object_config *); extern struct hw_context *gen8_enc_hw_context_init(VADriverContextP, struct object_config *); +extern void gen8_post_processing_context_init(VADriverContextP, void *, struct intel_batchbuffer *); static const struct hw_codec_info bdw_hw_codec_info = { .dec_hw_context_init = gen8_dec_hw_context_init, .enc_hw_context_init = gen8_enc_hw_context_init, .proc_hw_context_init = gen75_proc_context_init, .render_init = gen8_render_init, + .post_processing_context_init = gen8_post_processing_context_init, .max_width = 4096, .max_height = 4096, diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h index ddc0388..0e32f7d 100644 --- a/src/i965_drv_video.h +++ b/src/i965_drv_video.h @@ -287,6 +287,7 @@ struct hw_codec_info struct hw_context *(*enc_hw_context_init)(VADriverContextP, struct object_config *); struct hw_context *(*proc_hw_context_init)(VADriverContextP, struct object_config *); bool (*render_init)(VADriverContextP); + void (*post_processing_context_init)(VADriverContextP, void *, struct intel_batchbuffer *); int max_width; int max_height; diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c index 0ed98e1..c80c6bd 100755 --- a/src/i965_post_processing.c +++ b/src/i965_post_processing.c @@ -5345,11 +5345,7 @@ i965_post_processing_terminate(VADriverContextP ctx) struct i965_post_processing_context *pp_context = i965->pp_context; if (pp_context) { - if (IS_GEN8(i965->intel.device_info)) { - gen8_post_processing_context_finalize(pp_context); - } else { - i965_post_processing_context_finalize(pp_context); - } + pp_context->finalize(pp_context); free(pp_context); } @@ -5358,18 +5354,14 @@ i965_post_processing_terminate(VADriverContextP ctx) #define VPP_CURBE_ALLOCATION_SIZE 32 -static void +void i965_post_processing_context_init(VADriverContextP ctx, - struct i965_post_processing_context *pp_context, + void *data, struct intel_batchbuffer *batch) { struct i965_driver_data *i965 = i965_driver_data(ctx); int i; - - if (IS_GEN8(i965->intel.device_info)) { - gen8_post_processing_context_init(ctx, pp_context, batch); - return; - }; + struct i965_post_processing_context *pp_context = data; if (IS_IRONLAKE(i965->intel.device_info)) { pp_context->urb.size = i965->intel.device_info->urb_size; @@ -5391,7 +5383,8 @@ i965_post_processing_context_init(VADriverContextP ctx, pp_context->vfe_gpu_state.curbe_allocation_size = VPP_CURBE_ALLOCATION_SIZE; pp_context->intel_post_processing = gen6_post_processing; } - + + pp_context->finalize = i965_post_processing_context_finalize; assert(NUM_PP_MODULES == ARRAY_ELEMS(pp_modules_gen5)); assert(NUM_PP_MODULES == ARRAY_ELEMS(pp_modules_gen6)); @@ -5447,7 +5440,7 @@ i965_post_processing_init(VADriverContextP ctx) if (HAS_PP(i965)) { if (pp_context == NULL) { pp_context = calloc(1, sizeof(*pp_context)); - i965_post_processing_context_init(ctx, pp_context, i965->pp_batch); + i965->codec_info->post_processing_context_init(ctx, pp_context, i965->pp_batch); i965->pp_context = pp_context; } } @@ -5767,13 +5760,14 @@ i965_proc_context_destroy(void *hw_context) struct hw_context * i965_proc_context_init(VADriverContextP ctx, struct object_config *obj_config) { + struct i965_driver_data *i965 = i965_driver_data(ctx); struct intel_driver_data *intel = intel_driver_data(ctx); struct i965_proc_context *proc_context = calloc(1, sizeof(struct i965_proc_context)); proc_context->base.destroy = i965_proc_context_destroy; proc_context->base.run = i965_proc_picture; proc_context->base.batch = intel_batchbuffer_new(intel, I915_EXEC_RENDER, 0); - i965_post_processing_context_init(ctx, &proc_context->pp_context, proc_context->base.batch); + i965->codec_info->post_processing_context_init(ctx, &proc_context->pp_context, proc_context->base.batch); return (struct hw_context *)proc_context; } diff --git a/src/i965_post_processing.h b/src/i965_post_processing.h index 0ed4fcb..ffc9d1c 100755 --- a/src/i965_post_processing.h +++ b/src/i965_post_processing.h @@ -549,6 +549,7 @@ struct i965_post_processing_context const VARectangle *dst_rect, int pp_index, void * filter_param); + void (*finalize)(struct i965_post_processing_context *pp_context); }; struct i965_proc_context @@ -589,13 +590,4 @@ i965_post_processing_terminate(VADriverContextP ctx); bool i965_post_processing_init(VADriverContextP ctx); - -extern void -gen8_post_processing_context_init(VADriverContextP ctx, - struct i965_post_processing_context *pp_context, - struct intel_batchbuffer *batch); - -extern void -gen8_post_processing_context_finalize(struct i965_post_processing_context *pp_context); - #endif /* __I965_POST_PROCESSING_H__ */ |