File chromium-vaapi.patch of Package chromium.openSUSE_Leap_42.3_Update

From 53b93dfe87fd10cced5d2a2a63072dfc7a2af6e4 Mon Sep 17 00:00:00 2001
From: Daniel Charles <daniel.charles@intel.com>
Date: Fri, 28 Jul 2017 16:31:47 -0700
Subject: [PATCH] Enable VAVDA, VAVEA and VAJDA on linux with VAAPI only

This patch contains all the changes necessary to use VA-API along with
vaapi-driver to run all media use cases supported with hardware acceleration.

It is intended to remain as experimental accessible from chrome://flags on linux.
It requires libva/intel-vaapi-driver to be installed on the system path where
chrome is executed.  Other drivers could be tested if available. Flags are
kept independent for linux, where this feature has to be enabled before
actually using it.  This should not change how other OSes use the flags
already, the new flags will show at the buttom on the section of unavailable
experiments

The changes cover a range of compiler pre-processor flags to enable the stack.
It moves the presandbox operations to the vaapi_wrapper class as the hook function
is available there. vaInit will open driver on the correct installed folder.

chrome flags consolidtation into only two flags for linux.  Mjpeg and accelerated
video are used.  The other flags are kept for ChromeOS and other OSes.

Developer testing was made on skylake hardware, ChromeOS and Ubuntu.

BUG=NONE
TEST="subjective testing with VAVDA,VAVEA and VAJDA, autotest for encoder"
TEST="and decoder hardware accelerated"
TEST="have libva/intel-vaapi-driver installed and not installed in the system"
TEST="repeat on different hardware families"
R=posciak@chromium.org
R=kcwu@chromium.org

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ifbbf5c9e5221a8b5733fc6d4d0cf984a1f103171
Signed-off-by: Daniel Charles <daniel.charles@intel.com>
---

Index: chromium-69.0.3497.92/chrome/browser/about_flags.cc
===================================================================
--- chromium-69.0.3497.92.orig/chrome/browser/about_flags.cc	2018-09-11 21:09:23.000000000 +0200
+++ chromium-69.0.3497.92/chrome/browser/about_flags.cc	2018-09-12 08:48:49.602320030 +0200
@@ -1612,6 +1612,13 @@ const FeatureEntry kFeatureEntries[] = {
      flag_descriptions::kShowTouchHudDescription, kOsCrOS,
      SINGLE_VALUE_TYPE(ash::switches::kAshTouchHud)},
 #endif  // OS_CHROMEOS
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+    {
+        "enable-accelerated-video", flag_descriptions::kAcceleratedVideoName,
+        flag_descriptions::kAcceleratedVideoDescription, kOsLinux,
+        SINGLE_VALUE_TYPE(switches::kEnableAcceleratedVideo),
+    },
+#else
     {
         "disable-accelerated-video-decode",
         flag_descriptions::kAcceleratedVideoDecodeName,
@@ -1619,6 +1626,7 @@ const FeatureEntry kFeatureEntries[] = {
         kOsMac | kOsWin | kOsCrOS | kOsAndroid,
         SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode),
     },
+#endif
 #if defined(OS_WIN)
     {"enable-hdr", flag_descriptions::kEnableHDRName,
      flag_descriptions::kEnableHDRDescription, kOsWin,
@@ -2291,12 +2299,17 @@ const FeatureEntry kFeatureEntries[] = {
      FEATURE_VALUE_TYPE(features::kOpenVR)},
 #endif  // ENABLE_OPENVR
 #endif  // ENABLE_VR
-#if defined(OS_CHROMEOS)
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+    {"enable-accelerated-mjpeg-decode",
+     flag_descriptions::kAcceleratedMjpegDecodeName,
+     flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsLinux,
+     SINGLE_VALUE_TYPE(switches::kEnableAcceleratedMjpegDecode)},
+#elif defined(OS_CHROMEOS)
     {"disable-accelerated-mjpeg-decode",
      flag_descriptions::kAcceleratedMjpegDecodeName,
      flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS,
      SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedMjpegDecode)},
