Skip to content

Commit 03f4b30

Browse files
committed
ffmpeg: update v4l2-drmprime patch
Patch created using revisions 9047fa1..99bbab2 from branch v4l2-drmprime-n8.1 of https://github.com/jernejsk/FFmpeg
1 parent 79de202 commit 03f4b30

1 file changed

Lines changed: 25 additions & 49 deletions

File tree

packages/multimedia/ffmpeg/patches/v4l2-drmprime/ffmpeg-001-v4l2-drmprime.patch

Lines changed: 25 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 8444b369120d0514e22b9d3537fa597d4bc7248a Mon Sep 17 00:00:00 2001
1+
From 8d0c529749096e58c1404a526530cb0273f3aafe Mon Sep 17 00:00:00 2001
22
From: Lukas Rusak <lorusak@gmail.com>
33
Date: Tue, 24 Apr 2018 23:00:23 -0700
44
Subject: [PATCH 1/8] libavcodec: v4l2m2m: output AVDRMFrameDescriptor
@@ -42,7 +42,7 @@ V5:
4242
5 files changed, 212 insertions(+), 11 deletions(-)
4343

4444
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
45-
index 7f597a424aa9..c2c9905bc9a3 100644
45+
index 077c1ee9449d..863877ce2bb8 100644
4646
--- a/libavcodec/v4l2_buffers.c
4747
+++ b/libavcodec/v4l2_buffers.c
4848
@@ -21,6 +21,7 @@
@@ -61,7 +61,7 @@ index 7f597a424aa9..c2c9905bc9a3 100644
6161
#include "libavutil/pixdesc.h"
6262
#include "libavutil/refstruct.h"
6363
#include "v4l2_context.h"
64-
@@ -227,6 +229,78 @@ static void v4l2_get_interlacing(AVFrame *frame, V4L2Buffer *buf)
64+
@@ -233,6 +235,78 @@ static void v4l2_get_interlacing(AVFrame *frame, V4L2Buffer *buf)
6565
}
6666
}
6767

@@ -140,7 +140,7 @@ index 7f597a424aa9..c2c9905bc9a3 100644
140140
static void v4l2_free_buffer(void *opaque, uint8_t *unused)
141141
{
142142
V4L2Buffer* avbuf = opaque;
143-
@@ -251,6 +325,36 @@ static void v4l2_free_buffer(void *opaque, uint8_t *unused)
143+
@@ -257,6 +331,36 @@ static void v4l2_free_buffer(void *opaque, uint8_t *unused)
144144
}
145145
}
146146

@@ -177,7 +177,7 @@ index 7f597a424aa9..c2c9905bc9a3 100644
177177
static int v4l2_buf_increase_ref(V4L2Buffer *in)
178178
{
179179
V4L2m2mContext *s = buf_to_m2mctx(in);
180-
@@ -269,6 +373,24 @@ static int v4l2_buf_increase_ref(V4L2Buffer *in)
180+
@@ -275,6 +379,24 @@ static int v4l2_buf_increase_ref(V4L2Buffer *in)
181181
return 0;
182182
}
183183

@@ -202,7 +202,7 @@ index 7f597a424aa9..c2c9905bc9a3 100644
202202
static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf)
203203
{
204204
int ret;
205-
@@ -318,13 +440,24 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf)
205+
@@ -324,13 +446,24 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf)
206206

207207
frame->format = avbuf->context->av_pix_fmt;
208208

@@ -231,7 +231,7 @@ index 7f597a424aa9..c2c9905bc9a3 100644
231231
}
232232

233233
/* fixup special cases */
234-
@@ -560,9 +693,6 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
234+
@@ -566,9 +699,6 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
235235

236236
avbuf->status = V4L2BUF_AVAILABLE;
237237

@@ -241,7 +241,7 @@ index 7f597a424aa9..c2c9905bc9a3 100644
241241
if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) {
242242
avbuf->buf.m.planes = avbuf->planes;
243243
avbuf->buf.length = avbuf->num_planes;
244-
@@ -572,6 +702,15 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
244+
@@ -578,6 +708,15 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
245245
avbuf->buf.length = avbuf->planes[0].length;
246246
}
247247

@@ -418,11 +418,8 @@ index ba1fe769e0fe..08cfb4e5a49f 100644
418418
}
419419

420420
M2MDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb");
421-
--
422-
2.47.3
423421

