hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
From 33faca0ec60d7e8dcc73c5a277246bd9ff546372 Mon Sep 17 00:00:00 2001
From: Maksim Sisov <msisov@igalia.com>
Date: Wed, 31 Jul 2019 09:56:24 +0300
Subject: [PATCH 03/12] Add support for V4L2VDA on Linux
 
This patch enables hardware assisted video decoding via the
Chromium V4L2VDA. Including changes when Linux is used. In
order to use this, use_linux_v4l2_only flag should be set
to true.
 
Signed-off-by: Ryo Kodama <ryo.kodama.vz@renesas.com>
 
fixup! avoid building not declared formats
 
"FRAME", "_SLICE",  "V4L2_PIX_FMT_VP9" are not defined in mainline
 Linux headers. This patch avoids building these formats.
 
Signed-off-by: Ryo Kodama <ryo.kodama.vz@renesas.com>
 
fixup! add V4L2_PIX_FMT_VP9 support back again as it is now
included in mainline Linux kernel. This allows VP9 codec
to work with upstream kernel and v4l2 vda. Tested on db820c
with Venus v4l2 driver.
 
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
 .../gpu_mjpeg_decode_accelerator_factory.cc   |  3 +-
 src/3rdparty/chromium/media/gpu/BUILD.gn      |  1 +
 src/3rdparty/chromium/media/gpu/args.gni      |  4 ++
 .../chromeos_video_decoder_factory.cc         |  6 +--
 .../chromium/media/gpu/chromeos/fourcc.cc     |  4 ++
 .../gpu_video_decode_accelerator_factory.cc   |  8 +++
 .../gpu_video_decode_accelerator_factory.h    |  2 +
 src/3rdparty/chromium/media/gpu/v4l2/BUILD.gn | 47 +++++++++--------
 .../media/gpu/v4l2/generic_v4l2_device.cc     |  4 ++
 .../chromium/media/gpu/v4l2/v4l2_device.cc    | 52 +++++++++++++++++++
 .../chromium/media/gpu/v4l2/v4l2_device.h     |  6 +++
 .../gpu/v4l2/v4l2_video_decode_accelerator.cc |  3 ++
 .../mojo/services/gpu_mojo_media_client.cc    |  4 +-
 13 files changed, 118 insertions(+), 26 deletions(-)
 
diff --git a/src/3rdparty/chromium/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc b/src/3rdparty/chromium/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc
index 6f319e88..4f8f0b7d 100644
--- a/src/3rdparty/chromium/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc
+++ b/src/3rdparty/chromium/components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.cc
@@ -13,7 +13,8 @@
 #include "media/base/media_switches.h"
 #include "media/gpu/buildflags.h"
 
-#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY)
+#if BUILDFLAG(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) && \
+    !BUILDFLAG(USE_LINUX_V4L2)
 #define USE_V4L2_MJPEG_DECODE_ACCELERATOR
 #endif
 
diff --git a/src/3rdparty/chromium/media/gpu/BUILD.gn b/src/3rdparty/chromium/media/gpu/BUILD.gn
index 0c0c3e81..dd14a2a9 100644
--- a/src/3rdparty/chromium/media/gpu/BUILD.gn
+++ b/src/3rdparty/chromium/media/gpu/BUILD.gn
@@ -18,6 +18,7 @@ buildflag_header("buildflags") {
     "USE_VAAPI=$use_vaapi",
     "USE_V4L2_CODEC=$use_v4l2_codec",
     "USE_LIBV4L2=$use_v4lplugin",
+    "USE_LINUX_V4L2=$use_linux_v4l2_only",
   ]
 }
 
