Skip to content

Instantly share code, notes, and snippets.

@mark-kendall
Created September 10, 2020 10:28
Show Gist options
  • Save mark-kendall/bb9923ade6a41d3e7d901b8d8dc8b0e8 to your computer and use it in GitHub Desktop.
Save mark-kendall/bb9923ade6a41d3e7d901b8d8dc8b0e8 to your computer and use it in GitHub Desktop.
V4L2 M2M DMABUF test
--- mythtv/external/FFmpeg/libavcodec/v4l2_buffers.c
+++ mythtv/external/FFmpeg/libavcodec/v4l2_buffers.c
@@ -563,7 +563,6 @@ int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer *out)
if (frame->format == AV_PIX_FMT_DRM_PRIME) {
AVDRMFrameDescriptor *drm_desc = (AVDRMFrameDescriptor *)frame->data[0];
int i;
- av_assert0(out->buf.memory == V4L2_MEMORY_DMABUF);
if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) {
for (i = 0; i < drm_desc->nb_objects; i++) {
@@ -671,8 +670,7 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
V4L2Context *ctx = avbuf->context;
int ret, i;
- avbuf->buf.memory = ctx->av_pix_fmt == AV_PIX_FMT_DRM_PRIME && V4L2_TYPE_IS_OUTPUT(ctx->type) ?
- V4L2_MEMORY_DMABUF : V4L2_MEMORY_MMAP;
+ avbuf->buf.memory = V4L2_MEMORY_MMAP;
avbuf->buf.type = ctx->type;
avbuf->buf.index = index;
--- mythtv/external/FFmpeg/libavcodec/v4l2_context.c
+++ mythtv/external/FFmpeg/libavcodec/v4l2_context.c
@@ -794,8 +794,7 @@ int ff_v4l2_context_init(V4L2Context* ctx)
memset(&req, 0, sizeof(req));
req.count = ctx->num_buffers;
- req.memory = ctx->av_pix_fmt == AV_PIX_FMT_DRM_PRIME && V4L2_TYPE_IS_OUTPUT(ctx->type) ?
- V4L2_MEMORY_DMABUF : V4L2_MEMORY_MMAP;
+ req.memory = V4L2_MEMORY_MMAP;
req.type = ctx->type;
ret = ioctl(s->fd, VIDIOC_REQBUFS, &req);
if (ret < 0) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment