rk3288 android7副屏旋转显示异常与满屏修改

rk3288 android7副屏旋转显示异常与满屏修改

主屏使用的是HDMI,副屏使用的lvds
主屏是HMDI转lvds 由于转接模块不支持1280x800 所以设置了hdmi输入源为1280x720 为了保证主屏正常显示 修改了framebuffer为1280x800
就是由于修改了framebuffer导致副屏显示旋转异常,一定不要设置persist.sys.framebuffer.main这个参数

persist.sys.framebuffer.main=1280x800

查找rk资料了解到,双屏同显时,副屏显示是在主屏显示的基础上进行的缩放,双屏异显时,副屏显示是按照副屏实际物理分辨率重新进行了UI绘制
下面的patch能解决副屏旋转后显示异常及同显时不满屏的问题
修改patch如下

---
 device/rockchip/rk3288/system.prop                 | 13 ++++++-----
 .../server/display/LocalDisplayAdapter.java        | 20 ++++++++++++++++-
 .../com/android/server/display/LogicalDisplay.java | 26 +++++++++++++++++++++-
 .../services/surfaceflinger/DisplayDevice.cpp      |  3 ++-
 4 files changed, 53 insertions(+), 9 deletions(-)

diff --git a/device/rockchip/rk3288/system.prop b/device/rockchip/rk3288/system.prop
index 358f0fd..f34c991 100755
--- a/device/rockchip/rk3288/system.prop
+++ b/device/rockchip/rk3288/system.prop
@@ -48,9 +48,10 @@ ro.rk.displayd.enable=false

 sys.hwc.device.primary=HDMI-A
 sys.hwc.device.extend=LVDS
-persist.sys.framebuffer.main=1280x800
-persist.sys.resolution.main=1920x1080
-persist.sys.resolution.aux=480x1280
-ro.same.orientation=false
-#ro.orientation.einit=0
-ro.rotation.external=false
+#persist.sys.framebuffer.main=1280x800
+#persist.sys.resolution.main=1280x720
+#persist.sys.resolution.aux=480x1280
+#ro.same.orientation=false
+#ro.rotation.external=false
+ro.orientation.einit=270
+persist.sys.rotation.efull=true
diff --git a/frameworks/base/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/frameworks/base/services/core/java/com/android/server/display/LocalDisplayAdapter.java
index 68be9ce..be69c7e 100755
--- a/frameworks/base/services/core/java/com/android/server/display/LocalDisplayAdapter.java
+++ b/frameworks/base/services/core/java/com/android/server/display/LocalDisplayAdapter.java
@@ -422,8 +422,26 @@ final class LocalDisplayAdapter extends DisplayAdapter {

                     // For demonstration purposes, allow rotation of the external display.
                     // In the future we might allow the user to configure this directly.
-                    if ("portrait".equals(SystemProperties.get("persist.demo.hdmirotation"))) {
+                    /*if ("portrait".equals(SystemProperties.get("persist.demo.hdmirotation"))) {
                         mInfo.rotation = Surface.ROTATION_270;
+                    }*/
+                    String rotation = SystemProperties.get("ro.orientation.einit","0");
+                    switch(Integer.valueOf(rotation)) {
+						case 0:
+							mInfo.rotation = Surface.ROTATION_0;
+							break;
+						case 90:
+							mInfo.rotation = Surface.ROTATION_90;
+							break;
+						case 180:
+							mInfo.rotation = Surface.ROTATION_180;
+							break;
+						case 270:
+							mInfo.rotation = Surface.ROTATION_270;
+							break;
+						default:
+							mInfo.rotation = Surface.ROTATION_0;
+							break;
                     }

                     // For demonstration purposes, allow rotation of the external display
diff --git a/frameworks/base/services/core/java/com/android/server/display/LogicalDisplay.java b/frameworks/base/services/core/java/com/android/server/display/LogicalDisplay.java
index 287a25a..acc4c9f 100755
--- a/frameworks/base/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/frameworks/base/services/core/java/com/android/server/display/LogicalDisplay.java
@@ -26,7 +26,7 @@ import java.util.Arrays;
 import java.util.List;

 import libcore.util.Objects;
-
+import android.os.SystemProperties;

@@ -137,6 +137,22 @@ final class LogicalDisplay {
                 mInfo.physicalXDpi = mOverrideDisplayInfo.physicalXDpi;
                 mInfo.physicalYDpi = mOverrideDisplayInfo.physicalYDpi;
             }
+            if(mDisplayId!=Display.DEFAULT_DISPLAY){
+                 String rotation = SystemProperties.get("ro.orientation.einit","0");
+                 int rot = Integer.valueOf(rotation)/90;
+                if(rot%2!=0) {
+                    mInfo.appWidth = mPrimaryDisplayDeviceInfo.height;
+                    mInfo.appHeight = mPrimaryDisplayDeviceInfo.width;
+                    mInfo.logicalWidth = mPrimaryDisplayDeviceInfo.height;
+                    mInfo.logicalHeight=mPrimaryDisplayDeviceInfo.width;
+                }else{
+                    mInfo.appWidth = mPrimaryDisplayDeviceInfo.width;
+                    mInfo.appHeight = mPrimaryDisplayDeviceInfo.height;
+                    mInfo.logicalWidth = mPrimaryDisplayDeviceInfo.width;
+                    mInfo.logicalHeight=mPrimaryDisplayDeviceInfo.height;
+                }
+            }
+
         }
         return mInfo;
     }
@@ -349,6 +365,14 @@ final class LogicalDisplay {
         mTempDisplayRect.right += mDisplayOffsetX;
         mTempDisplayRect.top += mDisplayOffsetY;
         mTempDisplayRect.bottom += mDisplayOffsetY;
+        if(SystemProperties.getBoolean("persist.sys.rotation.efull", false)) {
+		    if(device.getDisplayDeviceInfoLocked().type!=Display.TYPE_BUILT_IN){
+		         mTempDisplayRect.left=0;
+		         mTempDisplayRect.right=physWidth;
+		         mTempDisplayRect.top=0;
+		         mTempDisplayRect.bottom=physHeight;
+		    }
+        }
         device.setProjectionInTransactionLocked(orientation, mTempLayerStackRect, mTempDisplayRect);
     }

diff --git a/frameworks/native/services/surfaceflinger/DisplayDevice.cpp b/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
index 0c63381..68f93ce 100755
--- a/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
+++ b/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
@@ -538,6 +538,7 @@ void DisplayDevice::setProjection(int orientation,
 #endif

 #if !RK_VR & RK_HW_ROTATION
+#if 0
     bool isHdmiScreen = mType == DisplayDevice::DISPLAY_EXTERNAL;
     if (isHdmiScreen) {
         int eInitOrientation = 0;
@@ -599,7 +600,7 @@ void DisplayDevice::setProjection(int orientation,
         }
         ALOGV("update frame [%d,%d]",frame.getWidth(),frame.getHeight());
     }
-
+#endif
     if (mType == DisplayDevice::DISPLAY_PRIMARY) {
         mClientOrientation = orientation;
         orientation = (mHardwareOrientation + orientation) % 4;
--
2.7.4

参考资料

https://blog.csdn.net/MrDongShiYi/article/details/96477121/

https://blog.csdn.net/kris_fei/article/details/86598923

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值