summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0115-V4L2VDA-Add-V4L2_PIX_FMT_NV12M_8L128-format-for-amph.patch
blob: e9afc8e69aa7ba17150a30026ffa33bdcf8e6a12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
From 4a3c50348edb021d0529d350aabcd78cc0c75164 Mon Sep 17 00:00:00 2001
From: Hou Qi <qi.hou@nxp.com>
Date: Fri, 9 Sep 2022 10:06:51 +0800
Subject: [PATCH 15/17] V4L2VDA: Add V4L2_PIX_FMT_NV12M_8L128 format for
 amphion

Upstream-Status: Inappropriate [NXP specific]
---
 media/gpu/chromeos/fourcc.cc                    | 2 ++
 media/gpu/chromeos/fourcc.h                     | 4 ++++
 media/gpu/v4l2/generic_v4l2_device.cc           | 4 ++++
 media/gpu/v4l2/v4l2_video_decode_accelerator.cc | 9 +++++++--
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/media/gpu/chromeos/fourcc.cc b/media/gpu/chromeos/fourcc.cc
index 80f392ebf5e41..e8239121d8e96 100644
--- a/media/gpu/chromeos/fourcc.cc
+++ b/media/gpu/chromeos/fourcc.cc
@@ -26,6 +26,7 @@ absl::optional<Fourcc> Fourcc::FromUint32(uint32_t fourcc) {
     case YM12:
     case YM21:
     case YUYV:
+    case NA12:
     case NV12:
     case NV21:
     case NM12:
@@ -149,6 +150,7 @@ VideoPixelFormat Fourcc::ToVideoPixelFormat() const {
       return PIXEL_FORMAT_YUY2;
     case NV12:
     case NM12:
+    case NA12:
       return PIXEL_FORMAT_NV12;
     case NV21:
     case NM21:
diff --git a/media/gpu/chromeos/fourcc.h b/media/gpu/chromeos/fourcc.h
index c4b233ac64562..27f1b679435b1 100644
--- a/media/gpu/chromeos/fourcc.h
+++ b/media/gpu/chromeos/fourcc.h
@@ -68,6 +68,10 @@ class MEDIA_GPU_EXPORT Fourcc {
     // Maps to PIXEL_FORMAT_NV21, V4L2_PIX_FMT_NV21M.
     NM21 = ComposeFourcc('N', 'M', '2', '1'),
 
+    // Tiled YUV formats, non contiguous planes.
+    // Maps to V4L2_PIX_FMT_NV12M_8L128.
+    NA12 = ComposeFourcc('N', 'A', '1', '2'),
+
     // YUV422 single-planar format.
     // https://linuxtv.org/downloads/v4l-dvb-apis-new/userspace-api/v4l/pixfmt-yuv422p.html
     // Maps to PIXEL_FORMAT_I422, V4L2_PIX_FMT_YUV422P.
diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc
index a578768f8d3b1..d7b57d180f7f7 100644
--- a/media/gpu/v4l2/generic_v4l2_device.cc
+++ b/media/gpu/v4l2/generic_v4l2_device.cc
@@ -46,6 +46,9 @@ using media_gpu_v4l2::InitializeStubs;
 using media_gpu_v4l2::StubPathMap;
 #endif
 
+/* Tiled YUV formats, non contiguous planes */
+#define V4L2_PIX_FMT_NV12M_8L128      v4l2_fourcc('N', 'A', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */
+
 namespace media {
 
 namespace {
@@ -54,6 +57,7 @@ uint32_t V4L2PixFmtToDrmFormat(uint32_t format) {
   switch (format) {
     case V4L2_PIX_FMT_NV12:
     case V4L2_PIX_FMT_NV12M:
+    case V4L2_PIX_FMT_NV12M_8L128:
       return DRM_FORMAT_NV12;
 
     case V4L2_PIX_FMT_YUV420:
diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
index fba38c4021855..a37efa9a708e8 100644
--- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
+++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
@@ -1356,8 +1356,9 @@ void V4L2VideoDecodeAccelerator::Enqueue() {
       // yet. Also, V4L2VDA calls STREAMOFF and STREAMON after resolution
       // change. They implicitly send a V4L2_DEC_CMD_STOP and V4L2_DEC_CMD_START
       // to the decoder.
-      if (input_queue_->QueuedBuffersCount() > 0)
-        break;
+      if (input_queue_->QueuedBuffersCount() > 0) {
+        // break;
+      }
 
       if (coded_size_.IsEmpty() || !input_queue_->IsStreaming()) {
         // In these situations, we should call NotifyFlushDone() immediately:
@@ -1499,6 +1500,10 @@ bool V4L2VideoDecodeAccelerator::DequeueOutputBuffer() {
   // Dequeue a completed output (VIDEO_CAPTURE) buffer, and queue to the
   // completed queue.
   auto ret = output_queue_->DequeueBuffer();
+  if (errno == EPIPE) {
+    VLOG(1) << "Got eos";
+    flush_awaiting_last_output_buffer_ = false;
+  }
   if (ret.first == false) {
     LOG(ERROR) << "Error in Dequeue output buffer";
     NOTIFY_ERROR(PLATFORM_FAILURE);
-- 
2.17.1