Commit c8c22806 authored by Khushal's avatar Khushal Committed by Commit Bot

gpu: Disable SurfaceControl on Samsung devices running Q.

A platform bug can result in transaction acks getting dropped which
stalls all rendering. A fix for this will be released in an R update
soon so this changes disables using this API in Q.

This also reverts an earlier workaround which was added for samsung dex
mode since its not necessary after this change.

TBR=skyostil@chromium.org

Bug: 1131081
Change-Id: I8d053f160fd8ad5bf6ce47d5e6e295c322bace69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2491401
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Auto-Submit: Khushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820511}
parent 20481244
......@@ -33,6 +33,8 @@ enum SdkVersion {
SDK_VERSION_OREO = 26,
SDK_VERSION_O_MR1 = 27,
SDK_VERSION_P = 28,
SDK_VERSION_Q = 29,
SDK_VERSION_R = 30,
};
// BuildInfo is a singleton class that stores android build and device
......
......@@ -367,9 +367,6 @@ void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) {
void CompositorImpl::SetSurface(const base::android::JavaRef<jobject>& surface,
bool can_be_used_with_surface_control) {
can_be_used_with_surface_control &=
!root_window_->ApplyDisableSurfaceControlWorkaround();
JNIEnv* env = base::android::AttachCurrentThread();
gpu::GpuSurfaceTracker* tracker = gpu::GpuSurfaceTracker::Get();
......
......@@ -978,11 +978,6 @@ public class WindowAndroid implements AndroidPermissionDelegate, DisplayAndroidO
window.setAttributes(params);
}
@CalledByNative
private boolean applyDisableSurfaceControlWorkaround() {
return mDisplayAndroid.applyDisableSurfaceControlWorkaround();
}
@SuppressLint("NewApi")
// mSupportedRefreshRateModes should only be set if Display.Mode is available.
@TargetApi(Build.VERSION_CODES.M)
......
......@@ -20,7 +20,7 @@ import java.util.WeakHashMap;
* anywhere, as long as the corresponding WindowAndroids are destroyed. The observers are
* held weakly so to not lead to leaks.
*/
public abstract class DisplayAndroid {
public class DisplayAndroid {
/**
* DisplayAndroidObserver interface for changes to this Display.
*/
......@@ -254,8 +254,6 @@ public abstract class DisplayAndroid {
update(null, null, null, null, null, null, isDisplayServerWideColorGamut, null, null, null);
}
public abstract boolean applyDisableSurfaceControlWorkaround();
/**
* Update the display to the provided parameters. Null values leave the parameter unchanged.
*/
......
......@@ -23,16 +23,12 @@ import java.util.List;
*/
/* package */ class PhysicalDisplayAndroid extends DisplayAndroid {
private static final String TAG = "DisplayAndroid";
private static final String SAMSUNG_DEX_DISPLAY = "Desktop";
// When this object exists, a positive value means that the forced DIP scale is set and
// the zero means it is not. The non existing object (i.e. null reference) means that
// the existence and value of the forced DIP scale has not yet been determined.
private static Float sForcedDIPScale;
// This is a workaround for crbug.com/1042581.
private final boolean mDisableSurfaceControlWorkaround;
private static boolean hasForcedDIPScale() {
if (sForcedDIPScale == null) {
String forcedScaleAsString = CommandLine.getInstance().getSwitchValue(
......@@ -127,7 +123,6 @@ import java.util.List;
/* package */ PhysicalDisplayAndroid(Display display) {
super(display.getDisplayId());
mDisableSurfaceControlWorkaround = display.getName().equals(SAMSUNG_DEX_DISPLAY);
}
@SuppressWarnings("deprecation")
......@@ -169,9 +164,4 @@ import java.util.List;
bitsPerComponent(pixelFormatId), display.getRotation(), isWideColorGamut, null,
display.getRefreshRate(), currentMode, supportedModes);
}
@Override
public boolean applyDisableSurfaceControlWorkaround() {
return mDisableSurfaceControlWorkaround;
}
}
......@@ -57,9 +57,4 @@ public class VirtualDisplayAndroid extends DisplayAndroid {
public void destroy() {
getManager().removeVirtualDisplay(this);
}
@Override
public boolean applyDisableSurfaceControlWorkaround() {
return false;
}
}
......@@ -243,12 +243,6 @@ void WindowAndroid::Force60HzRefreshRateIfNeeded() {
Java_WindowAndroid_setPreferredRefreshRate(env, GetJavaObject(), 60.f);
}
bool WindowAndroid::ApplyDisableSurfaceControlWorkaround() {
JNIEnv* env = AttachCurrentThread();
return Java_WindowAndroid_applyDisableSurfaceControlWorkaround(
env, GetJavaObject());
}
bool WindowAndroid::HasPermission(const std::string& permission) {
JNIEnv* env = AttachCurrentThread();
return Java_WindowAndroid_hasPermission(
......
......@@ -106,8 +106,6 @@ class UI_ANDROID_EXPORT WindowAndroid : public ViewAndroid {
void SetForce60HzRefreshRate();
bool ApplyDisableSurfaceControlWorkaround();
class TestHooks {
public:
virtual ~TestHooks() = default;
......
......@@ -305,7 +305,14 @@ void OnTransactionCompletedOnAnyThread(void* context,
// static
bool SurfaceControl::IsSupported() {
if (!base::android::BuildInfo::GetInstance()->is_at_least_q())
const auto* build_info = base::android::BuildInfo::GetInstance();
// Disabled on Samsung devices due to a platform bug fixed in R.
int min_sdk_version = base::android::SDK_VERSION_Q;
if (base::EqualsCaseInsensitiveASCII(build_info->manufacturer(), "samsung"))
min_sdk_version = base::android::SDK_VERSION_R;
if (build_info->sdk_int() < min_sdk_version)
return false;
CHECK(SurfaceControlMethods::Get().supported);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment