1From f7dc3dfe23a907de10143bc4327194389ecbf34e Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Mon, 28 Sep 2020 20:02:00 +0800
4Subject: [PATCH 08/14] media: gpu: v4l2: Fix compile error when ozone not
5 enabled
6
7Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
8---
9 media/gpu/v4l2/BUILD.gn               | 5 ++++-
10 media/gpu/v4l2/generic_v4l2_device.cc | 7 +++++++
11 2 files changed, 11 insertions(+), 1 deletion(-)
12
13diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn
14index 3e637653..9f83e8e3 100644
15--- a/media/gpu/v4l2/BUILD.gn
16+++ b/media/gpu/v4l2/BUILD.gn
17@@ -108,9 +108,12 @@ source_set("v4l2") {
18     "//media/parsers",
19     "//third_party/libyuv",
20     "//ui/gfx/geometry",
21-    "//ui/ozone",
22   ]
23
24+  if (use_ozone) {
25+    deps += [ "//ui/ozone" ]
26+  }
27+
28   if (use_v4lplugin) {
29     deps += [ ":libv4l2_stubs" ]
30   }
31diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc
32index 64aa8c6d..11cf9c96 100644
33--- a/media/gpu/v4l2/generic_v4l2_device.cc
34+++ b/media/gpu/v4l2/generic_v4l2_device.cc
35@@ -34,8 +34,11 @@
36 #include "ui/gl/egl_util.h"
37 #include "ui/gl/gl_bindings.h"
38 #include "ui/gl/gl_image_native_pixmap.h"
39+
40+#if defined(USE_OZONE)
41 #include "ui/ozone/public/ozone_platform.h"
42 #include "ui/ozone/public/surface_factory_ozone.h"
43+#endif
44
45 #if BUILDFLAG(USE_LIBV4L2)
46 // Auto-generated for dlopen libv4l2 libraries
47@@ -303,6 +306,9 @@ scoped_refptr<gl::GLImage> GenericV4L2Device::CreateGLImage(
48     const gfx::Size& size,
49     const Fourcc fourcc,
50     gfx::NativePixmapHandle handle) const {
51+#if !defined(USE_OZONE)
52+  return nullptr;
53+#else
54   DVLOGF(3);
55   DCHECK(CanCreateEGLImageFrom(fourcc));
56
57@@ -337,6 +343,7 @@ scoped_refptr<gl::GLImage> GenericV4L2Device::CreateGLImage(
58   bool ret = image->Initialize(std::move(pixmap));
59   DCHECK(ret);
60   return image;
61+#endif
62 }
63
64 EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display,
65--
662.20.1
67
68