summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gen6_mfc_common.c4
-rw-r--r--src/gen6_vme.c6
-rw-r--r--src/gen75_mfc.c3
-rw-r--r--src/gen75_vme.c6
-rw-r--r--src/gen7_mfc.c3
-rw-r--r--src/gen7_vme.c6
-rw-r--r--src/i965_drv_video.h1
-rw-r--r--src/i965_encoder.c23
8 files changed, 30 insertions, 22 deletions
diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c
index 7eeb71d..1393f1b 100644
--- a/src/gen6_mfc_common.c
+++ b/src/gen6_mfc_common.c
@@ -632,9 +632,7 @@ VAStatus intel_mfc_avc_prepare(VADriverContextP ctx,
}
}
- obj_surface = SURFACE(encoder_context->input_yuv_surface);
- assert(obj_surface && obj_surface->bo);
- mfc_context->uncompressed_picture_source.bo = obj_surface->bo;
+ mfc_context->uncompressed_picture_source.bo = encode_state->input_yuv_object->bo;
dri_bo_reference(mfc_context->uncompressed_picture_source.bo);
obj_buffer = BUFFER (pPicParameter->coded_buf); /* FIXME: fix this later */
diff --git a/src/gen6_vme.c b/src/gen6_vme.c
index ec70286..3d5baa5 100644
--- a/src/gen6_vme.c
+++ b/src/gen6_vme.c
@@ -277,8 +277,7 @@ gen6_vme_surface_setup(VADriverContextP ctx,
/*Setup surfaces state*/
/* current picture for encoding */
- obj_surface = SURFACE(encoder_context->input_yuv_surface);
- assert(obj_surface);
+ obj_surface = encode_state->input_yuv_object;
gen6_vme_source_surface_state(ctx, 0, obj_surface, encoder_context);
gen6_vme_media_source_surface_state(ctx, 4, obj_surface, encoder_context);
@@ -741,8 +740,7 @@ gen6_vme_mpeg2_surface_setup(VADriverContextP ctx,
/*Setup surfaces state*/
/* current picture for encoding */
- obj_surface = SURFACE(encoder_context->input_yuv_surface);
- assert(obj_surface);
+ obj_surface = encode_state->input_yuv_object;
gen6_vme_source_surface_state(ctx, 0, obj_surface, encoder_context);
gen6_vme_media_source_surface_state(ctx, 4, obj_surface, encoder_context);
diff --git a/src/gen75_mfc.c b/src/gen75_mfc.c
index e055d32..5da00de 100644
--- a/src/gen75_mfc.c
+++ b/src/gen75_mfc.c
@@ -2451,8 +2451,7 @@ intel_mfc_mpeg2_prepare(VADriverContextP ctx,
}
/* input YUV surface */
- obj_surface = SURFACE(encoder_context->input_yuv_surface);
- assert(obj_surface && obj_surface->bo);
+ obj_surface = encode_state->input_yuv_object;
mfc_context->uncompressed_picture_source.bo = obj_surface->bo;
dri_bo_reference(mfc_context->uncompressed_picture_source.bo);
diff --git a/src/gen75_vme.c b/src/gen75_vme.c
index 5853757..37751cf 100644
--- a/src/gen75_vme.c
+++ b/src/gen75_vme.c
@@ -272,8 +272,7 @@ gen75_vme_surface_setup(VADriverContextP ctx,
/*Setup surfaces state*/
/* current picture for encoding */
- obj_surface = SURFACE(encoder_context->input_yuv_surface);
- assert(obj_surface);
+ obj_surface = encode_state->input_yuv_object;
gen75_vme_source_surface_state(ctx, 0, obj_surface, encoder_context);
gen75_vme_media_source_surface_state(ctx, 4, obj_surface, encoder_context);
gen75_vme_media_chroma_source_surface_state(ctx, 6, obj_surface, encoder_context);
@@ -783,8 +782,7 @@ gen75_vme_mpeg2_surface_setup(VADriverContextP ctx,
/*Setup surfaces state*/
/* current picture for encoding */
- obj_surface = SURFACE(encoder_context->input_yuv_surface);
- assert(obj_surface);
+ obj_surface = encode_state->input_yuv_object;
gen75_vme_source_surface_state(ctx, 0, obj_surface, encoder_context);
gen75_vme_media_source_surface_state(ctx, 4, obj_surface, encoder_context);
gen75_vme_media_chroma_source_surface_state(ctx, 6, obj_surface, encoder_context);
diff --git a/src/gen7_mfc.c b/src/gen7_mfc.c
index 759b10a..3abcacd 100644
--- a/src/gen7_mfc.c
+++ b/src/gen7_mfc.c
@@ -1056,8 +1056,7 @@ gen7_mfc_mpeg2_prepare(VADriverContextP ctx,
}
/* input YUV surface */
- obj_surface = SURFACE(encoder_context->input_yuv_surface);
- assert(obj_surface && obj_surface->bo);
+ obj_surface = encode_state->input_yuv_object;
mfc_context->uncompressed_picture_source.bo = obj_surface->bo;
dri_bo_reference(mfc_context->uncompressed_picture_source.bo);
diff --git a/src/gen7_vme.c b/src/gen7_vme.c
index 493992f..e5b2020 100644
--- a/src/gen7_vme.c
+++ b/src/gen7_vme.c
@@ -255,8 +255,7 @@ gen7_vme_surface_setup(VADriverContextP ctx,
/*Setup surfaces state*/
/* current picture for encoding */
- obj_surface = SURFACE(encoder_context->input_yuv_surface);
- assert(obj_surface);
+ obj_surface = encode_state->input_yuv_object;
gen7_vme_source_surface_state(ctx, 0, obj_surface, encoder_context);
gen7_vme_media_source_surface_state(ctx, 4, obj_surface, encoder_context);
@@ -848,8 +847,7 @@ gen7_vme_mpeg2_surface_setup(VADriverContextP ctx,
/*Setup surfaces state*/
/* current picture for encoding */
- obj_surface = SURFACE(encoder_context->input_yuv_surface);
- assert(obj_surface);
+ obj_surface = encode_state->input_yuv_object;
gen7_vme_source_surface_state(ctx, 0, obj_surface, encoder_context);
gen7_vme_media_source_surface_state(ctx, 4, obj_surface, encoder_context);
diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h
index 37f8697..77ba9ab 100644
--- a/src/i965_drv_video.h
+++ b/src/i965_drv_video.h
@@ -132,6 +132,7 @@ struct encode_state
struct buffer_store *misc_param[8];
VASurfaceID current_render_target;
+ struct object_surface *input_yuv_object;
};
struct proc_state
diff --git a/src/i965_encoder.c b/src/i965_encoder.c
index 72ea548..a7334ac 100644
--- a/src/i965_encoder.c
+++ b/src/i965_encoder.c
@@ -56,7 +56,7 @@ i965_CreateSurfaces(VADriverContextP ctx,
int num_surfaces,
VASurfaceID *surfaces);
-static void
+static VAStatus
intel_encoder_check_yuv_surface(VADriverContextP ctx,
VAProfile profile,
struct encode_state *encode_state,
@@ -71,12 +71,16 @@ intel_encoder_check_yuv_surface(VADriverContextP ctx,
/* releae the temporary surface */
if (encoder_context->is_tmp_id) {
i965_DestroySurfaces(ctx, &encoder_context->input_yuv_surface, 1);
+ encode_state->input_yuv_object = NULL;
}
encoder_context->is_tmp_id = 0;
obj_surface = SURFACE(encode_state->current_render_target);
assert(obj_surface && obj_surface->bo);
+ if (!obj_surface || !obj_surface->bo)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+
if (obj_surface->fourcc == VA_FOURCC('N', 'V', '1', '2')) {
unsigned int tiling = 0, swizzle = 0;
@@ -84,7 +88,8 @@ intel_encoder_check_yuv_surface(VADriverContextP ctx,
if (tiling == I915_TILING_Y) {
encoder_context->input_yuv_surface = encode_state->current_render_target;
- return;
+ encode_state->input_yuv_object = obj_surface;
+ return VA_STATUS_SUCCESS;
}
}
@@ -104,7 +109,12 @@ intel_encoder_check_yuv_surface(VADriverContextP ctx,
1,
&encoder_context->input_yuv_surface);
assert(status == VA_STATUS_SUCCESS);
+
+ if (status != VA_STATUS_SUCCESS)
+ return status;
+
obj_surface = SURFACE(encoder_context->input_yuv_surface);
+ encode_state->input_yuv_object = obj_surface;
i965_check_alloc_surface_bo(ctx, obj_surface, 1, VA_FOURCC('N', 'V', '1', '2'), SUBSAMPLE_YUV420);
dst_surface.id = encoder_context->input_yuv_surface;
@@ -119,6 +129,8 @@ intel_encoder_check_yuv_surface(VADriverContextP ctx,
assert(status == VA_STATUS_SUCCESS);
encoder_context->is_tmp_id = 1;
+
+ return VA_STATUS_SUCCESS;
}
static VAStatus
@@ -131,7 +143,10 @@ intel_encoder_end_picture(VADriverContextP ctx,
struct encode_state *encode_state = &codec_state->encode;
VAStatus vaStatus;
- intel_encoder_check_yuv_surface(ctx, profile, encode_state, encoder_context);
+ vaStatus = intel_encoder_check_yuv_surface(ctx, profile, encode_state, encoder_context);
+
+ if (vaStatus != VA_STATUS_SUCCESS)
+ return vaStatus;
encoder_context->mfc_brc_prepare(encode_state, encoder_context);
@@ -163,6 +178,8 @@ gen6_enc_hw_context_init(VADriverContextP ctx, struct object_config *obj_config)
encoder_context->base.destroy = intel_encoder_context_destroy;
encoder_context->base.run = intel_encoder_end_picture;
encoder_context->base.batch = intel_batchbuffer_new(intel, I915_EXEC_RENDER, 0);
+ encoder_context->input_yuv_surface = VA_INVALID_SURFACE;
+ encoder_context->is_tmp_id = 0;
encoder_context->rate_control_mode = VA_RC_NONE;
encoder_context->profile = obj_config->profile;