parent
4f31ec8a71
commit
d155912d91
@ -0,0 +1,87 @@
|
|||||||
|
From f2076c6a4c9c14538d71a3ef9c9e4fd40ee6ee00 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stephan Hartmann <stha09@googlemail.com>
|
||||||
|
Date: Sun, 31 May 2020 11:46:05 +0000
|
||||||
|
Subject: [PATCH] GCC: fix __has_builtin defines for non-clang compilers
|
||||||
|
|
||||||
|
Defining __has_builtin to 0 for non-clang compilers in base headers can
|
||||||
|
lead to wrong detection of features. For example in base/location.h
|
||||||
|
checking for __has_builtin macros succeeds for non-clang compilers,
|
||||||
|
because base/check_op.h defines __has_builtin to 0 and is included
|
||||||
|
before base/location.h. Instead of defining __has_builtin to 0 for
|
||||||
|
non-clang compilers, define an independent preprocessor symbol that
|
||||||
|
reflects support for requested feature. Undefine the symbol to avoid
|
||||||
|
collision.
|
||||||
|
|
||||||
|
While we're at it fix base/memory/aligned_memory.h too.
|
||||||
|
|
||||||
|
Bug: 819294
|
||||||
|
Change-Id: Iac40dc44e7356b600e7d06aa4ccd1294bb09ebce
|
||||||
|
---
|
||||||
|
|
||||||
|
diff --git a/base/check_op.h b/base/check_op.h
|
||||||
|
index 04b0c6f..28f4263a 100644
|
||||||
|
--- a/base/check_op.h
|
||||||
|
+++ b/base/check_op.h
|
||||||
|
@@ -48,8 +48,10 @@
|
||||||
|
void (*stream_func)(std::ostream&,
|
||||||
|
const void*));
|
||||||
|
|
||||||
|
-#ifndef __has_builtin
|
||||||
|
-#define __has_builtin(x) 0 // Compatibility with non-clang compilers.
|
||||||
|
+#ifdef __has_builtin
|
||||||
|
+#define SUPPORTS_BUILTIN_ADDRESSOF (__has_builtin(__builtin_addressof))
|
||||||
|
+#else
|
||||||
|
+#define SUPPORTS_BUILTIN_ADDRESSOF 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
@@ -65,7 +67,7 @@
|
||||||
|
// operator& might be overloaded, so do the std::addressof dance.
|
||||||
|
// __builtin_addressof is preferred since it also handles Obj-C ARC pointers.
|
||||||
|
// Some casting is still needed, because T might be volatile.
|
||||||
|
-#if __has_builtin(__builtin_addressof)
|
||||||
|
+#if SUPPORTS_BUILTIN_ADDRESSOF
|
||||||
|
const void* vp = const_cast<const void*>(
|
||||||
|
reinterpret_cast<const volatile void*>(__builtin_addressof(v)));
|
||||||
|
#else
|
||||||
|
@@ -75,6 +77,8 @@
|
||||||
|
return StreamValToStr(vp, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
+#undef SUPPORTS_BUILTIN_ADDRESSOF
|
||||||
|
+
|
||||||
|
// Overload for types that have no operator<< but do have .ToString() defined.
|
||||||
|
template <typename T>
|
||||||
|
inline typename std::enable_if<
|
||||||
|
diff --git a/base/memory/aligned_memory.h b/base/memory/aligned_memory.h
|
||||||
|
index d1cba0c..a0d9f13 100644
|
||||||
|
--- a/base/memory/aligned_memory.h
|
||||||
|
+++ b/base/memory/aligned_memory.h
|
||||||
|
@@ -57,13 +57,15 @@
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
-#ifndef __has_builtin
|
||||||
|
-#define __has_builtin(x) 0 // Compatibility with non-clang compilers.
|
||||||
|
+#ifdef __has_builtin
|
||||||
|
+#define SUPPORTS_BUILTIN_IS_ALIGNED (__has_builtin(__builtin_is_aligned))
|
||||||
|
+#else
|
||||||
|
+#define SUPPORTS_BUILTIN_IS_ALIGNED 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
inline bool IsAligned(uintptr_t val, size_t alignment) {
|
||||||
|
// If the compiler supports builtin alignment checks prefer them.
|
||||||
|
-#if __has_builtin(__builtin_is_aligned)
|
||||||
|
+#if SUPPORTS_BUILTIN_IS_ALIGNED
|
||||||
|
return __builtin_is_aligned(val, alignment);
|
||||||
|
#else
|
||||||
|
DCHECK(!((alignment - 1) & alignment))
|
||||||
|
@@ -72,6 +74,8 @@
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
+#undef SUPPORTS_BUILTIN_IS_ALIGNED
|
||||||
|
+
|
||||||
|
inline bool IsAligned(void* val, size_t alignment) {
|
||||||
|
return IsAligned(reinterpret_cast<uintptr_t>(val), alignment);
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
diff -up chromium-84.0.4147.89/media/gpu/vaapi/vaapi_video_decode_accelerator.cc.vaapi-intel-fix chromium-84.0.4147.89/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
|
||||||
|
--- chromium-84.0.4147.89/media/gpu/vaapi/vaapi_video_decode_accelerator.cc.vaapi-intel-fix 2020-07-13 14:40:37.000000000 -0400
|
||||||
|
+++ chromium-84.0.4147.89/media/gpu/vaapi/vaapi_video_decode_accelerator.cc 2020-07-15 10:27:47.636831815 -0400
|
||||||
|
@@ -66,6 +66,7 @@ void ReportToUMA(VAVDADecoderFailure fai
|
||||||
|
VAVDA_DECODER_FAILURES_MAX + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
|
||||||
|
// Returns true if the CPU is an Intel Gemini Lake or later (including Kaby
|
||||||
|
// Lake) Cpu platform id's are referenced from the following file in kernel
|
||||||
|
// source arch/x86/include/asm/intel-family.h
|
||||||
|
@@ -78,6 +79,7 @@ bool IsGeminiLakeOrLater() {
|
||||||
|
cpuid.model() >= kGeminiLakeModelId;
|
||||||
|
return is_geminilake_or_later;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
@@ -1169,6 +1171,8 @@ VaapiVideoDecodeAccelerator::DecideBuffe
|
||||||
|
if (output_mode_ == VideoDecodeAccelerator::Config::OutputMode::IMPORT)
|
||||||
|
return BufferAllocationMode::kNormal;
|
||||||
|
|
||||||
|
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
|
||||||
|
+ // Move this to chromeOs only as it is causing problem in some intel linux drivers
|
||||||
|
// On Gemini Lake, Kaby Lake and later we can pass to libva the client's
|
||||||
|
// PictureBuffers to decode onto, which skips the use of the Vpp unit and its
|
||||||
|
// associated format reconciliation copy, avoiding all internal buffer
|
||||||
|
@@ -1184,6 +1188,7 @@ VaapiVideoDecodeAccelerator::DecideBuffe
|
||||||
|
num_extra_pics_ = 3;
|
||||||
|
return BufferAllocationMode::kNone;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
// For H.264 on older devices, another +1 is experimentally needed for
|
||||||
|
// high-to-high resolution changes.
|
Loading…
Reference in new issue