-#endif  // OS_CHROMEOS
+#endif
     {"v8-cache-options", flag_descriptions::kV8CacheOptionsName,
      flag_descriptions::kV8CacheOptionsDescription, kOsAll,
      MULTI_VALUE_TYPE(kV8CacheOptionsChoices)},
Index: chromium-69.0.3497.92/chrome/browser/chromeos/login/chrome_restart_request.cc
===================================================================
--- chromium-69.0.3497.92.orig/chrome/browser/chromeos/login/chrome_restart_request.cc	2018-09-11 21:09:23.000000000 +0200
+++ chromium-69.0.3497.92/chrome/browser/chromeos/login/chrome_restart_request.cc	2018-09-12 08:48:49.602320030 +0200
@@ -19,6 +19,7 @@
 #include "base/sys_info.h"
 #include "base/timer/timer.h"
 #include "base/values.h"
+#include "build/build_config.h"
 #include "cc/base/switches.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/chromeos/boot_times_recorder.h"
@@ -84,8 +85,13 @@ void DeriveCommandLine(const GURL& start
     ::switches::kDisable2dCanvasImageChromium,
     ::switches::kDisableAccelerated2dCanvas,
     ::switches::kDisableAcceleratedJpegDecoding,
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+    ::switches::kEnableAcceleratedMjpegDecode,
+    ::switches::kEnableAcceleratedVideo,
+#else
     ::switches::kDisableAcceleratedMjpegDecode,
     ::switches::kDisableAcceleratedVideoDecode,
+#endif
     ::switches::kDisableAcceleratedVideoEncode,
     ::switches::kDisableBlinkFeatures,
     ::switches::kDisableCastStreamingHWEncoding,
Index: chromium-69.0.3497.92/chrome/browser/flag_descriptions.cc
===================================================================
--- chromium-69.0.3497.92.orig/chrome/browser/flag_descriptions.cc	2018-09-11 21:09:24.000000000 +0200
+++ chromium-69.0.3497.92/chrome/browser/flag_descriptions.cc	2018-09-12 08:48:49.602320030 +0200
@@ -14,6 +14,13 @@ const char kAccelerated2dCanvasDescripti
     "Enables the use of the GPU to perform 2d canvas rendering instead of "
     "using software rendering.";
 
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+const char kAcceleratedVideoName[] = "Hardware-accelerated video";
+const char kAcceleratedVideoDescription[] =
+    "Hardware-accelerated video where VA-API driver is installed on the"
+    "system.";
+#endif
+
 const char kAcceleratedVideoDecodeName[] = "Hardware-accelerated video decode";
 const char kAcceleratedVideoDecodeDescription[] =
     "Hardware-accelerated video decode where available.";
@@ -2892,7 +2899,7 @@ const char kTabStripKeyboardFocusDescrip
 
 // Chrome OS -------------------------------------------------------------------
 
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID))
 
 const char kAcceleratedMjpegDecodeName[] =
     "Hardware-accelerated mjpeg decode for captured frame";
@@ -3407,7 +3414,7 @@ extern const char kEnableContinueReading
     "seamlessly continue reading a web page when they switch devices from "
     "phones or tablets to Chromebooks.";
 
-#endif  // defined(OS_CHROMEOS)
+#endif  // defined(OS_CHROMEOS) || BUILDFLAG(USE_VAAPI)
 
 // Random platform combinations -----------------------------------------------
 