424-
425-
From f889be857730b6df1b70c8d7cbea014535539829 Mon Sep 17 00:00:00 2001
422+
From 6e07edda13a1af6202d0edcee5e4a3140e3b3d85 Mon Sep 17 00:00:00 2001
426423
From: Lukas Rusak <lorusak@gmail.com>
427424
Date: Thu, 16 Aug 2018 21:09:40 -0700
428425
Subject: [PATCH 2/8] libavcodec: v4l2m2m: depends on libdrm
@@ -433,10 +430,10 @@ Subject: [PATCH 2/8] libavcodec: v4l2m2m: depends on libdrm
433430
2 files changed, 2 insertions(+), 1 deletion(-)
434431

435432
diff --git a/configure b/configure
436-
index a0eed36abfe3..f38d1db91f76 100755
433+
index 17596942749a..25f05fd2f2a6 100755
437434
--- a/configure
438435
+++ b/configure
439-
@@ -3831,6 +3831,7 @@ sndio_indev_deps="sndio"
436+
@@ -4000,6 +4000,7 @@ sndio_indev_deps="sndio"
440437
sndio_outdev_deps="sndio"
441438
v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
442439
v4l2_indev_suggest="libv4l2"
@@ -445,7 +442,7 @@ index a0eed36abfe3..f38d1db91f76 100755
445442
v4l2_outdev_suggest="libv4l2"
446443
vfwcap_indev_deps="vfw32 vfwcap_defines"
447444
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
448-
index c2c9905bc9a3..75070206d71d 100644
445+
index 863877ce2bb8..b6b1c6b586e2 100644
449446
--- a/libavcodec/v4l2_buffers.c
450447
+++ b/libavcodec/v4l2_buffers.c
451448
@@ -21,7 +21,7 @@
@@ -457,11 +454,8 @@ index c2c9905bc9a3..75070206d71d 100644
457454
#include <linux/videodev2.h>
458455
#include <sys/ioctl.h>
459456
#include <sys/mman.h>
460-
--
461-
2.47.3
462-
463457

464-
From 3e081e0f53419ed80dbaf108d8691cbfb5ee255c Mon Sep 17 00:00:00 2001
458+
From 52d0550fba278f41bf5a74a10197286c87c0d44d Mon Sep 17 00:00:00 2001
465459
From: Lukas Rusak <lorusak@gmail.com>
466460
Date: Thu, 16 Aug 2018 21:10:13 -0700
467461
Subject: [PATCH 3/8] libavcodec: v4l2m2m: set format_modifier to
@@ -472,10 +466,10 @@ Subject: [PATCH 3/8] libavcodec: v4l2m2m: set format_modifier to
472466
1 file changed, 2 insertions(+)
473467

474468
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
475-
index 75070206d71d..0035d7cff3a6 100644
469+
index b6b1c6b586e2..40420a50a3b2 100644
476470
--- a/libavcodec/v4l2_buffers.c
477471
+++ b/libavcodec/v4l2_buffers.c
478-
@@ -345,10 +345,12 @@ static int v4l2_buffer_export_drm(V4L2Buffer* avbuf)
472+
@@ -351,10 +351,12 @@ static int v4l2_buffer_export_drm(V4L2Buffer* avbuf)
479473
/* drm frame */
480474
avbuf->drm_frame.objects[i].size = avbuf->buf.m.planes[i].length;
481475
avbuf->drm_frame.objects[i].fd = expbuf.fd;
@@ -488,11 +482,8 @@ index 75070206d71d..0035d7cff3a6 100644
488482
}
489483
}
490484

491-
--
492-
2.47.3
493485

494-
495-
From dc01c0a40ce5b585809ab0b30b6c5512bf9d3a93 Mon Sep 17 00:00:00 2001
486+
From 2a9066cf6f683c9855cc9774ea3ee57fa333d2eb Mon Sep 17 00:00:00 2001
496487
From: Lukas Rusak <lorusak@gmail.com>
497488
Date: Thu, 16 Aug 2018 21:10:53 -0700
498489
Subject: [PATCH 4/8] libavcodec: v4l2m2m: only mmap the buffer when it is
@@ -503,10 +494,10 @@ Subject: [PATCH 4/8] libavcodec: v4l2m2m: only mmap the buffer when it is
503494
1 file changed, 14 insertions(+), 6 deletions(-)
504495

505496
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
506-
index 0035d7cff3a6..0b04f8fbca4b 100644
497+
index 40420a50a3b2..ad537dcc1184 100644
507498
--- a/libavcodec/v4l2_buffers.c
508499
+++ b/libavcodec/v4l2_buffers.c
509-
@@ -679,14 +679,22 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
500+
@@ -685,14 +685,22 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
510501

