summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2014-04-14 12:19:39 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2014-05-08 15:56:36 -0400
commiteee61f39e5f1e6a536c15331bd8a11d27cfb241b (patch)
tree7af99a7e074fd6407c68a954b9fd1f926343e062 /sys
parent1ab90ababa6196066139a6f90a39b060e6acbb3c (diff)
v4l2: Introduce DMABUF_IMPORT IO mode
Diffstat (limited to 'sys')
-rw-r--r--sys/v4l2/gstv4l2bufferpool.c15
-rw-r--r--sys/v4l2/gstv4l2object.c6
-rw-r--r--sys/v4l2/gstv4l2object.h11
3 files changed, 25 insertions, 7 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
index 088e3d5db..adf52cd49 100644
--- a/sys/v4l2/gstv4l2bufferpool.c
+++ b/sys/v4l2/gstv4l2bufferpool.c
@@ -115,6 +115,7 @@ gst_v4l2_buffer_pool_alloc_buffer (GstBufferPool * bpool, GstBuffer ** buffer,
pool->allocator);
break;
case GST_V4L2_IO_USERPTR:
+ case GST_V4L2_IO_DMABUF_IMPORT:
default:
newbuf = NULL;
g_assert_not_reached ();
@@ -265,12 +266,15 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
GST_V4L2_ALLOCATOR_CAN_ALLOCATE (pool->vallocator, USERPTR);
break;
case GST_V4L2_IO_RW:
- default:
pool->allocator = g_object_ref (allocator);
pool->params = params;
/* No need to change the configuration */
goto done;
break;
+ case GST_V4L2_IO_DMABUF_IMPORT:
+ default:
+ g_assert_not_reached ();
+ break;
}
if (min_buffers < GST_V4L2_MIN_BUFFERS) {
@@ -336,6 +340,7 @@ start_streaming (GstV4l2BufferPool * pool)
case GST_V4L2_IO_MMAP:
case GST_V4L2_IO_USERPTR:
case GST_V4L2_IO_DMABUF:
+ case GST_V4L2_IO_DMABUF_IMPORT:
GST_DEBUG_OBJECT (pool, "STREAMON");
if (v4l2_ioctl (pool->video_fd, VIDIOC_STREAMON, &obj->type) < 0)
goto start_failed;
@@ -438,6 +443,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
break;
}
case GST_V4L2_IO_USERPTR:
+ case GST_V4L2_IO_DMABUF_IMPORT:
default:
num_buffers = 0;
copy_threshold = 0;
@@ -519,6 +525,7 @@ stop_streaming (GstV4l2BufferPool * pool)
case GST_V4L2_IO_MMAP:
case GST_V4L2_IO_USERPTR:
case GST_V4L2_IO_DMABUF:
+ case GST_V4L2_IO_DMABUF_IMPORT:
GST_DEBUG_OBJECT (pool, "STREAMOFF");
if (v4l2_ioctl (pool->video_fd, VIDIOC_STREAMOFF, &obj->type) < 0)
goto stop_failed;
@@ -836,6 +843,7 @@ gst_v4l2_buffer_pool_acquire_buffer (GstBufferPool * bpool, GstBuffer ** buffer,
break;
case GST_V4L2_IO_USERPTR:
+ case GST_V4L2_IO_DMABUF_IMPORT:
default:
ret = GST_FLOW_ERROR;
g_assert_not_reached ();
@@ -861,6 +869,7 @@ gst_v4l2_buffer_pool_acquire_buffer (GstBufferPool * bpool, GstBuffer ** buffer,
break;
case GST_V4L2_IO_USERPTR:
+ case GST_V4L2_IO_DMABUF_IMPORT:
default:
ret = GST_FLOW_ERROR;
g_assert_not_reached ();
@@ -919,6 +928,7 @@ gst_v4l2_buffer_pool_release_buffer (GstBufferPool * bpool, GstBuffer * buffer)
break;
}
case GST_V4L2_IO_USERPTR:
+ case GST_V4L2_IO_DMABUF_IMPORT:
default:
g_assert_not_reached ();
break;
@@ -970,6 +980,7 @@ gst_v4l2_buffer_pool_release_buffer (GstBufferPool * bpool, GstBuffer * buffer)
}
case GST_V4L2_IO_USERPTR:
+ case GST_V4L2_IO_DMABUF_IMPORT:
default:
g_assert_not_reached ();
break;
@@ -1210,6 +1221,7 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer * buf)
}
case GST_V4L2_IO_USERPTR:
+ case GST_V4L2_IO_DMABUF_IMPORT:
default:
g_assert_not_reached ();
break;
@@ -1281,6 +1293,7 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer * buf)
}
case GST_V4L2_IO_USERPTR:
+ case GST_V4L2_IO_DMABUF_IMPORT:
default:
g_assert_not_reached ();
break;
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index 3c70ec53c..f70e666a0 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -238,6 +238,8 @@ gst_v4l2_io_mode_get_type (void)
{GST_V4L2_IO_MMAP, "GST_V4L2_IO_MMAP", "mmap"},
{GST_V4L2_IO_USERPTR, "GST_V4L2_IO_USERPTR", "userptr"},
{GST_V4L2_IO_DMABUF, "GST_V4L2_IO_DMABUF", "dmabuf"},
+ {GST_V4L2_IO_DMABUF_IMPORT, "GST_V4L2_IO_DMABUF_IMPORT",
+ "dmabuf-import"},
{0, NULL, NULL}
};
@@ -3123,8 +3125,10 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query)
}
break;
case GST_V4L2_IO_MMAP:
- case GST_V4L2_IO_USERPTR:
case GST_V4L2_IO_DMABUF:
+ /* FIXME in these case we actually prefer/need a downstream pool */
+ case GST_V4L2_IO_USERPTR:
+ case GST_V4L2_IO_DMABUF_IMPORT:
/* in streaming mode, prefer our own pool */
/* Check if we can use it ... */
if (can_use_own_pool) {
diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h
index 07723fc91..4500d315b 100644
--- a/sys/v4l2/gstv4l2object.h
+++ b/sys/v4l2/gstv4l2object.h
@@ -51,11 +51,12 @@ GType gst_v4l2_io_mode_get_type (void);
#define GST_V4L2_OBJECT(obj) (GstV4l2Object *)(obj)
typedef enum {
- GST_V4L2_IO_AUTO = 0,
- GST_V4L2_IO_RW = 1,
- GST_V4L2_IO_MMAP = 2,
- GST_V4L2_IO_USERPTR = 3,
- GST_V4L2_IO_DMABUF = 4
+ GST_V4L2_IO_AUTO = 0,
+ GST_V4L2_IO_RW = 1,
+ GST_V4L2_IO_MMAP = 2,
+ GST_V4L2_IO_USERPTR = 3,
+ GST_V4L2_IO_DMABUF = 4,
+ GST_V4L2_IO_DMABUF_IMPORT = 5
} GstV4l2IOMode;
typedef gboolean (*GstV4l2GetInOutFunction) (GstV4l2Object * v4l2object, gint * input);