summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2013-03-15 13:44:23 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-03-15 15:45:28 +0800
commitd313f2b15a48d3da4da9191400864769d15c6eb8 (patch)
treea7bcc5c0d28d8593f69f039e06c75072929eedc0
parent81a7227364ee23a28addb782da91e7b1edd73551 (diff)
downloadvaapi-intel-driver-d313f2b15a48d3da4da9191400864769d15c6eb8.tar.gz
vaapi-intel-driver-d313f2b15a48d3da4da9191400864769d15c6eb8.tar.bz2
vaapi-intel-driver-d313f2b15a48d3da4da9191400864769d15c6eb8.zip
Check object for VA buffer
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
-rw-r--r--src/gen75_picture_process.c39
-rw-r--r--src/gen75_picture_process.h1
-rw-r--r--src/gen75_vpp_gpe.c17
3 files changed, 38 insertions, 19 deletions
diff --git a/src/gen75_picture_process.c b/src/gen75_picture_process.c
index 7ed1528..fd437f5 100644
--- a/src/gen75_picture_process.c
+++ b/src/gen75_picture_process.c
@@ -140,6 +140,9 @@ gen75_proc_picture(VADriverContextP ctx,
if (!obj_src_surf)
goto error;
+ if (pipeline_param->num_filters && !pipeline_param->filters)
+ goto error;
+
if (!obj_dst_surf->bo) {
unsigned int is_tiled = 0;
unsigned int fourcc = VA_FOURCC('N','V','1','2');
@@ -159,9 +162,11 @@ gen75_proc_picture(VADriverContextP ctx,
}else if(pipeline_param->num_filters == 1) {
struct object_buffer * obj_buf = BUFFER((*filter_id) + 0);
- assert(obj_buf && obj_buf->buffer_store);
+ assert(obj_buf && obj_buf->buffer_store && obj_buf->buffer_store->buffer);
- if (!obj_buf || !obj_buf->buffer_store)
+ if (!obj_buf ||
+ !obj_buf->buffer_store ||
+ !obj_buf->buffer_store->buffer)
goto error;
VAProcFilterParameterBuffer* filter =
@@ -186,17 +191,25 @@ gen75_proc_picture(VADriverContextP ctx,
}else if (pipeline_param->num_filters >= 2) {
unsigned int i = 0;
for (i = 0; i < pipeline_param->num_filters; i++){
- struct object_buffer * obj_buf = BUFFER(pipeline_param->filters[i]);
- VAProcFilterParameterBuffer* filter =
- (VAProcFilterParameterBuffer*)obj_buf-> buffer_store->buffer;
-
- if (filter->type != VAProcFilterNoiseReduction &&
- filter->type != VAProcFilterDeinterlacing &&
- filter->type != VAProcFilterColorBalance &&
- filter->type != VAProcFilterNone ){
- printf("Do not support multiply filters outside vebox pipeline \n");
- assert(0);
- }
+ struct object_buffer * obj_buf = BUFFER(pipeline_param->filters[i]);
+
+ assert(obj_buf && obj_buf->buffer_store && obj_buf->buffer_store->buffer);
+
+ if (!obj_buf ||
+ !obj_buf->buffer_store ||
+ !obj_buf->buffer_store->buffer)
+ goto error;
+
+ VAProcFilterParameterBuffer* filter =
+ (VAProcFilterParameterBuffer*)obj_buf-> buffer_store->buffer;
+
+ if (filter->type != VAProcFilterNoiseReduction &&
+ filter->type != VAProcFilterDeinterlacing &&
+ filter->type != VAProcFilterColorBalance &&
+ filter->type != VAProcFilterNone ){
+ printf("Do not support multiply filters outside vebox pipeline \n");
+ assert(0);
+ }
}
gen75_vpp_vebox(ctx, proc_ctx);
}
diff --git a/src/gen75_picture_process.h b/src/gen75_picture_process.h
index a7b04f7..b0f9750 100644
--- a/src/gen75_picture_process.h
+++ b/src/gen75_picture_process.h
@@ -43,7 +43,6 @@ struct intel_video_process_context
struct vpp_gpe_context *vpp_gpe_ctx;
VAProcPipelineParameterBuffer* pipeline_param;
- VAProcFilterType filter_type;
struct object_surface *surface_render_output_object;
struct object_surface *surface_pipeline_input_object;
diff --git a/src/gen75_vpp_gpe.c b/src/gen75_vpp_gpe.c
index db6a82a..fb7eba6 100644
--- a/src/gen75_vpp_gpe.c
+++ b/src/gen75_vpp_gpe.c
@@ -344,9 +344,11 @@ gen75_gpe_process_sharpening(VADriverContextP ctx,
VABufferID *filter_ids = (VABufferID*)pipe->filters ;
struct object_buffer *obj_buf = BUFFER((*(filter_ids + 0)));
- assert(obj_buf && obj_buf->buffer_store);
+ assert(obj_buf && obj_buf->buffer_store && obj_buf->buffer_store->buffer);
- if (!obj_buf || !obj_buf->buffer_store)
+ if (!obj_buf ||
+ !obj_buf->buffer_store ||
+ !obj_buf->buffer_store->buffer)
goto error;
VAProcFilterParameterBuffer* filter =
@@ -473,12 +475,17 @@ VAStatus gen75_gpe_process_picture(VADriverContextP ctx,
unsigned int i;
struct object_surface *obj_surface = NULL;
+ if (pipe->num_filters && !pipe->filters)
+ goto error;
+
for(i = 0; i < pipe->num_filters; i++){
struct object_buffer *obj_buf = BUFFER(pipe->filters[i]);
- assert(obj_buf && obj_buf->buffer_store);
+ assert(obj_buf && obj_buf->buffer_store && obj_buf->buffer_store->buffer);
- if (!obj_buf || !obj_buf->buffer_store)
+ if (!obj_buf ||
+ !obj_buf->buffer_store ||
+ !obj_buf->buffer_store->buffer)
goto error;
filter = (VAProcFilterParameterBuffer*)obj_buf-> buffer_store->buffer;
@@ -515,7 +522,7 @@ VAStatus gen75_gpe_process_picture(VADriverContextP ctx,
vpp_gpe_ctx->in_frame_w = obj_surface->orig_width;
vpp_gpe_ctx->in_frame_h = obj_surface->orig_height;
- if(filter->type == VAProcFilterSharpening) {
+ if(filter && filter->type == VAProcFilterSharpening) {
va_status = gen75_gpe_process_sharpening(ctx, vpp_gpe_ctx);
} else {
va_status = VA_STATUS_ERROR_ATTR_NOT_SUPPORTED;