diff --git a/src/3rdparty/chromium/media/gpu/args.gni b/src/3rdparty/chromium/media/gpu/args.gni
index 2a87b998..60f39fe2 100644
--- a/src/3rdparty/chromium/media/gpu/args.gni
+++ b/src/3rdparty/chromium/media/gpu/args.gni
@@ -14,6 +14,10 @@ declare_args() {
   # platforms which have v4l2 hardware encoder
   use_v4l2_codec_aml = false
 
+  # Indicates that only definitions available in the mainline linux kernel
+  # will be used.
+  use_linux_v4l2_only = false
+
   # Indicates if VA-API-based hardware acceleration is to be used. This
   # is typically the case on x86-based ChromeOS devices.
   use_vaapi = false
diff --git a/src/3rdparty/chromium/media/gpu/chromeos/chromeos_video_decoder_factory.cc b/src/3rdparty/chromium/media/gpu/chromeos/chromeos_video_decoder_factory.cc
index b0c1595e..cfa9299f 100644
--- a/src/3rdparty/chromium/media/gpu/chromeos/chromeos_video_decoder_factory.cc
+++ b/src/3rdparty/chromium/media/gpu/chromeos/chromeos_video_decoder_factory.cc
@@ -17,7 +17,7 @@
 #include "media/gpu/vaapi/vaapi_video_decoder.h"
 #endif
 
-#if BUILDFLAG(USE_V4L2_CODEC)
+#if BUILDFLAG(USE_V4L2_CODEC) && !BUILDFLAG(USE_LINUX_V4L2)
 #include "media/gpu/v4l2/v4l2_slice_video_decoder.h"
 #endif
 
@@ -33,7 +33,7 @@ base::queue<VideoDecoderPipeline::CreateVDFunc> GetCreateVDFunctions(
     &VaapiVideoDecoder::Create,
 #endif  // BUILDFLAG(USE_VAAPI)
 
-#if BUILDFLAG(USE_V4L2_CODEC)
+#if BUILDFLAG(USE_V4L2_CODEC) && !BUILDFLAG(USE_LINUX_V4L2)
     &V4L2SliceVideoDecoder::Create,
 #endif  // BUILDFLAG(USE_V4L2_CODEC)
   };
@@ -60,7 +60,7 @@ ChromeosVideoDecoderFactory::GetSupportedConfigs() {
                            configs.end());
 #endif  // BUILDFLAG(USE_VAAPI)
 
-#if BUILDFLAG(USE_V4L2_CODEC)
+#if BUILDFLAG(USE_V4L2_CODEC) && !BUILDFLAG(USE_LINUX_V4L2)
   configs = V4L2SliceVideoDecoder::GetSupportedConfigs();
   supported_configs.insert(supported_configs.end(), configs.begin(),
                            configs.end());
diff --git a/src/3rdparty/chromium/media/gpu/chromeos/fourcc.cc b/src/3rdparty/chromium/media/gpu/chromeos/fourcc.cc
index e8d514df..243b75b2 100644
--- a/src/3rdparty/chromium/media/gpu/chromeos/fourcc.cc
+++ b/src/3rdparty/chromium/media/gpu/chromeos/fourcc.cc
@@ -16,6 +16,10 @@
 #include <va/va.h>
 #endif  // BUILDFLAG(USE_VAAPI)
 
+#ifndef V4L2_PIX_FMT_MT21C
+#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1')
+#endif
+
 namespace media {
 
 Fourcc::Fourcc(Fourcc::Value fourcc) : value_(fourcc) {}
diff --git a/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc b/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc
index 3d519b99..cb44aecb 100644
--- a/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc
+++ b/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc
@@ -26,7 +26,9 @@
 #endif
 #if BUILDFLAG(USE_V4L2_CODEC)
 #include "media/gpu/v4l2/v4l2_device.h"
+#if !BUILDFLAG(USE_LINUX_V4L2)
 #include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h"
+#endif
 #include "media/gpu/v4l2/v4l2_video_decode_accelerator.h"
 #include "ui/gl/gl_surface_egl.h"
 #endif
@@ -63,10 +65,12 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal(
   vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles();
   GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(
       vda_profiles, &capabilities.supported_profiles);
+#if !BUILDFLAG(USE_LINUX_V4L2)
   vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles();
   GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(
       vda_profiles, &capabilities.supported_profiles);
 #endif
+#endif
 #if BUILDFLAG(USE_VAAPI)
   vda_profiles = VaapiVideoDecodeAccelerator::GetSupportedProfiles();
   GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(
@@ -173,8 +177,10 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA(
 #endif
 #if BUILDFLAG(USE_V4L2_CODEC)
     &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA,
+#if !BUILDFLAG(USE_LINUX_V4L2)
     &GpuVideoDecodeAcceleratorFactory::CreateV4L2SVDA,
 #endif
+#endif
 #if defined(OS_MACOSX)
     &GpuVideoDecodeAcceleratorFactory::CreateVTVDA,
 #endif
@@ -222,6 +228,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA(
   return decoder;
 }
 
+#if !BUILDFLAG(USE_LINUX_V4L2)
 std::unique_ptr<VideoDecodeAccelerator>
 GpuVideoDecodeAcceleratorFactory::CreateV4L2SVDA(
     const gpu::GpuDriverBugWorkarounds& workarounds,
@@ -237,6 +244,7 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SVDA(
   return decoder;
 }
 #endif
+#endif
 
 #if BUILDFLAG(USE_VAAPI)
 std::unique_ptr<VideoDecodeAccelerator>
diff --git a/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.h b/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.h
index 74f10ebe..e779ef50 100644
--- a/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.h
+++ b/src/3rdparty/chromium/media/gpu/gpu_video_decode_accelerator_factory.h
@@ -111,11 +111,13 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory {
       const gpu::GpuDriverBugWorkarounds& workarounds,
       const gpu::GpuPreferences& gpu_preferences,
       MediaLog* media_log) const;
+#if !BUILDFLAG(USE_LINUX_V4L2)
   std::unique_ptr<VideoDecodeAccelerator> CreateV4L2SVDA(
       const gpu::GpuDriverBugWorkarounds& workarounds,
       const gpu::GpuPreferences& gpu_preferences,
       MediaLog* media_log) const;
 #endif
+#endif
 #if BUILDFLAG(USE_VAAPI)
   std::unique_ptr<VideoDecodeAccelerator> CreateVaapiVDA(
       const gpu::GpuDriverBugWorkarounds& workarounds,
diff --git a/src/3rdparty/chromium/media/gpu/v4l2/BUILD.gn b/src/3rdparty/chromium/media/gpu/v4l2/BUILD.gn
index 51814e19..7c0087e6 100644
--- a/src/3rdparty/chromium/media/gpu/v4l2/BUILD.gn
+++ b/src/3rdparty/chromium/media/gpu/v4l2/BUILD.gn
@@ -26,43 +26,48 @@ source_set("v4l2") {
   sources = [
     "generic_v4l2_device.cc",
     "generic_v4l2_device.h",
-    "v4l2_decode_surface.cc",
-    "v4l2_decode_surface.h",
-    "v4l2_decode_surface_handler.h",
     "v4l2_device.cc",
     "v4l2_device.h",
     "v4l2_device_poller.cc",
     "v4l2_device_poller.h",
-    "v4l2_h264_accelerator.cc",
-    "v4l2_h264_accelerator.h",
-    "v4l2_h264_accelerator_legacy.cc",
-    "v4l2_h264_accelerator_legacy.h",
     "v4l2_image_processor_backend.cc",
     "v4l2_image_processor_backend.h",
-    "v4l2_slice_video_decode_accelerator.cc",
-    "v4l2_slice_video_decode_accelerator.h",
-    "v4l2_slice_video_decoder.cc",
-    "v4l2_slice_video_decoder.h",
-    "v4l2_stateful_workaround.cc",
-    "v4l2_stateful_workaround.h",
     "v4l2_vda_helpers.cc",
     "v4l2_vda_helpers.h",
     "v4l2_video_decode_accelerator.cc",
     "v4l2_video_decode_accelerator.h",
     "v4l2_video_decoder_backend.cc",
     "v4l2_video_decoder_backend.h",
-    "v4l2_video_decoder_backend_stateless.cc",
-    "v4l2_video_decoder_backend_stateless.h",
     "v4l2_video_encode_accelerator.cc",
     "v4l2_video_encode_accelerator.h",
-    "v4l2_vp8_accelerator.cc",
-    "v4l2_vp8_accelerator.h",
-    "v4l2_vp8_accelerator_legacy.cc",
-    "v4l2_vp8_accelerator_legacy.h",
-    "v4l2_vp9_accelerator.cc",
-    "v4l2_vp9_accelerator.h",
   ]
 
+  if (!use_linux_v4l2_only) {
+    sources += [
+      "v4l2_decode_surface.cc",
+      "v4l2_decode_surface.h",
+      "v4l2_decode_surface_handler.h",
+      "v4l2_h264_accelerator.cc",
+      "v4l2_h264_accelerator.h",
+      "v4l2_h264_accelerator_legacy.cc",
+      "v4l2_h264_accelerator_legacy.h",
+      "v4l2_slice_video_decode_accelerator.cc",
+      "v4l2_slice_video_decode_accelerator.h",
+      "v4l2_slice_video_decoder.cc",
+      "v4l2_slice_video_decoder.h",
+      "v4l2_stateful_workaround.cc",
+      "v4l2_stateful_workaround.h",
+      "v4l2_video_decoder_backend_stateless.cc",
+      "v4l2_video_decoder_backend_stateless.h",
+      "v4l2_vp8_accelerator.cc",
+      "v4l2_vp8_accelerator.h",
+      "v4l2_vp8_accelerator_legacy.cc",
+      "v4l2_vp8_accelerator_legacy.h",
+      "v4l2_vp9_accelerator.cc",
+      "v4l2_vp9_accelerator.h",
+    ]
+  }
+
   libs = [
     "EGL",
     "GLESv2",
diff --git a/src/3rdparty/chromium/media/gpu/v4l2/generic_v4l2_device.cc b/src/3rdparty/chromium/media/gpu/v4l2/generic_v4l2_device.cc
index 6742dc14..f0f10345 100644
--- a/src/3rdparty/chromium/media/gpu/v4l2/generic_v4l2_device.cc
+++ b/src/3rdparty/chromium/media/gpu/v4l2/generic_v4l2_device.cc
@@ -415,7 +415,11 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) {
     return false;
 
 #if BUILDFLAG(USE_LIBV4L2)
+#if BUILDFLAG(USE_LINUX_V4L2)
+  if (
+#else
   if (type == Type::kEncoder &&
+#endif
       HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) !=
           -1) {
     DVLOGF(3) << "Using libv4l2 for " << path;
diff --git a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.cc b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.cc
index ee5c4430..c4a5f9fc 100644
--- a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.cc
+++ b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.cc
@@ -701,7 +701,9 @@ void V4L2WritableBufferRef::SetConfigStore(uint32_t config_store) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   DCHECK(buffer_data_);
 
+#if !BUILDFLAG(USE_LINUX_V4L2)
   buffer_data_->v4l2_buffer_.config_store = config_store;
+#endif
 }
 
 V4L2ReadableBuffer::V4L2ReadableBuffer(const struct v4l2_buffer& v4l2_buffer,
@@ -835,10 +837,12 @@ V4L2Queue::V4L2Queue(scoped_refptr<V4L2Device> dev,
     return;
   }
 
+#if !BUILDFLAG(USE_LINUX_V4L2)
   if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_REQUESTS) {
     supports_requests_ = true;
     DVLOGF(4) << "Queue supports request API.";
   }
+#endif
 }
 
 V4L2Queue::~V4L2Queue() {
@@ -1242,20 +1246,32 @@ scoped_refptr<V4L2Device> V4L2Device::Create() {
 uint32_t V4L2Device::VideoCodecProfileToV4L2PixFmt(VideoCodecProfile profile,
                                                    bool slice_based) {
   if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) {
+#if !BUILDFLAG(USE_LINUX_V4L2)
     if (slice_based)
       return V4L2_PIX_FMT_H264_SLICE;
     else
       return V4L2_PIX_FMT_H264;
+#else
+    return V4L2_PIX_FMT_H264;
+#endif
   } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) {
+#if !BUILDFLAG(USE_LINUX_V4L2)
     if (slice_based)
       return V4L2_PIX_FMT_VP8_FRAME;
     else
       return V4L2_PIX_FMT_VP8;
+#else
+    return V4L2_PIX_FMT_VP8;
+#endif
   } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) {
+#if !BUILDFLAG(USE_LINUX_V4L2)
     if (slice_based)
       return V4L2_PIX_FMT_VP9_FRAME;
     else
       return V4L2_PIX_FMT_VP9;
+#else
+    return V4L2_PIX_FMT_VP9;
+#endif
   } else {
     LOG(ERROR) << "Unknown profile: " << GetProfileName(profile);
     return 0;
@@ -1279,6 +1295,7 @@ VideoCodecProfile V4L2Device::V4L2ProfileToVideoCodecProfile(VideoCodec codec,
           return H264PROFILE_HIGH;
       }
       break;
+#if !BUILDFLAG(USE_LINUX_V4L2)
     case kCodecVP8:
       switch (profile) {
         case V4L2_MPEG_VIDEO_VP8_PROFILE_0:
@@ -1300,6 +1317,7 @@ VideoCodecProfile V4L2Device::V4L2ProfileToVideoCodecProfile(VideoCodec codec,
           return VP9PROFILE_PROFILE3;
       }
       break;
+#endif
     default:
       VLOGF(2) << "Unknown codec: " << codec;
   }
@@ -1318,12 +1336,14 @@ std::vector<VideoCodecProfile> V4L2Device::V4L2PixFmtToVideoCodecProfiles(
       case kCodecH264:
         query_id = V4L2_CID_MPEG_VIDEO_H264_PROFILE;
         break;
+#if !BUILDFLAG(USE_LINUX_V4L2)
       case kCodecVP8:
         query_id = V4L2_CID_MPEG_VIDEO_VP8_PROFILE;
         break;
       case kCodecVP9:
         query_id = V4L2_CID_MPEG_VIDEO_VP9_PROFILE;
         break;
+#endif
       default:
         return false;
     }
@@ -1351,7 +1371,9 @@ std::vector<VideoCodecProfile> V4L2Device::V4L2PixFmtToVideoCodecProfiles(
   std::vector<VideoCodecProfile> profiles;
   switch (pix_fmt) {
     case V4L2_PIX_FMT_H264:
+#if !BUILDFLAG(USE_LINUX_V4L2)
     case V4L2_PIX_FMT_H264_SLICE:
+#endif
       if (!get_supported_profiles(kCodecH264, &profiles)) {
         DLOG(WARNING) << "Driver doesn't support QUERY H264 profiles, "
                       << "use default values, Base, Main, High";
@@ -1363,11 +1385,15 @@ std::vector<VideoCodecProfile> V4L2Device::V4L2PixFmtToVideoCodecProfiles(
       }
       break;
     case V4L2_PIX_FMT_VP8:
+#if !BUILDFLAG(USE_LINUX_V4L2)
     case V4L2_PIX_FMT_VP8_FRAME:
+#endif
       profiles = {VP8PROFILE_ANY};
       break;
     case V4L2_PIX_FMT_VP9:
+#if !BUILDFLAG(USE_LINUX_V4L2)
     case V4L2_PIX_FMT_VP9_FRAME:
+#endif
       if (!get_supported_profiles(kCodecVP9, &profiles)) {
         DLOG(WARNING) << "Driver doesn't support QUERY VP9 profiles, "
                       << "use default values, Profile0";
@@ -1402,6 +1428,12 @@ uint32_t V4L2Device::V4L2PixFmtToDrmFormat(uint32_t format) {
     case V4L2_PIX_FMT_RGB32:
       return DRM_FORMAT_ARGB8888;
 
+    case V4L2_PIX_FMT_MT21C:
+#if !BUILDFLAG(USE_LINUX_V4L2)
+    case V4L2_PIX_FMT_MT21:
+      return DRM_FORMAT_MT21;
+#endif
+
     default:
       DVLOGF(1) << "Unrecognized format " << FourccToString(format);
       return 0;
@@ -2037,6 +2069,7 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   DCHECK_NE(ctrls, nullptr);
 
+#if !BUILDFLAG(USE_LINUX_V4L2)
   if (!request_fd_.is_valid()) {
     VPLOGF(1) << "Invalid request";
     return false;
@@ -2046,12 +2079,16 @@ bool V4L2Request::ApplyCtrls(struct v4l2_ext_controls* ctrls) {
   ctrls->request_fd = request_fd_.get();
 
   return true;
+#else
+  return false;
+#endif
 }
 
 bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   DCHECK_NE(buffer, nullptr);
 
+#if !BUILDFLAG(USE_LINUX_V4L2)
   if (!request_fd_.is_valid()) {
     VPLOGF(1) << "Invalid request";
     return false;
@@ -2061,6 +2098,9 @@ bool V4L2Request::ApplyQueueBuffer(struct v4l2_buffer* buffer) {
   buffer->request_fd = request_fd_.get();
 
   return true;
+#else
+  return false;
+#endif
 }
 
 bool V4L2Request::Submit() {
@@ -2071,7 +2111,11 @@ bool V4L2Request::Submit() {
     return false;
   }
 
+#if !BUILDFLAG(USE_LINUX_V4L2)
   return HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_QUEUE)) == 0;
+#else
+  return false;
+#endif
 }
 
 bool V4L2Request::IsCompleted() {
@@ -2114,6 +2158,7 @@ bool V4L2Request::Reset() {
     return false;
   }
 
+#if !BUILDFLAG(USE_LINUX_V4L2)
   // Reinit the request to make sure we can use it for a new submission.
   if (HANDLE_EINTR(ioctl(request_fd_.get(), MEDIA_REQUEST_IOC_REINIT)) < 0) {
     VPLOGF(1) << "Failed to reinit request.";
@@ -2121,6 +2166,9 @@ bool V4L2Request::Reset() {
   }
 
   return true;
+#else
+  return false;
+#endif
 }
 
 V4L2RequestRefBase::V4L2RequestRefBase(V4L2RequestRefBase&& req_base) {
@@ -2195,6 +2243,7 @@ V4L2RequestsQueue::~V4L2RequestsQueue() {
 base::Optional<base::ScopedFD> V4L2RequestsQueue::CreateRequestFD() {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
 
+#if !BUILDFLAG(USE_LINUX_V4L2)
   int request_fd;
   int ret = HANDLE_EINTR(
         ioctl(media_fd_.get(), MEDIA_IOC_REQUEST_ALLOC, &request_fd));
@@ -2204,6 +2253,9 @@ base::Optional<base::ScopedFD> V4L2RequestsQueue::CreateRequestFD() {
   }
 
   return base::ScopedFD(request_fd);
+#else
+  return base::nullopt;
+#endif
 }
 
 base::Optional<V4L2RequestRef> V4L2RequestsQueue::GetFreeRequest() {
diff --git a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.h b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.h
index 346ec0c9..7ab77f46 100644
--- a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.h
+++ b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_device.h
@@ -40,6 +40,12 @@
 #ifndef V4L2_PIX_FMT_JPEG_RAW
 #define V4L2_PIX_FMT_JPEG_RAW v4l2_fourcc('J', 'P', 'G', 'R')
 #endif
+#ifndef V4L2_PIX_FMT_VP9
+#define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0')
+#endif
+#ifndef V4L2_PIX_FMT_MT21C
+#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1')
+#endif
 #ifndef V4L2_CID_JPEG_LUMA_QUANTIZATION
 #define V4L2_CID_JPEG_LUMA_QUANTIZATION (V4L2_CID_JPEG_CLASS_BASE + 5)
 #endif
diff --git a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
index 7147d9f8..454bda07 100644
--- a/src/3rdparty/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
+++ b/src/3rdparty/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
@@ -31,6 +31,7 @@
 #include "media/base/unaligned_shared_memory.h"
 #include "media/base/video_frame_layout.h"
 #include "media/base/video_types.h"
+#include "media/gpu/buildflags.h"
 #include "media/gpu/chromeos/fourcc.h"
 #include "media/gpu/chromeos/platform_video_frame_utils.h"
 #include "media/gpu/macros.h"
@@ -306,8 +307,10 @@ bool V4L2VideoDecodeAccelerator::CheckConfig(const Config& config) {
     return false;
   }
 
+#if !BUILDFLAG(USE_LINUX_V4L2)
   workarounds_ =
       CreateV4L2StatefulWorkarounds(V4L2Device::Type::kDecoder, config.profile);
+#endif
 
   output_mode_ = config.output_mode;
 
diff --git a/src/3rdparty/chromium/media/mojo/services/gpu_mojo_media_client.cc b/src/3rdparty/chromium/media/mojo/services/gpu_mojo_media_client.cc
index 5074b435..f5a1ecfe 100644
--- a/src/3rdparty/chromium/media/mojo/services/gpu_mojo_media_client.cc
+++ b/src/3rdparty/chromium/media/mojo/services/gpu_mojo_media_client.cc
@@ -167,7 +167,8 @@ GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() {
         *d3d11_supported_configs_;
   }
 
-#elif BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
+#elif defined(OS_CHROMEOS)
+#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
   if (IsNewAcceleratedVideoDecoderUsed(gpu_preferences_)) {
     if (!cros_supported_configs_) {
       cros_supported_configs_ =
@@ -178,6 +179,7 @@ GpuMojoMediaClient::GetSupportedVideoDecoderConfigs() {
     return supported_config_map;
   }
 #endif
+#endif
 
 #if defined(OS_WIN)
   if (gpu_workarounds_.disable_dxva_video_decoder) {
-- 
2.20.1