由于项目需要,使用了一块480x1280分辨率的屏,但是M64官方Android系统只提供720p和1280p分辨率的选择,无法正常驱动这块屏。经过长期摸索,终于搞清楚了要修改的文件:

一、修改内核文件 1.lichee/linux-3.10/drivers/video/sunxi/disp2/hdmi/hdmi_core.c 修改自己屏幕的时序。 2.修改Android的hardware文件: android/hardware/aw/hwc/tulip/hwc_uevent.cpp android/hardware/aw/hwc/octopus/hwc_uevent.cpp android/hardware/aw/hwc/astar/hal.cpp android/hardware/aw/hwc/kylin/hal.cpp 修改 DISP_TV_MOD_720P_60HZDISP_TV_MOD_720P_50HZ分辨率为480x1280(原为1280x720) 

二、修改布局 由于需要横屏显示,所以还需要修改布局,以支持横屏 (一)支持横屏显示选项ro.sf.hwrotation 1.android/frameworks/native/services/surfaceflinger/DisplayDevice.h, 添加变量     // Current active config     int mActiveConfig;     //修改:支持横屏    // Panel hardware rotation    int32_t mHardwareRotation; 去掉    status_t orientationToTransfrom(int orientation,            int w, int h, Transform* tr);的 Static 声明 2.android/frameworks/native/services/surfaceflinger/DisplayDevice.cpp DisplayDevice::DisplayDevice函数添加:     property_get("ro.panel.mountflip", property, "0”);     mPanelMountFlip = atoi(property);     // initialize the display orientation transform.
DisplayDevice::orientationToTransfrom函数添加:     //修改:支持橫屏     if (mHardwareRotation && mType == DISPLAY_PRIMARY) {         orientation += mHardwareRotation;         orientation %= 4;     }
    switch (orientation) { …
DisplayDevice::setProjection函数添加:     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 == 1 || mHardwareRotation == 3) {             frame = Rect(h, w);         } else {             frame = Rect(w, h);         }         //frame = Rect(w, h);     }
3.android/frameworks/native/services/surfaceflinger/Surfaceflinger.cpp SurfaceFlinger::getDisplayConfigs函数添加:        //修改:支持橫屏        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.width;             info.w = hwConfig.height;             info.xdpi = ydpi;             info.ydpi = xdpi;         }         else {             info.w = hwConfig.width;             info.h = hwConfig.height;             info.xdpi = xdpi;             info.ydpi = ydpi;         }         /*         info.w = hwConfig.width;         info.h = hwConfig.height;         info.xdpi = xdpi;         info.ydpi = ydpi;         */                  info.fps = float(1e9 / hwConfig.refresh);         info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS;         info.colorTransform = hwConfig.colorTransform; 


经过以上修改后,重新编译内核和源码,终于可以正常横屏显示了,希望能帮到有同样问题的朋友。

更多相关文章

  1. 还在用android.support?该考虑迁移AndroidX了!
  2. Android(安卓)Studio SDK版本兼容问题,拷贝的Android包文件报错
  3. Android高手进阶教程(八)之----Android(安卓)Widget开发案例(世
  4. android 常用测试框架
  5. [置顶] 修改Android开机画面之rle制作
  6. android Widget添加过程和android添加widget不更新的问题分析解
  7. Android中级进阶 FAQ
  8. Android文档(一)——什么是Android?
  9. 让Qt应用程序跑在Android上

随机推荐

  1. Android中activity的启动模式详解
  2. 谷歌Android被Linux内核除名
  3. Android特色开发——基于位置的服务
  4. Android简明开发教程二十:Broadcast Recei
  5. android系统开发小问题-启动过程中android
  6. Android Android 导入Flutter模块(二)--
  7. 设置TextView文字居中,代码实现android:l
  8. 软件架构:基础概念总结
  9. Android中视频播放以及解码
  10. 关于ImageView的一些图片属性