diff --git a/.abf.yml b/.abf.yml index 56e9430..f67280e 100644 --- a/.abf.yml +++ b/.abf.yml @@ -1,5 +1,5 @@ sources: - chromium-88.0.4324.182.tar.xz: 1a7ada377e077caac581c92f001c75c23a438627 + chromium-89.0.4389.82.tar.xz: 46d40212d508e03b9cb636bb380d9b935c2b9657 chromium-gost-88.0.4324.182.tar.gz: 7ca94ebb0dbd147c6f806100b520ffdd7e0ee851 depot_tools.tar.xz: 082b7f9a4dfa7eb03900755b4866aef2d73543a5 icons.tar.bz2: a835954af164bf38f8ea4ea80608839bed7800a3 diff --git a/ALT-allow-to-override-clang-through-env-variables.patch b/ALT-allow-to-override-clang-through-env-variables.patch new file mode 100644 index 0000000..f75e480 --- /dev/null +++ b/ALT-allow-to-override-clang-through-env-variables.patch @@ -0,0 +1,43 @@ +From debe8e9f69d128e2113e53d7303f5b8e1b5604bb Mon Sep 17 00:00:00 2001 +From: Alexey Gladkov +Date: Mon, 27 Aug 2018 14:59:55 +0300 +Subject: [PATCH] ALT: allow to override clang through env variables + +--- + build/toolchain/gcc_toolchain.gni | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni +index 6e3c02444d0..bc6c6d705d3 100644 +--- a/build/toolchain/gcc_toolchain.gni ++++ b/build/toolchain/gcc_toolchain.gni +@@ -627,20 +627,27 @@ template("clang_toolchain") { + + gcc_toolchain(target_name) { + prefix = rebase_path("$clang_base_path/bin", root_build_dir) + cc = "$prefix/clang" + cxx = "$prefix/clang++" + ld = cxx + readelf = "${toolprefix}readelf" + ar = "${prefix}/llvm-ar" + nm = "${toolprefix}nm" + ++ cc = getenv("CC") ++ cxx = getenv("CXX") ++ ld = getenv("CXX") ++ readelf = getenv("READELF") ++ ar = getenv("AR") ++ nm = getenv("NM") ++ + forward_variables_from(invoker, + [ + "strip", + "default_shlib_subdir", + "enable_linker_map", + "use_unstripped_as_runtime_outputs", + ]) + + toolchain_args = { + if (defined(invoker.toolchain_args)) { +-- +2.25.4 diff --git a/BUILD.gn b/BUILD.gn deleted file mode 100644 index 78f7b57..0000000 --- a/BUILD.gn +++ /dev/null @@ -1,19 +0,0 @@ -import("//build/toolchain/gcc_toolchain.gni") - -gcc_toolchain("default") { - cc = getenv("CC") - cxx = getenv("CXX") - ar = getenv("AR") - nm = getenv("NM") - ld = cxx - - extra_cflags = getenv("CFLAGS") - extra_cppflags = getenv("CPPFLAGS") - extra_cxxflags = getenv("CXXFLAGS") - extra_ldflags = getenv("LDFLAGS") - - toolchain_args = { - current_cpu = current_cpu - current_os = current_os - } -} diff --git a/build-with-pipewire-0.3.patch b/build-with-pipewire-0.3.patch deleted file mode 100644 index 4edcd44..0000000 --- a/build-with-pipewire-0.3.patch +++ /dev/null @@ -1,793 +0,0 @@ -Index: chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/BUILD.gn -=================================================================== ---- chromium-83.0.4103.116.orig/third_party/webrtc/modules/desktop_capture/BUILD.gn -+++ chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/BUILD.gn -@@ -196,7 +196,7 @@ if (is_linux) { - - if (rtc_link_pipewire) { - pkg_config("pipewire") { -- packages = [ "libpipewire-0.2" ] -+ packages = [ "libpipewire-${rtc_use_pipewire_version}", "libspa-${rtc_use_spa_version}" ] - } - } else { - # When libpipewire is not directly linked, use stubs to allow for dlopening of -Index: chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc -=================================================================== ---- chromium-83.0.4103.116.orig/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc -+++ chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc -@@ -14,8 +14,11 @@ - #include - #include - #include --#include --#include -+ -+#include -+#include -+#include -+#include - - #include - #include -@@ -51,31 +54,35 @@ const char kPipeWireLib[] = "libpipewire - #endif - - // static --void BaseCapturerPipeWire::OnStateChanged(void* data, -- pw_remote_state old_state, -- pw_remote_state state, -- const char* error_message) { -- BaseCapturerPipeWire* that = static_cast(data); -- RTC_DCHECK(that); -+void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) { -+ struct dma_buf_sync sync = { 0 }; - -- switch (state) { -- case PW_REMOTE_STATE_ERROR: -- RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message; -- break; -- case PW_REMOTE_STATE_CONNECTED: -- RTC_LOG(LS_INFO) << "PipeWire remote state: connected."; -- that->CreateReceivingStream(); -- break; -- case PW_REMOTE_STATE_CONNECTING: -- RTC_LOG(LS_INFO) << "PipeWire remote state: connecting."; -+ sync.flags = start_or_end | DMA_BUF_SYNC_READ; -+ -+ while(true) { -+ int ret; -+ ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync); -+ if (ret == -1 && errno == EINTR) { -+ continue; -+ } else if (ret == -1) { -+ RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: " << g_strerror(errno); - break; -- case PW_REMOTE_STATE_UNCONNECTED: -- RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected."; -+ } else { - break; -+ } - } - } - - // static -+void BaseCapturerPipeWire::OnCoreError(void *data, -+ uint32_t id, -+ int seq, -+ int res, -+ const char *message) { -+ RTC_LOG(LS_ERROR) << "core error: " << message; -+} -+ -+// static - void BaseCapturerPipeWire::OnStreamStateChanged(void* data, - pw_stream_state old_state, - pw_stream_state state, -@@ -87,76 +94,54 @@ void BaseCapturerPipeWire::OnStreamState - case PW_STREAM_STATE_ERROR: - RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message; - break; -- case PW_STREAM_STATE_CONFIGURE: -- pw_stream_set_active(that->pw_stream_, true); -- break; -- case PW_STREAM_STATE_UNCONNECTED: -- case PW_STREAM_STATE_CONNECTING: -- case PW_STREAM_STATE_READY: - case PW_STREAM_STATE_PAUSED: - case PW_STREAM_STATE_STREAMING: -+ case PW_STREAM_STATE_UNCONNECTED: -+ case PW_STREAM_STATE_CONNECTING: - break; - } - } - - // static --void BaseCapturerPipeWire::OnStreamFormatChanged(void* data, -- const struct spa_pod* format) { -+void BaseCapturerPipeWire::OnStreamParamChanged(void *data, uint32_t id, -+ const struct spa_pod *format) { - BaseCapturerPipeWire* that = static_cast(data); - RTC_DCHECK(that); - -- RTC_LOG(LS_INFO) << "PipeWire stream format changed."; -+ RTC_LOG(LS_INFO) << "PipeWire stream param changed."; - -- if (!format) { -- pw_stream_finish_format(that->pw_stream_, /*res=*/0, /*params=*/nullptr, -- /*n_params=*/0); -+ if (!format || id != SPA_PARAM_Format) { - return; - } - -- that->spa_video_format_ = new spa_video_info_raw(); -- spa_format_video_raw_parse(format, that->spa_video_format_, -- &that->pw_type_->format_video); -+ spa_format_video_raw_parse(format, &that->spa_video_format_); - -- auto width = that->spa_video_format_->size.width; -- auto height = that->spa_video_format_->size.height; -+ auto width = that->spa_video_format_.size.width; -+ auto height = that->spa_video_format_.size.height; - auto stride = SPA_ROUND_UP_N(width * kBytesPerPixel, 4); - auto size = height * stride; - -+ that->desktop_size_ = DesktopSize(width, height); -+ - uint8_t buffer[1024] = {}; - auto builder = spa_pod_builder{buffer, sizeof(buffer)}; - - // Setup buffers and meta header for new format. -- const struct spa_pod* params[2]; -- params[0] = reinterpret_cast(spa_pod_builder_object( -- &builder, -- // id to enumerate buffer requirements -- that->pw_core_type_->param.idBuffers, -- that->pw_core_type_->param_buffers.Buffers, -- // Size: specified as integer (i) and set to specified size -- ":", that->pw_core_type_->param_buffers.size, "i", size, -- // Stride: specified as integer (i) and set to specified stride -- ":", that->pw_core_type_->param_buffers.stride, "i", stride, -- // Buffers: specifies how many buffers we want to deal with, set as -- // integer (i) where preferred number is 8, then allowed number is defined -- // as range (r) from min and max values and it is undecided (u) to allow -- // negotiation -- ":", that->pw_core_type_->param_buffers.buffers, "iru", 8, -- SPA_POD_PROP_MIN_MAX(1, 32), -- // Align: memory alignment of the buffer, set as integer (i) to specified -- // value -- ":", that->pw_core_type_->param_buffers.align, "i", 16)); -- params[1] = reinterpret_cast(spa_pod_builder_object( -- &builder, -- // id to enumerate supported metadata -- that->pw_core_type_->param.idMeta, that->pw_core_type_->param_meta.Meta, -- // Type: specified as id or enum (I) -- ":", that->pw_core_type_->param_meta.type, "I", -- that->pw_core_type_->meta.Header, -- // Size: size of the metadata, specified as integer (i) -- ":", that->pw_core_type_->param_meta.size, "i", -- sizeof(struct spa_meta_header))); -- -- pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2); -+ const struct spa_pod* params[3]; -+ params[0] = reinterpret_cast(spa_pod_builder_add_object(&builder, -+ SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers, -+ SPA_PARAM_BUFFERS_size, SPA_POD_Int(size), -+ SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride), -+ SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 1, 32))); -+ params[1] = reinterpret_cast(spa_pod_builder_add_object(&builder, -+ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, -+ SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header), -+ SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header)))); -+ params[2] = reinterpret_cast(spa_pod_builder_add_object(&builder, -+ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, -+ SPA_PARAM_META_type, SPA_POD_Id (SPA_META_VideoCrop), -+ SPA_PARAM_META_size, SPA_POD_Int (sizeof(struct spa_meta_region)))); -+ pw_stream_update_params(that->pw_stream_, params, 3); - } - - // static -@@ -164,15 +149,25 @@ void BaseCapturerPipeWire::OnStreamProce - BaseCapturerPipeWire* that = static_cast(data); - RTC_DCHECK(that); - -- pw_buffer* buf = nullptr; -+ struct pw_buffer *next_buffer; -+ struct pw_buffer *buffer = nullptr; - -- if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) { -+ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); -+ while (next_buffer) { -+ buffer = next_buffer; -+ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); -+ -+ if (next_buffer) -+ pw_stream_queue_buffer (that->pw_stream_, buffer); -+ } -+ -+ if (!buffer) { - return; - } - -- that->HandleBuffer(buf); -+ that->HandleBuffer(buffer); - -- pw_stream_queue_buffer(that->pw_stream_, buf); -+ pw_stream_queue_buffer(that->pw_stream_, buffer); - } - - BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type) -@@ -183,38 +178,22 @@ BaseCapturerPipeWire::~BaseCapturerPipeW - pw_thread_loop_stop(pw_main_loop_); - } - -- if (pw_type_) { -- delete pw_type_; -- } -- -- if (spa_video_format_) { -- delete spa_video_format_; -- } -- - if (pw_stream_) { - pw_stream_destroy(pw_stream_); - } - -- if (pw_remote_) { -- pw_remote_destroy(pw_remote_); -+ if (pw_core_) { -+ pw_core_disconnect(pw_core_); - } - -- if (pw_core_) { -- pw_core_destroy(pw_core_); -+ if (pw_context_) { -+ pw_context_destroy(pw_context_); - } - - if (pw_main_loop_) { - pw_thread_loop_destroy(pw_main_loop_); - } - -- if (pw_loop_) { -- pw_loop_destroy(pw_loop_); -- } -- -- if (current_frame_) { -- free(current_frame_); -- } -- - if (start_request_signal_id_) { - g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_); - } -@@ -284,27 +263,35 @@ void BaseCapturerPipeWire::InitPipeWire( - - pw_init(/*argc=*/nullptr, /*argc=*/nullptr); - -- pw_loop_ = pw_loop_new(/*properties=*/nullptr); -- pw_main_loop_ = pw_thread_loop_new(pw_loop_, "pipewire-main-loop"); -- -- pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr); -- pw_core_type_ = pw_core_get_type(pw_core_); -- pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0); -+ pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr); -+ pw_context_ = pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0); -+ if (!pw_context_) { -+ RTC_LOG(LS_ERROR) << "Failed to create PipeWire context"; -+ return; -+ } - -- InitPipeWireTypes(); -+ pw_core_ = pw_context_connect(pw_context_, nullptr, 0); -+ if (!pw_core_) { -+ RTC_LOG(LS_ERROR) << "Failed to connect PipeWire context"; -+ return; -+ } - - // Initialize event handlers, remote end and stream-related. -- pw_remote_events_.version = PW_VERSION_REMOTE_EVENTS; -- pw_remote_events_.state_changed = &OnStateChanged; -+ pw_core_events_.version = PW_VERSION_CORE_EVENTS; -+ pw_core_events_.error = &OnCoreError; - - pw_stream_events_.version = PW_VERSION_STREAM_EVENTS; - pw_stream_events_.state_changed = &OnStreamStateChanged; -- pw_stream_events_.format_changed = &OnStreamFormatChanged; -+ pw_stream_events_.param_changed = &OnStreamParamChanged; - pw_stream_events_.process = &OnStreamProcess; - -- pw_remote_add_listener(pw_remote_, &spa_remote_listener_, &pw_remote_events_, -- this); -- pw_remote_connect_fd(pw_remote_, pw_fd_); -+ pw_core_add_listener(pw_core_, &spa_core_listener_, &pw_core_events_, this); -+ -+ pw_stream_ = CreateReceivingStream(); -+ if (!pw_stream_) { -+ RTC_LOG(LS_ERROR) << "Failed to create PipeWire stream"; -+ return; -+ } - - if (pw_thread_loop_start(pw_main_loop_) < 0) { - RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop"; -@@ -314,81 +301,131 @@ void BaseCapturerPipeWire::InitPipeWire( - RTC_LOG(LS_INFO) << "PipeWire remote opened."; - } - --void BaseCapturerPipeWire::InitPipeWireTypes() { -- spa_type_map* map = pw_core_type_->map; -- pw_type_ = new PipeWireType(); -- -- spa_type_media_type_map(map, &pw_type_->media_type); -- spa_type_media_subtype_map(map, &pw_type_->media_subtype); -- spa_type_format_video_map(map, &pw_type_->format_video); -- spa_type_video_format_map(map, &pw_type_->video_format); --} -- --void BaseCapturerPipeWire::CreateReceivingStream() { -+pw_stream* BaseCapturerPipeWire::CreateReceivingStream() { - spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; -- spa_rectangle pwScreenBounds = -- spa_rectangle{static_cast(desktop_size_.width()), -- static_cast(desktop_size_.height())}; -- -- spa_fraction pwFrameRateMin = spa_fraction{0, 1}; -- spa_fraction pwFrameRateMax = spa_fraction{60, 1}; -- -- pw_properties* reuseProps = -- pw_properties_new_string("pipewire.client.reuse=1"); -- pw_stream_ = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps); -+ spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX}; -+ auto stream = pw_stream_new(pw_core_, "webrtc-pipewire-stream", nullptr); -+ -+ if (!stream) { -+ RTC_LOG(LS_ERROR) << "Could not create receiving stream."; -+ return nullptr; -+ } - - uint8_t buffer[1024] = {}; -- const spa_pod* params[1]; -- spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)}; -- params[0] = reinterpret_cast(spa_pod_builder_object( -- &builder, -- // id to enumerate formats -- pw_core_type_->param.idEnumFormat, pw_core_type_->spa_format, "I", -- pw_type_->media_type.video, "I", pw_type_->media_subtype.raw, -- // Video format: specified as id or enum (I), preferred format is BGRx, -- // then allowed formats are enumerated (e) and the format is undecided (u) -- // to allow negotiation -- ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx, -- SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx, -- pw_type_->video_format.BGRx), -- // Video size: specified as rectangle (R), preferred size is specified as -- // first parameter, then allowed size is defined as range (r) from min and -- // max values and the format is undecided (u) to allow negotiation -- ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2, -- &pwMinScreenBounds, &pwScreenBounds, -- // Frame rate: specified as fraction (F) and set to minimum frame rate -- // value -- ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin, -- // Max frame rate: specified as fraction (F), preferred frame rate is set -- // to maximum value, then allowed frame rate is defined as range (r) from -- // min and max values and it is undecided (u) to allow negotiation -- ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2, -- &pwFrameRateMin, &pwFrameRateMax)); -+ const spa_pod* params[2]; -+ spa_pod_builder builder = SPA_POD_BUILDER_INIT(buffer, sizeof (buffer)); -+ -+ params[0] = reinterpret_cast(spa_pod_builder_add_object(&builder, -+ SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, -+ SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video), -+ SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), -+ SPA_FORMAT_VIDEO_format, SPA_POD_CHOICE_ENUM_Id(5, SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx, SPA_VIDEO_FORMAT_RGBA, -+ SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_BGRA), -+ SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle(&pwMinScreenBounds, -+ &pwMinScreenBounds, -+ &pwMaxScreenBounds), -+ 0)); -+ pw_stream_add_listener(stream, &spa_stream_listener_, &pw_stream_events_, this); - -- pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_, -- this); - pw_stream_flags flags = static_cast( -- PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE | -- PW_STREAM_FLAG_MAP_BUFFERS); -- if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr, -- flags, params, -- /*n_params=*/1) != 0) { -+ PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE); -+ -+ if (pw_stream_connect(stream, PW_DIRECTION_INPUT, pw_stream_node_id_, PW_STREAM_FLAG_AUTOCONNECT, params, 1) != 0) { - RTC_LOG(LS_ERROR) << "Could not connect receiving stream."; - portal_init_failed_ = true; -- return; - } -+ -+ return stream; - } - - void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) { -+ struct spa_meta_region* video_crop; - spa_buffer* spaBuffer = buffer->buffer; -- void* src = nullptr; -+ uint8_t *map = nullptr; -+ uint8_t* src = nullptr; -+ uint8_t* dst = nullptr; -+ -+ if (spaBuffer->datas[0].chunk->size == 0) { -+ map = nullptr; -+ src = nullptr; -+ } else if (spaBuffer->datas[0].type == SPA_DATA_MemFd) { -+ map = static_cast(mmap( -+ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, -+ PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0)); -+ -+ if (map == MAP_FAILED) { -+ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno); -+ return; -+ } - -- if (!(src = spaBuffer->datas[0].data)) { -+ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); -+ } else if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) { -+ int fd; -+ fd = spaBuffer->datas[0].fd; -+ -+ map = static_cast(mmap( -+ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, -+ PROT_READ, MAP_PRIVATE, fd, 0)); -+ -+ if (map == MAP_FAILED) { -+ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno); -+ return; -+ } -+ -+ SyncDmaBuf(fd, DMA_BUF_SYNC_START); -+ -+ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); -+ } else if (spaBuffer->datas[0].type == SPA_DATA_MemPtr) { -+ map = nullptr; -+ src = static_cast(spaBuffer->datas[0].data); -+ } else { - return; - } - -- uint32_t maxSize = spaBuffer->datas[0].maxsize; -- int32_t srcStride = spaBuffer->datas[0].chunk->stride; -+ if (!src) { -+ return; -+ } -+ -+ DesktopSize prev_crop_size = DesktopSize(0, 0); -+ if (video_crop_size_initialized_) { -+ prev_crop_size = video_crop_size_; -+ } -+ -+ if ((video_crop = static_cast( -+ spa_buffer_find_meta_data(spaBuffer, SPA_META_VideoCrop, sizeof(*video_crop))))) { -+ RTC_DCHECK(video_crop->region.size.width <= desktop_size_.width() && -+ video_crop->region.size.height <= desktop_size_.height()); -+ if ((video_crop->region.size.width != desktop_size_.width() || -+ video_crop->region.size.height != desktop_size_.height()) && video_crop->region.size.width && video_crop->region.size.height) { -+ video_crop_size_ = DesktopSize(video_crop->region.size.width, video_crop->region.size.height); -+ video_crop_size_initialized_ = true; -+ } else { -+ video_crop_size_initialized_ = false; -+ } -+ } else { -+ video_crop_size_initialized_ = false; -+ } -+ -+ size_t frame_size; -+ if (video_crop_size_initialized_) { -+ frame_size = -+ video_crop_size_.width() * video_crop_size_.height() * kBytesPerPixel; -+ } else { -+ frame_size = -+ desktop_size_.width() * desktop_size_.height() * kBytesPerPixel; -+ } -+ -+ if (!current_frame_ || -+ (video_crop_size_initialized_ && !video_crop_size_.equals(prev_crop_size))) { -+ current_frame_ = std::make_unique(frame_size); -+ } -+ RTC_DCHECK(current_frame_ != nullptr); -+ -+ const int32_t dstStride = video_crop_size_initialized_ -+ ? video_crop_size_.width() * kBytesPerPixel -+ : desktop_size_.width() * kBytesPerPixel; -+ const int32_t srcStride = spaBuffer->datas[0].chunk->stride; -+ - if (srcStride != (desktop_size_.width() * kBytesPerPixel)) { - RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: " - << srcStride -@@ -397,21 +434,40 @@ void BaseCapturerPipeWire::HandleBuffer( - return; - } - -- if (!current_frame_) { -- current_frame_ = static_cast(malloc(maxSize)); -+ dst = current_frame_.get(); -+ -+ // Adjust source content based on crop video position -+ if (video_crop_size_initialized_ && -+ (video_crop->region.position.y + video_crop_size_.height() <= desktop_size_.height())) { -+ for (int i = 0; i < video_crop->region.position.y; ++i) { -+ src += srcStride; -+ } -+ } -+ const int xOffset = -+ video_crop_size_initialized_ && (video_crop->region.position.x + video_crop_size_.width() <= -+ desktop_size_.width()) -+ ? video_crop->region.position.x * kBytesPerPixel -+ : 0; -+ const int height = video_crop_size_initialized_ ? video_crop_size_.height() : desktop_size_.height(); -+ for (int i = 0; i < height; ++i) { -+ // Adjust source content based on crop video position if needed -+ src += xOffset; -+ std::memcpy(dst, src, dstStride); -+ // If both sides decided to go with the RGBx format we need to convert it to -+ // BGRx to match color format expected by WebRTC. -+ if (spa_video_format_.format == SPA_VIDEO_FORMAT_RGBx || -+ spa_video_format_.format == SPA_VIDEO_FORMAT_RGBA) { -+ ConvertRGBxToBGRx(dst, dstStride); -+ } -+ src += srcStride - xOffset; -+ dst += dstStride; - } -- RTC_DCHECK(current_frame_ != nullptr); - -- // If both sides decided to go with the RGBx format we need to convert it to -- // BGRx to match color format expected by WebRTC. -- if (spa_video_format_->format == pw_type_->video_format.RGBx) { -- uint8_t* tempFrame = static_cast(malloc(maxSize)); -- std::memcpy(tempFrame, src, maxSize); -- ConvertRGBxToBGRx(tempFrame, maxSize); -- std::memcpy(current_frame_, tempFrame, maxSize); -- free(tempFrame); -- } else { -- std::memcpy(current_frame_, src, maxSize); -+ if (map) { -+ if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) { -+ SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_END); -+ } -+ munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset); - } - } - -@@ -770,10 +826,7 @@ void BaseCapturerPipeWire::OnStartReques - g_variant_get(variant, "(u@a{sv})", &stream_id, &options); - RTC_DCHECK(options != nullptr); - -- g_variant_lookup(options, "size", "(ii)", &width, &height); -- -- that->desktop_size_.set(width, height); -- -+ that->pw_stream_node_id_ = stream_id; - g_variant_unref(options); - g_variant_unref(variant); - } -@@ -859,10 +912,15 @@ void BaseCapturerPipeWire::CaptureFrame( - return; - } - -- std::unique_ptr result(new BasicDesktopFrame(desktop_size_)); -+ DesktopSize frame_size = desktop_size_; -+ if (video_crop_size_initialized_) { -+ frame_size = video_crop_size_; -+ } -+ -+ std::unique_ptr result(new BasicDesktopFrame(frame_size)); - result->CopyPixelsFrom( -- current_frame_, (desktop_size_.width() * kBytesPerPixel), -- DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height())); -+ current_frame_.get(), (frame_size.width() * kBytesPerPixel), -+ DesktopRect::MakeWH(frame_size.width(), frame_size.height())); - if (!result) { - callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); - return; -@@ -887,4 +945,22 @@ bool BaseCapturerPipeWire::SelectSource( - return true; - } - -+// static -+std::unique_ptr -+BaseCapturerPipeWire::CreateRawScreenCapturer( -+ const DesktopCaptureOptions& options) { -+ std::unique_ptr capturer = -+ std::make_unique(BaseCapturerPipeWire::CaptureSourceType::kAny); -+ return std::move(capturer);} -+ -+// static -+std::unique_ptr -+BaseCapturerPipeWire::CreateRawWindowCapturer( -+ const DesktopCaptureOptions& options) { -+ -+ std::unique_ptr capturer = -+ std::make_unique(BaseCapturerPipeWire::CaptureSourceType::kAny); -+ return std::move(capturer); -+} -+ - } // namespace webrtc -Index: chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc -=================================================================== ---- chromium-83.0.4103.116.orig/third_party/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc -+++ chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc -@@ -16,7 +16,7 @@ - namespace webrtc { - - WindowCapturerPipeWire::WindowCapturerPipeWire() -- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {} -+ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kWindow) {} - WindowCapturerPipeWire::~WindowCapturerPipeWire() {} - - // static -Index: chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/window_capturer_linux.cc -=================================================================== ---- chromium-83.0.4103.116.orig/third_party/webrtc/modules/desktop_capture/window_capturer_linux.cc -+++ chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/window_capturer_linux.cc -@@ -28,7 +28,7 @@ std::unique_ptr Desktop - const DesktopCaptureOptions& options) { - #if defined(WEBRTC_USE_PIPEWIRE) - if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { -- return WindowCapturerPipeWire::CreateRawWindowCapturer(options); -+ return BaseCapturerPipeWire::CreateRawWindowCapturer(options); - } - #endif // defined(WEBRTC_USE_PIPEWIRE) - -Index: chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc -=================================================================== ---- chromium-83.0.4103.116.orig/third_party/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc -+++ chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc -@@ -16,7 +16,7 @@ - namespace webrtc { - - ScreenCapturerPipeWire::ScreenCapturerPipeWire() -- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {} -+ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kScreen) {} - ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {} - - // static -Index: chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/screen_capturer_linux.cc -=================================================================== ---- chromium-83.0.4103.116.orig/third_party/webrtc/modules/desktop_capture/screen_capturer_linux.cc -+++ chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/screen_capturer_linux.cc -@@ -28,8 +28,8 @@ std::unique_ptr Desktop - const DesktopCaptureOptions& options) { - #if defined(WEBRTC_USE_PIPEWIRE) - if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { -- return ScreenCapturerPipeWire::CreateRawScreenCapturer(options); -- } -+ return BaseCapturerPipeWire::CreateRawScreenCapturer(options); -+} - #endif // defined(WEBRTC_USE_PIPEWIRE) - - #if defined(WEBRTC_USE_X11) -Index: chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h -=================================================================== ---- chromium-83.0.4103.116.orig/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h -+++ chromium-83.0.4103.116/third_party/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h -@@ -22,17 +22,13 @@ - - namespace webrtc { - --class PipeWireType { -- public: -- spa_type_media_type media_type; -- spa_type_media_subtype media_subtype; -- spa_type_format_video format_video; -- spa_type_video_format video_format; --}; -- - class BaseCapturerPipeWire : public DesktopCapturer { - public: -- enum CaptureSourceType { Screen = 1, Window }; -+ enum CaptureSourceType : uint32_t { -+ kScreen = 0b01, -+ kWindow = 0b10, -+ kAny = 0b11 -+ }; - - explicit BaseCapturerPipeWire(CaptureSourceType source_type); - ~BaseCapturerPipeWire() override; -@@ -43,28 +39,32 @@ class BaseCapturerPipeWire : public Desk - bool GetSourceList(SourceList* sources) override; - bool SelectSource(SourceId id) override; - -+ static std::unique_ptr CreateRawScreenCapturer( -+ const DesktopCaptureOptions& options); -+ -+ static std::unique_ptr CreateRawWindowCapturer( -+ const DesktopCaptureOptions& options); -+ - private: - // PipeWire types --> -+ pw_context* pw_context_ = nullptr; - pw_core* pw_core_ = nullptr; -- pw_type* pw_core_type_ = nullptr; - pw_stream* pw_stream_ = nullptr; -- pw_remote* pw_remote_ = nullptr; -- pw_loop* pw_loop_ = nullptr; - pw_thread_loop* pw_main_loop_ = nullptr; -- PipeWireType* pw_type_ = nullptr; - -+ spa_hook spa_core_listener_ = {}; - spa_hook spa_stream_listener_ = {}; -- spa_hook spa_remote_listener_ = {}; - -+ pw_core_events pw_core_events_ = {}; - pw_stream_events pw_stream_events_ = {}; -- pw_remote_events pw_remote_events_ = {}; - -- spa_video_info_raw* spa_video_format_ = nullptr; -+ struct spa_video_info_raw spa_video_format_; - -+ guint32 pw_stream_node_id_ = 0; - gint32 pw_fd_ = -1; - - CaptureSourceType capture_source_type_ = -- BaseCapturerPipeWire::CaptureSourceType::Screen; -+ BaseCapturerPipeWire::CaptureSourceType::kAny; - - // <-- end of PipeWire types - -@@ -79,33 +79,38 @@ class BaseCapturerPipeWire : public Desk - guint sources_request_signal_id_ = 0; - guint start_request_signal_id_ = 0; - -+ bool video_crop_size_initialized_ = false; -+ DesktopSize video_crop_size_;; - DesktopSize desktop_size_ = {}; - DesktopCaptureOptions options_ = {}; - -- uint8_t* current_frame_ = nullptr; -+ std::unique_ptr current_frame_; - Callback* callback_ = nullptr; - - bool portal_init_failed_ = false; - - void InitPortal(); - void InitPipeWire(); -- void InitPipeWireTypes(); - -- void CreateReceivingStream(); -+ pw_stream* CreateReceivingStream(); - void HandleBuffer(pw_buffer* buffer); - - void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size); - -- static void OnStateChanged(void* data, -- pw_remote_state old_state, -- pw_remote_state state, -- const char* error); -+ static void SyncDmaBuf(int fd, uint64_t start_or_end); -+ static void OnCoreError(void *data, -+ uint32_t id, -+ int seq, -+ int res, -+ const char *message); -+ static void OnStreamParamChanged(void *data, -+ uint32_t id, -+ const struct spa_pod *format); - static void OnStreamStateChanged(void* data, - pw_stream_state old_state, - pw_stream_state state, - const char* error_message); - -- static void OnStreamFormatChanged(void* data, const struct spa_pod* format); - static void OnStreamProcess(void* data); - static void OnNewBuffer(void* data, uint32_t id); - -Index: chromium-83.0.4103.116/third_party/webrtc/webrtc.gni -=================================================================== ---- chromium-83.0.4103.116.orig/third_party/webrtc/webrtc.gni -+++ chromium-83.0.4103.116/third_party/webrtc/webrtc.gni -@@ -114,6 +114,10 @@ declare_args() { - # supported Ubuntu and Debian distributions. - rtc_use_pipewire = is_linux && use_sysroot - -+ # Sets the pipewire pkg-config version to use if rtc_use_pipewire is true -+ rtc_use_pipewire_version = "0.3" -+ rtc_use_spa_version = "0.2" -+ - # Set this to link PipeWire directly instead of using the dlopen. - rtc_link_pipewire = false - diff --git a/chromium-30.0.1599.66-master-prefs-path.patch b/chromium-30.0.1599.66-master-prefs-path.patch index 91db4f9..802ece0 100644 --- a/chromium-30.0.1599.66-master-prefs-path.patch +++ b/chromium-30.0.1599.66-master-prefs-path.patch @@ -1,7 +1,6 @@ -diff -up chromium-86.0.4240.75/chrome/browser/first_run/first_run_internal_linux.cc.etc chromium-86.0.4240.75/chrome/browser/first_run/first_run_internal_linux.cc ---- chromium-86.0.4240.75/chrome/browser/first_run/first_run_internal_linux.cc.etc 2020-10-14 14:38:42.826660141 -0400 -+++ chromium-86.0.4240.75/chrome/browser/first_run/first_run_internal_linux.cc 2020-10-14 14:44:49.906526646 -0400 -@@ -19,9 +19,9 @@ bool IsOrganicFirstRun() { +--- chromium-89.0.4389.82/chrome/browser/first_run/first_run_internal_linux.cc.orig 2021-03-07 14:49:07.372334047 +0300 ++++ chromium-89.0.4389.82/chrome/browser/first_run/first_run_internal_linux.cc 2021-03-07 14:49:57.910937907 +0300 +@@ -19,9 +19,9 @@ base::FilePath InitialPrefsPath() { // The standard location of the initial prefs is next to the chrome binary. @@ -10,6 +9,6 @@ diff -up chromium-86.0.4240.75/chrome/browser/first_run/first_run_internal_linux - if (!base::PathService::Get(base::DIR_EXE, &initial_prefs)) - return base::FilePath(); + initial_prefs = base::FilePath("/etc/chromium"); - return initial_prefs.AppendASCII(installer::kDefaultMasterPrefs); + return initial_prefs.AppendASCII(installer::kLegacyInitialPrefs); } diff --git a/chromium-40-sorenson-spark.patch b/chromium-40-sorenson-spark.patch index 71640de..789d6ff 100644 --- a/chromium-40-sorenson-spark.patch +++ b/chromium-40-sorenson-spark.patch @@ -77,38 +77,9 @@ diff -up chromium-51.0.2687.0/media/ffmpeg/ffmpeg_common.cc.flv1 chromium-51.0.2 default: DVLOG(1) << "Unknown video CodecID: " << codec_id; } -@@ -221,6 +223,28 @@ - return AV_CODEC_ID_VP9; - case kCodecAV1: - return AV_CODEC_ID_AV1; -+ case kCodecMSMPEG4V1: -+ return AV_CODEC_ID_MSMPEG4V1; -+ case kCodecMSMPEG4V2: -+ return AV_CODEC_ID_MSMPEG4V2; -+ case kCodecMSMPEG4V3: -+ return AV_CODEC_ID_MSMPEG4V3; -+ case kCodecWMV7: -+ return AV_CODEC_ID_WMV1; -+ case kCodecWMV8: -+ return AV_CODEC_ID_WMV2; -+ case kCodecWMV9: -+ return AV_CODEC_ID_WMV3; -+ case kCodecVC1: -+ return AV_CODEC_ID_VC1; -+ case kCodecVP6: -+ return AV_CODEC_ID_VP6; -+ case kCodecMPEG1: -+ return AV_CODEC_ID_MPEG1VIDEO; -+ case kCodecMPEG2: -+ return AV_CODEC_ID_MPEG2VIDEO; -+ case kCodecSorensonSpark: -+ return AV_CODEC_ID_FLV1; - default: - DVLOG(1) << "Unknown VideoCodec: " << video_codec; - } --- chromium-56.0.2924.10/media/remoting/proto_enum_utils.cc.bak.2 2016-12-01 23:42:15.717317808 +0100 +++ chromium-56.0.2924.10/media/remoting/proto_enum_utils.cc 2016-12-01 23:44:59.695754038 +0100 -@@ -36,6 +36,8 @@ +@@ -36,6 +36,8 @@ base::Optional ToMediaAudioC CASE_RETURN_OTHER(kCodecMpegHAudio); CASE_RETURN_OTHER(kCodecMP2); CASE_RETURN_OTHER(kCodecDTS); @@ -117,7 +88,7 @@ diff -up chromium-51.0.2687.0/media/ffmpeg/ffmpeg_common.cc.flv1 chromium-51.0.2 } return base::nullopt; // Not a 'default' to ensure compile-time checks. } -@@ -65,6 +67,8 @@ +@@ -65,6 +67,8 @@ base::Optional ToMediaVideoC CASE_RETURN_OTHER(kCodecHEVC); CASE_RETURN_OTHER(kCodecDolbyVision); CASE_RETURN_OTHER(kCodecAV1); @@ -142,7 +113,7 @@ diff -up chromium-51.0.2687.0/media/ffmpeg/ffmpeg_common.cc.flv1 chromium-51.0.2 } return base::nullopt; // Not a 'default' to ensure compile-time checks. } -@@ -231,6 +244,15 @@ +@@ -231,6 +244,15 @@ base::Optional ToMediaAudioC CASE_RETURN_OTHER(kCodecALAC); CASE_RETURN_OTHER(kCodecAC3); CASE_RETURN_OTHER(kCodecMpegHAudio); @@ -271,7 +271,7 @@ diff -up chromium-62.0.3192.0/media/remoting/proto_enum_utils.cc.extra-media chr } return base::nullopt; // Not a 'default' to ensure compile-time checks. } -@@ -61,6 +63,8 @@ +@@ -61,6 +63,8 @@ base::OptionalHasSwitch( + switches::kEnableClearHevcForTesting)) { +@@ -69,7 +68,6 @@ bool IsHevcProfileSupported(VideoCodecPr + } + return false; + } +-#endif // ENABLE_PLATFORM_HEVC && USE_CHROMEOS_PROTECTED_MEDIA + + } // namespace + +@@ -205,14 +203,18 @@ bool IsAudioCodecProprietary(AudioCodec case kCodecAAC: case kCodecAC3: case kCodecEAC3: @@ -334,7 +350,10 @@ diff -up chromium-62.0.3192.0/net/base/mime_util.cc.extra-media chromium-62.0.31 case kCodecAMR_NB: case kCodecAMR_WB: case kCodecGSM_MS: -@@ -171,6 +172,7 @@ bool IsAudioCodecProprietary(AudioCodec + case kCodecALAC: + case kCodecMpegHAudio: ++ case kCodecWMA1: ++ case kCodecWMA2: return true; case kCodecFLAC: @@ -342,7 +361,7 @@ diff -up chromium-62.0.3192.0/net/base/mime_util.cc.extra-media chromium-62.0.31 case kCodecMP3: case kCodecOpus: case kCodecVorbis: -@@ -205,6 +207,7 @@ bool IsDefaultSupportedAudioType(const A +@@ -250,6 +252,7 @@ bool IsDefaultSupportedAudioType(const A #endif case kCodecFLAC: @@ -350,7 +369,7 @@ diff -up chromium-62.0.3192.0/net/base/mime_util.cc.extra-media chromium-62.0.31 case kCodecMP3: case kCodecOpus: case kCodecPCM: -@@ -213,6 +216,10 @@ bool IsDefaultSupportedAudioType(const A +@@ -258,6 +261,12 @@ bool IsDefaultSupportedAudioType(const A case kCodecPCM_S24BE: case kCodecPCM_ALAW: case kCodecVorbis: @@ -358,10 +377,12 @@ diff -up chromium-62.0.3192.0/net/base/mime_util.cc.extra-media chromium-62.0.31 + case kCodecALAC: + case kCodecAC3: + case kCodecDTS: ++ case kCodecWMA1: ++ case kCodecWMA2: return true; case kCodecAMR_NB: -@@ -224,9 +231,6 @@ bool IsDefaultSupportedAudioType(const A +@@ -269,9 +278,6 @@ bool IsDefaultSupportedAudioType(const A return false; #endif @@ -371,28 +392,73 @@ diff -up chromium-62.0.3192.0/net/base/mime_util.cc.extra-media chromium-62.0.31 case kCodecMpegHAudio: case kUnknownAudioCodec: return false; -@@ -282,21 +286,15 @@ bool IsDefaultSupportedVideoType(const V +@@ -289,6 +295,15 @@ bool IsVideoCodecProprietary(VideoCodec + case kCodecMPEG4: + case kCodecHEVC: + case kCodecDolbyVision: ++ case kCodecMSMPEG4V1: ++ case kCodecMSMPEG4V2: ++ case kCodecMSMPEG4V3: ++ case kCodecWMV7: ++ case kCodecWMV8: ++ case kCodecWMV9: ++ case kCodecVP6: ++ case kCodecMPEG1: ++ case kCodecSorensonSpark: + return true; + case kUnknownVideoCodec: + case kCodecTheora: +@@ -336,27 +351,26 @@ bool IsDefaultSupportedVideoType(const V case kCodecH264: case kCodecVP8: case kCodecTheora: -- return true; -- -- case kUnknownVideoCodec: - case kCodecVC1: - case kCodecMPEG2: - case kCodecHEVC: -- case kCodecDolbyVision: -- return false; -- - case kCodecMPEG4: --#if BUILDFLAG(IS_ASH) ++ case kCodecVC1: ++ case kCodecMPEG2: ++ case kCodecMPEG4: ++ case kCodecMSMPEG4V1: ++ case kCodecMSMPEG4V2: ++ case kCodecMSMPEG4V3: ++ case kCodecWMV7: ++ case kCodecWMV8: ++ case kCodecWMV9: ++ case kCodecVP6: ++ case kCodecMPEG1: ++ case kCodecSorensonSpark: return true; + + case kCodecHEVC: +-#if BUILDFLAG(ENABLE_PLATFORM_HEVC) && BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA) + return IsColorSpaceSupported(type.color_space) && + IsHevcProfileSupported(type.profile); -#else -+ -+ case kUnknownVideoCodec: -+ case kCodecDolbyVision: +- return false; +-#endif + case kUnknownVideoCodec: +- case kCodecVC1: +- case kCodecMPEG2: + case kCodecDolbyVision: return false; +- +- case kCodecMPEG4: +-#if BUILDFLAG(IS_CHROMEOS_ASH) +- return true; +-#else +- return false; -#endif } NOTREACHED(); +--- chromium-89.0.4389.47/chrome/renderer/media/chrome_key_systems.cc.extra-media 2021-02-11 00:03:54.000000000 +0100 ++++ chromium-89.0.4389.47/chrome/renderer/media/chrome_key_systems.cc 2021-02-17 00:23:43.715337084 +0100 +@@ -182,11 +182,8 @@ static SupportedCodecs GetSupportedCodec + #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) + #if BUILDFLAG(ENABLE_PLATFORM_HEVC) + case media::VideoCodec::kCodecHEVC: +- if (is_secure && base::FeatureList::IsEnabled( +- chromeos::features::kCdmFactoryDaemon)) { + supported_codecs |= media::EME_CODEC_HEVC_PROFILE_MAIN; + supported_codecs |= media::EME_CODEC_HEVC_PROFILE_MAIN10; +- } + break; + #endif // BUILDFLAG(ENABLE_PLATFORM_HEVC) + default: diff --git a/chromium-58-glib.patch b/chromium-58-glib.patch deleted file mode 100644 index c7ce292..0000000 --- a/chromium-58-glib.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- chromium-58.0.3029.81/build/config/linux/BUILD.gn.glib 2017-04-19 21:06:28.000000000 +0200 -+++ chromium-58.0.3029.81/build/config/linux/BUILD.gn 2017-04-23 23:12:26.097911010 +0200 -@@ -94,7 +94,7 @@ if (use_glib) { - "gthread-2.0", - ] - defines = [ -- "GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40", -+ "GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_62", - "GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40", - ] - } diff --git a/chromium-60.0.3112.78-no-libpng-prefix.patch b/chromium-60.0.3112.78-no-libpng-prefix.patch deleted file mode 100644 index 0dbdcf9..0000000 --- a/chromium-60.0.3112.78-no-libpng-prefix.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -up chromium-60.0.3112.78/third_party/libpng/pnglibconf.h.noprefix chromium-60.0.3112.78/third_party/libpng/pnglibconf.h ---- chromium-60.0.3112.78/third_party/libpng/pnglibconf.h.noprefix 2017-08-01 14:42:54.321986758 -0400 -+++ chromium-60.0.3112.78/third_party/libpng/pnglibconf.h 2017-08-01 14:43:01.493845832 -0400 -@@ -225,13 +225,4 @@ - #define PNG_USER_CHUNK_MALLOC_MAX 4000000L - /* end of chromium settings */ - --/* chromium prefixing */ --/* -- * This is necessary to build multiple copies of libpng. We need this while pdfium builds -- * its own copy of libpng. -- */ --#define PNG_PREFIX --#include "pngprefix.h" --/* end of chromium prefixing */ -- - #endif /* PNGLCONF_H */ diff --git a/chromium-61-gcc5.patch b/chromium-61-gcc5.patch deleted file mode 100644 index 99d6c08..0000000 --- a/chromium-61-gcc5.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- chromium-61.0.3163.59/third_party/webrtc/modules/audio_processing/aec3/aec_state.cc.bak 2017-08-23 21:08:14.000000000 +0200 -+++ chromium-61.0.3163.59/third_party/webrtc/modules/audio_processing/aec3/aec_state.cc 2017-08-29 13:07:50.789475942 +0200 -@@ -10,7 +10,7 @@ - - #include "modules/audio_processing/aec3/aec_state.h" - --#include -+#include - - #include - #include diff --git a/chromium-72-i586.patch b/chromium-72-i586.patch deleted file mode 100644 index b4d5682..0000000 --- a/chromium-72-i586.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- chromium-72.0.3626.96/third_party/blink/renderer/core/fetch/multipart_parser.cc.i586 2019-02-06 23:06:47.000000000 +0100 -+++ chromium-72.0.3626.96/third_party/blink/renderer/core/fetch/multipart_parser.cc 2019-02-18 08:53:30.267915984 +0100 -@@ -299,7 +299,7 @@ bool MultipartParser::ParseHeaderFields( - HTTPHeaderMap* header_fields) { - // Combine the current bytes with buffered header bytes if needed. - const char* header_bytes = *bytes_pointer; -- if ((bytes_end - *bytes_pointer) > std::numeric_limits::max()) -+ if (uintptr_t(bytes_end - *bytes_pointer) > std::numeric_limits::max()) - return false; - - wtf_size_t header_size = static_cast(bytes_end - *bytes_pointer); diff --git a/chromium-86.0.4240.80-fcntl-h.patch b/chromium-86.0.4240.80-fcntl-h.patch deleted file mode 100644 index 085989c..0000000 --- a/chromium-86.0.4240.80-fcntl-h.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -up chromium-86.0.4240.75/sandbox/policy/linux/bpf_gpu_policy_linux.cc.epel7-kcmp chromium-86.0.4240.75/sandbox/policy/linux/bpf_gpu_policy_linux.cc ---- chromium-86.0.4240.75/sandbox/policy/linux/bpf_gpu_policy_linux.cc.epel7-kcmp 2020-10-20 11:58:00.449812627 -0400 -+++ chromium-86.0.4240.75/sandbox/policy/linux/bpf_gpu_policy_linux.cc 2020-10-20 11:58:32.919071919 -0400 -@@ -22,6 +22,22 @@ - #include "sandbox/policy/linux/sandbox_linux.h" - #include "sandbox/policy/linux/sandbox_seccomp_bpf_linux.h" - -+#ifndef F_LINUX_SPECIFIC_BASE -+#define F_LINUX_SPECIFIC_BASE 1024 -+#endif -+#ifndef F_SEAL_SEAL -+#define F_SEAL_SEAL 0x0001 -+#endif -+#ifndef F_SEAL_SHRINK -+#define F_SEAL_SHRINK 0x0002 -+#endif -+#ifndef F_SEAL_GROW -+#define F_SEAL_GROW 0x0004 -+#endif -+#ifndef F_ADD_SEALS -+#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9) -+#endif -+ - using sandbox::bpf_dsl::Allow; - using sandbox::bpf_dsl::Arg; - using sandbox::bpf_dsl::Error; diff --git a/chromium-browser-stable.spec b/chromium-browser-stable.spec index b62c68a..c48c477 100644 --- a/chromium-browser-stable.spec +++ b/chromium-browser-stable.spec @@ -4,7 +4,8 @@ # [3] https://www.archlinux.org/packages/extra/x86_64/chromium/ # [4] https://src.fedoraproject.org/rpms/chromium/ # [5] https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/chromium/ -# [6] https://packages.altlinux.org/ru/sisyphus/specfiles/chromium-gost +# [6] https://packages.altlinux.org/ru/sisyphus/srpms/chromium +# [7] https://packages.altlinux.org/ru/sisyphus/specfiles/chromium-gost # Get the version number of latest stable version # $ curl -s 'https://omahaproxy.appspot.com/all?os=linux&channel=stable' | sed 1d | cut -d , -f 3 @@ -27,9 +28,7 @@ %define ffmpeg 1 %define icu 0 -%define libva 1 %define jsoncpp 0 -%bcond_without native_libpng # Set up Google API keys, see http://www.chromium.org/developers/how-tos/api-keys # Note: these are for Mageia use ONLY. @@ -45,8 +44,6 @@ %define xcb_version 1.14.1 -%bcond_without clang - %if %{mdvver} <= 201410 %bcond_without bundled_llvm %else @@ -66,17 +63,14 @@ Summary: A fast web browser based on the Blink engine Name: chromium-browser-stable -Version: 88.0.4324.182 -Release: 2 +Version: 89.0.4389.82 +Release: 1 License: BSD, LGPL Group: Networking/WWW Url: https://www.chromium.org/Home Source0: https://commondatastorage.googleapis.com/chromium-browser-official/chromium-%{version}.tar.xz Source1: chromium-wrapper Source2: %{crname}.desktop -# Setup toolchain for rosa builds, from gentoo -# https://gitweb.gentoo.org/repo/gentoo.git/plain/www-client/chromium/files/toolchain/BUILD.gn -Source5: BUILD.gn Source10: %{name}.rpmlintrc # Bring xcb-proto with us (might need more than python on EPEL?) Source20: https://www.x.org/releases/individual/proto/xcb-proto-%{xcb_version}.tar.xz @@ -111,14 +105,8 @@ Patch28: chromium-53-gn-system-icu-jsoncpp.patch %endif # (cjw) fix webrtc build with system ffmpeg Patch35: chromium-50-system-ffmpeg-3.patch -# (cjw) fix build with current glib... -Patch36: chromium-58-glib.patch -# clang builtin subtract functions, scoped enum -Patch47: chromium-61-gcc5.patch # (cjw) fix gn bootstrapping with gcc Patch190: chromium-69-gn-bootstrap.patch -# (cjw) fix i586 build -Patch198: chromium-72-i586.patch # Google patched their bundled copy of icu 54 to include API functionality that wasn't added until 55. # :P @@ -128,9 +116,6 @@ Patch502: chromium-45.0.2454.101-system-icu-54-does-not-have-detectHostTimeZone. # fix build with icu other than 54 Patch504: chromium-system-icu-r0.patch -# https://aur.archlinux.org/packages/chromium-vaapi/ -Patch508: chromium-vaapi.patch - # ROSA Build Patch600: chromium-buildname-60.0.3112.90.patch # Patch to fix build @@ -140,28 +125,24 @@ Patch601: chromium-62-include-cstdlib.patch Patch604: chromium-compiler-r4.patch # Add "ROSA" to the user agent string Patch627: chromium-68.0.3440.106-rosa-user-agent.patch -# Do not prefix libpng functions -Patch629: chromium-60.0.3112.78-no-libpng-prefix.patch -# Fix build /sandbox/policy/linux/bpf_gpu_policy_linux.cc -Patch637: chromium-86.0.4240.80-fcntl-h.patch # Fix building third_party/wayland on rosa2016.1 Patch639: wayland-strndup.patch # Fix sandbox code to properly handle the new way that glibc handles fstat in rosa2019.1+ # Thanks to Kevin Kofler for the fix (from Fedora) Patch640: chromium-88.0.4324.96-fstatfix.patch -# https://build.opensuse.org/package/view_file/openSUSE:Factory/chromium/build-with-pipewire-0.3.patch -Patch642: build-with-pipewire-0.3.patch # Fix building with current glib2.0 # Hunks from https://build.opensuse.org/package/view_file/openSUSE:Factory/chromium/chromium-gcc11.patch Patch643: glib2.0.patch +# Enable hw mjpeg decoding, Nvidia etc. +# https://github.com/saiarcot895/chromium-ubuntu-build/blob/master/debian/patches/enable-vaapi-on-linux.diff +Patch644: enable-vaapi-on-linux.diff +# Enable VA-API with VDPAU backend on Nvidia GPUs +# https://github.com/saiarcot895/chromium-ubuntu-build/blob/master/debian/patches/vdpau-support.patch +Patch645: vdpau-support.patch +Patch646: ALT-allow-to-override-clang-through-env-variables.patch BuildRequires: bison -%if %{with clang} BuildRequires: llvm11 -BuildRequires: libcxx-devel -BuildRequires: libcxxabi-devel -BuildRequires: lld -%endif # for gn, not chromium itself BuildRequires: stdc++-gcc10-devel # gn needs these @@ -231,9 +212,7 @@ BuildRequires: pkgconfig(libtiff-4) BuildRequires: pkgconfig(libusb-1.0) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(libxslt) -%if 0%{?libva} BuildRequires: pkgconfig(libva) -%endif BuildRequires: pkgconfig(glesv2) BuildRequires: pkgconfig(minizip) BuildRequires: pkgconfig(nspr) @@ -365,34 +344,25 @@ cp -f %{_gostsourcedir}/src/msspi/third_party/cprocsp/include/* third_party/bori %if 0%{?ffmpeg} %patch35 -p1 %endif -%patch36 -p1 -%patch47 -p1 %patch190 -p1 -%patch198 -p1 %if 0%{icu} %patch502 -p1 -b .system-icu %patch504 -p0 -b .icu-ver %endif -%if 0%{?libva} -#%%patch508 -p1 -b .vaapi -%endif - %patch600 -p1 %patch601 -p1 -%patch604 -p1 +#patch604 -p1 %patch627 -p1 -%if %{without native_libpng} -%patch629 -p1 -%endif -%patch637 -p1 -b .fcntl %patch639 -p1 %patch640 -p1 -%patch642 -p1 %patch643 -p1 +%patch644 -p1 +%patch645 -p1 +%patch646 -p1 # fatal error: 'fuzzer/FuzzedDataProvider.h' file not found # (Available in Clang10) @@ -449,12 +419,6 @@ export PYTHONPATH="../../third_party/pyjson5/src:../../xcb-proto-%{xcb_version}" # handled by upstream regular build scripts? : freetype harfbuzz-ng # jsoncpp -%if %{with clang} -%define is_clang true -%else -%define is_clang false -%endif - # widevinecdmadapter # Build error with widevinecdmadapter in 67.0.3396.62 (fixed) %define widevine 1 @@ -466,23 +430,9 @@ export PYTHONPATH="../../third_party/pyjson5/src:../../xcb-proto-%{xcb_version}" %define lld 1 %if 0%{lld} -%define is_lld true -%define use_gold false +%define linker_params use_gold=false use_lld=true %else -%define is_lld false -%define use_gold true -%endif - -%if 0%{?libva} -%define is_vaapi true -%else -%define is_vaapi false -%endif - -%if %{without native_libpng} -%define is_libpng true -%else -%define is_libpng false +%define linker_params use_gold=true use_lld=false %endif %if %{without bundled_llvm} @@ -498,7 +448,7 @@ export PYTHONPATH="../../third_party/pyjson5/src:../../xcb-proto-%{xcb_version}" %endif %if %{mdvver} >= 201910 -%define pipewire_enablement rtc_use_pipewire=true rtc_link_pipewire=true +%define pipewire_enablement rtc_use_pipewire=true rtc_link_pipewire=true rtc_pipewire_version="0.3" %else %define pipewire_enablement rtc_use_pipewire=false %endif @@ -516,8 +466,7 @@ export PYTHONPATH="../../third_party/pyjson5/src:../../xcb-proto-%{xcb_version}" icu_use_data_file=true \ enable_nacl=false \ is_nacl_glibc=false \ - use_gold=%{use_gold} \ - custom_toolchain="%{_sourcedir}:default" \ + %{linker_params} \ ffmpeg_branding="Chromium" \ proprietary_codecs=true \ enable_platform_ac3_eac3_audio = true \ @@ -536,13 +485,12 @@ export PYTHONPATH="../../third_party/pyjson5/src:../../xcb-proto-%{xcb_version}" use_libpci = true \ is_debug=false \ gtk_version=3 \ - is_clang=%{is_clang} \ + is_clang=true \ %{?clang_use_chrome_plugins} \ - use_lld=%{is_lld} \ use_system_freetype=false \ use_system_harfbuzz=false \ - use_system_libpng=%{is_libpng} \ - use_vaapi=%{is_vaapi} \ + use_system_libpng=false \ + use_vaapi=true \ enable_dav1d_decoder=true enable_libaom_decoder=false \ %{?enable_remoting} \ v8_use_external_startup_data=false \ @@ -569,7 +517,7 @@ sed -i 's|aarch64-linux-gnu-||g' build/toolchain/linux/BUILD.gn %{__python} tools/clang/scripts/update.py %endif -%if %{with clang} +# ALT-allow-to-override-clang-through-env-variables.patch makes gn read these variables %if %{without bundled_llvm} export CC=%{llvm_prefix}/bin/clang export CXX=%{llvm_prefix}/bin/clang++ @@ -583,23 +531,7 @@ export CXX="%{clang_path}clang++" export AR="%{clang_path}llvm-ar" export NM=nm %endif -# flags to fix i586 builds -export LDFLAGS="$LDFLAGS -Wl,-z,notext -pthread" -%else -%setup_compile_flags -CC=%{__cc}; export CC -CXX=%{__cxx}; export CXX -AR=%{__ar}; export AR -NM=%{__nm}; export NM -LD=%{__cxx}; export LD - -# filter out some flags to fix i586 builds -CFLAGS=$(echo "$CFLAGS"|sed -e 's/-gdwarf-4//' -e 's/-fvar-tracking-assignments//' -e 's/-frecord-gcc-switches//') -CXXFLAGS=$(echo "$CXXFLAGS"|sed -e 's/-gdwarf-4//' -e 's/-fvar-tracking-assignments//' -e 's/-frecord-gcc-switches//') - -CFLAGS="$CFLAGS -Wno-error=pointer-to-int-cast -Wno-error=int-to-pointer-cast -fno-strict-aliasing" -CXXFLAGS="$CXXFLAGS -Wno-error=attributes -Wno-error=comment -Wno-error=unused-variable -Wno-error=strict-overflow -Wno-error=deprecated-declarations -fno-strict-aliasing" -%endif +export READELF=readelf export PYTHON=%{__python} # libstdc++ in rosa2016.1 is too old to build gn, there are 2 ways to solve this: @@ -612,6 +544,7 @@ CXXFLAGS="-nostdinc++ \ -I%{_includedir}/libstdc++-gcc10 \ -I%{_includedir}/libstdc++-gcc10/%{_host} \ " \ +unset LDFLAGS CXXFLAGS %{__python} tools/gn/bootstrap/bootstrap.py --gn-gen-args='%{gn_config}' out/Release/gn gen --script-executable=%{__python} --args='%{gn_config}' out/Release diff --git a/chromium-vaapi.patch b/chromium-vaapi.patch deleted file mode 100644 index da7b355..0000000 --- a/chromium-vaapi.patch +++ /dev/null @@ -1,116 +0,0 @@ -From abc7295ca1653c85472916909f0eb76e28e79a58 Mon Sep 17 00:00:00 2001 -From: Akarshan Biswas -Date: Thu, 24 Jan 2019 12:45:29 +0530 -Subject: [PATCH] Enable mojo with VDA2 on Linux - ---- - chrome/browser/about_flags.cc | 8 ++++---- - chrome/browser/flag_descriptions.cc | 9 +++++++-- - chrome/browser/flag_descriptions.h | 10 ++++++++-- - gpu/config/software_rendering_list.json | 3 ++- - media/media_options.gni | 9 ++++++--- - media/mojo/services/gpu_mojo_media_client.cc | 4 ++-- - 6 files changed, 29 insertions(+), 14 deletions(-) - -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 0a84c6ac1..be2aa1d8b 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -1714,7 +1714,7 @@ const FeatureEntry kFeatureEntries[] = { - "disable-accelerated-video-decode", - flag_descriptions::kAcceleratedVideoDecodeName, - flag_descriptions::kAcceleratedVideoDecodeDescription, -- kOsMac | kOsWin | kOsCrOS | kOsAndroid, -+ kOsMac | kOsWin | kOsCrOS | kOsAndroid | kOsLinux, - SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), - }, - #if defined(OS_WIN) -@@ -2345,12 +2345,12 @@ const FeatureEntry kFeatureEntries[] = { - FEATURE_VALUE_TYPE(service_manager::features::kXRSandbox)}, - #endif // ENABLE_ISOLATED_XR_SERVICE - #endif // ENABLE_VR --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - {"disable-accelerated-mjpeg-decode", - flag_descriptions::kAcceleratedMjpegDecodeName, -- flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS, -+ flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS | kOsLinux, - SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedMjpegDecode)}, --#endif // OS_CHROMEOS -+#endif // OS_CHROMEOS // OS_LINUX - {"v8-cache-options", flag_descriptions::kV8CacheOptionsName, - flag_descriptions::kV8CacheOptionsDescription, kOsAll, - MULTI_VALUE_TYPE(kV8CacheOptionsChoices)}, -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index 62637e092..86f89fc6e 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -3085,15 +3085,20 @@ const char kTextSuggestionsTouchBarDescription[] = - - #endif - --// Chrome OS ------------------------------------------------------------------- -+// Chrome OS Linux------------------------------------------------------------------- - --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID)) - - const char kAcceleratedMjpegDecodeName[] = - "Hardware-accelerated mjpeg decode for captured frame"; - const char kAcceleratedMjpegDecodeDescription[] = - "Enable hardware-accelerated mjpeg decode for captured frame where " - "available."; -+#endif -+ -+// Chrome OS -------------------------------------------------- -+ -+#if defined(OS_CHROMEOS) - - const char kAllowTouchpadThreeFingerClickName[] = "Touchpad three-finger-click"; - const char kAllowTouchpadThreeFingerClickDescription[] = -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index 5dac660bb..6cc4115da 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -1846,13 +1846,19 @@ extern const char kPermissionPromptPersistenceToggleDescription[]; - - #endif // defined(OS_MACOSX) - --// Chrome OS ------------------------------------------------------------------ -+// Chrome OS and Linux ------------------------------------------------------------------ - --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID)) - - extern const char kAcceleratedMjpegDecodeName[]; - extern const char kAcceleratedMjpegDecodeDescription[]; - -+#endif // defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID)) -+ -+// Chrome OS ------------------------------------------------------------------------ -+ -+#if defined(OS_CHROMEOS) -+ - extern const char kAllowTouchpadThreeFingerClickName[]; - extern const char kAllowTouchpadThreeFingerClickDescription[]; - -diff --git a/gpu/config/software_rendering_list.json b/gpu/config/software_rendering_list.json -index 65f37b3f1..ae8a1718f 100644 ---- a/gpu/config/software_rendering_list.json -+++ b/gpu/config/software_rendering_list.json -@@ -371,11 +371,12 @@ - }, - { - "id": 48, -- "description": "Accelerated video decode is unavailable on Linux", -+ "description": "Accelerated VA-API video decode is not supported on NVIDIA platforms", - "cr_bugs": [137247], - "os": { - "type": "linux" - }, -+ "vendor_id": "0x10de", - "features": [ - "accelerated_video_decode" - ] --- -2.20.1 diff --git a/enable-vaapi-on-linux.diff b/enable-vaapi-on-linux.diff new file mode 100644 index 0000000..19f5e21 --- /dev/null +++ b/enable-vaapi-on-linux.diff @@ -0,0 +1,222 @@ +From 53b93dfe87fd10cced5d2a2a63072dfc7a2af6e4 Mon Sep 17 00:00:00 2001 +From: Daniel Charles +Date: Fri, 28 Jul 2017 16:31:47 -0700 +Subject: [PATCH] Enable VAVDA, VAVEA and VAJDA on linux with VAAPI only + +This patch contains all the changes necessary to use VA-API along with +vaapi-driver to run all media use cases supported with hardware acceleration. + +It is intended to remain as experimental accessible from chrome://flags on linux. +It requires libva/intel-vaapi-driver to be installed on the system path where +chrome is executed. Other drivers could be tested if available. Flags are +kept independent for linux, where this feature has to be enabled before +actually using it. This should not change how other OSes use the flags +already, the new flags will show at the buttom on the section of unavailable +experiments + +The changes cover a range of compiler pre-processor flags to enable the stack. +It moves the presandbox operations to the vaapi_wrapper class as the hook function +is available there. vaInit will open driver on the correct installed folder. + +chrome flags consolidtation into only two flags for linux. Mjpeg and accelerated +video are used. The other flags are kept for ChromeOS and other OSes. + +Developer testing was made on skylake hardware, ChromeOS and Ubuntu. + +BUG=NONE +TEST="subjective testing with VAVDA,VAVEA and VAJDA, autotest for encoder" +TEST="and decoder hardware accelerated" +TEST="have libva/intel-vaapi-driver installed and not installed in the system" +TEST="repeat on different hardware families" +R=posciak@chromium.org +R=kcwu@chromium.org + +Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel +Change-Id: Ifbbf5c9e5221a8b5733fc6d4d0cf984a1f103171 +Signed-off-by: Daniel Charles +--- + +Index: dev/chrome/browser/about_flags.cc +=================================================================== +--- dev.orig/chrome/browser/about_flags.cc ++++ dev/chrome/browser/about_flags.cc +@@ -3014,7 +3014,7 @@ const FeatureEntry kFeatureEntries[] = { + "disable-accelerated-video-decode", + flag_descriptions::kAcceleratedVideoDecodeName, + flag_descriptions::kAcceleratedVideoDecodeDescription, +- kOsMac | kOsWin | kOsCrOS | kOsAndroid, ++ kOsAll, + SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), + }, + #endif // (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && +@@ -3510,10 +3510,10 @@ const FeatureEntry kFeatureEntries[] = { + flag_descriptions::kWebXrForceRuntimeDescription, kOsDesktop, + MULTI_VALUE_TYPE(kWebXrForceRuntimeChoices)}, + #endif // ENABLE_VR +-#if BUILDFLAG(IS_CHROMEOS_ASH) ++#if (BUILDFLAG(IS_CHROMEOS_ASH)) || (defined(OS_LINUX) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS)) + {"disable-accelerated-mjpeg-decode", + flag_descriptions::kAcceleratedMjpegDecodeName, +- flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS, ++ flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS | kOsLinux, + SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedMjpegDecode)}, + #endif // BUILDFLAG(IS_CHROMEOS_ASH) + {"system-keyboard-lock", flag_descriptions::kSystemKeyboardLockName, +Index: dev/chrome/browser/flag_descriptions.cc +=================================================================== +--- dev.orig/chrome/browser/flag_descriptions.cc ++++ dev/chrome/browser/flag_descriptions.cc +@@ -3656,7 +3656,7 @@ const char kVideoToolboxVp9DecodingDescr + + // Chrome OS ------------------------------------------------------------------- + +-#if BUILDFLAG(IS_CHROMEOS_ASH) ++#if (BUILDFLAG(IS_CHROMEOS_ASH)) || (defined(OS_LINUX) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS)) + + const char kAccountManagementFlowsV2Name[] = + "Enable redesign of account management flows"; +@@ -3671,6 +3671,12 @@ const char kAcceleratedMjpegDecodeDescri + "Enable hardware-accelerated mjpeg decode for captured frame where " + "available."; + ++#endif ++ ++// Chrome OS ------------------------------------------------------------------- ++ ++#if defined(OS_CHROMEOS) ++ + const char kAllowDisableMouseAccelerationName[] = + "Allow disabling mouse acceleration"; + const char kAllowDisableMouseAccelerationDescription[] = +Index: dev/chrome/browser/flag_descriptions.h +=================================================================== +--- dev.orig/chrome/browser/flag_descriptions.h ++++ dev/chrome/browser/flag_descriptions.h +@@ -2114,7 +2114,7 @@ extern const char kVideoToolboxVp9Decodi + + // Chrome OS ------------------------------------------------------------------ + +-#if BUILDFLAG(IS_CHROMEOS_ASH) ++#if (BUILDFLAG(IS_CHROMEOS_ASH)) || (defined(OS_LINUX) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS)) + + extern const char kAccountManagementFlowsV2Name[]; + extern const char kAccountManagementFlowsV2Description[]; +@@ -2122,6 +2122,12 @@ extern const char kAccountManagementFlow + extern const char kAcceleratedMjpegDecodeName[]; + extern const char kAcceleratedMjpegDecodeDescription[]; + ++#endif ++ ++// Chrome OS ------------------------------------------------------------------ ++ ++#if defined(OS_CHROMEOS) ++ + extern const char kAllowDisableMouseAccelerationName[]; + extern const char kAllowDisableMouseAccelerationDescription[]; + +Index: dev/content/gpu/BUILD.gn +=================================================================== +--- dev.orig/content/gpu/BUILD.gn ++++ dev/content/gpu/BUILD.gn +@@ -6,6 +6,7 @@ import("//build/config/chromeos/ui_mode. + import("//build/config/ui.gni") + import("//gpu/vulkan/features.gni") + import("//media/media_options.gni") ++import("//media/gpu/args.gni") + + # See //content/BUILD.gn for how this works. + group("gpu") { +@@ -140,4 +141,8 @@ target(link_target_type, "gpu_sources") + (!is_chromecast || is_cast_desktop_build)) { + configs += [ "//build/config/linux/dri" ] + } ++ ++ if (is_linux && use_vaapi) { ++ public_configs = [ "//build/config/linux/libva" ] ++ } + } +Index: dev/media/gpu/gpu_video_decode_accelerator_factory.cc +=================================================================== +--- dev.orig/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ dev/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -160,6 +160,8 @@ GpuVideoDecodeAcceleratorFactory::Create + vda = (this->*create_vda_function)(workarounds, gpu_preferences, media_log); + if (vda && vda->Initialize(config, client)) + return vda; ++ else ++ LOG(ERROR) << "Initialization of one or more VDAs failed."; + } + + return nullptr; +@@ -218,6 +220,7 @@ GpuVideoDecodeAcceleratorFactory::Create + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences, + MediaLog* media_log) const { ++ LOG(WARNING) << "Initializing VAAPI VDA."; + std::unique_ptr decoder; + decoder.reset(new VaapiVideoDecodeAccelerator(gl_client_.make_context_current, + gl_client_.bind_image)); +Index: dev/media/gpu/ipc/service/gpu_video_decode_accelerator.cc +=================================================================== +--- dev.orig/media/gpu/ipc/service/gpu_video_decode_accelerator.cc ++++ dev/media/gpu/ipc/service/gpu_video_decode_accelerator.cc +@@ -384,6 +384,7 @@ bool GpuVideoDecodeAccelerator::Initiali + LOG(ERROR) << "Failed creating the VDA factory"; + return false; + } ++ LOG(WARNING) << "Created the VDA factory"; + + const gpu::GpuDriverBugWorkarounds& gpu_workarounds = + stub_->channel()->gpu_channel_manager()->gpu_driver_bug_workarounds(); +@@ -404,6 +405,7 @@ bool GpuVideoDecodeAccelerator::Initiali + << (config.is_encrypted() ? " with encryption" : ""); + return false; + } ++ LOG(WARNING) << "Created VDA"; + + // Attempt to set up performing decoding tasks on IO thread, if supported by + // the VDA. +Index: dev/media/gpu/vaapi/vaapi_wrapper.cc +=================================================================== +--- dev.orig/media/gpu/vaapi/vaapi_wrapper.cc ++++ dev/media/gpu/vaapi/vaapi_wrapper.cc +@@ -520,6 +520,11 @@ void VADisplayState::PreSandboxInitializ + base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE); + if (drm_file.IsValid()) + VADisplayState::Get()->SetDrmFd(drm_file.GetPlatformFile()); ++ ++ const char kNvidiaPath[] = "/dev/dri/nvidiactl"; ++ base::File nvidia_file = base::File( ++ base::FilePath::FromUTF8Unsafe(kNvidiaPath), ++ base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE); + } + + VADisplayState::VADisplayState() +@@ -626,10 +631,6 @@ bool VADisplayState::InitializeVaDriver_ + } + + bool VADisplayState::InitializeOnce() { +- static_assert( +- VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 1), +- "Requires VA-API >= 1.1.0"); +- + // Set VA logging level, unless already set. + constexpr char libva_log_level_env[] = "LIBVA_MESSAGING_LEVEL"; + std::unique_ptr env(base::Environment::Create()); +@@ -650,7 +651,6 @@ bool VADisplayState::InitializeOnce() { + // https://github.com/intel/media-driver/issues/818 + if (!env->HasVar(libva_driver_impl_env)) + env->SetVar(libva_driver_impl_env, "i965"); +- + // Re-initialize with the new driver. + va_display_ = nullptr; + va_initialized_ = false; +@@ -856,7 +856,7 @@ bool AreAttribsSupported(const base::Loc + if (attribs[i].type != required_attribs[i].type || + (attribs[i].value & required_attribs[i].value) != + required_attribs[i].value) { +- DVLOG(1) << "Unsupported value " << required_attribs[i].value << " for " ++ VLOG(1) << "Unsupported value " << required_attribs[i].value << " for " + << vaConfigAttribTypeStr(required_attribs[i].type); + return false; + } diff --git a/glib2.0.patch b/glib2.0.patch index 8fe8491..557a4f0 100644 --- a/glib2.0.patch +++ b/glib2.0.patch @@ -1,4 +1,4 @@ -Fix building with current glib2.0 +Fix building with glib2.0 2.67 (unstable version) DEBUG: FAILED: obj/ui/accessibility/platform/platform/ax_platform_atk_hyperlink.o DEBUG: ../../ui/accessibility/platform/ax_platform_atk_hyperlink.cc:252:7: error: cannot initialize a parameter of type 'unsigned long *' with an rvalue of type 'typename std::remove_reference::type *' (aka 'volatile unsigned long *') diff --git a/vdpau-support.patch b/vdpau-support.patch new file mode 100644 index 0000000..dd016f8 --- /dev/null +++ b/vdpau-support.patch @@ -0,0 +1,152 @@ +Taken from https://aur.archlinux.org/cgit/aur.git/tree/vdpau-support.patch?h=chromium-vaapi + +Index: dev/media/gpu/vaapi/vaapi_video_decode_accelerator.cc +=================================================================== +--- dev.orig/media/gpu/vaapi/vaapi_video_decode_accelerator.cc ++++ dev/media/gpu/vaapi/vaapi_video_decode_accelerator.cc +@@ -711,7 +711,8 @@ void VaapiVideoDecodeAccelerator::Assign + // implementation we get from |vaapi_picture_factory_| requires the video + // processing pipeline for downloading the decoded frame from the internal + // surface, we need to create a |vpp_vaapi_wrapper_|. +- if (requires_vpp && buffer_allocation_mode_ != BufferAllocationMode::kNone) { ++ if (requires_vpp && buffer_allocation_mode_ != BufferAllocationMode::kNone && ++ buffer_allocation_mode_ != BufferAllocationMode::kWrapVdpau) { + if (!vpp_vaapi_wrapper_) { + vpp_vaapi_wrapper_ = VaapiWrapper::Create( + VaapiWrapper::kVideoProcess, VAProfileNone, +@@ -1226,6 +1227,12 @@ VaapiVideoDecodeAccelerator::DecideBuffe + return BufferAllocationMode::kReduced; + return BufferAllocationMode::kSuperReduced; + #else ++ // NVIDIA blobs use VDPAU ++ if (VaapiWrapper::GetImplementationType() == VAImplementation::kNVIDIAVDPAU) { ++ LOG(INFO) << "VA-API driver on VDPAU backend"; ++ return BufferAllocationMode::kWrapVdpau; ++ } ++ + // TODO(crbug.com/912295): Enable a better BufferAllocationMode for IMPORT + // |output_mode_| as well. + if (output_mode_ == VideoDecodeAccelerator::Config::OutputMode::IMPORT) +@@ -1236,7 +1243,7 @@ VaapiVideoDecodeAccelerator::DecideBuffe + // associated format reconciliation copy, avoiding all internal buffer + // allocations. + // TODO(crbug.com/911754): Enable for VP9 Profile 2. +- if (IsGeminiLakeOrLater() && ++ if (false && IsGeminiLakeOrLater() && + (profile_ == VP9PROFILE_PROFILE0 || profile_ == VP8PROFILE_ANY || + (profile_ >= H264PROFILE_MIN && profile_ <= H264PROFILE_MAX))) { + // Add one to the reference frames for the one being currently egressed, and +Index: dev/media/gpu/vaapi/vaapi_video_decode_accelerator.h +=================================================================== +--- dev.orig/media/gpu/vaapi/vaapi_video_decode_accelerator.h ++++ dev/media/gpu/vaapi/vaapi_video_decode_accelerator.h +@@ -217,6 +217,7 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeA + // Using |client_|s provided PictureBuffers and as many internally + // allocated. + kNormal, ++ kWrapVdpau, + }; + + // Decides the concrete buffer allocation mode, depending on the hardware +Index: dev/media/gpu/vaapi/vaapi_wrapper.cc +=================================================================== +--- dev.orig/media/gpu/vaapi/vaapi_wrapper.cc ++++ dev/media/gpu/vaapi/vaapi_wrapper.cc +@@ -240,6 +240,9 @@ media::VAImplementation VendorStringToIm + } else if (base::StartsWith(va_vendor_string, "Intel iHD driver", + base::CompareCase::SENSITIVE)) { + return media::VAImplementation::kIntelIHD; ++ } else if (base::StartsWith(va_vendor_string, "Splitted-Desktop Systems VDPAU", ++ base::CompareCase::SENSITIVE)) { ++ return media::VAImplementation::kNVIDIAVDPAU; + } + return media::VAImplementation::kOther; + } +@@ -1977,6 +1980,11 @@ VaapiWrapper::ExportVASurfaceAsNativePix + return nullptr; + } + ++ if (GetImplementationType() == VAImplementation::kNVIDIAVDPAU) { ++ LOG(ERROR) << "Disabled due to potential breakage."; ++ return nullptr; ++ } ++ + VADRMPRIMESurfaceDescriptor descriptor; + { + base::AutoLock auto_lock(*va_lock_); +@@ -2680,32 +2688,43 @@ bool VaapiWrapper::CreateSurfaces(unsign + DCHECK(va_surfaces->empty()); + + va_surfaces->resize(num_surfaces); ++ + VASurfaceAttrib attribute{}; +- attribute.type = VASurfaceAttribUsageHint; +- attribute.flags = VA_SURFACE_ATTRIB_SETTABLE; +- attribute.value.type = VAGenericValueTypeInteger; +- switch (usage_hint) { +- case SurfaceUsageHint::kVideoDecoder: +- attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_DECODER; +- break; +- case SurfaceUsageHint::kVideoEncoder: +- attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER; +- break; +- case SurfaceUsageHint::kVideoProcessWrite: +- attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE; +- break; +- case SurfaceUsageHint::kGeneric: +- attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC; +- break; ++ if (GetImplementationType() != VAImplementation::kNVIDIAVDPAU) { ++ // Nvidia's VAAPI-VDPAU driver doesn't support this attribute ++ attribute.type = VASurfaceAttribUsageHint; ++ attribute.flags = VA_SURFACE_ATTRIB_SETTABLE; ++ attribute.value.type = VAGenericValueTypeInteger; ++ switch (usage_hint) { ++ case SurfaceUsageHint::kVideoDecoder: ++ attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_DECODER; ++ break; ++ case SurfaceUsageHint::kVideoEncoder: ++ attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER; ++ break; ++ case SurfaceUsageHint::kVideoProcessWrite: ++ attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE; ++ break; ++ case SurfaceUsageHint::kGeneric: ++ attribute.value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC; ++ break; ++ } + } + + VAStatus va_res; + { + base::AutoLock auto_lock(*va_lock_); +- va_res = vaCreateSurfaces( +- va_display_, va_format, base::checked_cast(size.width()), +- base::checked_cast(size.height()), va_surfaces->data(), +- num_surfaces, &attribute, 1u); ++ if (GetImplementationType() == VAImplementation::kNVIDIAVDPAU) { ++ va_res = vaCreateSurfaces( ++ va_display_, va_format, base::checked_cast(size.width()), ++ base::checked_cast(size.height()), va_surfaces->data(), ++ num_surfaces, NULL, 0); ++ } else { ++ va_res = vaCreateSurfaces( ++ va_display_, va_format, base::checked_cast(size.width()), ++ base::checked_cast(size.height()), va_surfaces->data(), ++ num_surfaces, &attribute, 1u); ++ } + } + VA_LOG_ON_ERROR(va_res, VaapiFunctions::kVACreateSurfaces_Allocating); + return va_res == VA_STATUS_SUCCESS; +Index: dev/media/gpu/vaapi/vaapi_wrapper.h +=================================================================== +--- dev.orig/media/gpu/vaapi/vaapi_wrapper.h ++++ dev/media/gpu/vaapi/vaapi_wrapper.h +@@ -92,6 +92,7 @@ enum class VAImplementation { + kIntelIHD, + kOther, + kInvalid, ++ kNVIDIAVDPAU, + }; + + // This class handles VA-API calls and ensures proper locking of VA-API calls