summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2014-04-19 00:12:41 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2014-05-26 12:14:17 +0800
commitcd9d671b88b6f999142a8a90a86c5b42021e6ee5 (patch)
treee23ce3ae58228e86d94aa03b566f7c0de53d5d15
parent69e26f5ca4cad4ac69d47fa0db50f037c197c079 (diff)
downloadlibva-intel-driver-cd9d671b88b6f999142a8a90a86c5b42021e6ee5.tar.gz
libva-intel-driver-cd9d671b88b6f999142a8a90a86c5b42021e6ee5.tar.bz2
libva-intel-driver-cd9d671b88b6f999142a8a90a86c5b42021e6ee5.zip
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> (cherry picked from commit 77b6a72504d917af9335ab94f6ecbefb8b087206)
-rw-r--r--src/gen8_post_processing.c6
-rw-r--r--src/i965_device_info.c9
-rw-r--r--src/i965_drv_video.h1
-rwxr-xr-xsrc/i965_post_processing.c24
-rwxr-xr-xsrc/i965_post_processing.h10
5 files changed, 24 insertions, 26 deletions
diff --git a/src/gen8_post_processing.c b/src/gen8_post_processing.c
index 82bf3b9..4ff7f41 100644
--- a/src/gen8_post_processing.c
+++ b/src/gen8_post_processing.c
@@ -1373,7 +1373,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);
@@ -1410,7 +1410,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);
@@ -1418,6 +1418,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;
@@ -1428,6 +1429,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 a15a31b..f040592 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,
@@ -97,6 +102,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,
@@ -128,6 +134,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,
@@ -157,11 +164,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 2de9928..856b478 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 bdab73a..bcd22cd 100755
--- a/src/i965_post_processing.c
+++ b/src/i965_post_processing.c
@@ -5184,11 +5184,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);
}
@@ -5197,18 +5193,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;
@@ -5230,7 +5222,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));
@@ -5286,7 +5279,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;
}
}
@@ -5574,13 +5567,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 fd4cbcf..76f3595 100755
--- a/src/i965_post_processing.h
+++ b/src/i965_post_processing.h
@@ -535,6 +535,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
@@ -575,13 +576,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__ */