context: Make it clear why we copy the ids
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
This commit is contained in:
committed by
Paul Kocialkowski
parent
9f2c069f76
commit
53a8c6e1cf
+7
-2
@@ -96,12 +96,19 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP context,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The surface_ids array has been allocated by the caller and
|
||||||
|
* we don't have any indication wrt its life time. Let's make sure
|
||||||
|
* its life span is under our control.
|
||||||
|
*/
|
||||||
ids = malloc(surfaces_count * sizeof(VASurfaceID));
|
ids = malloc(surfaces_count * sizeof(VASurfaceID));
|
||||||
if (ids == NULL) {
|
if (ids == NULL) {
|
||||||
status = VA_STATUS_ERROR_ALLOCATION_FAILED;
|
status = VA_STATUS_ERROR_ALLOCATION_FAILED;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(ids, surfaces_ids, surfaces_count * sizeof(VASurfaceID));
|
||||||
|
|
||||||
for (i = 0; i < surfaces_count; i++) {
|
for (i = 0; i < surfaces_count; i++) {
|
||||||
surface_object = SURFACE(surfaces_ids[i]);
|
surface_object = SURFACE(surfaces_ids[i]);
|
||||||
if (surface_object == NULL) {
|
if (surface_object == NULL) {
|
||||||
@@ -125,8 +132,6 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP context,
|
|||||||
surface_object->destination_index = i;
|
surface_object->destination_index = i;
|
||||||
surface_object->source_data = source_data;
|
surface_object->source_data = source_data;
|
||||||
surface_object->source_size = length;
|
surface_object->source_size = length;
|
||||||
|
|
||||||
ids[i] = surfaces_ids[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = v4l2_set_stream(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, true);
|
rc = v4l2_set_stream(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user