Skip to content

Commit 8c203bc

Browse files
committed
surfaceflinger: hwc1: Fix hwrotation
Change-Id: I1f8defb108ff944f07ac32e8b147d1d87e7089e0
1 parent 527635e commit 8c203bc

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

services/surfaceflinger/SurfaceFlinger_hwc1.cpp

+15-4
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,21 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
634634
info.orientation = 0;
635635
}
636636

637-
info.w = hwConfig.width;
638-
info.h = hwConfig.height;
639-
info.xdpi = xdpi;
640-
info.ydpi = ydpi;
637+
char value[PROPERTY_VALUE_MAX];
638+
property_get("ro.sf.hwrotation", value, "0");
639+
int additionalRot = atoi(value) / 90;
640+
if ((type == DisplayDevice::DISPLAY_PRIMARY) && (additionalRot & DisplayState::eOrientationSwapMask)) {
641+
info.h = hwConfig.width;
642+
info.w = hwConfig.height;
643+
info.xdpi = ydpi;
644+
info.ydpi = xdpi;
645+
}
646+
else {
647+
info.w = hwConfig.width;
648+
info.h = hwConfig.height;
649+
info.xdpi = xdpi;
650+
info.ydpi = ydpi;
651+
}
641652
info.fps = float(1e9 / hwConfig.refresh);
642653
info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS;
643654
info.colorTransform = hwConfig.colorTransform;

0 commit comments

Comments
 (0)