Index: chromium-69.0.3497.92/chrome/browser/flag_descriptions.h
===================================================================
--- chromium-69.0.3497.92.orig/chrome/browser/flag_descriptions.h	2018-09-11 21:09:24.000000000 +0200
+++ chromium-69.0.3497.92/chrome/browser/flag_descriptions.h	2018-09-12 08:48:49.602320030 +0200
@@ -37,6 +37,10 @@ namespace flag_descriptions {
 extern const char kAccelerated2dCanvasName[];
 extern const char kAccelerated2dCanvasDescription[];
 
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+extern const char kAcceleratedVideoName[];
+extern const char kAcceleratedVideoDescription[];
+#endif
 extern const char kAcceleratedVideoDecodeName[];
 extern const char kAcceleratedVideoDecodeDescription[];
 
@@ -1762,13 +1766,17 @@ extern const char kPermissionPromptPersi
 
 #endif  // defined(OS_MACOSX)
 
-// Chrome OS ------------------------------------------------------------------
-
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID))
 
 extern const char kAcceleratedMjpegDecodeName[];
 extern const char kAcceleratedMjpegDecodeDescription[];
 
+#endif
+
+// Chrome OS ------------------------------------------------------------------
+
+#if defined(OS_CHROMEOS)
+
 extern const char kAllowTouchpadThreeFingerClickName[];
 extern const char kAllowTouchpadThreeFingerClickDescription[];
 
Index: chromium-69.0.3497.92/content/browser/gpu/compositor_util.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/browser/gpu/compositor_util.cc	2018-09-11 21:09:41.000000000 +0200
+++ chromium-69.0.3497.92/content/browser/gpu/compositor_util.cc	2018-09-12 08:48:49.602320030 +0200
@@ -149,7 +149,11 @@ const GpuFeatureData GetGpuFeatureData(
       {"video_decode",
        SafeGetFeatureStatus(gpu_feature_info,
                             gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE),
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+       !command_line.HasSwitch(switches::kEnableAcceleratedVideo),
+#else
        command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode),
+#endif
        "Accelerated video decode has been disabled, either via blacklist, "
        "about:flags or the command line.",
        true, true},
Index: chromium-69.0.3497.92/content/browser/renderer_host/media/video_capture_browsertest.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/browser/renderer_host/media/video_capture_browsertest.cc	2018-09-11 21:09:41.000000000 +0200
+++ chromium-69.0.3497.92/content/browser/renderer_host/media/video_capture_browsertest.cc	2018-09-12 08:48:49.602320030 +0200
@@ -165,8 +165,13 @@ class VideoCaptureBrowserTest : public C
       base::CommandLine::ForCurrentProcess()->AppendSwitch(
           switches::kUseFakeJpegDecodeAccelerator);
     } else {
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+      base::CommandLine::ForCurrentProcess()->AppendSwitch(
+          switches::kEnableAcceleratedMjpegDecode);
+#else
       base::CommandLine::ForCurrentProcess()->AppendSwitch(
           switches::kDisableAcceleratedMjpegDecode);
+#endif
     }
   }
 
Index: chromium-69.0.3497.92/content/browser/renderer_host/render_process_host_impl.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/browser/renderer_host/render_process_host_impl.cc	2018-09-11 21:09:41.000000000 +0200
+++ chromium-69.0.3497.92/content/browser/renderer_host/render_process_host_impl.cc	2018-09-12 08:48:49.606320048 +0200
@@ -2798,7 +2798,11 @@ void RenderProcessHostImpl::PropagateBro
     switches::kDefaultTileHeight,
     switches::kDisable2dCanvasImageChromium,
     switches::kDisableAcceleratedJpegDecoding,
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+    switches::kEnableAcceleratedVideo,
+#else
     switches::kDisableAcceleratedVideoDecode,
+#endif
     switches::kDisableBackgroundTasks,
     switches::kDisableBackgroundTimerThrottling,
     switches::kDisableBreakpad,
