summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Oltean <olteanv@gmail.com>2018-07-27 23:08:03 +0300
committerƁukasz Patron <priv.luk@gmail.com>2018-08-07 10:37:54 +0200
commit62f62c32ab5c469d59d19ebd2d735d59aa580938 (patch)
tree4f6e4cd71ceea5319a488be290c6e593b22fc1d1
parent44e3085b56ccd6505410fcf27061e27653543a0d (diff)
downloadandroid_frameworks_native-62f62c32ab5c469d59d19ebd2d735d59aa580938.tar.gz
android_frameworks_native-62f62c32ab5c469d59d19ebd2d735d59aa580938.tar.bz2
android_frameworks_native-62f62c32ab5c469d59d19ebd2d735d59aa580938.zip
Revert "SF: Fix hwrotation screenshots at surfaceflinger layer"
* This reverts commit 8c36832b66e9ae793cf79820d83628d136bfd117, because "fixing" screenshots in DisplayDevice.cpp actually works by rotating the DisplaySurface in the opposite direction by the same ro.sf.hwrotation angle. This introduces 2 regressions: - ro.sf.hwrotation now needs to be set to 270 whereas the same hardware needed 90 prior to this patch. - Activity preview thumbnails (in the recents menu) are no longer displayed correctly. The activities which were started in portrait mode now have 90-degree-rotated thumbnails, and the activities which were started in landscape mode now have vertically-stretched-to-half thumbnails. Change-Id: I779e3979df8cdcc3dd9775221d337c02f918bc00
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp6
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp46
-rw-r--r--services/surfaceflinger/SurfaceFlinger_hwc1.cpp30
3 files changed, 12 insertions, 70 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index a4b141233..946f0b365 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -489,9 +489,7 @@ status_t DisplayDevice::orientationToTransfrom(
uint32_t flags = 0;
if (mHardwareRotation && mType == DisplayType::DISPLAY_PRIMARY) {
- // Rotate such that accounting for hardware rotation puts the
- // buffer's rotation at 0 relative to the user.
- orientation += (4 - mHardwareRotation);
+ orientation += mHardwareRotation;
orientation %= 4;
}
@@ -550,7 +548,7 @@ void DisplayDevice::setProjection(int orientation,
if (!frame.isValid()) {
// the destination frame can be invalid if it has never been set,
// in that case we assume the whole display frame.
- if (mHardwareRotation & DisplayState::eOrientationSwapMask) {
+ if (mHardwareRotation == 1 || mHardwareRotation == 3) {
frame = Rect(h, w);
} else {
frame = Rect(w, h);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 63f94c6df..d75774686 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -100,20 +100,6 @@
extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name);
-static int convertRotation(android::Transform::orientation_flags rotation)
-{
- switch (rotation) {
- case android::Transform::ROT_90:
- return 1;
- case android::Transform::ROT_180:
- return 2;
- case android::Transform::ROT_270:
- return 3;
- default:
- return 0;
- }
-}
-
namespace android {
using namespace android::hardware::configstore;
@@ -258,10 +244,6 @@ SurfaceFlinger::SurfaceFlinger()
mLayerTripleBufferingDisabled = atoi(value);
ALOGI_IF(mLayerTripleBufferingDisabled, "Disabling Triple Buffering");
- // we store the value as orientation:
- // 90 -> 1, 180 -> 2, 270 -> 3
- mHardwareRotation = property_get_int32("ro.sf.hwrotation", 0) / 90;
-
// We should be reading 'persist.sys.sf.color_saturation' here
// but since /data may be encrypted, we need to wait until after vold
// comes online to attempt to read the property. The property is
@@ -813,8 +795,10 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
info.orientation = 0;
}
- if ((type == DisplayDevice::DISPLAY_PRIMARY) &&
- (mHardwareRotation & DisplayState::eOrientationSwapMask)) {
+ char value[PROPERTY_VALUE_MAX];
+ property_get("ro.sf.hwrotation", value, "0");
+ int additionalRot = atoi(value) / 90;
+ if ((type == DisplayDevice::DISPLAY_PRIMARY) && (additionalRot & DisplayState::eOrientationSwapMask)) {
info.h = hwConfig->getWidth();
info.w = hwConfig->getHeight();
info.xdpi = ydpi;
@@ -4180,27 +4164,14 @@ void SurfaceFlinger::repaintEverything() {
// Checks that the requested width and height are valid and updates them to the display dimensions
// if they are set to 0
static status_t updateDimensionsLocked(const sp<const DisplayDevice>& displayDevice,
- Transform::orientation_flags* rotation,
- int32_t hardwareRotation,
+ Transform::orientation_flags rotation,
uint32_t* requestedWidth, uint32_t* requestedHeight) {
// get screen geometry
uint32_t displayWidth = displayDevice->getWidth();
uint32_t displayHeight = displayDevice->getHeight();
- switch ((convertRotation(*rotation) + hardwareRotation) % 4) {
- case 1:
- std::swap(displayWidth, displayHeight);
- *rotation = Transform::ROT_90;
- break;
- case 2:
- *rotation = Transform::ROT_180;
- break;
- case 3:
- std::swap(displayWidth, displayHeight);
- *rotation = Transform::ROT_270;
- break;
- default:
- break;
+ if (rotation & Transform::ROT_90) {
+ std::swap(displayWidth, displayHeight);
}
if ((*requestedWidth > displayWidth) || (*requestedHeight > displayHeight)) {
@@ -4308,8 +4279,7 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& display,
{ // Autolock scope
Mutex::Autolock lock(mStateLock);
sp<const DisplayDevice> displayDevice(getDisplayDeviceLocked(display));
- updateDimensionsLocked(displayDevice, &rotationFlags, mHardwareRotation,
- &reqWidth, &reqHeight);
+ updateDimensionsLocked(displayDevice, rotationFlags, &reqWidth, &reqHeight);
}
// create a surface (because we're a producer, and we need to
diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
index 048619411..ecc0e04bb 100644
--- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
+++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
@@ -97,20 +97,6 @@
extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name);
-static int convertRotation(android::Transform::orientation_flags rotation)
-{
- switch (rotation) {
- case android::Transform::ROT_90:
- return 1;
- case android::Transform::ROT_180:
- return 2;
- case android::Transform::ROT_270:
- return 3;
- default:
- return 0;
- }
-}
-
namespace android {
// ---------------------------------------------------------------------------
@@ -3915,20 +3901,8 @@ status_t SurfaceFlinger::captureScreenImplLocked(
uint32_t hw_w = hw->getWidth();
uint32_t hw_h = hw->getHeight();
- switch ((convertRotation(rotation) + mHardwareRotation) % 4) {
- case 1:
- std::swap(hw_w, hw_h);
- rotation = Transform::ROT_90;
- break;
- case 2:
- rotation = Transform::ROT_180;
- break;
- case 3:
- std::swap(hw_w, hw_h);
- rotation = Transform::ROT_270;
- break;
- default:
- break;
+ if (rotation & Transform::ROT_90) {
+ std::swap(hw_w, hw_h);
}
if ((reqWidth > hw_w) || (reqHeight > hw_h)) {