511502
if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) {
512503
avbuf->plane_info[i].length = avbuf->buf.m.planes[i].length;
@@ -535,11 +526,8 @@ index 0035d7cff3a6..0b04f8fbca4b 100644
535526
}
536527

537528
if (avbuf->plane_info[i].mm_addr == MAP_FAILED)
538-
--
539-
2.47.3
540-
541529

542-
From bdd736ae2a0ecceb9843acd8e86dc56c15d9360f Mon Sep 17 00:00:00 2001
530+
From 90acef9ad745d9d1f6ab583f74495b0a67c153ac Mon Sep 17 00:00:00 2001
543531
From: Lukas Rusak <lorusak@gmail.com>
544532
Date: Thu, 16 Aug 2018 21:11:38 -0700
545533
Subject: [PATCH 5/8] libavcodec: v4l2m2m: allow using software pixel formats
@@ -578,11 +566,8 @@ index 08cfb4e5a49f..a500cad0b38b 100644
578566
AV_PIX_FMT_NONE}, \
579567
.hw_configs = v4l2_m2m_hw_configs, \
580568
}
581-
--
582-
2.47.3
583569

584-
585-
From fd47ac58a6ca82748ab7af07311476717409fae3 Mon Sep 17 00:00:00 2001
570+
From 0b204bfb795cc19fe0135429e1cf9055d0035f32 Mon Sep 17 00:00:00 2001
586571
From: Lukas Rusak <lorusak@gmail.com>
587572
Date: Mon, 24 Sep 2018 13:39:31 -0700
588573
Subject: [PATCH 6/8] libavcodec: v4l2m2m: implement hwcontext
@@ -595,18 +580,18 @@ Subject: [PATCH 6/8] libavcodec: v4l2m2m: implement hwcontext
595580
4 files changed, 37 insertions(+)
596581

597582
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
598-
index 0b04f8fbca4b..5e75dec11c50 100644
583+
index ad537dcc1184..0d3029573cda 100644
599584
--- a/libavcodec/v4l2_buffers.c
600585
+++ b/libavcodec/v4l2_buffers.c
601-
@@ -450,6 +450,7 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf)
586+
@@ -456,6 +456,7 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf)
602587

603588
frame->data[0] = (uint8_t *) v4l2_get_drm_frame(avbuf);
604589
frame->format = AV_PIX_FMT_DRM_PRIME;
605590
+ frame->hw_frames_ctx = av_buffer_ref(avbuf->context->frames_ref);
606591
} else {
607592
/* 1. get references to the actual data */
608593
for (i = 0; i < avbuf->num_planes; i++) {
609-
@@ -652,6 +653,27 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
594+
@@ -658,6 +659,27 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
610595
avbuf->buf.type = ctx->type;
611596
avbuf->buf.index = index;
612597

@@ -689,11 +674,8 @@ index a500cad0b38b..3512928895f0 100644
689674
s->avctx = avctx;
690675
ret = ff_v4l2_m2m_codec_init(priv);
691676
if (ret) {
692-
--
693-
2.47.3
694-
695677

696-
From 0cda0ccaf7f90a29cfc0a5dac83fb5f28da5dd98 Mon Sep 17 00:00:00 2001
678+
From 1d7da897085e1eb82c93af8037b6bb468b50aa0e Mon Sep 17 00:00:00 2001
697679
From: Lukas Rusak <lorusak@gmail.com>
698680
Date: Wed, 6 May 2020 11:12:58 -0700
699681
Subject: [PATCH 7/8] libavcodec: v4l2m2m: add option to specify pixel format
@@ -764,11 +746,8 @@ index 3512928895f0..3ec484b37a6a 100644
764746
{ NULL},
765747
};
766748

767-
--
768-
2.47.3
769749

770-
771-
From 01f52ab76139855c0d17bd338a7fed0f48648b4b Mon Sep 17 00:00:00 2001
750+
From 99bbab25229ac2d9f543f99fff5e4e38c6fe3a55 Mon Sep 17 00:00:00 2001
772751
From: Lukas Rusak <lorusak@gmail.com>
773752
Date: Mon, 24 Sep 2018 13:39:56 -0700
774753
Subject: [PATCH 8/8] libavcodec: v4l2m2m: implement flush
@@ -831,6 +810,3 @@ index 3ec484b37a6a..0dc848fb1cbe 100644
831810
.bsfs = bsf_name, \
832811
.p.capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \
833812
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
834-
--
835-
2.47.3
836-

0 commit comments

Comments
 (0)