Index: chromium-69.0.3497.92/content/browser/webrtc/webrtc_media_recorder_browsertest.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/browser/webrtc/webrtc_media_recorder_browsertest.cc	2018-09-11 21:09:41.000000000 +0200
+++ chromium-69.0.3497.92/content/browser/webrtc/webrtc_media_recorder_browsertest.cc	2018-09-12 08:48:49.606320048 +0200
@@ -66,7 +66,12 @@ class MAYBE_WebRtcMediaRecorderTest
       return;
     // This flag is also used for encoding, https://crbug.com/616640.
     base::CommandLine::ForCurrentProcess()->AppendSwitch(
-        switches::kDisableAcceleratedVideoDecode);
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+        switches::kEnableAcceleratedVideo
+#else
+        switches::kDisableAcceleratedVideoDecode
+#endif
+        );
   }
 
  private:
Index: chromium-69.0.3497.92/content/gpu/BUILD.gn
===================================================================
--- chromium-69.0.3497.92.orig/content/gpu/BUILD.gn	2018-09-11 21:09:41.000000000 +0200
+++ chromium-69.0.3497.92/content/gpu/BUILD.gn	2018-09-12 08:48:49.606320048 +0200
@@ -6,6 +6,7 @@ import("//build/config/jumbo.gni")
 import("//build/config/ui.gni")
 import("//gpu/vulkan/features.gni")
 import("//media/media_options.gni")
+import("//media/gpu/args.gni")
 import("//ui/ozone/ozone.gni")
 
 # See //content/BUILD.gn for how this works.
@@ -49,7 +50,6 @@ target(link_target_type, "gpu_sources")
   ]
 
   configs += [ "//content:content_implementation" ]
-
   deps = [
     "//base",
     "//base/third_party/dynamic_annotations",
@@ -133,4 +133,8 @@ target(link_target_type, "gpu_sources")
       (!is_chromecast || is_cast_desktop_build)) {
     configs += [ "//build/config/linux/dri" ]
   }
+
+  if (is_desktop_linux && use_vaapi) {
+    public_configs = [ "//media/gpu:libva_config" ]
+  }
 }
Index: chromium-69.0.3497.92/content/gpu/gpu_main.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/gpu/gpu_main.cc	2018-09-11 21:09:41.000000000 +0200
+++ chromium-69.0.3497.92/content/gpu/gpu_main.cc	2018-09-12 08:48:49.606320048 +0200
@@ -284,7 +284,7 @@ int GpuMain(const MainFunctionParams& pa
 
   base::PlatformThread::SetName("CrGpuMain");
 
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX)
   // Set thread priority before sandbox initialization.
   base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY);
 #endif
@@ -317,7 +317,7 @@ int GpuMain(const MainFunctionParams& pa
   GetContentClient()->SetGpuInfo(gpu_init->gpu_info());
 
   base::ThreadPriority io_thread_priority = base::ThreadPriority::NORMAL;
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX)
   io_thread_priority = base::ThreadPriority::DISPLAY;
 #endif
 
Index: chromium-69.0.3497.92/content/public/browser/gpu_utils.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/public/browser/gpu_utils.cc	2018-09-11 21:09:42.000000000 +0200
+++ chromium-69.0.3497.92/content/public/browser/gpu_utils.cc	2018-09-12 08:48:49.606320048 +0200
@@ -57,9 +57,17 @@ const gpu::GpuPreferences GetGpuPreferen
   gpu_preferences.in_process_gpu =
       command_line->HasSwitch(switches::kInProcessGPU);
   gpu_preferences.disable_accelerated_video_decode =
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+      !command_line->HasSwitch(switches::kEnableAcceleratedVideo);
+#else
       command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode);
+#endif
   gpu_preferences.disable_accelerated_video_encode =
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+     !command_line->HasSwitch(switches::kEnableAcceleratedVideo);
+#else
       command_line->HasSwitch(switches::kDisableAcceleratedVideoEncode);
+#endif
 #if defined(OS_WIN)
   uint32_t enable_accelerated_vpx_decode_val =
       gpu::GpuPreferences::VPX_VENDOR_MICROSOFT;
