From 2be36f77d18d0aa7889a39365cc3dcf05d47131a Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Tue, 11 Apr 2023 10:01:01 +0200 Subject: [PATCH 1/9] workaround for bug in clang 14 with c++20 on rhel8, linker errors std::u16string --- ...um-112-workaround-llvm14-c++20-epel8.patch | 312 ++++++++++++++++++ chromium.spec | 13 +- 2 files changed, 319 insertions(+), 6 deletions(-) create mode 100644 chromium-112-workaround-llvm14-c++20-epel8.patch diff --git a/chromium-112-workaround-llvm14-c++20-epel8.patch b/chromium-112-workaround-llvm14-c++20-epel8.patch new file mode 100644 index 0000000..d357538 --- /dev/null +++ b/chromium-112-workaround-llvm14-c++20-epel8.patch @@ -0,0 +1,312 @@ +diff -up chromium-112.0.5615.49/base/clang_work_around.h.me chromium-112.0.5615.49/base/clang_work_around.h +--- chromium-112.0.5615.49/base/clang_work_around.h.me 2023-04-10 12:10:42.229455956 +0200 ++++ chromium-112.0.5615.49/base/clang_work_around.h 2023-04-10 12:16:41.191744766 +0200 +@@ -0,0 +1,10 @@ ++// ++// workaound for clang-14 in c++20 mode ++// ++ ++#ifndef WORKAROUND_CLANG14_IN_C_PLUS_PLUS_20_H ++#define WORKAROUND_CLANG14_IN_C_PLUS_PLUS_20_H ++ ++static std::u16string clang_string_workaround(const char16_t* a, const char16_t* b) { return {a, b}; } ++ ++#endif // WORKAROUND_CLANG14_IN_C_PLUS_PLUS_20_H +diff -up chromium-112.0.5615.49/base/i18n/number_formatting.cc.me chromium-112.0.5615.49/base/i18n/number_formatting.cc +--- chromium-112.0.5615.49/base/i18n/number_formatting.cc.me 2023-04-10 11:26:58.126271434 +0200 ++++ chromium-112.0.5615.49/base/i18n/number_formatting.cc 2023-04-10 12:13:17.573209444 +0200 +@@ -18,6 +18,7 @@ + #include "base/strings/utf_string_conversions.h" + #include "third_party/icu/source/common/unicode/ustring.h" + #include "third_party/icu/source/i18n/unicode/numfmt.h" ++#include "base/clang_work_around.h" + + namespace base { + +diff -up chromium-112.0.5615.49/base/i18n/time_formatting.cc.me chromium-112.0.5615.49/base/i18n/time_formatting.cc +--- chromium-112.0.5615.49/base/i18n/time_formatting.cc.me 2023-04-10 10:21:25.360079525 +0200 ++++ chromium-112.0.5615.49/base/i18n/time_formatting.cc 2023-04-10 12:13:36.373485371 +0200 +@@ -22,6 +22,7 @@ + #include "third_party/icu/source/i18n/unicode/fmtable.h" + #include "third_party/icu/source/i18n/unicode/measfmt.h" + #include "third_party/icu/source/i18n/unicode/smpdtfmt.h" ++#include "base/clang_work_around.h" + + namespace base { + namespace { +diff -up chromium-112.0.5615.49/base/strings/string_piece.cc.me chromium-112.0.5615.49/base/strings/string_piece.cc +--- chromium-112.0.5615.49/base/strings/string_piece.cc.me 2023-04-10 10:20:40.230277808 +0200 ++++ chromium-112.0.5615.49/base/strings/string_piece.cc 2023-04-10 12:14:00.262863956 +0200 +@@ -12,6 +12,7 @@ + + #include "base/strings/utf_string_conversions.h" + #include "build/build_config.h" ++#include "base/clang_work_around.h" + + namespace base { + namespace { +diff -up chromium-112.0.5615.49/components/url_formatter/spoof_checks/skeleton_generator.cc.me chromium-112.0.5615.49/components/url_formatter/spoof_checks/skeleton_generator.cc +--- chromium-112.0.5615.49/components/url_formatter/spoof_checks/skeleton_generator.cc.me 2023-04-10 11:27:36.207948830 +0200 ++++ chromium-112.0.5615.49/components/url_formatter/spoof_checks/skeleton_generator.cc 2023-04-10 12:17:36.338730147 +0200 +@@ -15,6 +15,7 @@ + #include "third_party/icu/source/i18n/unicode/regex.h" + #include "third_party/icu/source/i18n/unicode/translit.h" + #include "third_party/icu/source/i18n/unicode/uspoof.h" ++#include "base/clang_work_around.h" + + namespace { + +diff -up chromium-112.0.5615.49/content/child/browser_font_resource_trusted.cc.me chromium-112.0.5615.49/content/child/browser_font_resource_trusted.cc +--- chromium-112.0.5615.49/content/child/browser_font_resource_trusted.cc.me 2023-04-10 11:28:09.962549271 +0200 ++++ chromium-112.0.5615.49/content/child/browser_font_resource_trusted.cc 2023-04-10 12:12:14.242145968 +0200 +@@ -26,6 +26,7 @@ + #include "third_party/skia/include/core/SkRect.h" + #include "ui/gfx/geometry/rect_f.h" + #include "ui/gfx/ubidi_deleter.h" ++#include "base/clang_work_around.h" + + using ppapi::StringVar; + using ppapi::thunk::EnterResourceNoLock; +diff -up chromium-112.0.5615.49/content/common/zygote/zygote_communication_linux.cc.me chromium-112.0.5615.49/content/common/zygote/zygote_communication_linux.cc +--- chromium-112.0.5615.49/content/common/zygote/zygote_communication_linux.cc.me 2023-04-10 10:19:32.223069670 +0200 ++++ chromium-112.0.5615.49/content/common/zygote/zygote_communication_linux.cc 2023-04-10 12:12:31.315438868 +0200 +@@ -22,6 +22,7 @@ + #include "content/public/common/result_codes.h" + #include "sandbox/policy/switches.h" + #include "third_party/icu/source/i18n/unicode/timezone.h" ++#include "base/clang_work_around.h" + + namespace content { + +diff -up chromium-112.0.5615.49/mojo/public/cpp/base/string16_mojom_traits.cc.me chromium-112.0.5615.49/mojo/public/cpp/base/string16_mojom_traits.cc +--- chromium-112.0.5615.49/mojo/public/cpp/base/string16_mojom_traits.cc.me 2023-04-10 11:26:20.277598168 +0200 ++++ chromium-112.0.5615.49/mojo/public/cpp/base/string16_mojom_traits.cc 2023-04-10 12:12:56.706874472 +0200 +@@ -6,6 +6,8 @@ + + #include "mojo/public/cpp/base/big_buffer_mojom_traits.h" + ++#include "base/clang_work_around.h" ++ + namespace mojo { + + // static +diff -up chromium-112.0.5615.49/third_party/blink/common/page_state/page_state_serialization.cc.me chromium-112.0.5615.49/third_party/blink/common/page_state/page_state_serialization.cc +--- chromium-112.0.5615.49/third_party/blink/common/page_state/page_state_serialization.cc.me 2023-04-10 11:22:27.525457904 +0200 ++++ chromium-112.0.5615.49/third_party/blink/common/page_state/page_state_serialization.cc 2023-04-10 12:14:21.584248718 +0200 +@@ -24,6 +24,7 @@ + #include "ui/display/screen.h" + #include "ui/gfx/geometry/mojom/geometry_mojom_traits.h" + #include "url/mojom/url_gurl_mojom_traits.h" ++#include "base/clang_work_around.h" + + namespace blink { + +diff -up chromium-112.0.5615.49/base/strings/escape.cc.me chromium-112.0.5615.49/base/strings/escape.cc +--- chromium-112.0.5615.49/base/strings/escape.cc.me 2023-04-10 16:10:08.298906995 +0200 ++++ chromium-112.0.5615.49/base/strings/escape.cc 2023-04-10 16:10:17.751072552 +0200 +@@ -14,6 +14,7 @@ + #include "base/strings/utf_string_conversion_utils.h" + #include "base/strings/utf_string_conversions.h" + #include "base/third_party/icu/icu_utf.h" ++#include "base/clang_work_around.h" + + namespace base { + +diff -up chromium-112.0.5615.49/base/strings/string_split.cc.me chromium-112.0.5615.49/base/strings/string_split.cc +--- chromium-112.0.5615.49/base/strings/string_split.cc.me 2023-04-10 16:17:49.702245206 +0200 ++++ chromium-112.0.5615.49/base/strings/string_split.cc 2023-04-10 16:17:56.420471079 +0200 +@@ -10,6 +10,7 @@ + #include "base/strings/string_split_internal.h" + #include "base/strings/string_util.h" + #include "base/third_party/icu/icu_utf.h" ++#include "base/clang_work_around.h" + + namespace base { + +diff -up chromium-112.0.5615.49/chrome/browser/sharing/click_to_call/click_to_call_utils.cc.me chromium-112.0.5615.49/chrome/browser/sharing/click_to_call/click_to_call_utils.cc +--- chromium-112.0.5615.49/chrome/browser/sharing/click_to_call/click_to_call_utils.cc.me 2023-04-10 16:09:21.861093623 +0200 ++++ chromium-112.0.5615.49/chrome/browser/sharing/click_to_call/click_to_call_utils.cc 2023-04-10 16:09:31.428261186 +0200 +@@ -21,6 +21,7 @@ + #include "third_party/re2/src/re2/re2.h" + #include "url/url_constants.h" + #include "url/url_util.h" ++#include "base/clang_work_around.h" + + namespace { + +diff -up chromium-112.0.5615.49/ui/ozone/platform/wayland/host/wayland_exchange_data_provider.cc.me chromium-112.0.5615.49/ui/ozone/platform/wayland/host/wayland_exchange_data_provider.cc +--- chromium-112.0.5615.49/ui/ozone/platform/wayland/host/wayland_exchange_data_provider.cc.me 2023-04-10 16:05:55.155357863 +0200 ++++ chromium-112.0.5615.49/ui/ozone/platform/wayland/host/wayland_exchange_data_provider.cc 2023-04-10 16:06:09.726629617 +0200 +@@ -27,6 +27,7 @@ + #include "url/gurl.h" + #include "url/url_canon.h" + #include "url/url_util.h" ++#include "base/clang_work_around.h" + + #if BUILDFLAG(IS_CHROMEOS_LACROS) + #include "ui/base/data_transfer_policy/data_transfer_endpoint_serializer.h" +diff -up chromium-112.0.5615.49/base/i18n/break_iterator.cc.me chromium-112.0.5615.49/base/i18n/break_iterator.cc +--- chromium-112.0.5615.49/base/i18n/break_iterator.cc.me 2023-04-11 09:19:54.124933361 +0200 ++++ chromium-112.0.5615.49/base/i18n/break_iterator.cc 2023-04-11 09:20:14.790301819 +0200 +@@ -15,6 +15,7 @@ + #include "third_party/icu/source/common/unicode/ubrk.h" + #include "third_party/icu/source/common/unicode/uchar.h" + #include "third_party/icu/source/common/unicode/ustring.h" ++#include "base/clang_work_around.h" + + namespace base { + namespace i18n { +diff -up chromium-112.0.5615.49/base/i18n/message_formatter.cc.me chromium-112.0.5615.49/base/i18n/message_formatter.cc +--- chromium-112.0.5615.49/base/i18n/message_formatter.cc.me 2023-04-11 09:20:34.687657454 +0200 ++++ chromium-112.0.5615.49/base/i18n/message_formatter.cc 2023-04-11 09:21:28.617663963 +0200 +@@ -13,6 +13,7 @@ + #include "third_party/icu/source/common/unicode/utypes.h" + #include "third_party/icu/source/i18n/unicode/fmtable.h" + #include "third_party/icu/source/i18n/unicode/msgfmt.h" ++#include "base/clang_work_around.h" + + using icu::UnicodeString; + +diff -up chromium-112.0.5615.49/base/time/time.cc.me chromium-112.0.5615.49/base/time/time.cc +--- chromium-112.0.5615.49/base/time/time.cc.me 2023-04-11 09:23:22.732757775 +0200 ++++ chromium-112.0.5615.49/base/time/time.cc 2023-04-11 09:23:33.655958193 +0200 +@@ -17,6 +17,7 @@ + #include "base/time/time_override.h" + #include "build/build_config.h" + #include "third_party/abseil-cpp/absl/types/optional.h" ++#include "base/clang_work_around.h" + + namespace base { + +diff -up chromium-112.0.5615.49/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc.me chromium-112.0.5615.49/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc +--- chromium-112.0.5615.49/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc.me 2023-04-11 09:36:50.646409434 +0200 ++++ chromium-112.0.5615.49/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc 2023-04-11 09:37:07.977731153 +0200 +@@ -36,6 +36,7 @@ + #include "net/base/filename_util.h" + #include "third_party/icu/source/i18n/unicode/datefmt.h" + #include "ui/base/l10n/time_format.h" ++#include "base/clang_work_around.h" + + using content::BrowserContext; + using content::DownloadManager; +diff -up chromium-112.0.5615.49/chrome/browser/ui/webui/new_tab_page/untrusted_source.cc.me chromium-112.0.5615.49/chrome/browser/ui/webui/new_tab_page/untrusted_source.cc +--- chromium-112.0.5615.49/chrome/browser/ui/webui/new_tab_page/untrusted_source.cc.me 2023-04-11 09:37:21.262977759 +0200 ++++ chromium-112.0.5615.49/chrome/browser/ui/webui/new_tab_page/untrusted_source.cc 2023-04-11 09:37:27.594095277 +0200 +@@ -33,6 +33,7 @@ + #include "ui/base/resource/resource_bundle.h" + #include "ui/base/template_expressions.h" + #include "url/url_util.h" ++#include "base/clang_work_around.h" + + namespace { + +diff -up chromium-112.0.5615.49/components/autofill/content/renderer/html_based_username_detector.cc.me chromium-112.0.5615.49/components/autofill/content/renderer/html_based_username_detector.cc +--- chromium-112.0.5615.49/components/autofill/content/renderer/html_based_username_detector.cc.me 2023-04-11 09:38:01.297776504 +0200 ++++ chromium-112.0.5615.49/components/autofill/content/renderer/html_based_username_detector.cc 2023-04-11 09:38:07.899908357 +0200 +@@ -18,6 +18,7 @@ + #include "components/autofill/content/renderer/html_based_username_detector_vocabulary.h" + #include "components/autofill/core/common/form_data.h" + #include "third_party/blink/public/web/web_form_element.h" ++#include "base/clang_work_around.h" + + using blink::WebFormControlElement; + using blink::WebFormElement; +diff -up chromium-112.0.5615.49/components/autofill/core/browser/autofill_data_util.cc.me chromium-112.0.5615.49/components/autofill/core/browser/autofill_data_util.cc +--- chromium-112.0.5615.49/components/autofill/core/browser/autofill_data_util.cc.me 2023-04-11 09:33:59.637234801 +0200 ++++ chromium-112.0.5615.49/components/autofill/core/browser/autofill_data_util.cc 2023-04-11 09:34:08.353412198 +0200 +@@ -25,6 +25,7 @@ + #include "components/strings/grit/components_strings.h" + #include "third_party/icu/source/common/unicode/uscript.h" + #include "third_party/re2/src/re2/re2.h" ++#include "base/clang_work_around.h" + + namespace autofill { + namespace data_util { +diff -up chromium-112.0.5615.49/components/autofill/core/browser/data_model/borrowed_transliterator.cc.me chromium-112.0.5615.49/components/autofill/core/browser/data_model/borrowed_transliterator.cc +--- chromium-112.0.5615.49/components/autofill/core/browser/data_model/borrowed_transliterator.cc.me 2023-04-11 09:33:33.683706577 +0200 ++++ chromium-112.0.5615.49/components/autofill/core/browser/data_model/borrowed_transliterator.cc 2023-04-11 09:33:40.115837491 +0200 +@@ -6,6 +6,7 @@ + + #include "base/logging.h" + #include "base/no_destructor.h" ++#include "base/clang_work_around.h" + + namespace autofill { + +diff -up chromium-112.0.5615.49/components/autofill/core/browser/form_processing/label_processing_util.cc.me chromium-112.0.5615.49/components/autofill/core/browser/form_processing/label_processing_util.cc +--- chromium-112.0.5615.49/components/autofill/core/browser/form_processing/label_processing_util.cc.me 2023-04-11 09:35:15.569558729 +0200 ++++ chromium-112.0.5615.49/components/autofill/core/browser/form_processing/label_processing_util.cc 2023-04-11 09:35:22.156704236 +0200 +@@ -7,6 +7,7 @@ + #include "base/ranges/algorithm.h" + #include "base/strings/string_split.h" + #include "base/strings/utf_string_conversions.h" ++#include "base/clang_work_around.h" + + namespace autofill { + +diff -up chromium-112.0.5615.49/components/autofill/core/common/autofill_regexes.cc.me chromium-112.0.5615.49/components/autofill/core/common/autofill_regexes.cc +--- chromium-112.0.5615.49/components/autofill/core/common/autofill_regexes.cc.me 2023-04-11 09:24:03.442503498 +0200 ++++ chromium-112.0.5615.49/components/autofill/core/common/autofill_regexes.cc 2023-04-11 09:24:10.633634865 +0200 +@@ -12,6 +12,7 @@ + #include "base/check.h" + #include "base/i18n/unicodestring.h" + #include "base/memory/ptr_util.h" ++#include "base/clang_work_around.h" + + namespace { + +diff -up chromium-112.0.5615.49/components/bookmarks/browser/titled_url_index.cc.me chromium-112.0.5615.49/components/bookmarks/browser/titled_url_index.cc +--- chromium-112.0.5615.49/components/bookmarks/browser/titled_url_index.cc.me 2023-04-11 09:35:47.419224388 +0200 ++++ chromium-112.0.5615.49/components/bookmarks/browser/titled_url_index.cc 2023-04-11 09:35:53.917341490 +0200 +@@ -29,6 +29,7 @@ + #include "components/query_parser/snippet.h" + #include "third_party/icu/source/common/unicode/normalizer2.h" + #include "third_party/icu/source/common/unicode/utypes.h" ++#include "base/clang_work_around.h" + + namespace bookmarks { + +diff -up chromium-112.0.5615.49/components/omnibox/browser/tailored_word_break_iterator.cc.me chromium-112.0.5615.49/components/omnibox/browser/tailored_word_break_iterator.cc +--- chromium-112.0.5615.49/components/omnibox/browser/tailored_word_break_iterator.cc.me 2023-04-11 09:36:26.323925501 +0200 ++++ chromium-112.0.5615.49/components/omnibox/browser/tailored_word_break_iterator.cc 2023-04-11 09:36:32.480043078 +0200 +@@ -5,6 +5,7 @@ + #include "components/omnibox/browser/tailored_word_break_iterator.h" + + #include "base/strings/string_piece.h" ++#include "base/clang_work_around.h" + + namespace { + constexpr char16_t kUnderscore = '_'; +diff -up chromium-112.0.5615.49/components/sync/base/time.cc.me chromium-112.0.5615.49/components/sync/base/time.cc +--- chromium-112.0.5615.49/components/sync/base/time.cc.me 2023-04-11 09:32:48.709645320 +0200 ++++ chromium-112.0.5615.49/components/sync/base/time.cc 2023-04-11 09:32:56.044820918 +0200 +@@ -11,6 +11,7 @@ + #include "base/strings/utf_string_conversions.h" + #include "third_party/icu/source/common/unicode/utypes.h" + #include "third_party/icu/source/i18n/unicode/smpdtfmt.h" ++#include "base/clang_work_around.h" + + namespace syncer { + +diff -up chromium-112.0.5615.49/ui/base/x/selection_utils.cc.me chromium-112.0.5615.49/ui/base/x/selection_utils.cc +--- chromium-112.0.5615.49/ui/base/x/selection_utils.cc.me 2023-04-11 09:22:42.734023876 +0200 ++++ chromium-112.0.5615.49/ui/base/x/selection_utils.cc 2023-04-11 09:22:51.565185914 +0200 +@@ -18,6 +18,7 @@ + #include "base/strings/utf_string_conversions.h" + #include "ui/base/clipboard/clipboard_constants.h" + #include "ui/gfx/x/x11_atom_cache.h" ++#include "base/clang_work_around.h" + + namespace ui { + +diff -up chromium-112.0.5615.49/chrome/test/chromedriver/server/http_handler.cc.me chromium-112.0.5615.49/chrome/test/chromedriver/server/http_handler.cc +--- chromium-112.0.5615.49/chrome/test/chromedriver/server/http_handler.cc.me 2023-04-11 09:43:01.795293420 +0200 ++++ chromium-112.0.5615.49/chrome/test/chromedriver/server/http_handler.cc 2023-04-11 09:43:13.763545992 +0200 +@@ -46,6 +46,7 @@ + #include "services/network/public/mojom/url_loader_factory.mojom.h" + #include "services/network/transitional_url_loader_factory_owner.h" + #include "url/url_util.h" ++#include "base/clang_work_around.h" + + #if BUILDFLAG(IS_MAC) + #include "base/mac/scoped_nsautorelease_pool.h" diff --git a/chromium.spec b/chromium.spec index 60b81dc..a5dcb5a 100644 --- a/chromium.spec +++ b/chromium.spec @@ -376,6 +376,9 @@ Patch206: chromium-110-ozone-wayland-vaapi-support.patch # Apply these patches to work around EPEL8 issues Patch300: chromium-99.0.4844.51-rhel8-force-disable-use_gnome_keyring.patch +# workaround for bug in clang 14 with c++20 on rhel9, linker errors std::u16string +Patch301: chromium-112-workaround-llvm14-c++20-epel8.patch + # Use chromium-latest.py to generate clean tarball from released build tarballs, found here: # http://build.chromium.org/buildbot/official/ # For Chromium Fedora use chromium-latest.py --stable --ffmpegclean --ffmpegarm @@ -973,6 +976,10 @@ udev. %patch -P300 -p1 -b .disblegnomekeyring %endif +%if 0%{?rhel} == 8 +%patch -P301 -p1 -b .clang14_c++20 +%endif + # Change shebang in all relevant files in this directory and all subdirectories # See `man find` for how the `-exec command {} +` syntax works find -type f \( -iname "*.py" \) -exec sed -i '1s=^#! */usr/bin/\(python\|env python\)[23]\?=#!%{__python3}=' {} + @@ -1121,12 +1128,6 @@ CHROMIUM_CORE_GN_DEFINES+=' use_gold=false' CHROMIUM_CORE_GN_DEFINES+=' target_cpu="arm64"' %endif -# clang =< 14 and C++20, linker errors std::u16string -# build failure on rhel8 -%if 0%{?rhel} == 8 -CHROMIUM_CORE_GN_DEFINES+=' use_cxx17=true' -%endif - CHROMIUM_CORE_GN_DEFINES+=' icu_use_data_file=true' CHROMIUM_CORE_GN_DEFINES+=' target_os="linux"' CHROMIUM_CORE_GN_DEFINES+=' current_os="linux"' From 98ea22a6b6f976f887416b87a9553a923cb82ce2 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Sat, 15 Apr 2023 09:45:22 +0200 Subject: [PATCH 2/9] update to 112.0.5615.121 --- ...mium-110-ozone-wayland-vaapi-support.patch | 584 ------------------ chromium-112-enable-vaapi-ozone-wayland.patch | 21 + chromium.spec | 11 +- sources | 2 +- 4 files changed, 31 insertions(+), 587 deletions(-) delete mode 100644 chromium-110-ozone-wayland-vaapi-support.patch create mode 100644 chromium-112-enable-vaapi-ozone-wayland.patch diff --git a/chromium-110-ozone-wayland-vaapi-support.patch b/chromium-110-ozone-wayland-vaapi-support.patch deleted file mode 100644 index fdcff26..0000000 --- a/chromium-110-ozone-wayland-vaapi-support.patch +++ /dev/null @@ -1,584 +0,0 @@ -author Jianhui Dai Tue Nov 15 06:18:04 2022 -committer Jianhui Dai Tue Nov 15 06:18:04 2022 - -[Ozone/Linux] Support VA-API on Linux Ozone/Wayland - -VA-API supports different display backends [1]. VA/DRM and VA/X11 are -used by Chromium at the moment. All Ozone platforms support VA/DRM by -default. VA/X11 is supported only on Ozone/X11. - -This CL renames 'supports_vaapi' to 'supports_vaapi_x11'; it indicates -if VA/X11 supported. Linux Ozone/X11 supports both VA/X11 and VA/DRM; -Linux Ozone/Wayland supports only VA/DRM. `VaapiPictureFactory` also -takes this flag to determine picture creation and downloading mechanism -on Linux. - -[1] https://github.com/intel/libva/blob/master/va/va_backend.h - -Test: VDA video playback on Linux X11 and Linux Wayland -Bug: 1326754,1116701 -Change-Id: I6d6bf781833a7752d23dafb2b63112c2fc81b17a -diff -up chromium-109.0.5359.124/media/gpu/args.gni.wayland-vaapi chromium-109.0.5359.124/media/gpu/args.gni ---- chromium-109.0.5359.124/media/gpu/args.gni.wayland-vaapi 2022-12-14 01:39:52.000000000 +0100 -+++ chromium-109.0.5359.124/media/gpu/args.gni 2023-01-05 10:13:08.291403261 +0100 -@@ -6,10 +6,14 @@ import("//build/config/chromeos/ui_mode. - import("//build/config/ozone.gni") - - declare_args() { -- # Indicates if X11 VA-API-based hardware acceleration is to be used. -- # See also the comment near the |use_vaapi| arg. -- use_vaapi_x11 = is_linux && ozone_platform_x11 && -- (target_cpu == "x86" || target_cpu == "x64") && !is_castos -+ # Build Chrome support for using VA-API over X11. Note that setting this to true is -+ # not a guarantee that Chrome will use (or even try to use) VA-API over X11. In -+ # particular, it is possible to build Chrome with support for VA-API over X11 but -+ # pick Wayland as the Ozone backend at runtime. In this case, Chrome will try to -+ # use VA-API over DRM. -+ support_vaapi_over_x11 = -+ is_linux && ozone_platform_x11 && -+ (target_cpu == "x86" || target_cpu == "x64") && !is_castos - } - - declare_args() { -@@ -29,8 +33,9 @@ declare_args() { - # is typically the case on x86-based ChromeOS devices. - # VA-API should also be compiled by default on x11-using linux devices - # using x86/x64. -- use_vaapi = use_vaapi_x11 || (is_chromeos_lacros && -- (target_cpu == "x86" || target_cpu == "x64")) -+ use_vaapi = -+ support_vaapi_over_x11 || -+ (is_chromeos_lacros && (target_cpu == "x86" || target_cpu == "x64")) - - # Indicates if ChromeOS protected media support exists. This is used - # to enable the CDM daemon in Chrome OS as well as support for -diff -up chromium-109.0.5359.124/media/gpu/BUILD.gn.wayland-vaapi chromium-109.0.5359.124/media/gpu/BUILD.gn ---- chromium-109.0.5359.124/media/gpu/BUILD.gn.wayland-vaapi 2022-12-14 01:39:52.000000000 +0100 -+++ chromium-109.0.5359.124/media/gpu/BUILD.gn 2023-01-05 10:13:08.291403261 +0100 -@@ -20,7 +20,7 @@ buildflag_header("buildflags") { - "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", - "USE_V4L2_CODEC=$use_v4l2_codec", - "USE_LIBV4L2=$use_v4lplugin", -- "USE_VAAPI_X11=$use_vaapi_x11", -+ "SUPPORT_VAAPI_OVER_X11=$support_vaapi_over_x11", - ] - } - -diff -up chromium-109.0.5359.124/media/gpu/vaapi/BUILD.gn.wayland-vaapi chromium-109.0.5359.124/media/gpu/vaapi/BUILD.gn ---- chromium-109.0.5359.124/media/gpu/vaapi/BUILD.gn.wayland-vaapi 2022-12-14 01:39:52.000000000 +0100 -+++ chromium-109.0.5359.124/media/gpu/vaapi/BUILD.gn 2023-01-05 10:13:08.291403261 +0100 -@@ -17,7 +17,7 @@ assert(use_vaapi) - generate_stubs("libva_stubs") { - extra_header = "va_stub_header.fragment" - sigs = [ "va.sigs" ] -- if (use_vaapi_x11) { -+ if (support_vaapi_over_x11) { - sigs += [ "va_x11.sigs" ] - } - if (is_chromeos_ash) { -@@ -138,7 +138,7 @@ source_set("vaapi") { - ] - } - -- if (use_vaapi_x11) { -+ if (support_vaapi_over_x11) { - deps += [ "//ui/gfx/x" ] - sources += [ - "vaapi_picture_native_pixmap_angle.cc", -@@ -214,7 +214,7 @@ source_set("common") { - deps += [ "//ui/ozone" ] - } - -- if (use_vaapi_x11) { -+ if (support_vaapi_over_x11) { - deps += [ "//ui/gfx/x" ] - } - -diff -up chromium-109.0.5359.124/media/gpu/vaapi/vaapi_picture_factory.h.wayland-vaapi chromium-109.0.5359.124/media/gpu/vaapi/vaapi_picture_factory.h ---- chromium-109.0.5359.124/media/gpu/vaapi/vaapi_picture_factory.h.wayland-vaapi 2022-12-14 01:39:53.000000000 +0100 -+++ chromium-109.0.5359.124/media/gpu/vaapi/vaapi_picture_factory.h 2023-01-05 10:13:08.291403261 +0100 -@@ -36,7 +36,11 @@ class MEDIA_GPU_EXPORT VaapiPictureFacto - kVaapiImplementationAngle, - }; - -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ explicit VaapiPictureFactory(absl::optional may_use_vaapi_over_x11); -+#else - VaapiPictureFactory(); -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - - VaapiPictureFactory(const VaapiPictureFactory&) = delete; - VaapiPictureFactory& operator=(const VaapiPictureFactory&) = delete; -@@ -85,6 +89,11 @@ class MEDIA_GPU_EXPORT VaapiPictureFacto - - CreatePictureCB create_picture_cb_; - bool needs_vpp_for_downloading_ = false; -+ -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ // See comment in `VaapiWrapper::MayUseVaapiOverX11()`. -+ absl::optional may_use_vaapi_over_x11_; -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - }; - - } // namespace media -diff -up chromium-109.0.5359.124/media/gpu/vaapi/vaapi_video_decode_accelerator.cc.wayland-vaapi chromium-109.0.5359.124/media/gpu/vaapi/vaapi_video_decode_accelerator.cc ---- chromium-109.0.5359.124/media/gpu/vaapi/vaapi_video_decode_accelerator.cc.wayland-vaapi 2023-01-05 10:13:08.290403251 +0100 -+++ chromium-109.0.5359.124/media/gpu/vaapi/vaapi_video_decode_accelerator.cc 2023-01-05 10:13:08.292403271 +0100 -@@ -184,7 +184,12 @@ bool VaapiVideoDecodeAccelerator::Initia - Client* client) { - DCHECK(task_runner_->BelongsToCurrentThread()); - -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ vaapi_picture_factory_ = -+ std::make_unique(VaapiWrapper::MayUseVaapiOverX11()); -+#else - vaapi_picture_factory_ = std::make_unique(); -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - - if (config.is_encrypted()) { - NOTREACHED() << "Encrypted streams are not supported for this VDA"; -@@ -1210,7 +1215,7 @@ VaapiVideoDecodeAccelerator::GetSupporte - - VaapiVideoDecodeAccelerator::BufferAllocationMode - VaapiVideoDecodeAccelerator::DecideBufferAllocationMode() { --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - // The IMPORT mode is used for Android on Chrome OS, so this doesn't apply - // here. - DCHECK_NE(output_mode_, VideoDecodeAccelerator::Config::OutputMode::IMPORT); -diff -up chromium-109.0.5359.124/media/gpu/vaapi/vaapi_wrapper.h.wayland-vaapi chromium-109.0.5359.124/media/gpu/vaapi/vaapi_wrapper.h ---- chromium-109.0.5359.124/media/gpu/vaapi/vaapi_wrapper.h.wayland-vaapi 2022-12-14 01:39:53.000000000 +0100 -+++ chromium-109.0.5359.124/media/gpu/vaapi/vaapi_wrapper.h 2023-01-05 10:13:08.292403271 +0100 -@@ -36,9 +36,9 @@ - #include "third_party/abseil-cpp/absl/types/optional.h" - #include "ui/gfx/geometry/size.h" - --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - #include "ui/gfx/x/xproto.h" // nogncheck --#endif // BUILDFLAG(USE_VAAPI_X11) -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - - namespace gfx { - enum class BufferFormat; -@@ -186,6 +186,16 @@ class MEDIA_GPU_EXPORT VaapiWrapper - VaapiWrapper(const VaapiWrapper&) = delete; - VaapiWrapper& operator=(const VaapiWrapper&) = delete; - -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ // Returns true if VaapiWrapper instances may use VA-API over X11 and false -+ // otherwise (VA-API over DRM will be used). If this returns absl::nullopt, -+ // it's because it was not possible to determine how VA-API may be used. This -+ // should only be called after PreSandboxInitialization() (which is assumed to -+ // be called only once during the GPU process startup) and is safe to call -+ // from any thread. Additionally, this should always return the same value. -+ static absl::optional MayUseVaapiOverX11(); -+#endif -+ - // Returns the supported SVC scalability modes for specified profile. - static std::vector GetSupportedScalabilityModes( - VideoCodecProfile media_profile, -@@ -439,13 +449,13 @@ class MEDIA_GPU_EXPORT VaapiWrapper - VASurfaceID va_surface_id, - const std::vector>& va_buffers); - --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - // Put data from |va_surface_id| into |x_pixmap| of size - // |dest_size|, converting/scaling to it. - [[nodiscard]] bool PutSurfaceIntoPixmap(VASurfaceID va_surface_id, - x11::Pixmap x_pixmap, - gfx::Size dest_size); --#endif // BUILDFLAG(USE_VAAPI_X11) -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - - // Creates a ScopedVAImage from a VASurface |va_surface_id| and map it into - // memory with the given |format| and |size|. If |format| is not equal to the -diff -up chromium-109.0.5359.124/media/gpu/vaapi/va_stub_header.fragment.wayland-vaapi chromium-109.0.5359.124/media/gpu/vaapi/va_stub_header.fragment ---- chromium-109.0.5359.124/media/gpu/vaapi/va_stub_header.fragment.wayland-vaapi 2022-12-14 01:39:52.000000000 +0100 -+++ chromium-109.0.5359.124/media/gpu/vaapi/va_stub_header.fragment 2023-01-05 10:13:08.291403261 +0100 -@@ -7,8 +7,8 @@ extern "C" { - - #include - #include --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - #include --#endif // BUILDFLAG(USE_VAAPI_X11) -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - - } -diff -up chromium-109.0.5359.124/ui/ozone/platform/x11/ozone_platform_x11.cc.wayland-vaapi chromium-109.0.5359.124/ui/ozone/platform/x11/ozone_platform_x11.cc ---- chromium-109.0.5359.124/ui/ozone/platform/x11/ozone_platform_x11.cc.wayland-vaapi 2022-12-14 01:40:14.000000000 +0100 -+++ chromium-109.0.5359.124/ui/ozone/platform/x11/ozone_platform_x11.cc 2023-01-05 10:13:08.292403271 +0100 -@@ -196,7 +196,7 @@ class OzonePlatformX11 : public OzonePla - properties->app_modal_dialogs_use_event_blocker = true; - properties->fetch_buffer_formats_for_gmb_on_gpu = true; - #if BUILDFLAG(IS_LINUX) -- properties->supports_vaapi = true; -+ properties->supports_vaapi_x11 = true; - #endif - - initialised = true; -diff -up chromium-109.0.5359.124/ui/ozone/public/ozone_platform.h.wayland-vaapi chromium-109.0.5359.124/ui/ozone/public/ozone_platform.h ---- chromium-109.0.5359.124/ui/ozone/public/ozone_platform.h.wayland-vaapi 2022-12-14 01:40:14.000000000 +0100 -+++ chromium-109.0.5359.124/ui/ozone/public/ozone_platform.h 2023-01-05 10:13:08.293403281 +0100 -@@ -145,12 +145,13 @@ class COMPONENT_EXPORT(OZONE) OzonePlatf - bool fetch_buffer_formats_for_gmb_on_gpu = false; - - #if BUILDFLAG(IS_LINUX) -- // TODO(crbug.com/1116701): add vaapi support for other Ozone platforms on -- // Linux. At the moment, VA-API Linux implementation supports only X11 -- // backend. This implementation must be refactored to support Ozone -- // properly. As a temporary solution, VA-API on Linux checks if vaapi is -- // supported (which implicitly means that it is Ozone/X11). -- bool supports_vaapi = false; -+ // VA-API supports different display backends. -+ // See https://github.com/intel/libva/blob/master/va/va_backend.h -+ // -+ // VA/DRM and VA/X11 are used by Chromium at the moment. All Ozone platforms -+ // support VA/DRM by default. `supports_vaapi_x11` indicates if VA/X11 -+ // supported; it is true only on Ozone/X11 platform. -+ bool supports_vaapi_x11 = false; - #endif - - // Indicates that the platform allows client applications to manipulate -diff -up chromium-109.0.5414.74/media/gpu/vaapi/vaapi_wrapper.cc.orig chromium-109.0.5414.74/media/gpu/vaapi/vaapi_wrapper.cc ---- chromium-109.0.5414.74/media/gpu/vaapi/vaapi_wrapper.cc.orig 2023-01-04 20:20:18.000000000 +0100 -+++ chromium-109.0.5414.74/media/gpu/vaapi/vaapi_wrapper.cc 2023-01-11 15:08:02.721768243 +0100 -@@ -62,7 +62,7 @@ - #include "ui/gl/gl_bindings.h" - #include "ui/gl/gl_implementation.h" - --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - typedef XID Drawable; - - extern "C" { -@@ -70,7 +70,7 @@ - } - - #include "ui/gfx/x/connection.h" // nogncheck --#endif // BUILDFLAG(USE_VAAPI_X11) -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - - #if BUILDFLAG(IS_OZONE) - #include "ui/ozone/public/ozone_platform.h" -@@ -84,14 +84,14 @@ - - using media_gpu_vaapi::kModuleVa; - using media_gpu_vaapi::kModuleVa_drm; --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - using media_gpu_vaapi::kModuleVa_x11; --#endif // BUILDFLAG(USE_VAAPI_X11) -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - using media_gpu_vaapi::InitializeStubs; - using media_gpu_vaapi::IsVaInitialized; --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - using media_gpu_vaapi::IsVa_x11Initialized; --#endif // BUILDFLAG(USE_VAAPI_X11) -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - using media_gpu_vaapi::IsVa_drmInitialized; - using media_gpu_vaapi::StubPathMap; - -@@ -668,6 +668,12 @@ - - void SetDrmFd(base::PlatformFile fd) { drm_fd_.reset(HANDLE_EINTR(dup(fd))); } - -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ absl::optional MayUseVaapiOverX11() const { -+ return may_use_vaapi_over_x11_; -+ } -+#endif -+ - private: - friend class base::NoDestructor; - -@@ -690,6 +696,13 @@ - // Drm fd used to obtain access to the driver interface by VA. - base::ScopedFD drm_fd_; - -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ // Whether we'll be possibly using VA-API over Ozone/X11. This should only be -+ // set (if at all) during the pre-sandbox initialization. If absl::nullopt, -+ // all calls to Initialize() will return false immediately. -+ absl::optional may_use_vaapi_over_x11_; -+#endif -+ - // The VADisplay handle. Valid between Initialize() and Deinitialize(). - VADisplay va_display_; - -@@ -708,6 +721,15 @@ - - // static - void VADisplayState::PreSandboxInitialization() { -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ if (ui::OzonePlatform::IsInitialized()) { -+ VADisplayState::Get()->may_use_vaapi_over_x11_ = -+ ui::OzonePlatform::GetInstance() -+ ->GetPlatformProperties() -+ .supports_vaapi_x11; -+ } -+#endif -+ - constexpr char kRenderNodeFilePattern[] = "/dev/dri/renderD%d"; - // This loop ends on either the first card that does not exist or the first - // render node that is not vgem. -@@ -740,20 +762,18 @@ - bool VADisplayState::Initialize() { - base::AutoLock auto_lock(va_lock_); - --#if BUILDFLAG(IS_OZONE) && BUILDFLAG(IS_LINUX) -- // TODO(crbug.com/1116701): add vaapi support for other Ozone platforms on -- // Linux. See comment in OzonePlatform::PlatformProperties::supports_vaapi -- // for more details. This will also require revisiting everything that's -- // guarded by USE_VAAPI_X11. For example, if USE_VAAPI_X11 is true, but the -- // user chooses the Wayland backend for Ozone at runtime, then many things (if -- // not all) that we do for X11 won't apply. -- if (!ui::OzonePlatform::GetInstance()->GetPlatformProperties().supports_vaapi) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ if (!may_use_vaapi_over_x11_.has_value()) - return false; - #endif - - bool libraries_initialized = IsVaInitialized() && IsVa_drmInitialized(); --#if BUILDFLAG(USE_VAAPI_X11) -- libraries_initialized = libraries_initialized && IsVa_x11Initialized(); -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ // Initialize VA-API X11 display backend for Linux Ozone/X11. -+ // See comment in OzonePlatform::PlatformProperties::supports_vaapi_x11 for -+ // more details. -+ if (may_use_vaapi_over_x11_.value()) -+ libraries_initialized = libraries_initialized && IsVa_x11Initialized(); - #endif - if (!libraries_initialized) - return false; -@@ -768,7 +788,7 @@ - return success; - } - --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - - absl::optional GetVADisplayStateX11(const base::ScopedFD& drm_fd) { - switch (gl::GetGLImplementation()) { -@@ -796,13 +816,19 @@ - } - } - --#else -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - - absl::optional GetVADisplayState(const base::ScopedFD& drm_fd) { - switch (gl::GetGLImplementation()) { - case gl::kGLImplementationEGLGLES2: -+#if BUILDFLAG(IS_CHROMEOS) -+ // GetVADisplayState() should not get called on Linux with Ozone/X11 -+ // (GetVADisplayStateX11() should get called instead), and we haven't tried -+ // VA-API decoding on Linux with Ozone/Wayland and anything other than -+ // native EGL/GLES2. - case gl::kGLImplementationEGLANGLE: - case gl::kGLImplementationNone: -+#endif - return vaGetDisplayDRM(drm_fd.get()); - default: - LOG(WARNING) << "VAAPI video acceleration not available for " -@@ -812,18 +838,23 @@ - } - } - --#endif // BUILDFLAG(USE_VAAPI_X11) -- - bool VADisplayState::InitializeVaDisplay_Locked() { -- absl::optional display = --#if BUILDFLAG(USE_VAAPI_X11) -- GetVADisplayStateX11(drm_fd_); --#else -- GetVADisplayState(drm_fd_); --#endif -+ absl::optional display; - -- if (!display) -- return false; -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ DCHECK(may_use_vaapi_over_x11_.has_value()); -+ if (may_use_vaapi_over_x11_.value()) { -+ display = GetVADisplayStateX11(drm_fd_); -+ if (!display) -+ return false; -+ } -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ -+ if (!display) { -+ display = GetVADisplayState(drm_fd_); -+ if (!display) -+ return false; -+ } - - va_display_ = *display; - if (!vaDisplayIsValid(va_display_)) { -@@ -1656,6 +1687,13 @@ - enforce_sequence_affinity); - } - -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+// static -+absl::optional VaapiWrapper::MayUseVaapiOverX11() { -+ return VADisplayState::Get()->MayUseVaapiOverX11(); -+} -+#endif -+ - // static - std::vector VaapiWrapper::GetSupportedScalabilityModes( - VideoCodecProfile media_profile, -@@ -2665,12 +2703,13 @@ - return Execute_Locked(va_surface_id, va_buffer_ids); - } - --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - bool VaapiWrapper::PutSurfaceIntoPixmap(VASurfaceID va_surface_id, - x11::Pixmap x_pixmap, - gfx::Size dest_size) { - CHECK(!enforce_sequence_affinity_ || - sequence_checker_.CalledOnValidSequence()); -+ CHECK(MayUseVaapiOverX11().value_or(false)); - base::AutoLockMaybe auto_lock(va_lock_.get()); - - VAStatus va_res = vaSyncSurface(va_display_, va_surface_id); -@@ -2684,7 +2723,7 @@ - VA_SUCCESS_OR_RETURN(va_res, VaapiFunctions::kVAPutSurface, false); - return true; - } --#endif // BUILDFLAG(USE_VAAPI_X11) -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - - std::unique_ptr VaapiWrapper::CreateVaImage( - VASurfaceID va_surface_id, -@@ -3086,7 +3125,7 @@ - - paths[kModuleVa].push_back(std::string("libva.so.") + va_suffix); - paths[kModuleVa_drm].push_back(std::string("libva-drm.so.") + va_suffix); --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - paths[kModuleVa_x11].push_back(std::string("libva-x11.so.") + va_suffix); - #endif - #if BUILDFLAG(IS_CHROMEOS_ASH) -diff -up chromium-109.0.5414.74/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc.orig chromium-109.0.5414.74/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc ---- chromium-109.0.5414.74/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc.orig 2023-01-11 20:45:17.347940426 +0100 -+++ chromium-109.0.5414.74/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc 2023-01-11 20:45:58.314670752 +0100 -@@ -109,7 +109,7 @@ - ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance(); - ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone(); - gfx::BufferUsage buffer_usage = gfx::BufferUsage::SCANOUT_VDA_WRITE; --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - // The 'VaapiVideoDecodeAccelerator' requires the VPP to download the decoded - // frame from the internal surface to the allocated native pixmap. - // 'SCANOUT_VDA_WRITE' is used for 'YUV_420_BIPLANAR' on ChromeOS; For Linux, -diff -up chromium-110.0.5481.61/media/gpu/vaapi/vaapi_picture_factory.cc.me1 chromium-110.0.5481.61/media/gpu/vaapi/vaapi_picture_factory.cc ---- chromium-110.0.5481.61/media/gpu/vaapi/vaapi_picture_factory.cc.me1 2023-02-01 16:42:01.000000000 +0100 -+++ chromium-110.0.5481.61/media/gpu/vaapi/vaapi_picture_factory.cc 2023-02-04 16:45:27.769211581 +0100 -@@ -13,9 +13,9 @@ - #if BUILDFLAG(IS_OZONE) - #include "media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h" - #endif // BUILDFLAG(IS_OZONE) --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - #include "media/gpu/vaapi/vaapi_picture_native_pixmap_angle.h" --#endif // BUILDFLAG(USE_VAAPI_X11) -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - #if defined(USE_EGL) - #include "media/gpu/vaapi/vaapi_picture_native_pixmap_egl.h" - #endif -@@ -41,19 +41,28 @@ std::unique_ptr CreateVaap - - } // namespace - -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+VaapiPictureFactory::VaapiPictureFactory( -+ absl::optional may_use_vaapi_over_x11) -+ : may_use_vaapi_over_x11_(may_use_vaapi_over_x11) { -+#else - VaapiPictureFactory::VaapiPictureFactory() { -+#endif - vaapi_impl_pairs_.insert( - std::make_pair(gl::kGLImplementationEGLGLES2, - VaapiPictureFactory::kVaapiImplementationDrm)); --#if BUILDFLAG(USE_VAAPI_X11) -- vaapi_impl_pairs_.insert( -- std::make_pair(gl::kGLImplementationEGLANGLE, -- VaapiPictureFactory::kVaapiImplementationAngle)); --#elif BUILDFLAG(IS_OZONE) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ CHECK(may_use_vaapi_over_x11_.has_value()); -+ if (may_use_vaapi_over_x11_.value()) { -+ vaapi_impl_pairs_.insert( -+ std::make_pair(gl::kGLImplementationEGLANGLE, -+ VaapiPictureFactory::kVaapiImplementationAngle)); -+ } -+#else - vaapi_impl_pairs_.insert( - std::make_pair(gl::kGLImplementationEGLANGLE, - VaapiPictureFactory::kVaapiImplementationDrm)); --#endif -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - - DeterminePictureCreationAndDownloadingMechanism(); - } -@@ -93,19 +102,19 @@ VaapiPictureFactory::GetVaapiImplementat - } - - uint32_t VaapiPictureFactory::GetGLTextureTarget() { --#if BUILDFLAG(USE_VAAPI_X11) -- return GL_TEXTURE_2D; --#else -+#if BUILDFLAG(IS_CHROMEOS) - return GL_TEXTURE_EXTERNAL_OES; --#endif -+#else -+ return GL_TEXTURE_2D; -+#endif // BUILDFLAG(IS_CHROMEOS) - } - - gfx::BufferFormat VaapiPictureFactory::GetBufferFormat() { --#if BUILDFLAG(USE_VAAPI_X11) -- return gfx::BufferFormat::RGBX_8888; --#else -+#if BUILDFLAG(IS_CHROMEOS) - return gfx::BufferFormat::YUV_420_BIPLANAR; --#endif -+#else -+ return gfx::BufferFormat::RGBX_8888; -+#endif // BUILDFLAG(IS_CHROMEOS) - } - - void VaapiPictureFactory::DeterminePictureCreationAndDownloadingMechanism() { -@@ -113,19 +122,23 @@ void VaapiPictureFactory::DeterminePictu - #if BUILDFLAG(IS_OZONE) - // We can be called without GL initialized, which is valid if we use Ozone. - case kVaapiImplementationNone: -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) -+ DCHECK(may_use_vaapi_over_x11_.value_or(false)); -+#endif - create_picture_cb_ = base::BindRepeating( - &CreateVaapiPictureNativeImpl); - needs_vpp_for_downloading_ = true; - break; - #endif // BUILDFLAG(IS_OZONE) --#if BUILDFLAG(USE_VAAPI_X11) -+#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - case kVaapiImplementationAngle: -+ CHECK(may_use_vaapi_over_x11_.value_or(false)); - create_picture_cb_ = base::BindRepeating( - &CreateVaapiPictureNativeImpl); - // Neither VaapiTFPPicture or VaapiPictureNativePixmapAngle needs the VPP. - needs_vpp_for_downloading_ = false; - break; --#endif // BUILDFLAG(USE_VAAPI_X11) -+#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) - case kVaapiImplementationDrm: - #if BUILDFLAG(IS_OZONE) - create_picture_cb_ = base::BindRepeating( diff --git a/chromium-112-enable-vaapi-ozone-wayland.patch b/chromium-112-enable-vaapi-ozone-wayland.patch new file mode 100644 index 0000000..1a75ce3 --- /dev/null +++ b/chromium-112-enable-vaapi-ozone-wayland.patch @@ -0,0 +1,21 @@ +author Yaowei Zhou Thu Feb 02 06:18:34 2023 +committer Yaowei Zhou Thu Feb 02 06:18:34 2023 +tree 62a79c7f155fc32140d3aa4c4a6b01b8d7eddfcc +parent 98e427b87ff8447180a60f20ee3792dcbd649481 [diff] +Enable VA-API flag on ozone wayland + +Bug: POC +Change-Id: I09f696bfe3be82930161ce005152d1397b93f636 +diff --git a/ui/ozone/platform/wayland/ozone_platform_wayland.cc b/ui/ozone/platform/wayland/ozone_platform_wayland.cc +index b3190c6b..4a2c3bb 100644 +--- a/ui/ozone/platform/wayland/ozone_platform_wayland.cc ++++ b/ui/ozone/platform/wayland/ozone_platform_wayland.cc +@@ -309,6 +309,8 @@ + properties->supports_global_screen_coordinates = + features::IsWaylandScreenCoordinatesEnabled(); + ++ properties->supports_vaapi_x11 = true; ++ + initialised = true; + } + diff --git a/chromium.spec b/chromium.spec index a5dcb5a..6fc5717 100644 --- a/chromium.spec +++ b/chromium.spec @@ -241,7 +241,7 @@ %endif Name: chromium%{chromium_channel} -Version: 112.0.5615.49 +Version: 112.0.5615.121 Release: 1%{?dist} Summary: A WebKit (Blink) powered web browser that Google doesn't want you to use Url: http://www.chromium.org/Home @@ -371,7 +371,8 @@ Patch146: chromium-110-LargerThan4k.patch # Upstream turned VAAPI on in Linux in 86 Patch202: chromium-104.0.5112.101-enable-hardware-accelerated-mjpeg.patch Patch205: chromium-86.0.4240.75-fix-vaapi-on-intel.patch -Patch206: chromium-110-ozone-wayland-vaapi-support.patch +Patch206: chromium-112-ozone-wayland-vaapi-support.patch +Patch207: chromium-112-enable-vaapi-ozone-wayland.patch # Apply these patches to work around EPEL8 issues Patch300: chromium-99.0.4844.51-rhel8-force-disable-use_gnome_keyring.patch @@ -957,7 +958,9 @@ udev. %patch -P107 -p1 -b .el7-extra-operator-equalequal %endif +%if 0%{?fedora} == 37 %patch -P108 -p1 -R -b .chrome_feed_response_metadata +%endif %patch -P130 -p1 -b .VirtualCursor-std-layout @@ -970,6 +973,7 @@ udev. %patch -P202 -p1 -b .accel-mjpeg %patch -P205 -p1 -b .vaapi-intel-fix %patch -P206 -p1 -b .wayland-vaapi +%patch -P207 -p1 -b .enable-wayland-vaapi %endif %if 0%{?rhel} >= 8 @@ -1649,6 +1653,9 @@ getent group chrome-remote-desktop >/dev/null || groupadd -r chrome-remote-deskt %{chromium_path}/chromedriver %changelog +* Sat Apr 15 2023 Than Ngo - 112.0.5615.121-1 +- update to 112.0.5615.121 + * Wed Apr 05 2023 Than Ngo - 112.0.5615.49-1 - update to 112.0.5615.49 - fix #2184142, Small fonts in menus diff --git a/sources b/sources index 4487c5a..2871077 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (node-v19.8.1-linux-arm64.tar.xz) = 86ff19085669e92ce7afe2fd7d4df0c5441df2d88c00f29d5463b805f3cf5625626db8aebf98349c9a495b772da1ce6d68263730018207ea98815058a1c81397 SHA512 (node-v19.8.1-linux-x64.tar.xz) = 925c0037c6b7074d0b0245bced20d0a0d9b1300f53b808106f16b5018d763f5f5b00bc321b33fa1033d736b1e1076608da9b7fcae66aed53d27b100b1186e2c6 -SHA512 (chromium-112.0.5615.49-clean.tar.xz) = cda9247696503dc0be0d9519f85c0619736da66410751412819362beeb115a51da1f90b15c60bae0d517fea70dca5797ae5eccf728ee13fd1cf29d1fe216f943 +SHA512 (chromium-112.0.5615.121-clean.tar.xz) = 4dfb8abb5ae475f069ff18d98c6b8c5a241187ce2ed5d85d6bc6ac33efdcca6a657539df50b3836baca93190aff96676d6673a1a554b48394cb4625aaea0275d From 48ba3e76624fcf90233c2d0952d4491696588277 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Sat, 15 Apr 2023 09:46:41 +0200 Subject: [PATCH 3/9] rebase ozone-wayland-vaapi-support patch --- ...mium-112-ozone-wayland-vaapi-support.patch | 625 ++++++++++++++++++ 1 file changed, 625 insertions(+) create mode 100644 chromium-112-ozone-wayland-vaapi-support.patch diff --git a/chromium-112-ozone-wayland-vaapi-support.patch b/chromium-112-ozone-wayland-vaapi-support.patch new file mode 100644 index 0000000..3f4d4af --- /dev/null +++ b/chromium-112-ozone-wayland-vaapi-support.patch @@ -0,0 +1,625 @@ +diff -up chromium-112.0.5615.49/media/gpu/args.gni.wayland-vaapi chromium-112.0.5615.49/media/gpu/args.gni +--- chromium-112.0.5615.49/media/gpu/args.gni.wayland-vaapi 2023-03-30 02:33:53.000000000 +0200 ++++ chromium-112.0.5615.49/media/gpu/args.gni 2023-04-14 21:29:41.776328044 +0200 +@@ -6,10 +6,14 @@ import("//build/config/chromeos/ui_mode. + import("//build/config/ozone.gni") + + declare_args() { +- # Indicates if X11 VA-API-based hardware acceleration is to be used. +- # See also the comment near the |use_vaapi| arg. +- use_vaapi_x11 = is_linux && ozone_platform_x11 && +- (target_cpu == "x86" || target_cpu == "x64") && !is_castos ++ # Build Chrome support for using VA-API over X11. Note that setting this to true is ++ # not a guarantee that Chrome will use (or even try to use) VA-API over X11. In ++ # particular, it is possible to build Chrome with support for VA-API over X11 but ++ # pick Wayland as the Ozone backend at runtime. In this case, Chrome will try to ++ # use VA-API over DRM. ++ support_vaapi_over_x11 = ++ is_linux && ozone_platform_x11 && ++ (target_cpu == "x86" || target_cpu == "x64") && !is_castos + } + + declare_args() { +@@ -29,8 +33,9 @@ declare_args() { + # is typically the case on x86-based ChromeOS devices. + # VA-API should also be compiled by default on x11-using linux devices + # using x86/x64. +- use_vaapi = use_vaapi_x11 || (is_chromeos_lacros && +- (target_cpu == "x86" || target_cpu == "x64")) ++ use_vaapi = ++ support_vaapi_over_x11 || ++ (is_chromeos_lacros && (target_cpu == "x86" || target_cpu == "x64")) + + # Indicates if ChromeOS protected media support exists. This is used + # to enable the CDM daemon in Chrome OS as well as support for +diff -up chromium-112.0.5615.49/media/gpu/BUILD.gn.wayland-vaapi chromium-112.0.5615.49/media/gpu/BUILD.gn +--- chromium-112.0.5615.49/media/gpu/BUILD.gn.wayland-vaapi 2023-03-30 02:33:53.000000000 +0200 ++++ chromium-112.0.5615.49/media/gpu/BUILD.gn 2023-04-14 21:29:41.776328044 +0200 +@@ -20,7 +20,7 @@ buildflag_header("buildflags") { + "USE_VAAPI_IMAGE_CODECS=$use_vaapi_image_codecs", + "USE_V4L2_CODEC=$use_v4l2_codec", + "USE_LIBV4L2=$use_v4lplugin", +- "USE_VAAPI_X11=$use_vaapi_x11", ++ "SUPPORT_VAAPI_OVER_X11=$support_vaapi_over_x11", + ] + } + +diff -up chromium-112.0.5615.49/media/gpu/vaapi/BUILD.gn.wayland-vaapi chromium-112.0.5615.49/media/gpu/vaapi/BUILD.gn +--- chromium-112.0.5615.49/media/gpu/vaapi/BUILD.gn.wayland-vaapi 2023-03-30 02:33:53.000000000 +0200 ++++ chromium-112.0.5615.49/media/gpu/vaapi/BUILD.gn 2023-04-14 21:29:41.776328044 +0200 +@@ -17,7 +17,7 @@ assert(use_vaapi) + generate_stubs("libva_stubs") { + extra_header = "va_stub_header.fragment" + sigs = [ "va.sigs" ] +- if (use_vaapi_x11) { ++ if (support_vaapi_over_x11) { + sigs += [ "va_x11.sigs" ] + } + if (is_chromeos_ash) { +@@ -139,7 +139,7 @@ source_set("vaapi") { + ] + } + +- if (use_vaapi_x11) { ++ if (support_vaapi_over_x11) { + deps += [ "//ui/gfx/x" ] + sources += [ + "vaapi_picture_native_pixmap_angle.cc", +@@ -213,7 +213,7 @@ source_set("common") { + deps += [ "//ui/ozone" ] + } + +- if (use_vaapi_x11) { ++ if (support_vaapi_over_x11) { + deps += [ "//ui/gfx/x" ] + } + +diff -up chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_factory.cc.wayland-vaapi chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_factory.cc +--- chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_factory.cc.wayland-vaapi 2023-03-30 02:33:53.000000000 +0200 ++++ chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_factory.cc 2023-04-15 07:14:05.573796794 +0200 +@@ -13,9 +13,9 @@ + #if BUILDFLAG(IS_OZONE) + #include "media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h" + #endif // BUILDFLAG(IS_OZONE) +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + #include "media/gpu/vaapi/vaapi_picture_native_pixmap_angle.h" +-#endif // BUILDFLAG(USE_VAAPI_X11) ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + #if defined(USE_EGL) + #include "media/gpu/vaapi/vaapi_picture_native_pixmap_egl.h" + #endif +@@ -41,19 +41,28 @@ std::unique_ptr CreateVaap + + } // namespace + ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++VaapiPictureFactory::VaapiPictureFactory( ++ absl::optional may_use_vaapi_over_x11) ++ : may_use_vaapi_over_x11_(may_use_vaapi_over_x11) { ++#else + VaapiPictureFactory::VaapiPictureFactory() { ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + vaapi_impl_pairs_.insert( + std::make_pair(gl::kGLImplementationEGLGLES2, + VaapiPictureFactory::kVaapiImplementationDrm)); +-#if BUILDFLAG(USE_VAAPI_X11) +- vaapi_impl_pairs_.insert( +- std::make_pair(gl::kGLImplementationEGLANGLE, +- VaapiPictureFactory::kVaapiImplementationAngle)); +-#elif BUILDFLAG(IS_OZONE) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ CHECK(may_use_vaapi_over_x11_.has_value()); ++ if (may_use_vaapi_over_x11_.value()) { ++ vaapi_impl_pairs_.insert( ++ std::make_pair(gl::kGLImplementationEGLANGLE, ++ VaapiPictureFactory::kVaapiImplementationAngle)); ++ } ++#else + vaapi_impl_pairs_.insert( + std::make_pair(gl::kGLImplementationEGLANGLE, + VaapiPictureFactory::kVaapiImplementationDrm)); +-#endif ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + + DeterminePictureCreationAndDownloadingMechanism(); + } +@@ -93,19 +102,19 @@ VaapiPictureFactory::GetVaapiImplementat + } + + uint32_t VaapiPictureFactory::GetGLTextureTarget() { +-#if BUILDFLAG(USE_VAAPI_X11) +- return GL_TEXTURE_2D; +-#else ++#if BUILDFLAG(IS_CHROMEOS) + return GL_TEXTURE_EXTERNAL_OES; +-#endif ++#else ++ return GL_TEXTURE_2D; ++#endif // BUILDFLAG(IS_CHROMEOS) + } + + gfx::BufferFormat VaapiPictureFactory::GetBufferFormat() { +-#if BUILDFLAG(USE_VAAPI_X11) +- return gfx::BufferFormat::RGBX_8888; +-#else ++#if BUILDFLAG(IS_CHROMEOS) + return gfx::BufferFormat::YUV_420_BIPLANAR; +-#endif ++#else ++ return gfx::BufferFormat::RGBX_8888; ++#endif // BUILDFLAG(IS_CHROMEOS) + } + + void VaapiPictureFactory::DeterminePictureCreationAndDownloadingMechanism() { +@@ -113,19 +122,23 @@ void VaapiPictureFactory::DeterminePictu + #if BUILDFLAG(IS_OZONE) + // We can be called without GL initialized, which is valid if we use Ozone. + case kVaapiImplementationNone: ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ DCHECK(may_use_vaapi_over_x11_.value_or(false)); ++#endif + create_picture_cb_ = base::BindRepeating( + &CreateVaapiPictureNativeImpl); + needs_vpp_for_downloading_ = true; + break; + #endif // BUILDFLAG(IS_OZONE) +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + case kVaapiImplementationAngle: ++ DCHECK(may_use_vaapi_over_x11_.value_or(false)); + create_picture_cb_ = base::BindRepeating( + &CreateVaapiPictureNativeImpl); + // Neither VaapiTFPPicture or VaapiPictureNativePixmapAngle needs the VPP. + needs_vpp_for_downloading_ = false; + break; +-#endif // BUILDFLAG(USE_VAAPI_X11) ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + case kVaapiImplementationDrm: + #if BUILDFLAG(IS_OZONE) + create_picture_cb_ = base::BindRepeating( +diff -up chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_factory.h.wayland-vaapi chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_factory.h +--- chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_factory.h.wayland-vaapi 2023-03-30 02:33:53.000000000 +0200 ++++ chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_factory.h 2023-04-14 21:29:41.777328062 +0200 +@@ -35,7 +35,11 @@ class MEDIA_GPU_EXPORT VaapiPictureFacto + kVaapiImplementationAngle, + }; + ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ explicit VaapiPictureFactory(absl::optional may_use_vaapi_over_x11); ++#else + VaapiPictureFactory(); ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + + VaapiPictureFactory(const VaapiPictureFactory&) = delete; + VaapiPictureFactory& operator=(const VaapiPictureFactory&) = delete; +@@ -84,6 +88,11 @@ class MEDIA_GPU_EXPORT VaapiPictureFacto + + CreatePictureCB create_picture_cb_; + bool needs_vpp_for_downloading_ = false; ++ ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ // See comment in `VaapiWrapper::MayUseVaapiOverX11()`. ++ absl::optional may_use_vaapi_over_x11_; ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + }; + + } // namespace media +diff -up chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc.wayland-vaapi chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc +--- chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc.wayland-vaapi 2023-03-30 02:33:53.000000000 +0200 ++++ chromium-112.0.5615.49/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc 2023-04-14 21:29:41.777328062 +0200 +@@ -113,7 +113,7 @@ VaapiStatus VaapiPictureNativePixmapOzon + ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance(); + ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone(); + gfx::BufferUsage buffer_usage = gfx::BufferUsage::SCANOUT_VDA_WRITE; +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + // The 'VaapiVideoDecodeAccelerator' requires the VPP to download the decoded + // frame from the internal surface to the allocated native pixmap. + // 'SCANOUT_VDA_WRITE' is used for 'YUV_420_BIPLANAR' on ChromeOS; For Linux, +diff -up chromium-112.0.5615.49/media/gpu/vaapi/vaapi_video_decode_accelerator.cc.wayland-vaapi chromium-112.0.5615.49/media/gpu/vaapi/vaapi_video_decode_accelerator.cc +--- chromium-112.0.5615.49/media/gpu/vaapi/vaapi_video_decode_accelerator.cc.wayland-vaapi 2023-04-14 21:29:41.775328024 +0200 ++++ chromium-112.0.5615.49/media/gpu/vaapi/vaapi_video_decode_accelerator.cc 2023-04-14 21:29:41.777328062 +0200 +@@ -185,7 +185,12 @@ bool VaapiVideoDecodeAccelerator::Initia + Client* client) { + DCHECK(task_runner_->BelongsToCurrentThread()); + ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ vaapi_picture_factory_ = ++ std::make_unique(VaapiWrapper::MayUseVaapiOverX11()); ++#else + vaapi_picture_factory_ = std::make_unique(); ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + + if (config.is_encrypted()) { + NOTREACHED() << "Encrypted streams are not supported for this VDA"; +@@ -1211,7 +1216,7 @@ VaapiVideoDecodeAccelerator::GetSupporte + + VaapiVideoDecodeAccelerator::BufferAllocationMode + VaapiVideoDecodeAccelerator::DecideBufferAllocationMode() { +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + // The IMPORT mode is used for Android on Chrome OS, so this doesn't apply + // here. + DCHECK_NE(output_mode_, VideoDecodeAccelerator::Config::OutputMode::IMPORT); +diff -up chromium-112.0.5615.49/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc.wayland-vaapi chromium-112.0.5615.49/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc +--- chromium-112.0.5615.49/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc.wayland-vaapi 2023-03-30 02:33:53.000000000 +0200 ++++ chromium-112.0.5615.49/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc 2023-04-15 07:38:19.058957112 +0200 +@@ -41,6 +41,11 @@ struct TestParams { + bool decode_using_client_picture_buffers; + }; + ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++// TODO: Add it in TestParams to cover Ozone/Wayland. ++bool kMayUseVaapiOverX11 = true; ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ + constexpr int32_t kBitstreamId = 123; + constexpr size_t kInputSize = 256; + +@@ -134,7 +139,13 @@ class MockVaapiPicture : public VaapiPic + + class MockVaapiPictureFactory : public VaapiPictureFactory { + public: ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ explicit MockVaapiPictureFactory(absl::optional may_use_vaapi_over_x11) ++ : VaapiPictureFactory(may_use_vaapi_over_x11) {} ++#else + MockVaapiPictureFactory() = default; ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ + ~MockVaapiPictureFactory() override = default; + + MOCK_METHOD3(MockCreateVaapiPicture, +@@ -167,7 +178,12 @@ class VaapiVideoDecodeAcceleratorTest : + const scoped_refptr& image) { return true; })), + decoder_thread_("VaapiVideoDecodeAcceleratorTestThread"), + mock_decoder_(new ::testing::StrictMock), ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ mock_vaapi_picture_factory_( ++ new MockVaapiPictureFactory(kMayUseVaapiOverX11)), ++#else + mock_vaapi_picture_factory_(new MockVaapiPictureFactory()), ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + mock_vaapi_wrapper_(new MockVaapiWrapper(VaapiWrapper::kDecode)), + mock_vpp_vaapi_wrapper_(new MockVaapiWrapper(VaapiWrapper::kDecode)), + weak_ptr_factory_(this) { +@@ -422,11 +438,13 @@ TEST_P(VaapiVideoDecodeAcceleratorTest, + mock_vaapi_picture_factory_->GetVaapiImplementation( + gl::kGLImplementationEGLGLES2)); + +-#if BUILDFLAG(USE_VAAPI_X11) +- EXPECT_EQ(VaapiPictureFactory::kVaapiImplementationAngle, +- mock_vaapi_picture_factory_->GetVaapiImplementation( +- gl::kGLImplementationEGLANGLE)); +-#elif BUILDFLAG(IS_OZONE) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ if (kMayUseVaapiOverX11) { ++ EXPECT_EQ(VaapiPictureFactory::kVaapiImplementationAngle, ++ mock_vaapi_picture_factory_->GetVaapiImplementation( ++ gl::kGLImplementationEGLANGLE)); ++ } ++#else + EXPECT_EQ(VaapiPictureFactory::kVaapiImplementationDrm, + mock_vaapi_picture_factory_->GetVaapiImplementation( + gl::kGLImplementationEGLANGLE)); +diff -up chromium-112.0.5615.49/media/gpu/vaapi/vaapi_wrapper.cc.wayland-vaapi chromium-112.0.5615.49/media/gpu/vaapi/vaapi_wrapper.cc +--- chromium-112.0.5615.49/media/gpu/vaapi/vaapi_wrapper.cc.wayland-vaapi 2023-03-30 02:33:53.000000000 +0200 ++++ chromium-112.0.5615.49/media/gpu/vaapi/vaapi_wrapper.cc 2023-04-14 21:29:41.777328062 +0200 +@@ -62,7 +62,7 @@ + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_implementation.h" + +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + typedef XID Drawable; + + extern "C" { +@@ -70,7 +70,7 @@ extern "C" { + } + + #include "ui/gfx/x/connection.h" // nogncheck +-#endif // BUILDFLAG(USE_VAAPI_X11) ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + + #if BUILDFLAG(IS_OZONE) + #include "ui/ozone/public/ozone_platform.h" +@@ -84,14 +84,14 @@ using media_gpu_vaapi::kModuleVa_prot; + + using media_gpu_vaapi::kModuleVa; + using media_gpu_vaapi::kModuleVa_drm; +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + using media_gpu_vaapi::kModuleVa_x11; +-#endif // BUILDFLAG(USE_VAAPI_X11) ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + using media_gpu_vaapi::InitializeStubs; + using media_gpu_vaapi::IsVaInitialized; +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + using media_gpu_vaapi::IsVa_x11Initialized; +-#endif // BUILDFLAG(USE_VAAPI_X11) ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + using media_gpu_vaapi::IsVa_drmInitialized; + using media_gpu_vaapi::StubPathMap; + +@@ -680,6 +680,12 @@ class VADisplayState { + + void SetDrmFd(base::PlatformFile fd) { drm_fd_.reset(HANDLE_EINTR(dup(fd))); } + ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ absl::optional MayUseVaapiOverX11() const { ++ return may_use_vaapi_over_x11_; ++ } ++#endif ++ + private: + friend class base::NoDestructor; + +@@ -702,6 +708,13 @@ class VADisplayState { + // Drm fd used to obtain access to the driver interface by VA. + base::ScopedFD drm_fd_; + ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ // Whether we'll be possibly using VA-API over Ozone/X11. This should only be ++ // set (if at all) during the pre-sandbox initialization. If absl::nullopt, ++ // all calls to Initialize() will return false immediately. ++ absl::optional may_use_vaapi_over_x11_; ++#endif ++ + // The VADisplay handle. Valid between Initialize() and Deinitialize(). + VADisplay va_display_; + +@@ -723,6 +736,15 @@ VADisplayState* VADisplayState::Get() { + + // static + void VADisplayState::PreSandboxInitialization() { ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ if (ui::OzonePlatform::IsInitialized()) { ++ VADisplayState::Get()->may_use_vaapi_over_x11_ = ++ ui::OzonePlatform::GetInstance() ++ ->GetPlatformProperties() ++ .supports_vaapi_x11; ++ } ++#endif ++ + constexpr char kRenderNodeFilePattern[] = "/dev/dri/renderD%d"; + // This loop ends on either the first card that does not exist or the first + // render node that is not vgem. +@@ -755,20 +777,18 @@ VADisplayState::VADisplayState() + bool VADisplayState::Initialize() { + base::AutoLock auto_lock(va_lock_); + +-#if BUILDFLAG(IS_OZONE) && BUILDFLAG(IS_LINUX) +- // TODO(crbug.com/1116701): add vaapi support for other Ozone platforms on +- // Linux. See comment in OzonePlatform::PlatformProperties::supports_vaapi +- // for more details. This will also require revisiting everything that's +- // guarded by USE_VAAPI_X11. For example, if USE_VAAPI_X11 is true, but the +- // user chooses the Wayland backend for Ozone at runtime, then many things (if +- // not all) that we do for X11 won't apply. +- if (!ui::OzonePlatform::GetInstance()->GetPlatformProperties().supports_vaapi) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ if (!may_use_vaapi_over_x11_.has_value()) + return false; + #endif + + bool libraries_initialized = IsVaInitialized() && IsVa_drmInitialized(); +-#if BUILDFLAG(USE_VAAPI_X11) +- libraries_initialized = libraries_initialized && IsVa_x11Initialized(); ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ // Initialize VA-API X11 display backend for Linux Ozone/X11. ++ // See comment in OzonePlatform::PlatformProperties::supports_vaapi_x11 for ++ // more details. ++ if (may_use_vaapi_over_x11_.value()) ++ libraries_initialized = libraries_initialized && IsVa_x11Initialized(); + #endif + if (!libraries_initialized) + return false; +@@ -783,7 +803,7 @@ bool VADisplayState::Initialize() { + return success; + } + +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + + absl::optional GetVADisplayStateX11(const base::ScopedFD& drm_fd) { + switch (gl::GetGLImplementation()) { +@@ -809,13 +829,19 @@ absl::optional GetVADisplaySt + } + } + +-#else ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + + absl::optional GetVADisplayState(const base::ScopedFD& drm_fd) { + switch (gl::GetGLImplementation()) { + case gl::kGLImplementationEGLGLES2: ++#if BUILDFLAG(IS_CHROMEOS) ++ // GetVADisplayState() should not get called on Linux with Ozone/X11 ++ // (GetVADisplayStateX11() should get called instead), and we haven't tried ++ // VA-API decoding on Linux with Ozone/Wayland and anything other than ++ // native EGL/GLES2. + case gl::kGLImplementationEGLANGLE: + case gl::kGLImplementationNone: ++#endif + return vaGetDisplayDRM(drm_fd.get()); + default: + LOG(WARNING) << "VAAPI video acceleration not available for " +@@ -825,18 +851,23 @@ absl::optional GetVADisplaySt + } + } + +-#endif // BUILDFLAG(USE_VAAPI_X11) +- + bool VADisplayState::InitializeVaDisplay_Locked() { +- absl::optional display = +-#if BUILDFLAG(USE_VAAPI_X11) +- GetVADisplayStateX11(drm_fd_); +-#else +- GetVADisplayState(drm_fd_); +-#endif ++ absl::optional display; + +- if (!display) +- return false; ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ DCHECK(may_use_vaapi_over_x11_.has_value()); ++ if (may_use_vaapi_over_x11_.value()) { ++ display = GetVADisplayStateX11(drm_fd_); ++ if (!display) ++ return false; ++ } ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ ++ if (!display) { ++ display = GetVADisplayState(drm_fd_); ++ if (!display) ++ return false; ++ } + + va_display_ = *display; + if (!vaDisplayIsValid(va_display_)) { +@@ -1671,6 +1702,13 @@ scoped_refptr VaapiWrapper + enforce_sequence_affinity); + } + ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++// static ++absl::optional VaapiWrapper::MayUseVaapiOverX11() { ++ return VADisplayState::Get()->MayUseVaapiOverX11(); ++} ++#endif ++ + // static + std::vector VaapiWrapper::GetSupportedScalabilityModes( + VideoCodecProfile media_profile, +@@ -2684,12 +2722,13 @@ bool VaapiWrapper::MapAndCopyAndExecute( + return Execute_Locked(va_surface_id, va_buffer_ids); + } + +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + bool VaapiWrapper::PutSurfaceIntoPixmap(VASurfaceID va_surface_id, + x11::Pixmap x_pixmap, + gfx::Size dest_size) { + CHECK(!enforce_sequence_affinity_ || + sequence_checker_.CalledOnValidSequence()); ++ CHECK(MayUseVaapiOverX11().value_or(false)); + base::AutoLockMaybe auto_lock(va_lock_.get()); + + VAStatus va_res = vaSyncSurface(va_display_, va_surface_id); +@@ -2703,7 +2742,7 @@ bool VaapiWrapper::PutSurfaceIntoPixmap( + VA_SUCCESS_OR_RETURN(va_res, VaapiFunctions::kVAPutSurface, false); + return true; + } +-#endif // BUILDFLAG(USE_VAAPI_X11) ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + + std::unique_ptr VaapiWrapper::CreateVaImage( + VASurfaceID va_surface_id, +@@ -3105,7 +3144,7 @@ void VaapiWrapper::PreSandboxInitializat + + paths[kModuleVa].push_back(std::string("libva.so.") + va_suffix); + paths[kModuleVa_drm].push_back(std::string("libva-drm.so.") + va_suffix); +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + paths[kModuleVa_x11].push_back(std::string("libva-x11.so.") + va_suffix); + #endif + #if BUILDFLAG(IS_CHROMEOS_ASH) +diff -up chromium-112.0.5615.49/media/gpu/vaapi/vaapi_wrapper.h.wayland-vaapi chromium-112.0.5615.49/media/gpu/vaapi/vaapi_wrapper.h +--- chromium-112.0.5615.49/media/gpu/vaapi/vaapi_wrapper.h.wayland-vaapi 2023-03-30 02:33:53.000000000 +0200 ++++ chromium-112.0.5615.49/media/gpu/vaapi/vaapi_wrapper.h 2023-04-14 21:29:41.777328062 +0200 +@@ -36,9 +36,9 @@ + #include "third_party/abseil-cpp/absl/types/optional.h" + #include "ui/gfx/geometry/size.h" + +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + #include "ui/gfx/x/xproto.h" // nogncheck +-#endif // BUILDFLAG(USE_VAAPI_X11) ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + + namespace gfx { + enum class BufferFormat; +@@ -186,6 +186,16 @@ class MEDIA_GPU_EXPORT VaapiWrapper + VaapiWrapper(const VaapiWrapper&) = delete; + VaapiWrapper& operator=(const VaapiWrapper&) = delete; + ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) ++ // Returns true if VaapiWrapper instances may use VA-API over X11 and false ++ // otherwise (VA-API over DRM will be used). If this returns absl::nullopt, ++ // it's because it was not possible to determine how VA-API may be used. This ++ // should only be called after PreSandboxInitialization() (which is assumed to ++ // be called only once during the GPU process startup) and is safe to call ++ // from any thread. Additionally, this should always return the same value. ++ static absl::optional MayUseVaapiOverX11(); ++#endif ++ + // Returns the supported SVC scalability modes for specified profile. + static std::vector GetSupportedScalabilityModes( + VideoCodecProfile media_profile, +@@ -439,13 +449,13 @@ class MEDIA_GPU_EXPORT VaapiWrapper + VASurfaceID va_surface_id, + const std::vector>& va_buffers); + +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + // Put data from |va_surface_id| into |x_pixmap| of size + // |dest_size|, converting/scaling to it. + [[nodiscard]] bool PutSurfaceIntoPixmap(VASurfaceID va_surface_id, + x11::Pixmap x_pixmap, + gfx::Size dest_size); +-#endif // BUILDFLAG(USE_VAAPI_X11) ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + + // Creates a ScopedVAImage from a VASurface |va_surface_id| and map it into + // memory with the given |format| and |size|. If |format| is not equal to the +diff -up chromium-112.0.5615.49/media/gpu/vaapi/va_stub_header.fragment.wayland-vaapi chromium-112.0.5615.49/media/gpu/vaapi/va_stub_header.fragment +--- chromium-112.0.5615.49/media/gpu/vaapi/va_stub_header.fragment.wayland-vaapi 2023-03-30 02:33:53.000000000 +0200 ++++ chromium-112.0.5615.49/media/gpu/vaapi/va_stub_header.fragment 2023-04-14 21:29:41.777328062 +0200 +@@ -7,8 +7,8 @@ extern "C" { + + #include + #include +-#if BUILDFLAG(USE_VAAPI_X11) ++#if BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + #include +-#endif // BUILDFLAG(USE_VAAPI_X11) ++#endif // BUILDFLAG(SUPPORT_VAAPI_OVER_X11) + + } +diff -up chromium-112.0.5615.49/ui/ozone/platform/x11/ozone_platform_x11.cc.wayland-vaapi chromium-112.0.5615.49/ui/ozone/platform/x11/ozone_platform_x11.cc +--- chromium-112.0.5615.49/ui/ozone/platform/x11/ozone_platform_x11.cc.wayland-vaapi 2023-03-30 02:34:19.000000000 +0200 ++++ chromium-112.0.5615.49/ui/ozone/platform/x11/ozone_platform_x11.cc 2023-04-14 21:29:41.778328082 +0200 +@@ -197,7 +197,7 @@ class OzonePlatformX11 : public OzonePla + properties->app_modal_dialogs_use_event_blocker = true; + properties->fetch_buffer_formats_for_gmb_on_gpu = true; + #if BUILDFLAG(IS_LINUX) +- properties->supports_vaapi = true; ++ properties->supports_vaapi_x11 = true; + #endif + + initialised = true; +diff -up chromium-112.0.5615.49/ui/ozone/public/ozone_platform.h.wayland-vaapi chromium-112.0.5615.49/ui/ozone/public/ozone_platform.h +--- chromium-112.0.5615.49/ui/ozone/public/ozone_platform.h.wayland-vaapi 2023-03-30 02:34:19.000000000 +0200 ++++ chromium-112.0.5615.49/ui/ozone/public/ozone_platform.h 2023-04-14 21:29:41.778328082 +0200 +@@ -145,12 +145,13 @@ class COMPONENT_EXPORT(OZONE) OzonePlatf + bool fetch_buffer_formats_for_gmb_on_gpu = false; + + #if BUILDFLAG(IS_LINUX) +- // TODO(crbug.com/1116701): add vaapi support for other Ozone platforms on +- // Linux. At the moment, VA-API Linux implementation supports only X11 +- // backend. This implementation must be refactored to support Ozone +- // properly. As a temporary solution, VA-API on Linux checks if vaapi is +- // supported (which implicitly means that it is Ozone/X11). +- bool supports_vaapi = false; ++ // VA-API supports different display backends. ++ // See https://github.com/intel/libva/blob/master/va/va_backend.h ++ // ++ // VA/DRM and VA/X11 are used by Chromium at the moment. All Ozone platforms ++ // support VA/DRM by default. `supports_vaapi_x11` indicates if VA/X11 ++ // supported; it is true only on Ozone/X11 platform. ++ bool supports_vaapi_x11 = false; + #endif + + // Indicates that the platform allows client applications to manipulate From 6ad637573beca37e62933d6cac8dc26a1e5dd6cf Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 17 Apr 2023 18:15:42 +0200 Subject: [PATCH 4/9] - fix vaapi issue on xwayland - fix the build order, chrome_feed_response_metadata.pb.h file not found --- ...12-check-passthrough-command-decoder.patch | 71 ++ chromium-112-feed_protos.patch | 66 -- ...eNativePixmap_NativePixmapEGLBinding.patch | 630 ++++++++++++++++++ chromium.spec | 19 +- 4 files changed, 712 insertions(+), 74 deletions(-) create mode 100644 chromium-112-check-passthrough-command-decoder.patch delete mode 100644 chromium-112-feed_protos.patch create mode 100644 chromium-112-invert_of_GLImageNativePixmap_NativePixmapEGLBinding.patch diff --git a/chromium-112-check-passthrough-command-decoder.patch b/chromium-112-check-passthrough-command-decoder.patch new file mode 100644 index 0000000..55fa1e0 --- /dev/null +++ b/chromium-112-check-passthrough-command-decoder.patch @@ -0,0 +1,71 @@ +From 041cb248e818823caaaabc67db92b16499d0416d Mon Sep 17 00:00:00 2001 +From: Vasiliy Telezhnikov +Date: Thu, 02 Feb 2023 15:42:28 +0000 +Subject: [PATCH] CHECK that passthrough command decoder is used on launched platforms + +This CL adds enforces that validating command decoder is not used on +platforms where passthrough is fully launched. We still allow to use it +by tests on linux + +Bug: 1406585 +Change-Id: Id6bc1d748fdf9c953dde76c8d4b5f59ddef60857 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4212134 +Reviewed-by: Kyle Charbonneau +Commit-Queue: Vasiliy Telezhnikov +Cr-Commit-Position: refs/heads/main@{#1100440} +--- + +diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc +index eb710696..b22dffb 100644 +--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc ++++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc +@@ -3447,7 +3447,13 @@ + outputter, group); + } + ++// Allow linux to run fuzzers. ++#if BUILDFLAG(ENABLE_VALIDATING_COMMAND_DECODER) || BUILDFLAG(IS_LINUX) + return new GLES2DecoderImpl(client, command_buffer_service, outputter, group); ++#else ++ LOG(FATAL) << "Validating command decoder is not supported."; ++ return nullptr; ++#endif + } + + GLES2DecoderImpl::GLES2DecoderImpl( +diff --git a/gpu/ipc/service/gpu_init.cc b/gpu/ipc/service/gpu_init.cc +index 40977d9b..50171e20 100644 +--- a/gpu/ipc/service/gpu_init.cc ++++ b/gpu/ipc/service/gpu_init.cc +@@ -510,8 +510,9 @@ + + auto impl = gl::GetGLImplementationParts(); + bool gl_disabled = impl == gl::kGLImplementationDisabled; +- bool is_swangle = impl == gl::ANGLEImplementation::kSwiftShader; + ++#if BUILDFLAG(ENABLE_VALIDATING_COMMAND_DECODER) ++ bool is_swangle = impl == gl::ANGLEImplementation::kSwiftShader; + // Compute passthrough decoder status before ComputeGpuFeatureInfo below. + // Do this after GL is initialized so extensions can be queried. + // Using SwANGLE forces the passthrough command decoder. +@@ -533,6 +534,20 @@ + } + gpu_preferences_.use_passthrough_cmd_decoder = + gpu_info_.passthrough_cmd_decoder; ++#else ++ // If gl is disabled passthrough/validating command decoder doesn't matter. If ++ // it's not ensure that passthrough command decoder is supported as it's our ++ // only option. ++ if (!gl_disabled) { ++ LOG_IF(FATAL, !gles2::PassthroughCommandDecoderSupported()) ++ << "Passthrough is not supported, GL is " ++ << gl::GetGLImplementationGLName(gl::GetGLImplementationParts()) ++ << ", ANGLE is " ++ << gl::GetGLImplementationANGLEName(gl::GetGLImplementationParts()); ++ gpu_info_.passthrough_cmd_decoder = true; ++ gpu_preferences_.use_passthrough_cmd_decoder = true; ++ } ++#endif + + // We need to collect GL strings (VENDOR, RENDERER) for blocklisting purposes. + if (!gl_disabled) { diff --git a/chromium-112-feed_protos.patch b/chromium-112-feed_protos.patch deleted file mode 100644 index 222d439..0000000 --- a/chromium-112-feed_protos.patch +++ /dev/null @@ -1,66 +0,0 @@ -Split out ios shared feed protos - -chrome_feed_response_metadata.proto is needed in ios so split it out -so it can be separately compiled into ios. - -Change-Id: I9e5e50f5e1742258f5c8197d54f0c610b56daf4b -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4266050 -Commit-Queue: edchin -Reviewed-by: Dan H -Cr-Commit-Position: refs/heads/main@{#1107357} -diff --git a/components/feed/core/proto/BUILD.gn b/components/feed/core/proto/BUILD.gn -index 51916e08..f0ec531 100644 ---- a/components/feed/core/proto/BUILD.gn -+++ b/components/feed/core/proto/BUILD.gn -@@ -22,7 +22,6 @@ - "v2/wire/capabilities_debug_data.proto", - "v2/wire/capability.proto", - "v2/wire/chrome_client_info.proto", -- "v2/wire/chrome_feed_response_metadata.proto", - "v2/wire/chrome_fulfillment_info.proto", - "v2/wire/client_info.proto", - "v2/wire/client_user_profiles.proto", -@@ -69,6 +68,10 @@ - ] - } - -+proto_library("proto_ios_shared_v2") { -+ sources = [ "v2/wire/chrome_feed_response_metadata.proto" ] -+} -+ - if (is_android) { - proto_java_library("proto_java_v2") { - proto_path = "../../../../" -diff --git a/components/feed/core/v2/BUILD.gn b/components/feed/core/v2/BUILD.gn -index ab5efcc4..b1d3fb4 100644 ---- a/components/feed/core/v2/BUILD.gn -+++ b/components/feed/core/v2/BUILD.gn -@@ -172,6 +172,7 @@ - ":ios_shared", - "//base", - "//components/feed/core/common:feed_core_common", -+ "//components/feed/core/proto:proto_ios_shared_v2", - "//components/feed/core/proto:proto_v2", - ] - } -@@ -187,7 +188,7 @@ - deps = [ - "//base", - "//components/feed/core/common:feed_core_common", -- "//components/feed/core/proto:proto_v2", -+ "//components/feed/core/proto:proto_ios_shared_v2", - "//components/prefs", - ] - } -diff --git a/components/feed/core/v2/public/ios/BUILD.gn b/components/feed/core/v2/public/ios/BUILD.gn -index 106f089a..59bdd2b 100644 ---- a/components/feed/core/v2/public/ios/BUILD.gn -+++ b/components/feed/core/v2/public/ios/BUILD.gn -@@ -25,7 +25,6 @@ - deps = [ - ":feed_ios_public", - "//base/test:test_support", -- "//components/feed/core/v2:feed_core_v2", - "//components/prefs", - "//components/prefs:test_support", - "//testing/gmock", diff --git a/chromium-112-invert_of_GLImageNativePixmap_NativePixmapEGLBinding.patch b/chromium-112-invert_of_GLImageNativePixmap_NativePixmapEGLBinding.patch new file mode 100644 index 0000000..80fe156 --- /dev/null +++ b/chromium-112-invert_of_GLImageNativePixmap_NativePixmapEGLBinding.patch @@ -0,0 +1,630 @@ +commit 7f0858c08dcef70ca26ce8527bbedfcc5c5218d3 +Author: Colin Blundell +Date: Thu Feb 23 14:19:33 2023 +0000 + + [Ozone] Invert layering of GLImageNativePixmap & NativePixmapEGLBinding + + NativePixmapEGLBinding is currently a thin layer on top of + GLImageNativePixmap. This CL inverts the layering so that + GLImageNativePixmap instead sits on top of NativePixmapEGLBinding + (via the public Ozone ImportNativePixmap() method, for which all + implementations return NativePixmapEGLBinding). Note that this entails + moving GLImageNativePixmap into //gpu, as //ui/gl cannot depend on + //ozone/public. + + This inversion means that + (a) the SharedImage Ozone backing/representations no longer use GLImage + (b) when we no longer need GLImageNativePixmap we can simply directly + eliminate it. + + Followup CLs will fold NativePixmapEGLBindingHelper into + NativePixmapEGLBinding and make GLImageNativePixmap creation private + with friending to ensure that no more usage of the deprecated class + creeps in. + + Bug: 1412692 + Change-Id: I5f01e9b1f616dd99b61cd203662d0d02d3da7b3e + Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4262390 + Reviewed-by: Vasiliy Telezhnikov + Reviewed-by: ccameron chromium + Reviewed-by: Andres Calderon Jaramillo + Commit-Queue: Colin Blundell + Cr-Commit-Position: refs/heads/main@{#1108909} + +diff --git a/gpu/command_buffer/service/BUILD.gn b/gpu/command_buffer/service/BUILD.gn +index d08be597e3e5d..5ad724dd57bbb 100644 +--- a/gpu/command_buffer/service/BUILD.gn ++++ b/gpu/command_buffer/service/BUILD.gn +@@ -397,6 +397,8 @@ target(link_target_type, "gles2_sources") { + + if (use_ozone) { + sources += [ ++ "shared_image/gl_image_native_pixmap.cc", ++ "shared_image/gl_image_native_pixmap.h", + "shared_image/gl_ozone_image_representation.cc", + "shared_image/gl_ozone_image_representation.h", + "shared_image/ozone_image_backing.cc", +diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc +index e3f5b3c5721cf..a297347c19670 100644 +--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc ++++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc +@@ -120,10 +120,10 @@ + #endif + + #if BUILDFLAG(IS_OZONE) ++#include "gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h" + #include "ui/gfx/buffer_format_util.h" + #include "ui/gfx/buffer_usage_util.h" + #include "ui/gfx/native_pixmap.h" +-#include "ui/gl/gl_image_native_pixmap.h" + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" + #endif +@@ -499,7 +499,7 @@ class BackTexture { + #if BUILDFLAG(IS_OZONE) + // The image that backs the texture, if its backed by a native + // GpuMemoryBuffer. +- scoped_refptr image_; ++ scoped_refptr image_; + #endif + }; + +@@ -2522,7 +2522,7 @@ class GLES2DecoderImpl : public GLES2Decoder, + // Note: Creation of anonymous images is possible only on Ozone. + #if BUILDFLAG(IS_OZONE) + bool SupportsCreateAnonymousImage(); +- scoped_refptr CreateAnonymousImage( ++ scoped_refptr CreateAnonymousImage( + const gfx::Size& size, + gfx::BufferFormat format, + bool* is_cleared, +@@ -3242,7 +3242,7 @@ bool BackTexture::AllocateNativeGpuMemoryBuffer(const gfx::Size& size, + // duplicate BGRX_8888. + buffer_format = gfx::BufferFormat::BGRX_8888; + } +- scoped_refptr image = decoder_->CreateAnonymousImage( ++ scoped_refptr image = decoder_->CreateAnonymousImage( + size, buffer_format, &is_cleared, Target(), id()); + if (!image) + return false; +@@ -19592,7 +19592,7 @@ bool GLES2DecoderImpl::SupportsCreateAnonymousImage() { + .supports_native_pixmaps; + } + +-scoped_refptr GLES2DecoderImpl::CreateAnonymousImage( ++scoped_refptr GLES2DecoderImpl::CreateAnonymousImage( + const gfx::Size& size, + gfx::BufferFormat format, + bool* is_cleared, +@@ -19612,8 +19612,8 @@ scoped_refptr GLES2DecoderImpl::CreateAnonymousImage( + << gfx::BufferUsageToString(usage); + return nullptr; + } +- auto image = gl::GLImageNativePixmap::Create(size, format, std::move(pixmap), +- target, texture_id); ++ auto image = GLImageNativePixmap::Create(size, format, std::move(pixmap), ++ target, texture_id); + if (!image) { + LOG(ERROR) << "Failed to create GLImage " << size.ToString() << ", " + << gfx::BufferFormatToString(format) << ", usage " +diff --git a/ui/gl/gl_image_native_pixmap.cc b/gpu/command_buffer/service/shared_image/gl_image_native_pixmap.cc +similarity index 73% +rename from ui/gl/gl_image_native_pixmap.cc +rename to gpu/command_buffer/service/shared_image/gl_image_native_pixmap.cc +index 6cbe7be2899de..d9101fbda893b 100644 +--- a/ui/gl/gl_image_native_pixmap.cc ++++ b/gpu/command_buffer/service/shared_image/gl_image_native_pixmap.cc +@@ -2,9 +2,13 @@ + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + +-#include "ui/gl/gl_image_native_pixmap.h" ++#include "gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h" + +-namespace gl { ++#include "ui/ozone/public/native_pixmap_gl_binding.h" ++#include "ui/ozone/public/ozone_platform.h" ++#include "ui/ozone/public/surface_factory_ozone.h" ++ ++namespace gpu { + + scoped_refptr GLImageNativePixmap::Create( + const gfx::Size& size, +@@ -47,18 +51,18 @@ bool GLImageNativePixmap::InitializeFromNativePixmap( + const gfx::ColorSpace& color_space, + GLenum target, + GLuint texture_id) { +- binding_helper_ = NativePixmapEGLBindingHelper::CreateForPlane( +- size_, format, plane, std::move(pixmap), color_space, target, texture_id); ++ pixmap_gl_binding_ = ++ ui::OzonePlatform::GetInstance() ++ ->GetSurfaceFactoryOzone() ++ ->GetCurrentGLOzone() ++ ->ImportNativePixmap(std::move(pixmap), format, plane, size_, ++ color_space, target, texture_id); + +- return !!binding_helper_; ++ return !!pixmap_gl_binding_; + } + + gfx::Size GLImageNativePixmap::GetSize() { + return size_; + } + +-unsigned GLImageNativePixmap::GetInternalFormat() { +- return binding_helper_->GetInternalFormat(); +-} +- +-} // namespace gl ++} // namespace gpu +diff --git a/ui/gl/gl_image_native_pixmap.h b/gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h +similarity index 72% +rename from ui/gl/gl_image_native_pixmap.h +rename to gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h +index 5ff5e91b3ec18..4087360b04b45 100644 +--- a/ui/gl/gl_image_native_pixmap.h ++++ b/gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h +@@ -2,21 +2,24 @@ + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + +-#ifndef UI_GL_GL_IMAGE_NATIVE_PIXMAP_H_ +-#define UI_GL_GL_IMAGE_NATIVE_PIXMAP_H_ ++#ifndef GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_GL_IMAGE_NATIVE_PIXMAP_H_ ++#define GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_GL_IMAGE_NATIVE_PIXMAP_H_ + + #include + ++#include "gpu/gpu_gles2_export.h" + #include "ui/gfx/color_space.h" + #include "ui/gfx/native_pixmap.h" + #include "ui/gl/gl_bindings.h" +-#include "ui/gl/gl_export.h" + #include "ui/gl/gl_image.h" +-#include "ui/gl/native_pixmap_egl_binding_helper.h" + +-namespace gl { ++namespace ui { ++class NativePixmapGLBinding; ++} + +-class GL_EXPORT GLImageNativePixmap : public GLImage { ++namespace gpu { ++ ++class GPU_GLES2_EXPORT GLImageNativePixmap : public gl::GLImage { + public: + // Create an EGLImage from a given NativePixmap and bind |texture_id| to + // |target| following by binding the image to |target|. +@@ -41,22 +44,15 @@ class GL_EXPORT GLImageNativePixmap : public GLImage { + GLenum target, + GLuint texture_id); + +- // Get the GL internal format of the image. +- // It is aligned with glTexImage{2|3}D's parameter |internalformat|. +- unsigned GetInternalFormat(); +- + // Overridden from GLImage: + gfx::Size GetSize() override; + +- protected: +- ~GLImageNativePixmap() override; +- + private: + explicit GLImageNativePixmap(const gfx::Size& size); ++ ~GLImageNativePixmap() override; + +- // Create an EGLImage from a given NativePixmap and bind |texture_id| to +- // |target| followed by binding the image to |target|. This EGLImage can be +- // converted to a GL texture. ++ // Create a NativePixmapGLBinding from a given NativePixmap. Returns true iff ++ // the binding was successfully created. + bool InitializeFromNativePixmap(gfx::BufferFormat format, + gfx::BufferPlane plane, + scoped_refptr pixmap, +@@ -64,10 +60,10 @@ class GL_EXPORT GLImageNativePixmap : public GLImage { + GLenum target, + GLuint texture_id); + +- std::unique_ptr binding_helper_; ++ std::unique_ptr pixmap_gl_binding_; + const gfx::Size size_; + }; + +-} // namespace gl ++} // namespace gpu + +-#endif // UI_GL_GL_IMAGE_NATIVE_PIXMAP_H_ ++#endif // GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_GL_IMAGE_NATIVE_PIXMAP_H_ +diff --git a/gpu/command_buffer/service/shared_image/gl_ozone_image_representation.h b/gpu/command_buffer/service/shared_image/gl_ozone_image_representation.h +index 31723894088e1..ade337bde9966 100644 +--- a/gpu/command_buffer/service/shared_image/gl_ozone_image_representation.h ++++ b/gpu/command_buffer/service/shared_image/gl_ozone_image_representation.h +@@ -14,7 +14,6 @@ + #include "gpu/command_buffer/service/shared_image/shared_image_representation.h" + #include "gpu/command_buffer/service/texture_manager.h" + #include "ui/gfx/native_pixmap.h" +-#include "ui/gl/gl_image_native_pixmap.h" + #include "ui/ozone/public/native_pixmap_gl_binding.h" + + namespace gpu { +diff --git a/gpu/command_buffer/service/shared_image/ozone_image_backing.cc b/gpu/command_buffer/service/shared_image/ozone_image_backing.cc +index 8d4a7d9306eb1..7a652ae425c0e 100644 +--- a/gpu/command_buffer/service/shared_image/ozone_image_backing.cc ++++ b/gpu/command_buffer/service/shared_image/ozone_image_backing.cc +@@ -36,7 +36,6 @@ + #include "ui/gfx/native_pixmap.h" + #include "ui/gfx/native_widget_types.h" + #include "ui/gl/buildflags.h" +-#include "ui/gl/gl_image_native_pixmap.h" + + #if BUILDFLAG(ENABLE_VULKAN) + #include "gpu/command_buffer/service/shared_image/skia_vk_ozone_image_representation.h" +diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn +index 12e6b66cf7b89..ff7b5a1a50a38 100644 +--- a/media/gpu/v4l2/BUILD.gn ++++ b/media/gpu/v4l2/BUILD.gn +@@ -98,6 +98,7 @@ source_set("v4l2") { + ":libv4l2_stubs", + ":v4l2_status", + "//base", ++ "//gpu/command_buffer/service:gles2", + "//gpu/ipc/common", + "//gpu/ipc/service", + "//media", +diff --git a/media/gpu/v4l2/generic_v4l2_device.cc b/media/gpu/v4l2/generic_v4l2_device.cc +index bdbb256ed578c..337ec0e7b372b 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.cc ++++ b/media/gpu/v4l2/generic_v4l2_device.cc +@@ -23,6 +23,7 @@ + #include "base/strings/stringprintf.h" + #include "base/trace_event/trace_event.h" + #include "build/build_config.h" ++#include "gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h" + #include "media/base/video_types.h" + #include "media/gpu/buildflags.h" + #include "media/gpu/chromeos/fourcc.h" +@@ -32,7 +33,6 @@ + #include "ui/gfx/native_pixmap_handle.h" + #include "ui/gl/egl_util.h" + #include "ui/gl/gl_bindings.h" +-#include "ui/gl/gl_image_native_pixmap.h" + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" + +@@ -281,7 +281,7 @@ EGLImageKHR GenericV4L2Device::CreateEGLImage( + return egl_image; + } + +-scoped_refptr GenericV4L2Device::CreateGLImage( ++scoped_refptr GenericV4L2Device::CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle, +@@ -317,7 +317,7 @@ scoped_refptr GenericV4L2Device::CreateGLImage( + DCHECK(pixmap); + + // TODO(b/220336463): plumb the right color space. +- auto image = gl::GLImageNativePixmap::Create( ++ auto image = gpu::GLImageNativePixmap::Create( + size, buffer_format, std::move(pixmap), target, texture_id); + DCHECK(image); + return image; +diff --git a/media/gpu/v4l2/generic_v4l2_device.h b/media/gpu/v4l2/generic_v4l2_device.h +index bb9ce391c15bd..fd84aee27097e 100644 +--- a/media/gpu/v4l2/generic_v4l2_device.h ++++ b/media/gpu/v4l2/generic_v4l2_device.h +@@ -55,7 +55,7 @@ class GenericV4L2Device : public V4L2Device { + const Fourcc fourcc, + gfx::NativePixmapHandle handle) const override; + +- scoped_refptr CreateGLImage( ++ scoped_refptr CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle, +diff --git a/media/gpu/v4l2/v4l2_device.h b/media/gpu/v4l2/v4l2_device.h +index bdc39bf65ae38..ee74cbcd39957 100644 +--- a/media/gpu/v4l2/v4l2_device.h ++++ b/media/gpu/v4l2/v4l2_device.h +@@ -28,6 +28,7 @@ + #include "base/files/scoped_file.h" + #include "base/memory/ref_counted.h" + #include "base/sequence_checker.h" ++#include "gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h" + #include "media/base/video_codecs.h" + #include "media/base/video_decoder_config.h" + #include "media/base/video_frame.h" +@@ -42,7 +43,6 @@ + #include "ui/gfx/geometry/size.h" + #include "ui/gfx/native_pixmap_handle.h" + #include "ui/gl/gl_bindings.h" +-#include "ui/gl/gl_image_native_pixmap.h" + + // TODO(mojahsu): remove this once V4L2 headers are updated. + #ifndef V4L2_PIX_FMT_JPEG_RAW +@@ -777,7 +777,7 @@ class MEDIA_GPU_EXPORT V4L2Device + + // Create a GLImageNativePixmap from provided |handle|, taking full ownership + // of it. +- virtual scoped_refptr CreateGLImage( ++ virtual scoped_refptr CreateGLImage( + const gfx::Size& size, + const Fourcc fourcc, + gfx::NativePixmapHandle handle, +diff --git a/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc +index a51acedc105b7..78cc605e986e6 100644 +--- a/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc ++++ b/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc +@@ -30,6 +30,7 @@ + #include "base/time/time.h" + #include "base/trace_event/memory_dump_manager.h" + #include "base/trace_event/trace_event.h" ++#include "gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h" + #include "media/base/bind_to_current_loop.h" + #include "media/base/media_switches.h" + #include "media/base/scopedfd_helper.h" +@@ -49,7 +50,6 @@ + #include "ui/gl/gl_bindings.h" + #include "ui/gl/gl_context.h" + #include "ui/gl/gl_display.h" +-#include "ui/gl/gl_image_native_pixmap.h" + #include "ui/gl/gl_surface_egl.h" + #include "ui/gl/scoped_binders.h" + +@@ -1444,7 +1444,7 @@ void V4L2SliceVideoDecodeAccelerator::CreateGLImageFor( + return; + } + +- scoped_refptr gl_image = ++ scoped_refptr gl_image = + gl_device->CreateGLImage(visible_size, fourcc, std::move(handle), + gl_device->GetTextureTarget(), texture_id); + if (!gl_image) { +diff --git a/media/gpu/vaapi/BUILD.gn b/media/gpu/vaapi/BUILD.gn +index 1ecf8854d02e7..7687384553806 100644 +--- a/media/gpu/vaapi/BUILD.gn ++++ b/media/gpu/vaapi/BUILD.gn +@@ -96,6 +96,7 @@ source_set("vaapi") { + ":vaapi_status", + "//base", + "//build:chromeos_buildflags", ++ "//gpu/command_buffer/service:gles2", + "//gpu/config", + "//gpu/ipc/common", + "//gpu/ipc/service", +diff --git a/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc b/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc +index 06617ffec8e5a..626dda6312213 100644 +--- a/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc ++++ b/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc +@@ -4,6 +4,7 @@ + + #include "media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h" + ++#include "gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h" + #include "media/base/format_utils.h" + #include "media/gpu/buffer_validation.h" + #include "media/gpu/chromeos/platform_video_frame_utils.h" +@@ -15,7 +16,6 @@ + #include "ui/gfx/linux/native_pixmap_dmabuf.h" + #include "ui/gfx/native_pixmap.h" + #include "ui/gl/gl_bindings.h" +-#include "ui/gl/gl_image_native_pixmap.h" + #include "ui/gl/scoped_binders.h" + #include "ui/ozone/public/ozone_platform.h" + #include "ui/ozone/public/surface_factory_ozone.h" +@@ -87,7 +87,7 @@ VaapiStatus VaapiPictureNativePixmapOzone::Initialize( + const gfx::BufferFormat format = pixmap->GetBufferFormat(); + + // TODO(b/220336463): plumb the right color space. +- auto image = gl::GLImageNativePixmap::Create( ++ auto image = gpu::GLImageNativePixmap::Create( + visible_size_, format, std::move(pixmap), + base::strict_cast(texture_target_), + base::strict_cast(texture_id_)); +diff --git a/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h b/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h +index 101728f36c1e1..eaced9a8ccadf 100644 +--- a/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h ++++ b/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h +@@ -17,7 +17,7 @@ namespace gfx { + class NativePixmap; + } // namespace gfx + +-namespace gl { ++namespace gpu { + class GLImageNativePixmap; + } + +@@ -55,7 +55,7 @@ class VaapiPictureNativePixmapOzone : public VaapiPictureNativePixmap { + VaapiStatus Initialize(scoped_refptr pixmap); + + // GLImage bound to the GL textures used by the VDA client. +- scoped_refptr gl_image_; ++ scoped_refptr gl_image_; + }; + + } // namespace media +diff --git a/ui/gfx/linux/native_pixmap_dmabuf.h b/ui/gfx/linux/native_pixmap_dmabuf.h +index 7f134110417ea..f12d4f5eac89d 100644 +--- a/ui/gfx/linux/native_pixmap_dmabuf.h ++++ b/ui/gfx/linux/native_pixmap_dmabuf.h +@@ -17,7 +17,7 @@ + namespace gfx { + + // This class converts a gfx::NativePixmapHandle to a gfx::NativePixmap. +-// It is useful because gl::GLImageNativePixmap::Initialize only takes ++// It is useful because gpu::GLImageNativePixmap::Initialize only takes + // a gfx::NativePixmap as input. + class GFX_EXPORT NativePixmapDmaBuf : public gfx::NativePixmap { + public: +diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn +index cc23c0a8b4c64..2a07859c4dad8 100644 +--- a/ui/gl/BUILD.gn ++++ b/ui/gl/BUILD.gn +@@ -226,8 +226,6 @@ component("gl") { + + if (is_linux || is_chromeos || use_ozone) { + sources += [ +- "gl_image_native_pixmap.cc", +- "gl_image_native_pixmap.h", + "native_pixmap_egl_binding_helper.cc", + "native_pixmap_egl_binding_helper.h", + ] +diff --git a/ui/ozone/common/native_pixmap_egl_binding.cc b/ui/ozone/common/native_pixmap_egl_binding.cc +index 8dce01a41281e..2e18e73eb6cbb 100644 +--- a/ui/ozone/common/native_pixmap_egl_binding.cc ++++ b/ui/ozone/common/native_pixmap_egl_binding.cc +@@ -8,7 +8,7 @@ + #include "base/memory/scoped_refptr.h" + #include "base/notreached.h" + #include "ui/gl/gl_bindings.h" +-#include "ui/gl/gl_image_native_pixmap.h" ++#include "ui/gl/native_pixmap_egl_binding_helper.h" + + namespace ui { + +@@ -50,9 +50,9 @@ unsigned BufferFormatToGLDataType(gfx::BufferFormat format) { + } // namespace + + NativePixmapEGLBinding::NativePixmapEGLBinding( +- scoped_refptr gl_image, ++ std::unique_ptr binding_helper, + gfx::BufferFormat format) +- : gl_image_(std::move(gl_image)), format_(format) {} ++ : binding_helper_(std::move(binding_helper)), format_(format) {} + NativePixmapEGLBinding::~NativePixmapEGLBinding() = default; + + // static +@@ -64,22 +64,22 @@ std::unique_ptr NativePixmapEGLBinding::Create( + const gfx::ColorSpace& color_space, + GLenum target, + GLuint texture_id) { +- auto gl_image = gl::GLImageNativePixmap::CreateForPlane( ++ auto binding_helper = gl::NativePixmapEGLBindingHelper::CreateForPlane( + plane_size, plane_format, plane, std::move(pixmap), color_space, target, + texture_id); +- if (!gl_image) { +- LOG(ERROR) << "Unable to initialize GL image from pixmap"; ++ if (!binding_helper) { ++ LOG(ERROR) << "Unable to initialize binding from pixmap"; + return nullptr; + } + +- auto binding = std::make_unique(std::move(gl_image), +- plane_format); ++ auto binding = std::make_unique( ++ std::move(binding_helper), plane_format); + + return binding; + } + + GLuint NativePixmapEGLBinding::GetInternalFormat() { +- return gl_image_->GetInternalFormat(); ++ return binding_helper_->GetInternalFormat(); + } + + GLenum NativePixmapEGLBinding::GetDataType() { +diff --git a/ui/ozone/common/native_pixmap_egl_binding.h b/ui/ozone/common/native_pixmap_egl_binding.h +index 44d68be3527a4..c0382b1068426 100644 +--- a/ui/ozone/common/native_pixmap_egl_binding.h ++++ b/ui/ozone/common/native_pixmap_egl_binding.h +@@ -15,16 +15,17 @@ class ColorSpace; + } + + namespace gl { +-class GLImageNativePixmap; ++class NativePixmapEGLBindingHelper; + } + + namespace ui { + +-// A binding maintained between GLImageNativePixmap and GL Textures in Ozone. ++// A binding maintained between NativePixmap and GL Textures in Ozone. + class NativePixmapEGLBinding : public NativePixmapGLBinding { + public: +- NativePixmapEGLBinding(scoped_refptr gl_image, +- gfx::BufferFormat format); ++ NativePixmapEGLBinding( ++ std::unique_ptr binding_helper, ++ gfx::BufferFormat format); + ~NativePixmapEGLBinding() override; + + static std::unique_ptr Create( +@@ -41,10 +42,7 @@ class NativePixmapEGLBinding : public NativePixmapGLBinding { + GLenum GetDataType() override; + + private: +- // TODO(hitawala): Merge BindTexImage, Initialize from GLImage and its +- // subclass NativePixmap to NativePixmapEGLBinding once we stop using them +- // elsewhere eg. VDA decoders in media. +- scoped_refptr gl_image_; ++ std::unique_ptr binding_helper_; + + gfx::BufferFormat format_; + }; +diff --git a/ui/ozone/gl/BUILD.gn b/ui/ozone/gl/BUILD.gn +index 4fc90f0471362..6064eb6f83a8c 100644 +--- a/ui/ozone/gl/BUILD.gn ++++ b/ui/ozone/gl/BUILD.gn +@@ -9,6 +9,14 @@ test("ozone_gl_unittests") { + + deps = [ + "//base/test:test_support", ++ ++ # NOTE: The above tests of gpu::GLImageNativePixmap cannot easily be made ++ # to run as part of //gpu's gl_tests or gpu_unittests: they crash when run ++ # with the former due to differences in GL configuration, and they are ++ # skipped when run with the latter due to differences in Ozone ++ # configuration. Simply leave them here with this dependency for the short ++ # time remaining until GLImageNativePixmap is eliminated altogether. ++ "//gpu/command_buffer/service:gles2", + "//testing/gtest", + "//ui/gfx", + "//ui/gl:run_all_unittests", +diff --git a/ui/ozone/gl/DEPS b/ui/ozone/gl/DEPS +new file mode 100644 +index 0000000000000..e6142e85d2154 +--- /dev/null ++++ b/ui/ozone/gl/DEPS +@@ -0,0 +1,6 @@ ++specific_include_rules = { ++ # NOTE: See comment in ./BUILD.gn with respect to this dependency. ++ "gl_image_ozone_native_pixmap_unittest\.cc": [ ++ "+gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h", ++ ], ++} +diff --git a/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc b/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc +index 9a538903c8ff0..1527df91a3238 100644 +--- a/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc ++++ b/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc +@@ -5,10 +5,10 @@ + #include + #include + ++#include "gpu/command_buffer/service/shared_image/gl_image_native_pixmap.h" + #include "testing/gtest/include/gtest/gtest.h" + #include "ui/gfx/buffer_types.h" + #include "ui/gfx/client_native_pixmap.h" +-#include "ui/gl/gl_image_native_pixmap.h" + #include "ui/gl/test/gl_image_test_template.h" + #include "ui/ozone/public/client_native_pixmap_factory_ozone.h" + #include "ui/ozone/public/ozone_platform.h" +@@ -83,7 +83,7 @@ class GLImageNativePixmapTestDelegate : public GLImageTestDelegateBase { + glGenTextures(1, &texture_id_); + } + +- auto image = gl::GLImageNativePixmap::Create( ++ auto image = gpu::GLImageNativePixmap::Create( + size, format, std::move(pixmap), GetTextureTarget(), texture_id_); + EXPECT_TRUE(image); + return image; +@@ -100,8 +100,9 @@ class GLImageNativePixmapTestDelegate : public GLImageTestDelegateBase { + format == gfx::BufferFormat::YUV_420_BIPLANAR) { + return 1; + } +- if (format == gfx::BufferFormat::P010) ++ if (format == gfx::BufferFormat::P010) { + return 3; ++ } + return 0; + } + diff --git a/chromium.spec b/chromium.spec index 6fc5717..466c29e 100644 --- a/chromium.spec +++ b/chromium.spec @@ -347,9 +347,6 @@ Patch106: chromium-98.0.4758.80-epel7-erase-fix.patch # Add additional operator== to make el7 happy. Patch107: chromium-99.0.4844.51-el7-extra-operator==.patch -# Split out ios shared feed protos -Patch108: chromium-112-feed_protos.patch - # system ffmpeg Patch114: chromium-107-ffmpeg-duration.patch Patch115: chromium-107-proprietary-codecs.patch @@ -370,6 +367,8 @@ Patch146: chromium-110-LargerThan4k.patch # VAAPI # Upstream turned VAAPI on in Linux in 86 Patch202: chromium-104.0.5112.101-enable-hardware-accelerated-mjpeg.patch +Patch203: chromium-112-check-passthrough-command-decoder.patch +Patch204: chromium-112-invert_of_GLImageNativePixmap_NativePixmapEGLBinding.patch Patch205: chromium-86.0.4240.75-fix-vaapi-on-intel.patch Patch206: chromium-112-ozone-wayland-vaapi-support.patch Patch207: chromium-112-enable-vaapi-ozone-wayland.patch @@ -425,7 +424,7 @@ BuildRequires: %{toolset}-%{dts_version}-libatomic-devel %if 0%{?rhel} == 7 || 0%{?rhel} == 8 BuildRequires: %{toolset}-%{dts_version}-toolchain, %{toolset}-%{dts_version}-libatomic-devel %endif -%if 0{?fedora} || 0%{?rhel} > 8 +%if 0%{?fedora} || 0%{?rhel} > 8 BuildRequires: gcc-c++ BuildRequires: gcc BuildRequires: binutils @@ -958,10 +957,6 @@ udev. %patch -P107 -p1 -b .el7-extra-operator-equalequal %endif -%if 0%{?fedora} == 37 -%patch -P108 -p1 -R -b .chrome_feed_response_metadata -%endif - %patch -P130 -p1 -b .VirtualCursor-std-layout %patch -P146 -p1 -b .LargerThan4k @@ -971,6 +966,8 @@ udev. # Feature specific patches %if %{use_vaapi} %patch -P202 -p1 -b .accel-mjpeg +%patch -P203 -p1 -R -b .revert +%patch -P204 -p1 -R -b .revert %patch -P205 -p1 -b .vaapi-intel-fix %patch -P206 -p1 -b .wayland-vaapi %patch -P207 -p1 -b .enable-wayland-vaapi @@ -1040,9 +1037,11 @@ sed -i 's|moc|moc-qt5|g' ui/qt/moc_wrapper.py export LANG=en_US.UTF-8 # reduce warnings +%if %{clang} FLAGS=' -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-unused-command-line-argument' FLAGS+=' -Wno-unused-but-set-variable -Wno-unused-result -Wno-unused-function -Wno-unused-variable' FLAGS+=' -Wno-unused-const-variable -Wno-unneeded-internal-declaration' +%endif %if %{system_build_flags} CFLAGS=${CFLAGS/-g } @@ -1279,9 +1278,13 @@ mkdir -p %{builddir} && cp -a %{_bindir}/gn %{builddir}/ %if %{build_headless} # Do headless first. +# workaround for build dependency +%build_target %{headlessbuilddir} gen/components/feed/core/proto/v2/wire/chrome_feed_response_metadata.pb.h %build_target %{headlessbuilddir} headless_shell %endif +# workaround for build dependency +%build_target %{builddir} gen/components/feed/core/proto/v2/wire/chrome_feed_response_metadata.pb.h %build_target %{builddir} chrome %build_target %{builddir} chrome_sandbox %build_target %{builddir} chromedriver From 62f1aa0668579a4a32477a09e8e867954c15d51c Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 17 Apr 2023 18:21:01 +0200 Subject: [PATCH 5/9] try to build with use_all_cpus=1 --- chromium.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromium.spec b/chromium.spec index 466c29e..f6eaadd 100644 --- a/chromium.spec +++ b/chromium.spec @@ -21,7 +21,7 @@ # This flag is so I can build things very fast on a giant system. # Enabling this in koji causes aarch64 builds to timeout indefinitely. -%global use_all_cpus 0 +%global use_all_cpus 1 %if %{use_all_cpus} %global numjobs %{_smp_build_ncpus} From 1960712b03e2dd57f7807e00ca44d124db797e2f Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 17 Apr 2023 18:25:19 +0200 Subject: [PATCH 6/9] bump release --- chromium.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chromium.spec b/chromium.spec index f6eaadd..a984855 100644 --- a/chromium.spec +++ b/chromium.spec @@ -242,7 +242,7 @@ Name: chromium%{chromium_channel} Version: 112.0.5615.121 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A WebKit (Blink) powered web browser that Google doesn't want you to use Url: http://www.chromium.org/Home License: BSD-3-Clause AND LGPL-2.1-or-later AND Apache-2.0 AND IJG AND MIT AND GPL-2.0-or-later AND ISC AND OpenSSL AND (MPL-1.1 OR GPL-2.0-only OR LGPL-2.0-only) @@ -1656,6 +1656,11 @@ getent group chrome-remote-desktop >/dev/null || groupadd -r chrome-remote-deskt %{chromium_path}/chromedriver %changelog +* Mon Apr 17 2023 Than Ngo - 112.0.5615.121-2 +- fix vaapi issue on xwayland +- fix the build order, chrome_feed_response_metadata.pb.h file not found +- fix compiler flags and typo + * Sat Apr 15 2023 Than Ngo - 112.0.5615.121-1 - update to 112.0.5615.121 From 82c025e54969b1d84cdd904e40bbd7fef9f496ff Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 17 Apr 2023 20:17:03 +0200 Subject: [PATCH 7/9] cleanup --- chromium.spec | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/chromium.spec b/chromium.spec index a984855..ba08b47 100644 --- a/chromium.spec +++ b/chromium.spec @@ -1060,16 +1060,18 @@ CXXFLAGS="$FLAGS" %if %{clang} export CC=clang export CXX=clang++ +export AR=llvm-ar +export NM=llvm-nm +export READELF=llvm-readelf %else export CC=gcc export CXX=g++ +export AR="ar" +export NM="nm" +export READELF="readelf" %endif export CFLAGS export CXXFLAGS -export LDFLAGS="$LDFLAGS -Wl,--threads=4" -export AR="llvm-ar" -export NM="llvm-nm" -export READELF="llvm-readelf" # enable toolset on el7 %if 0%{?rhel} == 7 @@ -1141,6 +1143,7 @@ CHROMIUM_CORE_GN_DEFINES+=' enable_vr=false' CHROMIUM_CORE_GN_DEFINES+=' build_dawn_tests=false enable_perfetto_unittests=false' CHROMIUM_CORE_GN_DEFINES+=' disable_fieldtrial_testing_config=true' CHROMIUM_CORE_GN_DEFINES+=' blink_symbol_level=0 symbol_level=0 v8_symbol_level=0' +CHROMIUM_CORE_GN_DEFINES+=' blink_enable_generated_code_formatting=false' export CHROMIUM_CORE_GN_DEFINES # browser gn defines From 5a9eed00e068b59998572e0af0e511e87e998a86 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 17 Apr 2023 20:17:49 +0200 Subject: [PATCH 8/9] reset use_all_cpus --- chromium.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromium.spec b/chromium.spec index ba08b47..5a39f78 100644 --- a/chromium.spec +++ b/chromium.spec @@ -21,7 +21,7 @@ # This flag is so I can build things very fast on a giant system. # Enabling this in koji causes aarch64 builds to timeout indefinitely. -%global use_all_cpus 1 +%global use_all_cpus 0 %if %{use_all_cpus} %global numjobs %{_smp_build_ncpus} From a0b2c7a2290cda51317a5913ccfb87233592799e Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Thu, 20 Apr 2023 12:03:08 +0200 Subject: [PATCH 9/9] update to 112.0.5615.165 --- chromium-browser.sh | 6 ++++++ chromium.spec | 15 +++++++++------ sources | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/chromium-browser.sh b/chromium-browser.sh index 5c95ef8..492a496 100755 --- a/chromium-browser.sh +++ b/chromium-browser.sh @@ -52,4 +52,10 @@ CHROMIUM_DISTRO_FLAGS=" --enable-plugins \ --enable-sync \ --auto-ssl-client-auth @@EXTRA_FLAGS@@" +# Sanitize std{in,out,err} because they'll be shared with untrusted child +# processes (http://crbug.com/376567). +exec < /dev/null +exec > >(exec cat) +exec 2> >(exec cat >&2) + exec -a "$0" "$HERE/@@CHROMIUM_BROWSER_CHANNEL@@" $CHROMIUM_FLAGS $CHROMIUM_DISTRO_FLAGS "$@" diff --git a/chromium.spec b/chromium.spec index 5a39f78..12588eb 100644 --- a/chromium.spec +++ b/chromium.spec @@ -241,8 +241,8 @@ %endif Name: chromium%{chromium_channel} -Version: 112.0.5615.121 -Release: 2%{?dist} +Version: 112.0.5615.165 +Release: 1%{?dist} Summary: A WebKit (Blink) powered web browser that Google doesn't want you to use Url: http://www.chromium.org/Home License: BSD-3-Clause AND LGPL-2.1-or-later AND Apache-2.0 AND IJG AND MIT AND GPL-2.0-or-later AND ISC AND OpenSSL AND (MPL-1.1 OR GPL-2.0-only OR LGPL-2.0-only) @@ -977,7 +977,7 @@ udev. %patch -P300 -p1 -b .disblegnomekeyring %endif -%if 0%{?rhel} == 8 +%if %{clang} && 0%{?rhel} == 8 %patch -P301 -p1 -b .clang14_c++20 %endif @@ -1066,9 +1066,9 @@ export READELF=llvm-readelf %else export CC=gcc export CXX=g++ -export AR="ar" -export NM="nm" -export READELF="readelf" +export AR=ar +export NM=nm +export READELF=readelf %endif export CFLAGS export CXXFLAGS @@ -1659,6 +1659,9 @@ getent group chrome-remote-desktop >/dev/null || groupadd -r chrome-remote-deskt %{chromium_path}/chromedriver %changelog +* Thu Apr 20 2023 Than Ngo - 112.0.5615.165-1 +- update to 112.0.5615.165 + * Mon Apr 17 2023 Than Ngo - 112.0.5615.121-2 - fix vaapi issue on xwayland - fix the build order, chrome_feed_response_metadata.pb.h file not found diff --git a/sources b/sources index 2871077..2425ca7 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (node-v19.8.1-linux-arm64.tar.xz) = 86ff19085669e92ce7afe2fd7d4df0c5441df2d88c00f29d5463b805f3cf5625626db8aebf98349c9a495b772da1ce6d68263730018207ea98815058a1c81397 SHA512 (node-v19.8.1-linux-x64.tar.xz) = 925c0037c6b7074d0b0245bced20d0a0d9b1300f53b808106f16b5018d763f5f5b00bc321b33fa1033d736b1e1076608da9b7fcae66aed53d27b100b1186e2c6 -SHA512 (chromium-112.0.5615.121-clean.tar.xz) = 4dfb8abb5ae475f069ff18d98c6b8c5a241187ce2ed5d85d6bc6ac33efdcca6a657539df50b3836baca93190aff96676d6673a1a554b48394cb4625aaea0275d +SHA512 (chromium-112.0.5615.165-clean.tar.xz) = 68f8f4f0e8add04e608c1d285351b38de0199ac5635b29dcce653b30435e68431f92ea7b381d6fe6cb4ffd5b1910e66ed6f82aab62a8fab952cb969a40f7456a