瑞芯微Rockchip开发者社区
直播中

刘玉兰

8年用户 1075经验值
私信 关注
[问答]

如何去实现RK3288的横竖屏+竖屏的双屏显异设计呢

如何去实现RK3288的横竖屏+竖屏的双屏显异设计呢?

回帖(1)

孙丽萍

2022-3-4 14:53:41
  RK32288888双屏显异,横竖屏+竖屏
  由于是横屏+屏的组合情况,目前正处于副屏状态。1.副屏存在2.对屏内容进行时。
  默认情况下下,我们设置的双屏最终旋转方法都为Surface.ROTATION_0,因此需要将WSM中的updateRotationUncheckedLocked的语句进行屏蔽。
  if (mRotateOnBoot) {
  mRotation = Surface.ROTATION_0;
  旋转 = Surface.ROTATION_90;
  }
  /* 显示纵向,强制 android 根据 90 度旋转 */
  if(“true”.equals(SystemProperties.get(“persist.display.portrait”,“false”))){
  rotation = Surface.ROTATION_90;
  }
  //
  LQH // 旋转 = Surface.ROTATION_0;
  /* 显示纵向结束 */
  // if(“vr”.equals(SystemProperties.get(“ro.target.product”,“tablet”)))
  // rotation = Surface.ROTATION_0;
  if (mRotation == rotation && mAltOrientation == altOrientation) {
  // 没有变化。
  返回假;
  ro.sf.hwrotation =0 主工程方向初始(在。/native/services/surfaceflinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger/SurfaceFlinger
  )
  .cpp.cpp进行随主旋转方向)
  ro.orientation.init=90 副屏初始方向
  .sameation=false 主副屏orientaion是否相同
  rorotation.external=false 副屏是否随主旋转
  了解显示框架的初始化过程,主要对显示部分的参数进行调整。
  该代码在base/services/core/java/com/android/server/display/ LocalDisplayAdapter.java的getDisplayDeviceInfoLocked()方法下完成:
  @Override
  public DisplayDeviceInfo getDisplayDeviceInfoLocked() {
  if (mInfo == null) {
  SurfaceControl.PhysicalDisplayInfo phys = mDisplayInfos[mActivePhysIndex];
  mInfo = new DisplayDeviceInfo();
  mInfo.width = phys.width;
  mInfo.height = phys.height;
  mInfo.modeId = mActiveModeId;
  mInfo.defaultModeId = mDefaultModeId;
  mInfo.supportedModes = new Display.Mode[mSupportedModes.size()];
  for (int i = 0; i
  DisplayModeRecord 记录 = mSupportedModes.valueAt(i);
  mInfo.supportedModes = record.mMode;
  }
  mInfo.colorTransformId = mActiveColorTransformId;
  mInfo.defaultColorTransformId = mDefaultColorTransformId;
  mInfo.supportedColorTransforms =
  new Display.ColorTransform[mSupportedColorTransforms.size()];
  for (int i = 0; i
  mInfo.supportedColorTransforms = mSupportedColorTransforms.valueAt(i);
  }
  mInfo.appVsyncOffsetNanos = phys.appVsyncOffsetNanos;
  mInfo.presentationDeadlineNanos = phys.presentationDeadlineNanos;
  mInfo.state = mState;
  mInfo.uniqueId = getUniqueId();
  // Assume that all built-in displays that have secure output (eg. HDCP) also
  // support compositing from gralloc protected buffers.
  if (phys.secure) {
  mInfo.flags = DisplayDeviceInfo.FLAG_SECURE
  | DisplayDeviceInfo.FLAG_SUPPORTS_PROTECTED_BUFFERS;
  }
  if (mBuiltInDisplayId == SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN) {
  final Resources res = getContext().getResources();
  mInfo.name = res.getString(
  com.android.internal.R.string.display_manager_built_in_display_name);
  mInfo.flags |= DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY
  | DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
  if (res.getBoolean(com.android.internal.R.bool.config_mainBuiltInDisplayIsRound)
  || (Build.HARDWARE.contains(“goldfish”)
  && SystemProperties.getBoolean(PROPERTY_EMULATOR_CIRCULAR, false))) {
  mInfo.flags |= DisplayDeviceInfo.FLAG_ROUND;
  }
  mInfo.type = Display.TYPE_BUILT_IN;
  mInfo.densityDpi = (int)(phys.density * 160 + 0.5f);
  mInfo.xDpi = phys.xDpi;
  mInfo.yDpi = phys.yDpi;
  mInfo.touch = DisplayDeviceInfo.TOUCH_INTERNAL;
  } else {
  mInfo.type = Display.TYPE_HDMI;
  mInfo.flags |= DisplayDeviceInfo.FLAG_PRESENTATION;
  boolean noRotate = “0”.equals(SystemProperties.get(“ro.sf.hwrotation”));
  if(noRotate && mBuiltInDisplayId == SurfaceControl.BUILT_IN_DISPLAY_ID_HDMI){
  if (SystemProperties.getBoolean(“ro.rotation.external”, false)) {
  mInfo.flags |= DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
  }
  String value = SystemProperties.get(“ro.orientation.einit”);
  if (“0”.equals(value)) {
  mInfo.rotation = Surface.ROTATION_0;
  } else if (“90”.equals(value)) {
  mInfo.rotation = Surface.ROTATION_90;
  } else if (“180”.equals(value)) {
  mInfo.rotation = Surface.ROTATION_180;
  } else if (“270”.equals(value)) {
  mInfo.rotation = Surface.ROTATION_270;
  }
  }
  mInfo.name = getContext().getResources().getString(
  com.android.internal.R.string.display_manager_hdmi_display_name);
  mInfo.touch = DisplayDeviceInfo.TOUCH_EXTERNAL;
  mInfo.setAssumedDensityForExternalDisplay(phys.width, phys.height);
  // 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”))) {
  mInfo.rotation = Surface.ROTATION_270;
  }
  // For demonstration purposes, allow rotation of the external display
  // to follow the built-in display.
  if (SystemProperties.getBoolean(“persist.demo.hdmirotates”, false)) {
  mInfo.flags |= DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
  }
  }
  }
  return mInfo;
  }
  最终显示的frame大小确定,在framework/native/service/surfaceflinger/DisplayDevice.cpp中
  bool isHdmiScreen = mType == DisplayDevice::DISPLAY_EXTERNAL;
  if (isHdmiScreen) {
  int eInitOrientation = 0;
  bool isSfHwrotated = false;
  bool isSupportRotation = false;
  bool isPrimaryExternalSameOrientation = false;
  Rect newFrame = Rect(0,0,getWidth(),getHeight());
  Rect newFrameRotated = Rect(0,0,getHeight(),getWidth());
  float frameRatio = (float)frame.getWidth() / frame.getHeight();
  char value[PROPERTY_VALUE_MAX];
  property_get(“ro.sf.hwrotation”, value, “0”);
  isSfHwrotated = atoi(value) != 0;
  property_get(“ro.same.orientation”, value, “false”);
  isPrimaryExternalSameOrientation = !strcmp(value,“true”);
  if(!isSfHwrotated) {
  property_get(“ro.orientation.einit”, value, “0”);
  eInitOrientation = atoi(value) / 90;
  property_get(“ro.rotation.external”, value, “false”);
  isSupportRotation = !strcmp(value,“true”);
  }
  if (isSupportRotation && !isPrimaryExternalSameOrientation) {
  mClientOrientation = orientation;
  if (eInitOrientation % 2 == 1) {
  frame = frameRatio 》 1.0 ? frame : newFrameRotated;
  ALOGE(“%d,[%d,%d]”,__LINE__,frame.getWidth(),frame.getHeight());
  } else {
  frame = frameRatio 》 1.0 ? newFrame : frame;
  ALOGE(“%d,[%d,%d]”,__LINE__,frame.getWidth(),frame.getHeight());
  }
  } else if (isSupportRotation) {
  mClientOrientation = orientation;
  if (eInitOrientation % 2 == 1) {
  //frame = frameRatio 》 1.0 ? frame : frame;
  ALOGE(“%d,[%d,%d]”,__LINE__,frame.getWidth(),frame.getHeight());
  } else {
  frame = frameRatio 》 1.0 ? newFrame : newFrameRotated;
  ALOGE(“%d,[%d,%d]”,__LINE__,frame.getWidth(),frame.getHeight());
  }
  } else if (eInitOrientation % 2 != 0) {
  if (isPrimaryExternalSameOrientation) {
  //frame = frameRatio 》 1.0 ? frame : frame;
  ALOGE(“%d,[%d,%d]”,__LINE__,frame.getWidth(),frame.getHeight());
  } else {
  //应该走的这里
  frame = frameRatio 》 1.0 ? frame : newFrameRotated;
  ALOGE(“%d,[%d,%d]”,__LINE__,frame.getWidth(),frame.getHeight());
  }
  } else if (eInitOrientation % 2 == 0) {
  if (isPrimaryExternalSameOrientation) {
  frame = frameRatio 》 1.0 ? newFrame : frame;
  ALOGE(“%d,[%d,%d]”,__LINE__,frame.getWidth(),frame.getHeight());
  } else {
  frame = frameRatio 》 1.0 ? newFrame : frame;
  ALOGE(“%d,[%d,%d]”,__LINE__,frame.getWidth(),frame.getHeight());
  }
  } else {
  frame = frameRatio 》 1.0 ? newFrame : frame;
  ALOGE(“%d,[%d,%d]”,__LINE__,frame.getWidth(),frame.getHeight());
  }
  ALOGE(“update frame [%d,%d]”,frame.getWidth(),frame.getHeight());
  }
  根据具体情况进行配置,即可实现 双屏异显,横屏+竖屏,竖屏存在黑边的效果。在上面的补丁中,可对frame进行强制定义为副屏大小,则可以实现拉伸效果,填充黑边。
  frame=Rect(0,0,getHeight(),getWidth());
  但两块屏幕比例相差较大的情况下,拉伸显示的效果较差。
  注:在设置中将g-sensor的旋转功能关闭,旋转对上述实现存在一定影响。
  RK3288 双屏异显,两屏默认方向不一致
  CPU:RK3288 系统:Android 5.1 RK3288 支持双屏异显,一般都会同方向显示,如果遇到两个 lcd 的默认方向不一致,只需修改下面参数即可。 例如:主屏为mipi接口,分辨率为 。..
  RK3288 增加双屏异显 eDP+LVDS
  CPU:RK3288 系统:Android 5.1 下面是官方文档中的信息。 1.rk3288 支持的显示接口可以任意组合。 2.双屏异显时,一个显示接口当主屏,另一个当副屏:主副屏由板级 dts 文 。..
  Rk3288 双屏异显单触摸
  系统版本:RK3288 android 5.1 设备同时有两个lcd,主屏是mipi接口,带有触摸屏,触摸屏是u***接口,副屏是hdmi接口,没有触摸屏,正常情况下,两个lcd显示相同内容,触摸屏一切 。..
  RK3288 双屏异显时,触摸屏(USB接口)无反应
  系统版本:RK3288 android 5.1 设备同时有两个lcd,主屏是mipi接口,带有触摸屏,触摸屏是u***接口,副屏是hdmi接口,没有触摸屏,正常情况下,两个lcd显示相同内容,触摸屏一切 。..
  [Android6.0][RK3399] 双屏异显代码实现流程分析(一)
  Platform: RK3399 OS: Android 6.0 Version: 。..
  iTOP-4418/6818开发板支持双屏异显,双屏同显
  iTOP-4418/6818开发板平台安卓系统下支持双屏异显,双屏同显,客户可按照不同用途,分别播放适合屏幕显示方式的内容 ,如HDMI屏幕和LCD屏幕显示不同内容, 一个屏幕播放广告,另一个屏幕运行 。..
  【ARM开发板】迅为IMX6开发板QT下LVDS和HDMI双屏异显
  迅为-IMX6开发板 首先开发板分别连接9.7寸屏和HDMI显示器,然后使用MfgTool工具烧写QT系统,然后拨码开关设 。..
  iTOP-iMX6开发板Android系统下LVDS和HDMI双屏异显方法
  迅为iMX6 开发板 android 系统下 LVDS 和 HDMI 双屏异显的使用过程。 注意,iTOP-iMX6 开发板的 android 系统想要实现对 LVDS 和 HDMI 双屏异显功能的支 。..
  HTML5中判断横屏竖屏
  在移动端中我们经常碰到横屏竖屏的问题,那么我们应该如何去判断或者针对横屏。竖屏来写不同的代码呢。 这里有两种方法: 一:CSS判断横屏竖屏 写在同一个CSS中 1 2 3 4 5 6 @media s 。..
  随机推荐
  HTML骨架结构
  前面的话   一个完整的HTML文档必须包含3个部分:文档声明。文档头部和文档主体。而正是它们构成了HTML的骨架结构。前面已经分别介绍过文档声明和文档头部,本文将详细介绍构成HTML骨架结构的基础元 。..
  Spark的DataFrame的窗口函数使用
  SparkSQL这块儿从1.4开始支持了很多的窗口分析函数,像row_number这些,平时写程 。..
  Scala override
  var 变量不能在子类中重写,除非父类是抽象类 在抽象类中var变量不能赋初值 abstract class Person{ val def name1=“ 。..
  VS2010--canot determine the locationof the vs common tools folder
  在vcvars32.bat第一行后复制 @SET VSINSTALLDIR=c:Program FilesMicrosoft Visual Studio 10.0 @SET VCINSTALLDI 。..
  linux包之sysstat之sar命令
  要启动SAR,必须通过cron工具以周期性的间隔启动。安装sysstat包后,默认创建一个/etc/cron.d/sysstat文件,其默认内容为:# run system activity acco 。..
  Angularjs 通过WebApi 下载excel
  如果想知道 AngularJs 通过WebAPI 下载Excel.请看下文,这里仅提供了一种方案。 服务器端代码如下: protected HttpResponseMessage GenereateE 。..
  2D游戏编程7—星空案例
  // INCLUDES /// #define WIN32_LEAN_AND_MEAN // just say 。..
  [HDU1210] Eddy's 洗牌问题
  Problem Description Eddy是个ACMer,他不仅喜欢做ACM题,而且对于纸牌也有一定的研究,他在无聊时研究发现,如果他有2N张牌,编号为1,2,3..n,n+1,。.2n.这也是 。..
  Learning ROS forRobotics Programming Second Edition学习笔记(八)indigo rviz gazebo
举报

更多回帖

发帖
×
20
完善资料,
赚取积分