Index: chromium-69.0.3497.92/content/public/common/content_switches.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/public/common/content_switches.cc	2018-09-11 21:09:42.000000000 +0200
+++ chromium-69.0.3497.92/content/public/common/content_switches.cc	2018-09-12 08:48:49.606320048 +0200
@@ -79,6 +79,11 @@ const char kDisable3DAPIs[]
 // Disable gpu-accelerated 2d canvas.
 const char kDisableAccelerated2dCanvas[]    = "disable-accelerated-2d-canvas";
 
+#if defined(OS_LINUX)
+// Enables hardware acceleration of video for Linux only. VA-API driver
+// is required to be present on the system installation.
+const char kEnableAcceleratedVideo[] = "enable-accelerated-video";
+#endif
 // Disables hardware acceleration of video decode, where available.
 const char kDisableAcceleratedVideoDecode[] =
     "disable-accelerated-video-decode";
Index: chromium-69.0.3497.92/content/public/common/content_switches.h
===================================================================
--- chromium-69.0.3497.92.orig/content/public/common/content_switches.h	2018-09-11 21:09:42.000000000 +0200
+++ chromium-69.0.3497.92/content/public/common/content_switches.h	2018-09-12 08:48:49.606320048 +0200
@@ -104,6 +104,9 @@ CONTENT_EXPORT extern const char kDisabl
 CONTENT_EXPORT extern const char kDomAutomationController[];
 extern const char kDisable2dCanvasClipAntialiasing[];
 CONTENT_EXPORT extern const char kDumpBlinkRuntimeCallStats[];
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+CONTENT_EXPORT extern const char kEnableAcceleratedVideo[];
+#endif
 CONTENT_EXPORT extern const char kEnableAccessibilityObjectModel[];
 CONTENT_EXPORT extern const char kEnableAggressiveDOMStorageFlushing[];
 CONTENT_EXPORT extern const char kEnableAutomation[];
Index: chromium-69.0.3497.92/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/renderer/media/webrtc/peer_connection_dependency_factory.cc	2018-09-11 21:09:42.000000000 +0200
+++ chromium-69.0.3497.92/content/renderer/media/webrtc/peer_connection_dependency_factory.cc	2018-09-12 08:48:49.606320048 +0200
@@ -276,10 +276,18 @@ void PeerConnectionDependencyFactory::In
 
   const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
   if (gpu_factories && gpu_factories->IsGpuVideoAcceleratorEnabled()) {
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+    if (cmd_line->HasSwitch(switches::kEnableAcceleratedVideo))
+#else
     if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding))
+#endif
       decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories));
 
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+    if (cmd_line->HasSwitch(switches::kEnableAcceleratedVideo))
+#else
     if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding))
+#endif
       encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories));
   }
 
Index: chromium-69.0.3497.92/content/renderer/render_thread_impl.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/renderer/render_thread_impl.cc	2018-09-11 21:09:42.000000000 +0200
+++ chromium-69.0.3497.92/content/renderer/render_thread_impl.cc	2018-09-12 08:48:49.606320048 +0200
@@ -1441,7 +1441,11 @@ media::GpuVideoAcceleratorFactories* Ren
           kGpuStreamPriorityMedia);
 
   const bool enable_video_accelerator =
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+      cmd_line->HasSwitch(switches::kEnableAcceleratedVideo) &&
+#else
       !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode) &&
+#endif
       (gpu_channel_host->gpu_feature_info()
            .status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE] ==
        gpu::kGpuFeatureStatusEnabled);
