Always clear v4l2_plane before sending them to the kernel

This commit is contained in:
Florent Revest
2016-08-29 17:44:23 +02:00
parent 5412e2676b
commit c8e187aed5
5 changed files with 15 additions and 1 deletions
+2
View File
@@ -52,6 +52,8 @@ VAStatus sunxi_cedrus_CreateBuffer(VADriverContextP ctx, VAContextID context,
struct v4l2_plane plane[1]; struct v4l2_plane plane[1];
object_buffer_p obj_buffer; object_buffer_p obj_buffer;
memset(plane, 0, sizeof(struct v4l2_plane));
/* Validate type */ /* Validate type */
switch (type) switch (type)
{ {
+2
View File
@@ -48,6 +48,8 @@ VAStatus sunxi_cedrus_render_mpeg2_slice_data(VADriverContextP ctx,
struct v4l2_buffer buf; struct v4l2_buffer buf;
struct v4l2_plane plane[1]; struct v4l2_plane plane[1];
memset(plane, 0, sizeof(struct v4l2_plane));
/* Query */ /* Query */
memset(&(buf), 0, sizeof(buf)); memset(&(buf), 0, sizeof(buf));
buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+2
View File
@@ -48,6 +48,8 @@ VAStatus sunxi_cedrus_render_mpeg4_slice_data(VADriverContextP ctx,
struct v4l2_buffer buf; struct v4l2_buffer buf;
struct v4l2_plane plane[1]; struct v4l2_plane plane[1];
memset(plane, 0, sizeof(struct v4l2_plane));
/* Query */ /* Query */
memset(&(buf), 0, sizeof(buf)); memset(&(buf), 0, sizeof(buf));
buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+3
View File
@@ -170,6 +170,9 @@ VAStatus sunxi_cedrus_EndPicture(VADriverContextP ctx, VAContextID context)
* order the different RenderPicture will be called. * order the different RenderPicture will be called.
*/ */
memset(plane, 0, sizeof(struct v4l2_plane));
memset(planes, 0, 2 * sizeof(struct v4l2_plane));
memset(&(out_buf), 0, sizeof(out_buf)); memset(&(out_buf), 0, sizeof(out_buf));
out_buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; out_buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
out_buf.memory = V4L2_MEMORY_MMAP; out_buf.memory = V4L2_MEMORY_MMAP;
+6 -1
View File
@@ -63,6 +63,8 @@ VAStatus sunxi_cedrus_CreateSurfaces(VADriverContextP ctx, int width,
struct v4l2_create_buffers create_bufs; struct v4l2_create_buffers create_bufs;
struct v4l2_format fmt; struct v4l2_format fmt;
memset(planes, 0, 2 * sizeof(struct v4l2_plane));
/* We only support one format */ /* We only support one format */
if (VA_RT_FORMAT_YUV420 != format) if (VA_RT_FORMAT_YUV420 != format)
return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT; return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
@@ -160,9 +162,13 @@ VAStatus sunxi_cedrus_SyncSurface(VADriverContextP ctx,
object_surface_p obj_surface; object_surface_p obj_surface;
struct v4l2_buffer buf; struct v4l2_buffer buf;
struct v4l2_plane plane[1]; struct v4l2_plane plane[1];
struct v4l2_plane planes[2];
fd_set read_fds; fd_set read_fds;
struct timeval tv = {0, 300000}; struct timeval tv = {0, 300000};
memset(plane, 0, sizeof(struct v4l2_plane));
memset(planes, 0, 2 * sizeof(struct v4l2_plane));
obj_surface = SURFACE(render_target); obj_surface = SURFACE(render_target);
assert(obj_surface); assert(obj_surface);
@@ -186,7 +192,6 @@ VAStatus sunxi_cedrus_SyncSurface(VADriverContextP ctx,
} }
memset(&(buf), 0, sizeof(buf)); memset(&(buf), 0, sizeof(buf));
struct v4l2_plane planes[2];
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
buf.memory = V4L2_MEMORY_MMAP; buf.memory = V4L2_MEMORY_MMAP;
buf.index = obj_surface->output_buf_index; buf.index = obj_surface->output_buf_index;