summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0108-V4L2VDA-Use-correct-size-to-allocate-CAPTURE-buffer.patch
blob: d10e704651abb073d2f31a156dcc4c86763ea40c (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
From cd2caf4313d91197092dce6262a6f4b325501c04 Mon Sep 17 00:00:00 2001
From: Hou Qi <qi.hou@nxp.com>
Date: Sun, 4 Sep 2022 20:19:05 +0800
Subject: [PATCH 08/17] V4L2VDA: Use correct size to allocate CAPTURE buffer

Upstream-Status: Inappropriate [NXP specific]
---
 media/gpu/v4l2/v4l2_video_decode_accelerator.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
index 54c72c6148d94..018fe8c25f506 100644
--- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
+++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
@@ -2189,7 +2189,10 @@ bool V4L2VideoDecodeAccelerator::CreateBuffersForFormat(
   DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
   size_t egl_image_planes_count;
 
-  coded_size_.SetSize(format.fmt.pix_mp.width, format.fmt.pix_mp.height);
+  if (V4L2_TYPE_IS_MULTIPLANAR(format.type))
+    coded_size_.SetSize(format.fmt.pix_mp.width, format.fmt.pix_mp.height);
+  else
+    coded_size_.SetSize(format.fmt.pix.width, format.fmt.pix.height);
   visible_size_ = visible_size;
   egl_image_size_ = coded_size_;
   if (image_processor_device_) {
@@ -2207,11 +2210,11 @@ bool V4L2VideoDecodeAccelerator::CreateBuffersForFormat(
     // In practice, this applies to all Image Processors, i.e. Mediatek devices.
     DCHECK_EQ(coded_size_, output_size);
   } else {
-    egl_image_planes_count = format.fmt.pix_mp.num_planes;
+    egl_image_planes_count = V4L2_TYPE_IS_MULTIPLANAR(format.type) ? format.fmt.pix_mp.num_planes : 1;
   }
   VLOGF(2) << "new resolution: " << coded_size_.ToString()
            << ", visible size: " << visible_size_.ToString()
-           << ", decoder output planes count: " << format.fmt.pix_mp.num_planes
+           << ", decoder output planes count: " << egl_image_planes_count
            << ", EGLImage size: " << egl_image_size_.ToString()
            << ", EGLImage plane count: " << egl_image_planes_count;
 
-- 
2.17.1