Index: chromium-69.0.3497.92/gpu/config/software_rendering_list.json
===================================================================
--- chromium-69.0.3497.92.orig/gpu/config/software_rendering_list.json	2018-09-11 21:09:44.000000000 +0200
+++ chromium-69.0.3497.92/gpu/config/software_rendering_list.json	2018-09-12 08:48:49.606320048 +0200
@@ -377,17 +377,6 @@
       ]
     },
     {
-      "id": 48,
-      "description": "Accelerated video decode is unavailable on Linux",
-      "cr_bugs": [137247],
-      "os": {
-        "type": "linux"
-      },
-      "features": [
-        "accelerated_video_decode"
-      ]
-    },
-    {
       "id": 50,
       "description": "Disable VMware software renderer on older Mesa",
       "cr_bugs": [145531, 332596, 571899, 629434],
Index: chromium-69.0.3497.92/media/filters/BUILD.gn
===================================================================
--- chromium-69.0.3497.92.orig/media/filters/BUILD.gn	2018-09-11 21:09:48.000000000 +0200
+++ chromium-69.0.3497.92/media/filters/BUILD.gn	2018-09-12 08:48:49.606320048 +0200
@@ -4,6 +4,7 @@
 
 import("//media/media_options.gni")
 import("//third_party/libaom/options.gni")
+import("//media/gpu/args.gni")
 
 source_set("filters") {
   # Do not expand the visibility here without double-checking with OWNERS, this
@@ -199,7 +200,7 @@ source_set("filters") {
     deps += [ "//media/base/android" ]
   }
 
-  if (current_cpu != "arm" && is_linux) {
+  if (use_vaapi) {
     sources += [
       "h264_bitstream_buffer.cc",
       "h264_bitstream_buffer.h",
Index: chromium-69.0.3497.92/media/gpu/BUILD.gn
===================================================================
--- chromium-69.0.3497.92.orig/media/gpu/BUILD.gn	2018-09-11 21:09:48.000000000 +0200
+++ chromium-69.0.3497.92/media/gpu/BUILD.gn	2018-09-12 08:48:49.606320048 +0200
@@ -495,6 +495,12 @@ if (use_v4l2_codec || use_vaapi || is_ma
   }
 }
 
+import("//build/config/linux/pkg_config.gni")
+
+pkg_config("libva_config") {
+  packages = [ "libva" ]
+}
+
 if (use_vaapi) {
   test("jpeg_encode_accelerator_unittest") {
     deps = [
@@ -559,6 +565,7 @@ if (use_v4l2_codec || use_vaapi) {
     if (use_ozone) {
       deps += [ "//ui/ozone" ]
     }
+    public_configs = [ ":libva_config" ]
   }
 }
 
Index: chromium-69.0.3497.92/media/gpu/gpu_video_decode_accelerator_factory.cc
===================================================================
--- chromium-69.0.3497.92.orig/media/gpu/gpu_video_decode_accelerator_factory.cc	2018-09-11 21:09:48.000000000 +0200
+++ chromium-69.0.3497.92/media/gpu/gpu_video_decode_accelerator_factory.cc	2018-09-12 08:48:49.606320048 +0200
@@ -88,6 +88,7 @@ GpuVideoDecodeAcceleratorFactory::GetDec
 // profile (instead of calculating a superset).
 // TODO(posciak,henryhsu): improve this so that we choose a superset of
 // resolutions and other supported profile parameters.
+  DVLOG(1) << "Get Supported profiles";
 #if defined(OS_WIN)
   capabilities.supported_profiles =
       DXVAVideoDecodeAccelerator::GetSupportedProfiles(gpu_preferences,
Index: chromium-69.0.3497.92/media/gpu/vaapi/vaapi_wrapper.cc
===================================================================
--- chromium-69.0.3497.92.orig/media/gpu/vaapi/vaapi_wrapper.cc	2018-09-12 08:48:49.522319682 +0200
+++ chromium-69.0.3497.92/media/gpu/vaapi/vaapi_wrapper.cc	2018-09-12 08:48:49.606320048 +0200
@@ -332,7 +332,7 @@ bool VADisplayState::InitializeOnce() {
   DVLOG(1) << "VAAPI version: " << major_version << "." << minor_version << " "
            << va_vendor_string_;
 
-  if (major_version != VA_MAJOR_VERSION || minor_version != VA_MINOR_VERSION) {
+  if (major_version != VA_MAJOR_VERSION) {
     LOG(ERROR) << "This build of Chromium requires VA-API version "
                << VA_MAJOR_VERSION << "." << VA_MINOR_VERSION
                << ", system version: " << major_version << "." << minor_version;
@@ -863,7 +863,11 @@ scoped_refptr<VASurface> VaapiWrapper::C
   }
   va_attrib_extbuf.num_planes = num_planes;
 
+#if VA_CHECK_VERSION(1, 0, 0)
+  std::vector<uintptr_t> fds(num_fds);
+#else
   std::vector<unsigned long> fds(num_fds);
+#endif
   for (size_t i = 0; i < num_fds; ++i) {
     int dmabuf_fd = pixmap->GetDmaBufFd(i);
     if (dmabuf_fd < 0) {
Index: chromium-69.0.3497.92/components/viz/service/main/viz_main_impl.cc
===================================================================
--- chromium-69.0.3497.92.orig/components/viz/service/main/viz_main_impl.cc	2018-09-11 21:09:40.000000000 +0200
+++ chromium-69.0.3497.92/components/viz/service/main/viz_main_impl.cc	2018-09-12 08:48:49.606320048 +0200
@@ -63,7 +63,7 @@ std::unique_ptr<viz::CompositorThreadTyp
   thread_options.message_loop_type = base::MessageLoop::TYPE_UI;
 #endif
 
-#if defined(OS_CHROMEOS)
+#if defined(OS_LINUX)
   thread_options.priority = base::ThreadPriority::DISPLAY;
 #endif
   CHECK(thread->StartWithOptions(thread_options));
@@ -76,7 +76,7 @@ std::unique_ptr<base::Thread> CreateAndS
   // It should be possible to use |main_task_runner_| for doing IO tasks.
   base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
   thread_options.priority = base::ThreadPriority::NORMAL;
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#if defined(OS_LINUX)
   // TODO(reveman): Remove this in favor of setting it explicitly for each
   // type of process.
   thread_options.priority = base::ThreadPriority::DISPLAY;
Index: chromium-69.0.3497.92/content/browser/renderer_host/render_view_host_impl.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/browser/renderer_host/render_view_host_impl.cc	2018-09-11 21:09:41.000000000 +0200
+++ chromium-69.0.3497.92/content/browser/renderer_host/render_view_host_impl.cc	2018-09-12 08:48:49.606320048 +0200
@@ -463,7 +463,11 @@ WebPreferences RenderViewHostImpl::Compu
   prefs.save_previous_document_resources = GetSavePreviousDocumentResources();
 
   prefs.accelerated_video_decode_enabled =
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+      command_line.HasSwitch(switches::kEnableAcceleratedVideo);
+#else
       !command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode);
+#endif
 
   std::string autoplay_policy = media::GetEffectiveAutoplayPolicy(command_line);
   if (autoplay_policy == switches::autoplay::kNoUserGestureRequiredPolicy) {
Index: chromium-69.0.3497.92/media/base/media_switches.cc
===================================================================
--- chromium-69.0.3497.92.orig/media/base/media_switches.cc	2018-09-11 21:09:48.000000000 +0200
+++ chromium-69.0.3497.92/media/base/media_switches.cc	2018-09-12 08:48:49.606320048 +0200
@@ -117,10 +117,16 @@ const char kUseFileForFakeAudioCapture[]
 // accelerator hardware to be present.
 const char kUseFakeJpegDecodeAccelerator[] = "use-fake-jpeg-decode-accelerator";
 
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+// Enable hardware acceleration of mjpeg decode on Linux
+const char kEnableAcceleratedMjpegDecode[] =
+    "enable-accelerated-mjpeg-decode";
+#else
 // Disable hardware acceleration of mjpeg decode for captured frame, where
 // available.
 const char kDisableAcceleratedMjpegDecode[] =
     "disable-accelerated-mjpeg-decode";
+#endif
 
 // When running tests on a system without the required hardware or libraries,
 // this flag will cause the tests to fail. Otherwise, they silently succeed.
@@ -462,15 +468,22 @@ const base::Feature kPreloadMediaEngagem
 #endif
 
 bool IsVideoCaptureAcceleratedJpegDecodingEnabled() {
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+  if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+          switches::kEnableAcceleratedMjpegDecode)) {
+    return false;
+  }
+#else
   if (base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kDisableAcceleratedMjpegDecode)) {
     return false;
   }
+#endif
   if (base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kUseFakeJpegDecodeAccelerator)) {
     return true;
   }
-#if defined(OS_CHROMEOS)
+#if defined(OS_LINUX)
   return true;
 #endif
   return false;
Index: chromium-69.0.3497.92/media/base/media_switches.h
===================================================================
--- chromium-69.0.3497.92.orig/media/base/media_switches.h	2018-09-11 21:09:48.000000000 +0200
+++ chromium-69.0.3497.92/media/base/media_switches.h	2018-09-12 08:48:49.606320048 +0200
@@ -66,7 +66,11 @@ MEDIA_EXPORT extern const char kUseFakeD
 MEDIA_EXPORT extern const char kUseFileForFakeVideoCapture[];
 MEDIA_EXPORT extern const char kUseFileForFakeAudioCapture[];
 MEDIA_EXPORT extern const char kUseFakeJpegDecodeAccelerator[];
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+MEDIA_EXPORT extern const char kEnableAcceleratedMjpegDecode[];
+#else
 MEDIA_EXPORT extern const char kDisableAcceleratedMjpegDecode[];
+#endif
 
 MEDIA_EXPORT extern const char kRequireAudioHardwareForTesting[];
 MEDIA_EXPORT extern const char kMuteAudio[];
Index: chromium-69.0.3497.92/content/browser/utility_process_host.cc
===================================================================
--- chromium-69.0.3497.92.orig/content/browser/utility_process_host.cc	2018-09-11 21:09:41.000000000 +0200
+++ chromium-69.0.3497.92/content/browser/utility_process_host.cc	2018-09-12 08:48:49.606320048 +0200
@@ -296,7 +296,11 @@ bool UtilityProcessHost::StartProcess()
       switches::kOverrideUseSoftwareGLForTests,
       switches::kOverrideEnabledCdmInterfaceVersion,
       switches::kProxyServer,
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+      switches::kEnableAcceleratedMjpegDecode,
+#else
       switches::kDisableAcceleratedMjpegDecode,
+#endif
       switches::kUseFakeDeviceForMediaStream,
       switches::kUseFakeJpegDecodeAccelerator,
       switches::kUseFileForFakeVideoCapture,
Index: chromium-69.0.3497.92/media/gpu/vaapi/vaapi_jpeg_decode_accelerator.cc
===================================================================
--- chromium-69.0.3497.92.orig/media/gpu/vaapi/vaapi_jpeg_decode_accelerator.cc	2018-09-11 21:09:48.000000000 +0200
+++ chromium-69.0.3497.92/media/gpu/vaapi/vaapi_jpeg_decode_accelerator.cc	2018-09-12 08:48:49.606320048 +0200
@@ -174,7 +174,7 @@ bool VaapiJpegDecodeAccelerator::OutputP
 
   VAImage image = {};
   VAImageFormat format = {};
-  format.fourcc = VA_FOURCC_I420;
+  format.fourcc = libyuv::FOURCC_I420;
   format.byte_order = VA_LSB_FIRST;
   format.bits_per_pixel = 12;  // 12 for I420
 
openSUSE Build Service is sponsored by