File old-libva.patch of Package chromium.openSUSE_Backports_SLE-15-SP1_Update

Index: chromium-76.0.3809.12/media/gpu/vaapi/vaapi_wrapper.cc
===================================================================
--- chromium-76.0.3809.12.orig/media/gpu/vaapi/vaapi_wrapper.cc
+++ chromium-76.0.3809.12/media/gpu/vaapi/vaapi_wrapper.cc
@@ -63,6 +63,10 @@
 #include "ui/ozone/public/surface_factory_ozone.h"
 #endif
 
+#ifndef VA_FOURCC_I420
+#define VA_FOURCC_I420 0x30323449
+#endif
+
 using media_gpu_vaapi::kModuleVa;
 using media_gpu_vaapi::kModuleVa_drm;
 #if defined(USE_X11)
@@ -351,10 +355,6 @@ bool VADisplayState::Initialize() {
 }
 
 bool VADisplayState::InitializeOnce() {
-  static_assert(
-      VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 1),
-      "Requires VA-API >= 1.1.0");
-
   switch (gl::GetGLImplementation()) {
     case gl::kGLImplementationEGLGLES2:
       va_display_ = vaGetDisplayDRM(drm_fd_.get());
Index: chromium-76.0.3809.12/media/gpu/vaapi/vaapi_jpeg_decoder.cc
===================================================================
--- chromium-76.0.3809.12.orig/media/gpu/vaapi/vaapi_jpeg_decoder.cc
+++ chromium-76.0.3809.12/media/gpu/vaapi/vaapi_jpeg_decoder.cc
@@ -20,6 +20,10 @@
 #include "media/parsers/jpeg_parser.h"
 #include "ui/gfx/geometry/size.h"
 
+#ifndef VA_FOURCC_I420
+#define VA_FOURCC_I420 0x30323449
+#endif
+
 namespace media {
 
 namespace {
Index: chromium-76.0.3809.12/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc
===================================================================
--- chromium-76.0.3809.12.orig/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc
+++ chromium-76.0.3809.12/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc
@@ -44,6 +44,10 @@
 #include "ui/gfx/linux/native_pixmap_dmabuf.h"
 #include "ui/gfx/native_pixmap.h"
 
+#ifndef VA_FOURCC_I420
+#define VA_FOURCC_I420 0x30323449
+#endif
+
 namespace media {
 
 namespace {
diff --git a/media/gpu/vaapi/vaapi_wrapper.cc b/media/gpu/vaapi/vaapi_wrapper.cc
index 82f2b3c154f6..5edaa92e7380 100644
--- a/media/gpu/vaapi/vaapi_wrapper.cc
+++ b/media/gpu/vaapi/vaapi_wrapper.cc
@@ -1456,7 +1456,7 @@ VaapiWrapper::ExportVASurfaceAsNativePixmapDmaBuf(
     LOG(ERROR) << "Cannot export an invalid surface";
     return nullptr;
   }
-
+#if VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 2)
   VADRMPRIMESurfaceDescriptor descriptor;
   {
     base::AutoLock auto_lock(*va_lock_);
@@ -1549,6 +1549,10 @@ VaapiWrapper::ExportVASurfaceAsNativePixmapDmaBuf(
   exported_pixmap->pixmap = base::MakeRefCounted<gfx::NativePixmapDmaBuf>(
       scoped_va_surface.size(), buffer_format, std::move(handle));
   return exported_pixmap;
+#else
+  LOG(ERROR) << "Exporting a surface with FOURCC has been disabled on old libva";
+  return nullptr;
+#endif
 }
 
 bool VaapiWrapper::SyncSurface(VASurfaceID va_surface_id) {
openSUSE Build Service is sponsored by