1From 556b8e10e159147916e5f27d4a968d029e6a9f6c 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 07/17] 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 0f88f7454..12a281267 100644
15--- a/media/gpu/v4l2/BUILD.gn
16+++ b/media/gpu/v4l2/BUILD.gn
17@@ -123,9 +123,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 61c003ba6..fa909064e 100644
33--- a/media/gpu/v4l2/generic_v4l2_device.cc
34+++ b/media/gpu/v4l2/generic_v4l2_device.cc
35@@ -33,8 +33,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@@ -302,6 +305,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