Remove PPAPISharedImagesSwapChainAllowed and feature flags
The feature was enabled by default in M112 and according to our launch
timelines we're removing code after M114 branched.
This CL removes command line switch, feature flag and escape hatch
policy (with corresponding preferences).
Follow-up CLs will simplify and remove more code once M115 branched.
Bug: 1410109
Change-Id: I61a8e32284b4f7056ae73b186bdb7ad9c492cc69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4521684
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1143576}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
625c88469a
commit
2a7864509a
chrome/browser
about_flags.ccchrome_content_browser_client.ccflag-metadata.jsonflag_descriptions.ccflag_descriptions.h
policy
prefs
components/policy
core
resources
templates
policy_definitions
Miscellaneous
test
content
browser
renderer_host
renderer
gpu
ppapi
proxy
shared_impl
thunk
ui/gfx
@ -9798,13 +9798,6 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
policy::features::kSafeSitesFilterBehaviorPolicyAndroid)},
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_NACL)
|
||||
{"ppapi-shared-images-swapchain",
|
||||
flag_descriptions::kPPAPISharedImagesSwapChainName,
|
||||
flag_descriptions::kPPAPISharedImagesSwapChainDescription, kOsDesktop,
|
||||
FEATURE_VALUE_TYPE(features::kPPAPISharedImagesSwapChain)},
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_NACL)
|
||||
{"support-pepper-video-decoder-dev-api",
|
||||
flag_descriptions::kSupportPepperVideoDecoderDevAPIName,
|
||||
|
@ -1579,8 +1579,6 @@ void ChromeContentBrowserClient::RegisterLocalStatePrefs(
|
||||
prefs::kThrottleNonVisibleCrossOriginIframesAllowed, true);
|
||||
registry->RegisterBooleanPref(prefs::kNewBaseUrlInheritanceBehaviorAllowed,
|
||||
true);
|
||||
registry->RegisterBooleanPref(
|
||||
policy::policy_prefs::kPPAPISharedImagesSwapChainAllowed, true);
|
||||
registry->RegisterBooleanPref(
|
||||
policy::policy_prefs::kForceEnablePepperVideoDecoderDevAPI, false);
|
||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
|
||||
@ -3005,11 +3003,6 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
DCHECK(g_browser_process);
|
||||
PrefService* local_state = g_browser_process->local_state();
|
||||
DCHECK(local_state);
|
||||
if (!local_state->GetBoolean(
|
||||
policy::policy_prefs::kPPAPISharedImagesSwapChainAllowed)) {
|
||||
command_line->AppendSwitch(
|
||||
::switches::kDisablePPAPISharedImagesSwapChain);
|
||||
}
|
||||
if (local_state->GetBoolean(
|
||||
policy::policy_prefs::kForceEnablePepperVideoDecoderDevAPI)) {
|
||||
command_line->AppendSwitch(
|
||||
|
@ -6163,11 +6163,6 @@
|
||||
"owners": [ "emshack", "chrome-desktop-ui-sea" ],
|
||||
"expiry_milestone": 118
|
||||
},
|
||||
{
|
||||
"name": "ppapi-shared-images-swapchain",
|
||||
"owners": [ "vasilyt" ],
|
||||
"expiry_milestone": 128
|
||||
},
|
||||
{
|
||||
"name": "prefer-constant-frame-rate",
|
||||
"owners": [ "chromeos-camera-eng@google.com" ],
|
||||
|
@ -215,11 +215,6 @@ const char kEnableBenchmarkingDescription[] =
|
||||
"after 3 restarts. On the third restart, the flag will appear to be off "
|
||||
"but the effect is still active.";
|
||||
|
||||
extern const char kPPAPISharedImagesSwapChainName[] =
|
||||
"Use SharedImages for PPAPI swapchain";
|
||||
extern const char kPPAPISharedImagesSwapChainDescription[] =
|
||||
"Switches legacy swap chain code to SharedImages";
|
||||
|
||||
extern const char kSupportPepperVideoDecoderDevAPIName[] =
|
||||
"Controls whether the Pepper PPB_VideoDecoder(Dev) API is supported";
|
||||
extern const char kSupportPepperVideoDecoderDevAPIDescription[] =
|
||||
|
@ -158,9 +158,6 @@ extern const char kPasspointARCSupportDescription[];
|
||||
extern const char kPasspointSettingsName[];
|
||||
extern const char kPasspointSettingsDescription[];
|
||||
|
||||
extern const char kPPAPISharedImagesSwapChainName[];
|
||||
extern const char kPPAPISharedImagesSwapChainDescription[];
|
||||
|
||||
extern const char kSupportPepperVideoDecoderDevAPIName[];
|
||||
extern const char kSupportPepperVideoDecoderDevAPIDescription[];
|
||||
|
||||
|
@ -1879,9 +1879,6 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
|
||||
base::Value::Type::INTEGER },
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
#if BUILDFLAG(ENABLE_PPAPI)
|
||||
{ key::kPPAPISharedImagesSwapChainAllowed,
|
||||
policy::policy_prefs::kPPAPISharedImagesSwapChainAllowed,
|
||||
base::Value::Type::BOOLEAN },
|
||||
{ key::kForceEnablePepperVideoDecoderDevAPI,
|
||||
policy::policy_prefs::kForceEnablePepperVideoDecoderDevAPI,
|
||||
base::Value::Type::BOOLEAN },
|
||||
|
@ -819,6 +819,10 @@ const char kVideoTutorialsLastUpdatedTimeKey[] =
|
||||
const char kUseMojoVideoDecoderForPepperAllowed[] =
|
||||
"policy.use_mojo_video_decoder_for_pepper_allowed";
|
||||
|
||||
// Deprecated 05/2023.
|
||||
const char kPPAPISharedImagesSwapChainAllowed[] =
|
||||
"policy.ppapi_shared_images_swap_chain_allowed";
|
||||
|
||||
// Register local state used only for migration (clearing or moving to a new
|
||||
// key).
|
||||
void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
|
||||
@ -911,6 +915,9 @@ void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
|
||||
|
||||
// Deprecated 05/2023.
|
||||
registry->RegisterBooleanPref(kUseMojoVideoDecoderForPepperAllowed, true);
|
||||
|
||||
// Deprecated 05/2023.
|
||||
registry->RegisterBooleanPref(kPPAPISharedImagesSwapChainAllowed, true);
|
||||
}
|
||||
|
||||
// Register prefs used only for migration (clearing or moving to a new key).
|
||||
@ -1895,6 +1902,9 @@ void MigrateObsoleteLocalStatePrefs(PrefService* local_state) {
|
||||
// Added 05/2023.
|
||||
local_state->ClearPref(kUseMojoVideoDecoderForPepperAllowed);
|
||||
|
||||
// Added 05/2023
|
||||
local_state->ClearPref(kPPAPISharedImagesSwapChainAllowed);
|
||||
|
||||
// Please don't delete the following line. It is used by PRESUBMIT.py.
|
||||
// END_MIGRATE_OBSOLETE_LOCAL_STATE_PREFS
|
||||
|
||||
|
@ -122,11 +122,6 @@ const char kOffsetParentNewSpecBehaviorEnabled[] =
|
||||
const char kSendMouseEventsDisabledFormControlsEnabled[] =
|
||||
"policy.send_mouse_events_disabled_form_controls_enabled";
|
||||
|
||||
// If true the feature PPAPISharedImagesSwapChain will be allowed, otherwise
|
||||
// feature will be forced off.
|
||||
const char kPPAPISharedImagesSwapChainAllowed[] =
|
||||
"policy.ppapi_shared_images_swap_chain_allowed";
|
||||
|
||||
// If true then support for the PPB_VideoDecoder(Dev) API will be enabled;
|
||||
// otherwise the browser will decide whether the API is supported.
|
||||
const char kForceEnablePepperVideoDecoderDevAPI[] =
|
||||
|
@ -63,7 +63,6 @@ extern const char kUserPolicyNotificationWasShown[];
|
||||
extern const char kEventPathEnabled[];
|
||||
extern const char kOffsetParentNewSpecBehaviorEnabled[];
|
||||
extern const char kSendMouseEventsDisabledFormControlsEnabled[];
|
||||
extern const char kPPAPISharedImagesSwapChainAllowed[];
|
||||
extern const char kForceEnablePepperVideoDecoderDevAPI[];
|
||||
extern const char kForceGoogleSafeSearch[];
|
||||
extern const char kForceYouTubeRestrict[];
|
||||
|
@ -23,9 +23,9 @@ desc: |-
|
||||
policy while the browser is running.
|
||||
|
||||
supported_on:
|
||||
# TODO(crbug.com/1410109): Remove this policy on ~May 6 after 114 has branched.
|
||||
- chrome.*:110-
|
||||
- chrome_os:110-
|
||||
- chrome.*:110-114
|
||||
- chrome_os:110-114
|
||||
deprecated: true
|
||||
device_only: false
|
||||
supported_chrome_os_management:
|
||||
- google_cloud
|
||||
|
@ -21786,42 +21786,7 @@
|
||||
"reason_for_missing_test": "Policy was removed"
|
||||
},
|
||||
"PPAPISharedImagesSwapChainAllowed": {
|
||||
"os": [
|
||||
"win",
|
||||
"linux",
|
||||
"mac",
|
||||
"chromeos_ash",
|
||||
"chromeos_lacros"
|
||||
],
|
||||
"policy_pref_mapping_tests": [
|
||||
{
|
||||
"policies": {},
|
||||
"prefs": {
|
||||
"policy.ppapi_shared_images_swap_chain_allowed": {
|
||||
"location": "local_state",
|
||||
"default_value": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"policies": { "PPAPISharedImagesSwapChainAllowed": true },
|
||||
"prefs": {
|
||||
"policy.ppapi_shared_images_swap_chain_allowed": {
|
||||
"location": "local_state",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"policies": { "PPAPISharedImagesSwapChainAllowed": false },
|
||||
"prefs": {
|
||||
"policy.ppapi_shared_images_swap_chain_allowed": {
|
||||
"location": "local_state",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"reason_for_missing_test": "Policy was removed"
|
||||
},
|
||||
"ForceEnablePepperVideoDecoderDevAPI": {
|
||||
"os": [
|
||||
|
@ -3379,7 +3379,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
|
||||
switches::kDisableOriginTrialControlledBlinkFeatures,
|
||||
switches::kDisablePepper3DImageChromium,
|
||||
switches::kDisablePermissionsAPI,
|
||||
switches::kDisablePPAPISharedImagesSwapChain,
|
||||
switches::kDisablePresentationAPI,
|
||||
switches::kDisableRTCSmoothnessAlgorithm,
|
||||
switches::kDisableScrollToTextFragment,
|
||||
|
@ -46,26 +46,6 @@ using blink::WebString;
|
||||
|
||||
namespace content {
|
||||
|
||||
namespace {
|
||||
|
||||
bool UseSharedImagesSwapChainForPPAPI() {
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kDisablePPAPISharedImagesSwapChain)) {
|
||||
// This log is to make diagnosing any outages for Enterprise customers
|
||||
// easier.
|
||||
LOG(WARNING) << "NaCL SwapChain: Disabled by policy";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto enabled =
|
||||
base::FeatureList::IsEnabled(features::kPPAPISharedImagesSwapChain);
|
||||
// This log is to make diagnosing any outages for Enterprise customers easier.
|
||||
LOG(WARNING) << "NaCL SwapChain: Feature Controled: " << enabled;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// This class encapsulates ColorBuffer for the plugin. It wraps corresponding
|
||||
// SharedImage that we draw to and that we send to display compositor.
|
||||
// Can be in one of the 3 states:
|
||||
@ -183,16 +163,9 @@ class PPB_Graphics3D_Impl::ColorBuffer {
|
||||
};
|
||||
|
||||
PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance)
|
||||
: PPB_Graphics3D_Shared(instance,
|
||||
/*use_shared_images_swapchain=*/
|
||||
UseSharedImagesSwapChainForPPAPI()),
|
||||
: PPB_Graphics3D_Shared(instance),
|
||||
bound_to_instance_(false),
|
||||
commit_pending_(false),
|
||||
has_alpha_(false),
|
||||
use_image_chromium_(
|
||||
!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kDisablePepper3DImageChromium) &&
|
||||
base::FeatureList::IsEnabled(features::kPepper3DImageChromium)) {}
|
||||
commit_pending_(false) {}
|
||||
|
||||
PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() {
|
||||
if (current_color_buffer_ && current_color_buffer_->IsAttached()) {
|
||||
@ -271,27 +244,17 @@ void PPB_Graphics3D_Impl::EnsureWorkVisible() {
|
||||
command_buffer_->EnsureWorkVisible();
|
||||
}
|
||||
|
||||
void PPB_Graphics3D_Impl::TakeFrontBuffer() {
|
||||
taken_front_buffer_ = GenerateMailbox();
|
||||
command_buffer_->TakeFrontBuffer(taken_front_buffer_);
|
||||
}
|
||||
|
||||
void PPB_Graphics3D_Impl::ReturnFrontBuffer(const gpu::Mailbox& mailbox,
|
||||
const gpu::SyncToken& sync_token,
|
||||
bool is_lost) {
|
||||
if (use_shared_images_swapchain_) {
|
||||
if (is_single_buffered_) {
|
||||
// We don't verify that mailbox is the same we have in the
|
||||
// `current_color_buffer_` because it could have changed do to resize.
|
||||
} else {
|
||||
auto it = inflight_color_buffers_.find(mailbox);
|
||||
DCHECK(it != inflight_color_buffers_.end());
|
||||
RecycleColorBuffer(std::move(it->second), sync_token, is_lost);
|
||||
inflight_color_buffers_.erase(it);
|
||||
}
|
||||
if (is_single_buffered_) {
|
||||
// We don't verify that mailbox is the same we have in the
|
||||
// `current_color_buffer_` because it could have changed do to resize.
|
||||
} else {
|
||||
command_buffer_->ReturnFrontBuffer(mailbox, sync_token, is_lost);
|
||||
mailboxes_to_reuse_.push_back(mailbox);
|
||||
auto it = inflight_color_buffers_.find(mailbox);
|
||||
DCHECK(it != inflight_color_buffers_.end());
|
||||
RecycleColorBuffer(std::move(it->second), sync_token, is_lost);
|
||||
inflight_color_buffers_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,50 +285,6 @@ gpu::GpuControl* PPB_Graphics3D_Impl::GetGpuControl() {
|
||||
return command_buffer_.get();
|
||||
}
|
||||
|
||||
int32_t PPB_Graphics3D_Impl::DoSwapBuffers(const gpu::SyncToken& sync_token,
|
||||
const gfx::Size& size) {
|
||||
DCHECK(command_buffer_);
|
||||
|
||||
if (use_shared_images_swapchain_)
|
||||
return DoPresent(sync_token, size);
|
||||
|
||||
if (taken_front_buffer_.IsZero()) {
|
||||
DLOG(ERROR) << "TakeFrontBuffer should be called before DoSwapBuffers";
|
||||
return PP_ERROR_FAILED;
|
||||
}
|
||||
|
||||
if (bound_to_instance_) {
|
||||
// If we are bound to the instance, we need to ask the compositor
|
||||
// to commit our backing texture so that the graphics appears on the page.
|
||||
// When the backing texture will be committed we get notified via
|
||||
// ViewFlushedPaint().
|
||||
//
|
||||
// Don't need to check for NULL from GetPluginInstance since when we're
|
||||
// bound, we know our instance is valid.
|
||||
bool is_overlay_candidate = use_image_chromium_;
|
||||
// TODO(reveman): Get texture target from browser process.
|
||||
uint32_t target = GL_TEXTURE_2D;
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
if (use_image_chromium_)
|
||||
target = GL_TEXTURE_RECTANGLE_ARB;
|
||||
#endif
|
||||
viz::TransferableResource resource = viz::TransferableResource::MakeGpu(
|
||||
taken_front_buffer_, target, sync_token, size,
|
||||
viz::SinglePlaneFormat::kRGBA_8888, is_overlay_candidate);
|
||||
HostGlobals::Get()
|
||||
->GetInstance(pp_instance())
|
||||
->CommitTransferableResource(resource);
|
||||
commit_pending_ = true;
|
||||
} else {
|
||||
// Wait for the command to complete on the GPU to allow for throttling.
|
||||
command_buffer_->SignalSyncToken(
|
||||
sync_token, base::BindOnce(&PPB_Graphics3D_Impl::OnSwapBuffers,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
return PP_OK_COMPLETIONPENDING;
|
||||
}
|
||||
|
||||
bool PPB_Graphics3D_Impl::InitRaw(
|
||||
PPB_Graphics3D_API* share_context,
|
||||
const gpu::ContextCreationAttribs& requested_attribs,
|
||||
@ -407,12 +326,11 @@ bool PPB_Graphics3D_Impl::InitRaw(
|
||||
|
||||
has_alpha_ = requested_attribs.alpha_size > 0;
|
||||
|
||||
if (use_shared_images_swapchain_) {
|
||||
is_single_buffered_ = requested_attribs.single_buffer;
|
||||
needs_depth_ = requested_attribs.depth_size > 0;
|
||||
needs_stencil_ = requested_attribs.stencil_size > 0;
|
||||
swapchain_size_ = requested_attribs.offscreen_framebuffer_size;
|
||||
}
|
||||
is_single_buffered_ = requested_attribs.single_buffer;
|
||||
needs_depth_ = requested_attribs.depth_size > 0;
|
||||
needs_stencil_ = requested_attribs.stencil_size > 0;
|
||||
swapchain_size_ = requested_attribs.offscreen_framebuffer_size;
|
||||
|
||||
// If we're in single buffered mode, we don't need additional buffer to
|
||||
// preserve contents.
|
||||
preserve_ = requested_attribs.buffer_preserved && !is_single_buffered_;
|
||||
@ -421,14 +339,7 @@ bool PPB_Graphics3D_Impl::InitRaw(
|
||||
!requested_attribs.single_buffer)
|
||||
samples_count_ = requested_attribs.samples;
|
||||
|
||||
gpu::ContextCreationAttribs attrib_helper = requested_attribs;
|
||||
attrib_helper.should_use_native_gmb_for_backbuffer = use_image_chromium_;
|
||||
|
||||
if (use_shared_images_swapchain_) {
|
||||
// Reset all attribs to default if we use our own default framebuffer.
|
||||
attrib_helper = gpu::ContextCreationAttribs();
|
||||
}
|
||||
|
||||
gpu::ContextCreationAttribs attrib_helper;
|
||||
attrib_helper.context_type = gpu::CONTEXT_TYPE_OPENGLES2;
|
||||
|
||||
gpu::CommandBufferProxyImpl* share_buffer = nullptr;
|
||||
@ -439,8 +350,7 @@ bool PPB_Graphics3D_Impl::InitRaw(
|
||||
share_buffer = share_graphics->GetCommandBufferProxy();
|
||||
}
|
||||
|
||||
if (use_shared_images_swapchain_)
|
||||
shared_image_interface_ = channel->CreateClientSharedImageInterface();
|
||||
shared_image_interface_ = channel->CreateClientSharedImageInterface();
|
||||
|
||||
command_buffer_ = std::make_unique<gpu::CommandBufferProxyImpl>(
|
||||
std::move(channel), render_thread->GetGpuMemoryBufferManager(),
|
||||
@ -457,17 +367,13 @@ bool PPB_Graphics3D_Impl::InitRaw(
|
||||
*shared_state_region = &command_buffer_->GetSharedStateRegion();
|
||||
if (capabilities) {
|
||||
*capabilities = command_buffer_->GetCapabilities();
|
||||
capabilities->use_shared_images_swapchain_for_ppapi =
|
||||
use_shared_images_swapchain_;
|
||||
}
|
||||
if (command_buffer_id)
|
||||
*command_buffer_id = command_buffer_->GetCommandBufferID();
|
||||
|
||||
if (use_shared_images_swapchain_) {
|
||||
current_color_buffer_ = GetOrCreateColorBuffer();
|
||||
current_color_buffer_->Attach(command_buffer_.get(), samples_count_,
|
||||
preserve_, needs_depth_, needs_stencil_);
|
||||
}
|
||||
current_color_buffer_ = GetOrCreateColorBuffer();
|
||||
current_color_buffer_->Attach(command_buffer_.get(), samples_count_,
|
||||
preserve_, needs_depth_, needs_stencil_);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -551,20 +457,9 @@ void PPB_Graphics3D_Impl::SendContextLost() {
|
||||
ppp_graphics_3d->Graphics3DContextLost(this_pp_instance);
|
||||
}
|
||||
|
||||
gpu::Mailbox PPB_Graphics3D_Impl::GenerateMailbox() {
|
||||
if (!mailboxes_to_reuse_.empty()) {
|
||||
gpu::Mailbox mailbox = mailboxes_to_reuse_.back();
|
||||
mailboxes_to_reuse_.pop_back();
|
||||
return mailbox;
|
||||
}
|
||||
|
||||
return gpu::Mailbox::GenerateLegacyMailbox();
|
||||
}
|
||||
|
||||
int32_t PPB_Graphics3D_Impl::DoPresent(const gpu::SyncToken& sync_token,
|
||||
const gfx::Size& size) {
|
||||
int32_t PPB_Graphics3D_Impl::DoSwapBuffers(const gpu::SyncToken& sync_token,
|
||||
const gfx::Size& size) {
|
||||
DCHECK(command_buffer_);
|
||||
DCHECK(use_shared_images_swapchain_);
|
||||
DCHECK(current_color_buffer_);
|
||||
DCHECK_EQ(size, current_color_buffer_->size());
|
||||
|
||||
@ -619,14 +514,11 @@ int32_t PPB_Graphics3D_Impl::DoPresent(const gpu::SyncToken& sync_token,
|
||||
}
|
||||
|
||||
void PPB_Graphics3D_Impl::ResolveAndDetachFramebuffer() {
|
||||
DCHECK(use_shared_images_swapchain_);
|
||||
DCHECK(current_color_buffer_);
|
||||
current_color_buffer_->Detach(command_buffer_.get());
|
||||
}
|
||||
|
||||
void PPB_Graphics3D_Impl::DoResize(gfx::Size size) {
|
||||
DCHECK(use_shared_images_swapchain_);
|
||||
|
||||
if (swapchain_size_ == size)
|
||||
return;
|
||||
swapchain_size_ = size;
|
||||
@ -643,7 +535,6 @@ void PPB_Graphics3D_Impl::DoResize(gfx::Size size) {
|
||||
|
||||
std::unique_ptr<PPB_Graphics3D_Impl::ColorBuffer>
|
||||
PPB_Graphics3D_Impl::GetOrCreateColorBuffer() {
|
||||
DCHECK(use_shared_images_swapchain_);
|
||||
if (!available_color_buffers_.empty()) {
|
||||
auto result = std::move(*available_color_buffers_.begin());
|
||||
available_color_buffers_.erase(available_color_buffers_.begin());
|
||||
@ -659,7 +550,6 @@ void PPB_Graphics3D_Impl::RecycleColorBuffer(
|
||||
std::unique_ptr<ColorBuffer> buffer,
|
||||
const gpu::SyncToken& sync_token,
|
||||
bool is_lost) {
|
||||
DCHECK(use_shared_images_swapchain_);
|
||||
buffer->Recycle(sync_token);
|
||||
if (is_lost || buffer->size() != swapchain_size_)
|
||||
return;
|
||||
|
@ -55,7 +55,6 @@ class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared,
|
||||
int32_t start,
|
||||
int32_t end) override;
|
||||
void EnsureWorkVisible() override;
|
||||
void TakeFrontBuffer() override;
|
||||
void ReturnFrontBuffer(const gpu::Mailbox& mailbox,
|
||||
const gpu::SyncToken& sync_token,
|
||||
bool is_lost);
|
||||
@ -105,9 +104,6 @@ class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared,
|
||||
// Notifications sent to plugin.
|
||||
void SendContextLost();
|
||||
|
||||
// Reuses a mailbox if one is available, otherwise makes a new one.
|
||||
gpu::Mailbox GenerateMailbox();
|
||||
|
||||
// This is called by NaCL process when it wants to present next frame
|
||||
// (SwapBuffers call from the plugin). Note that
|
||||
// `ResolveAndDetachFramebuffer()` must be called before and `sync_token` must
|
||||
@ -131,13 +127,6 @@ class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared,
|
||||
base::flat_map<gpu::Mailbox, std::unique_ptr<ColorBuffer>>
|
||||
inflight_color_buffers_;
|
||||
|
||||
// A front buffer that was recently taken from the command buffer. This should
|
||||
// be immediately consumed by DoSwapBuffers().
|
||||
gpu::Mailbox taken_front_buffer_;
|
||||
|
||||
// Mailboxes that are no longer in use.
|
||||
std::vector<gpu::Mailbox> mailboxes_to_reuse_;
|
||||
|
||||
// True if context is bound to instance.
|
||||
bool bound_to_instance_;
|
||||
// True when waiting for compositor to commit our backing texture.
|
||||
@ -154,7 +143,6 @@ class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared,
|
||||
bool needs_depth_ = false;
|
||||
bool needs_stencil_ = false;
|
||||
|
||||
const bool use_image_chromium_;
|
||||
std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_;
|
||||
std::unique_ptr<gpu::ClientSharedImageInterface> shared_image_interface_;
|
||||
|
||||
|
@ -181,9 +181,6 @@ struct GPU_EXPORT Capabilities {
|
||||
// Used by OOP raster.
|
||||
bool context_supports_distance_field_text = true;
|
||||
|
||||
// Used only by NaCL graphics 3D.
|
||||
bool use_shared_images_swapchain_for_ppapi = false;
|
||||
|
||||
GpuMemoryBufferFormatSet gpu_memory_buffer_formats = {
|
||||
gfx::BufferFormat::BGR_565, gfx::BufferFormat::RGBA_4444,
|
||||
gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::RGBX_8888,
|
||||
|
@ -137,8 +137,6 @@ IPC_STRUCT_TRAITS_BEGIN(gpu::Capabilities)
|
||||
IPC_STRUCT_TRAITS_MEMBER(major_version)
|
||||
IPC_STRUCT_TRAITS_MEMBER(minor_version)
|
||||
|
||||
IPC_STRUCT_TRAITS_MEMBER(use_shared_images_swapchain_for_ppapi)
|
||||
|
||||
IPC_STRUCT_TRAITS_MEMBER(gpu_memory_buffer_formats)
|
||||
IPC_STRUCT_TRAITS_MEMBER(texture_target_exception_list)
|
||||
IPC_STRUCT_TRAITS_MEMBER(drm_formats_and_modifiers)
|
||||
|
@ -758,11 +758,10 @@ IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer,
|
||||
int32_t /* id */)
|
||||
// The receiver of this message takes ownership of the front buffer of the GL
|
||||
// context. Each call to PpapiHostMsg_PPBGraphics3D_SwapBuffers must be preceded
|
||||
// by exactly one call to PpapiHostMsg_PPBGraphics3D_TakeFrontBuffer. The
|
||||
// SyncToken passed to PpapiHostMsg_PPBGraphics3D_SwapBuffers must be generated
|
||||
// after this message is sent.
|
||||
IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBGraphics3D_TakeFrontBuffer,
|
||||
ppapi::HostResource /* graphics_3d */)
|
||||
// by exactly one call to
|
||||
// PpapiHostMsg_PPBGraphics3D_ResolveAndDetachFramebuffer. The SyncToken passed
|
||||
// to PpapiHostMsg_PPBGraphics3D_SwapBuffers must be generated after this
|
||||
// message is sent.
|
||||
IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBGraphics3D_SwapBuffers,
|
||||
ppapi::HostResource /* graphics_3d */,
|
||||
gpu::SyncToken /* sync_token */,
|
||||
|
@ -46,17 +46,8 @@ gpu::CommandBuffer::State GetErrorState() {
|
||||
|
||||
} // namespace
|
||||
|
||||
Graphics3D::Graphics3D(const HostResource& resource,
|
||||
const gfx::Size& size,
|
||||
const bool single_buffer,
|
||||
bool use_shared_images_swapchain)
|
||||
: PPB_Graphics3D_Shared(resource, size, use_shared_images_swapchain),
|
||||
single_buffer(single_buffer) {
|
||||
// This log is to make diagnosing any outages for Enterprise customers
|
||||
// easier.
|
||||
LOG(WARNING) << "Graphics3D initialized. use_shared_images_swapchain: "
|
||||
<< use_shared_images_swapchain_;
|
||||
}
|
||||
Graphics3D::Graphics3D(const HostResource& resource, const gfx::Size& size)
|
||||
: PPB_Graphics3D_Shared(resource, size) {}
|
||||
|
||||
Graphics3D::~Graphics3D() {
|
||||
DestroyGLES2Impl();
|
||||
@ -115,10 +106,6 @@ void Graphics3D::EnsureWorkVisible() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void Graphics3D::TakeFrontBuffer() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void Graphics3D::ResolveAndDetachFramebuffer() {
|
||||
NOTREACHED();
|
||||
}
|
||||
@ -138,23 +125,13 @@ int32_t Graphics3D::DoSwapBuffers(const gpu::SyncToken& sync_token,
|
||||
|
||||
gpu::gles2::GLES2Implementation* gl = gles2_impl();
|
||||
|
||||
if (use_shared_images_swapchain_) {
|
||||
// Flush current GL commands.
|
||||
gl->ShallowFlushCHROMIUM();
|
||||
// Flush current GL commands.
|
||||
gl->ShallowFlushCHROMIUM();
|
||||
|
||||
// Make sure we resolved and detached our frame buffer
|
||||
PluginDispatcher::GetForResource(this)->Send(
|
||||
new PpapiHostMsg_PPBGraphics3D_ResolveAndDetachFramebuffer(
|
||||
API_ID_PPB_GRAPHICS_3D, host_resource()));
|
||||
} else {
|
||||
gl->SwapBuffers(swap_id_++);
|
||||
|
||||
if (!single_buffer || swap_id_ == 1) {
|
||||
PluginDispatcher::GetForResource(this)->Send(
|
||||
new PpapiHostMsg_PPBGraphics3D_TakeFrontBuffer(API_ID_PPB_GRAPHICS_3D,
|
||||
host_resource()));
|
||||
}
|
||||
}
|
||||
// Make sure we resolved and detached our frame buffer
|
||||
PluginDispatcher::GetForResource(this)->Send(
|
||||
new PpapiHostMsg_PPBGraphics3D_ResolveAndDetachFramebuffer(
|
||||
API_ID_PPB_GRAPHICS_3D, host_resource()));
|
||||
|
||||
gpu::SyncToken new_sync_token;
|
||||
gl->GenSyncTokenCHROMIUM(new_sync_token.GetData());
|
||||
@ -168,7 +145,6 @@ int32_t Graphics3D::DoSwapBuffers(const gpu::SyncToken& sync_token,
|
||||
}
|
||||
|
||||
void Graphics3D::DoResize(gfx::Size size) {
|
||||
DCHECK(use_shared_images_swapchain_);
|
||||
// Flush current GL commands.
|
||||
gles2_impl()->ShallowFlushCHROMIUM();
|
||||
PluginDispatcher::GetForResource(this)->Send(
|
||||
@ -275,9 +251,7 @@ PP_Resource PPB_Graphics3D_Proxy::CreateProxyResource(
|
||||
return 0;
|
||||
|
||||
scoped_refptr<Graphics3D> graphics_3d(
|
||||
new Graphics3D(result, attrib_helper.offscreen_framebuffer_size,
|
||||
attrib_helper.single_buffer,
|
||||
capabilities.use_shared_images_swapchain_for_ppapi));
|
||||
new Graphics3D(result, attrib_helper.offscreen_framebuffer_size));
|
||||
if (!graphics_3d->Init(share_gles2, capabilities, std::move(shared_state),
|
||||
command_buffer_id)) {
|
||||
return 0;
|
||||
@ -304,8 +278,6 @@ bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
|
||||
OnMsgDestroyTransferBuffer)
|
||||
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers,
|
||||
OnMsgSwapBuffers)
|
||||
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_TakeFrontBuffer,
|
||||
OnMsgTakeFrontBuffer)
|
||||
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_ResolveAndDetachFramebuffer,
|
||||
OnMsgResolveAndDetachFramebuffer)
|
||||
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Resize, OnMsgResize)
|
||||
@ -438,12 +410,6 @@ void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context,
|
||||
enter.callback(), sync_token, size));
|
||||
}
|
||||
|
||||
void PPB_Graphics3D_Proxy::OnMsgTakeFrontBuffer(const HostResource& context) {
|
||||
EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
|
||||
if (enter.succeeded())
|
||||
enter.object()->TakeFrontBuffer();
|
||||
}
|
||||
|
||||
void PPB_Graphics3D_Proxy::OnMsgResolveAndDetachFramebuffer(
|
||||
const HostResource& context) {
|
||||
EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
|
||||
|
@ -36,10 +36,7 @@ class PpapiCommandBufferProxy;
|
||||
|
||||
class PPAPI_PROXY_EXPORT Graphics3D : public PPB_Graphics3D_Shared {
|
||||
public:
|
||||
Graphics3D(const HostResource& resource,
|
||||
const gfx::Size& size,
|
||||
const bool single_buffer,
|
||||
bool use_shared_images_swapchain);
|
||||
Graphics3D(const HostResource& resource, const gfx::Size& size);
|
||||
|
||||
Graphics3D(const Graphics3D&) = delete;
|
||||
Graphics3D& operator=(const Graphics3D&) = delete;
|
||||
@ -64,7 +61,6 @@ class PPAPI_PROXY_EXPORT Graphics3D : public PPB_Graphics3D_Shared {
|
||||
int32_t start,
|
||||
int32_t end) override;
|
||||
void EnsureWorkVisible() override;
|
||||
void TakeFrontBuffer() override;
|
||||
void ResolveAndDetachFramebuffer() override;
|
||||
|
||||
private:
|
||||
@ -76,9 +72,6 @@ class PPAPI_PROXY_EXPORT Graphics3D : public PPB_Graphics3D_Shared {
|
||||
void DoResize(gfx::Size size) override;
|
||||
|
||||
std::unique_ptr<PpapiCommandBufferProxy> command_buffer_;
|
||||
|
||||
uint64_t swap_id_ = 0;
|
||||
bool single_buffer = false;
|
||||
};
|
||||
|
||||
class PPB_Graphics3D_Proxy : public InterfaceProxy {
|
||||
@ -130,7 +123,6 @@ class PPB_Graphics3D_Proxy : public InterfaceProxy {
|
||||
void OnMsgSwapBuffers(const HostResource& context,
|
||||
const gpu::SyncToken& sync_token,
|
||||
const gfx::Size& size);
|
||||
void OnMsgTakeFrontBuffer(const HostResource& context);
|
||||
void OnMsgEnsureWorkVisible(const HostResource& context);
|
||||
void OnMsgResolveAndDetachFramebuffer(const HostResource& context);
|
||||
void OnMsgResize(const HostResource& context, gfx::Size size);
|
||||
|
@ -96,8 +96,7 @@ class VideoDecoderResourceTest : public PluginProxyTest {
|
||||
HostResource host_resource;
|
||||
host_resource.SetHostResource(pp_instance(), kGraphics3D);
|
||||
scoped_refptr<ppapi::proxy::Graphics3D> graphics_3d(
|
||||
new ppapi::proxy::Graphics3D(host_resource, gfx::Size(640, 480), false,
|
||||
false));
|
||||
new ppapi::proxy::Graphics3D(host_resource, gfx::Size(640, 480)));
|
||||
|
||||
return graphics_3d->GetReference();
|
||||
}
|
||||
|
@ -15,17 +15,12 @@
|
||||
|
||||
namespace ppapi {
|
||||
|
||||
PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(PP_Instance instance,
|
||||
bool use_shared_images_swapchain)
|
||||
: Resource(OBJECT_IS_IMPL, instance),
|
||||
use_shared_images_swapchain_(use_shared_images_swapchain) {}
|
||||
PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(PP_Instance instance)
|
||||
: Resource(OBJECT_IS_IMPL, instance) {}
|
||||
|
||||
PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(const HostResource& host_resource,
|
||||
const gfx::Size& size,
|
||||
bool use_shared_images_swapchain)
|
||||
: Resource(OBJECT_IS_PROXY, host_resource),
|
||||
use_shared_images_swapchain_(use_shared_images_swapchain),
|
||||
size_(size) {}
|
||||
const gfx::Size& size)
|
||||
: Resource(OBJECT_IS_PROXY, host_resource), size_(size) {}
|
||||
|
||||
PPB_Graphics3D_Shared::~PPB_Graphics3D_Shared() {
|
||||
// Make sure that GLES2 implementation has already been destroyed.
|
||||
@ -59,11 +54,8 @@ int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) {
|
||||
|
||||
size_ = gfx::Size(width, height);
|
||||
|
||||
if (use_shared_images_swapchain_) {
|
||||
DoResize(size_);
|
||||
} else {
|
||||
gles2_impl()->ResizeCHROMIUM(width, height, 1.f, nullptr, true);
|
||||
}
|
||||
DoResize(size_);
|
||||
|
||||
// TODO(alokp): Check if resize succeeded and return appropriate error code.
|
||||
return PP_OK;
|
||||
}
|
||||
|
@ -68,10 +68,9 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared
|
||||
void SwapBuffersACK(int32_t pp_error);
|
||||
|
||||
protected:
|
||||
PPB_Graphics3D_Shared(PP_Instance instance, bool use_shared_images_swapchain);
|
||||
explicit PPB_Graphics3D_Shared(PP_Instance instance);
|
||||
PPB_Graphics3D_Shared(const HostResource& host_resource,
|
||||
const gfx::Size& size,
|
||||
bool use_shared_images_swapchain);
|
||||
const gfx::Size& size);
|
||||
~PPB_Graphics3D_Shared() override;
|
||||
|
||||
virtual gpu::CommandBuffer* GetCommandBuffer() = 0;
|
||||
@ -84,8 +83,6 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared
|
||||
bool CreateGLES2Impl(gpu::gles2::GLES2Implementation* share_gles2);
|
||||
void DestroyGLES2Impl();
|
||||
|
||||
const bool use_shared_images_swapchain_;
|
||||
|
||||
private:
|
||||
std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
|
||||
std::unique_ptr<gpu::TransferBuffer> transfer_buffer_;
|
||||
|
@ -69,7 +69,6 @@ class PPAPI_THUNK_EXPORT PPB_Graphics3D_API {
|
||||
virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) = 0;
|
||||
|
||||
virtual void EnsureWorkVisible() = 0;
|
||||
virtual void TakeFrontBuffer() = 0;
|
||||
virtual void ResolveAndDetachFramebuffer() = 0;
|
||||
};
|
||||
|
||||
|
@ -18,11 +18,6 @@ const char kAnimationDurationScale[] = "animation-duration-scale";
|
||||
const char kDisableFontSubpixelPositioning[] =
|
||||
"disable-font-subpixel-positioning";
|
||||
|
||||
// Disables new code to run SharedImages for NaCL swapchain. This overrides
|
||||
// value of kPPAPISharedImagesSwapChain feature flag.
|
||||
const char kDisablePPAPISharedImagesSwapChain[] =
|
||||
"disable-ppapi-shared-images-swapchain";
|
||||
|
||||
// Enable native CPU-mappable GPU memory buffer support on Linux.
|
||||
const char kEnableNativeGpuMemoryBuffers[] = "enable-native-gpu-memory-buffers";
|
||||
|
||||
@ -62,10 +57,6 @@ BASE_FEATURE(kOddWidthMultiPlanarBuffers,
|
||||
#endif
|
||||
);
|
||||
|
||||
BASE_FEATURE(kPPAPISharedImagesSwapChain,
|
||||
"PPAPISharedImagesSwapChain",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
BASE_FEATURE(kVariableGoogleSansFont,
|
||||
"VariableGoogleSansFont",
|
||||
|
@ -14,7 +14,6 @@ namespace switches {
|
||||
|
||||
GFX_SWITCHES_EXPORT extern const char kAnimationDurationScale[];
|
||||
GFX_SWITCHES_EXPORT extern const char kDisableFontSubpixelPositioning[];
|
||||
GFX_SWITCHES_EXPORT extern const char kDisablePPAPISharedImagesSwapChain[];
|
||||
GFX_SWITCHES_EXPORT extern const char kEnableNativeGpuMemoryBuffers[];
|
||||
GFX_SWITCHES_EXPORT extern const char kForcePrefersReducedMotion[];
|
||||
GFX_SWITCHES_EXPORT extern const char kHeadless[];
|
||||
@ -30,7 +29,6 @@ namespace features {
|
||||
|
||||
GFX_SWITCHES_EXPORT BASE_DECLARE_FEATURE(kOddHeightMultiPlanarBuffers);
|
||||
GFX_SWITCHES_EXPORT BASE_DECLARE_FEATURE(kOddWidthMultiPlanarBuffers);
|
||||
GFX_SWITCHES_EXPORT BASE_DECLARE_FEATURE(kPPAPISharedImagesSwapChain);
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
GFX_SWITCHES_EXPORT BASE_DECLARE_FEATURE(kVariableGoogleSansFont);
|
||||
|
Reference in New Issue
Block a user