Android HDMI输出竖屏问题

podjman 2014-10-23 05:44:43
大家好

我的板子采用HDMI输出到显示器上显示,系统本来就编译成横屏(landscape)的,显示也正常。

但当我开启要求竖屏的应用时(比如flappy bird),画面就要发生旋转,但是旋转结果是只在中间显示竖屏的画面,但两旁都是黑的,没有按照我期望那样横过来竖屏显示。

我换了另一个安卓系统来试,结果竖屏显示正常,这就证明跟linux内核没有关系,只跟安卓源码的配置有关系。

我该怎么修改安卓系统呢?希望有这方面经验的大神来帮帮我,谢谢!

我现在的情况是这样:


我想把它变成这样:
...全文
4781 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
huangzhenyu1983 2015-02-25
  • 打赏
  • 举报
回复
这个是正常现象,因为hdmi,包括wifidisplay 的输出设备(比方说电视机)一般都是横着放的,一般情况下没人会无聊到将电视机竖着放,因这个原因故surfaceflinger在合并surface的时候不会将surface旋转90度(当surfaceflinger为手机屏幕合并sruface的时候,如果横着放,且当前应用程序界面允许横着放,那么surfacelinger就会将surface旋转90,而hdmi,wifidisplay则surfaceflinger不会对他做旋转处理)。结合你上面这个问题,你只需要在surfaceflinger在合并surface的时候将其旋转90即可。我在wifidisplay中试过,是修改WifiDisplayDevice::getDisplayDeviceInfoLocked中添加一行:mInfo.rotation = Surface.ROTATION_90(原本为Surface.ROTATION_0)就能将显示旋转过来了。mInfo.rotation这个值就终会传入并设置到surfaceflinger中,你可以跟下代码最终设置到surfaceflinger中的哪里去了,并把hdmi的情况旋转90即可。
龙川魂 2014-11-11
  • 打赏
  • 举报
回复
修改frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java文件,我已成功实现,希望帮到你
龙川魂 2014-11-11
  • 打赏
  • 举报
回复
mContext.getResources().getInteger(resID); switch (rotation) { case 0: return Surface.ROTATION_90;//Surface.ROTATION_0; case 90: return Surface.ROTATION_0;//Surface.ROTATION_90; case 180: return Surface.ROTATION_180; case 270: return Surface.ROTATION_270; }
龙川魂 2014-11-11
  • 打赏
  • 举报
回复
android4.2以上系统修应该frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java的mContext.getResources().getInteger(resID); switch (rotation) { case 0: return Surface.ROTATION_90;//Surface.ROTATION_0; case 90: return Surface.ROTATION_0;//Surface.ROTATION_90; case 180: return Surface.ROTATION_180; case 270: return Surface.ROTATION_270; 我已成功实现,希望帮到你
podjman 2014-10-24
  • 打赏
  • 举报
回复
引用 6 楼 YKDSea 的回复:
你这个好像不是用的hwc来做的,那就不用看那个代码了。
恩,好的,我自己再看看吧,谢谢!
sky-Z 2014-10-24
  • 打赏
  • 举报
回复
你这个好像不是用的hwc来做的,那就不用看那个代码了。
podjman 2014-10-24
  • 打赏
  • 举报
回复
引用 3 楼 YKDSea 的回复:
三星的话,应该是通过android层的hwc来实现的,你可以dumpsys SurfaceFlinger 确认下是不是有两个display 设备。 如果是hwc实现的话,那原因应该是hdmi和panel在方向上的差异,你可以debug下LocalDisplay里面的configureDisplayInTransactionLocked(),这个是在输出前设置display的信息的,可以尝试调整下hdmi display的方向。
你好,我在我的源码里搜不到跟configureDisplayInTransactionLocked有关的文件,可否给个参考呢?
podjman 2014-10-24
  • 打赏
  • 举报
回复
引用 3 楼 YKDSea 的回复:
三星的话,应该是通过android层的hwc来实现的,你可以dumpsys SurfaceFlinger 确认下是不是有两个display 设备。 如果是hwc实现的话,那原因应该是hdmi和panel在方向上的差异,你可以debug下LocalDisplay里面的configureDisplayInTransactionLocked(),这个是在输出前设置display的信息的,可以尝试调整下hdmi display的方向。
看来你也是做系统的呀。 这是我dumpsys之后的信息:
Visible layers (count = 4)
+ Layer 0x8450c8 (com.android.systemui.ImageWallpaper)
      z=    21010, pos=(-533,-444), size=(2985,1920), isOpaque=1, needsDithering=0, invalidate=0, alpha=0xff, flags=0x00000000, tr=[1.00, 0.00][0.00, 1.00]
      client=0x8405b0, identity=4
      format= 2, activeBuffer=[2985x1920:2986,  1], transform-hint=0x00, queued-frames=0
            mBufferCount=4, mSynchronousMode=1, default-size=[2985x1920], mPixelFormat=1, mTexName=6
            current: {crop=[0,0,-1,-1], transform=0x00, current=-1}
            next   : {crop=[0,0,-1,-1], transform=0x00, FIFO(0)={}}
             [00] state=FREE    , crop=[0,0,-1,-1], transform=0x00, timestamp=12718397758
             [01] state=FREE    , crop=[0,0,-1,-1], transform=0x00, timestamp=0
             [02] state=FREE    , crop=[0,0,-1,-1], transform=0x00, timestamp=0
             [03] state=FREE    , crop=[0,0,-1,-1], transform=0x00, timestamp=0
  Region transparentRegion (this=0x845268, count=1)
    [  0,   0,   0,   0]
  Region transparentRegionScreen (this=0x8450fc, count=1)
    [  0,   0,   0,   0]
  Region visibleRegionScreen (this=0x8450d8, count=1)
    [  0,   0, 1920, 1032]
+ Layer 0x83e948 (com.android.launcher/com.android.launcher2.Launcher)
      z=    21015, pos=(0,0), size=(1920,1032), isOpaque=0, needsDithering=0, invalidate=0, alpha=0xff, flags=0x00000000, tr=[1.00, 0.00][0.00, 1.00]
      client=0x843958, identity=16
      format= 1, activeBuffer=[1920x1032:1920,  1], transform-hint=0x00, queued-frames=0
            mBufferCount=4, mSynchronousMode=1, default-size=[1920x1032], mPixelFormat=1, mTexName=9
            current: {crop=[0,0,-1,-1], transform=0x00, current=1}
            next   : {crop=[0,0,-1,-1], transform=0x00, FIFO(0)={}}
             [00] state=FREE    , crop=[0,0,-1,-1], transform=0x00, timestamp=23780590389, 0x841c30 [1920x1032:1920,  1]
            >[01] state=QUEUED  , crop=[0,0,-1,-1], transform=0x00, timestamp=26119057723, 0x852970 [1920x1032:1920,  1]
             [02] state=FREE    , crop=[0,0,-1,-1], transform=0x00, timestamp=0
             [03] state=FREE    , crop=[0,0,-1,-1], transform=0x00, timestamp=0
  Region transparentRegion (this=0x83eae8, count=1)
    [  0,   0,   0,   0]
  Region transparentRegionScreen (this=0x83e97c, count=1)
    [  0,   0,   0,   0]
  Region visibleRegionScreen (this=0x83e958, count=1)
    [  0,   0, 1920, 1032]
+ Layer 0x843000 (StatusBar)
      z=   141000, pos=(0,1032), size=(1920,  48), isOpaque=1, needsDithering=0, invalidate=0, alpha=0xff, flags=0x00000000, tr=[1.00, 0.00][0.00, 1.00]
      client=0x8405b0, identity=3
      format= 4, activeBuffer=[1920x  48:1920,  4], transform-hint=0x00, queued-frames=0
            mBufferCount=2, mSynchronousMode=1, default-size=[1920x48], mPixelFormat=4, mTexName=5
            current: {crop=[0,0,-1,-1], transform=0x00, current=0}
            next   : {crop=[0,0,-1,-1], transform=0x00, FIFO(0)={}}
            >[00] state=QUEUED  , crop=[0,0,-1,-1], transform=0x00, timestamp=26098821390, 0x8404e0 [1920x  48:1920,  4]
             [01] state=FREE    , crop=[0,0,-1,-1], transform=0x00, timestamp=23885046430, 0x841d18 [1920x  48:1920,  4]
  Region transparentRegion (this=0x8431a0, count=1)
    [  0,   0,   0,   0]
  Region transparentRegionScreen (this=0x843034, count=1)
    [  0,   0,   0,   0]
  Region visibleRegionScreen (this=0x843010, count=1)
    [  0, 1032, 1920, 1080]
+ Layer 0x83aca8 (Sprite)
      z=   231000, pos=(1913,-6), size=(  22,  28), isOpaque=0, needsDithering=0, invalidate=0, alpha=0xff, flags=0x00000000, tr=[1.00, 0.00][0.00, 1.00]
      client=0x843620, identity=5
      format= 1, activeBuffer=[  22x  28:  22,  1], transform-hint=0x00, queued-frames=0
            mBufferCount=2, mSynchronousMode=1, default-size=[22x28], mPixelFormat=1, mTexName=3
            current: {crop=[0,0,-1,-1], transform=0x00, current=0}
            next   : {crop=[0,0,-1,-1], transform=0x00, FIFO(0)={}}
            >[00] state=QUEUED  , crop=[0,0,-1,-1], transform=0x00, timestamp=14202493509, 0x83a4f0 [  22x  28:  22,  1]
             [01] state=FREE    , crop=[0,0,-1,-1], transform=0x00, timestamp=0
  Region transparentRegion (this=0x83ae48, count=1)
    [  0,   0,   0,   0]
  Region transparentRegionScreen (this=0x83acdc, count=1)
    [  0,   0,   0,   0]
  Region visibleRegionScreen (this=0x83acb8, count=1)
    [1913,   0, 1920,  22]
Purgatory state (0 entries)
SurfaceFlinger global state:
GLES: ARM, Mali-400 MP, OpenGL ES-CM 1.1
EGL : 1.4 Linux-r2p4-02rel0
EXTS: GL_OES_byte_coordinates GL_OES_fixed_point GL_OES_single_precision GL_OES_matrix_get GL_OES_read_format GL_OES_compressed_paletted_texture GL_OES_point_size_array GL_OES_point_sprite GL_OES_texture_npot GL_OES_query_matrix GL_OES_matrix_palette GL_OES_extended_matrix_palette GL_OES_compressed_ETC1_RGB8_texture GL_OES_EGL_image GL_OES_draw_texture GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 GL_OES_framebuffer_object GL_OES_stencil8 GL_OES_depth24 GL_ARM_rgba8 GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_rgb8_rgba8 GL_EXT_multisampled_render_to_texture GL_OES_texture_cube_map GL_EXT_discard_framebuffer
  Region WormholeRegion (this=0x821b44, count=1)
    [  0,   0,   0,   0]
  orientation=0, canDraw=1
  last eglSwapBuffers() time: 19329.708000 us
  last transaction time     : 5.541000 us
  refresh-rate              : 63.345001 fps
  x-dpi                     : 159.895081
  y-dpi                     : 160.421051
  h/w composer present and enabled
Hardware Composer state:
  numHwLayers=4, flags=00000000
   type   |  handle  |   hints  |   flags  | tr | blend |  format  |       source crop         |           frame           name
----------+----------+----------+----------+----+-------+----------+---------------------------+--------------------------------
       FB | 0084aa88 | 00000000 | 00000000 | 00 | 00100 | 00000001 | [    0,    0, 2985, 1920] | [ -533, -444, 2452, 1476] com.android.systemui.ImageWallpaper
       FB | 00852970 | 00000000 | 00000000 | 00 | 00105 | 00000001 | [    0,    0, 1920, 1032] | [    0,    0, 1920, 1032] com.android.launcher/com.android.launcher2.Launcher
       FB | 008404e0 | 00000000 | 00000000 | 00 | 00100 | 00000004 | [    0,    0, 1920,   48] | [    0, 1032, 1920, 1080] StatusBar
       FB | 0083a4f0 | 00000000 | 00000000 | 00 | 00105 | 00000001 | [    0,    0,   22,   28] | [ 1913,   -6, 1935,   22] Sprite
Allocated buffers:
  0x83a4f0:    2.41 KiB |   22 (  22) x   28 |        1 | 0x00000933
  0x8404e0:  180.00 KiB | 1920 (1920) x   48 |        4 | 0x00000933
  0x841c30: 7740.00 KiB | 1920 (1920) x 1032 |        1 | 0x00000f02
  0x841d18:  180.00 KiB | 1920 (1920) x   48 |        4 | 0x00000933
  0x84aa88: 22395.00 KiB | 2985 (2986) x 1920 |        1 | 0x00000f02
  0x852970: 7740.00 KiB | 1920 (1920) x 1032 |        1 | 0x00000f02
Total allocated (estimate): 38237.41 KB
我之前一直在device/samsung/exynos4/libhdmi/目录里面调的,主要还在看SecHdmi.cpp这个文件,主要是没有方向,摸索了很久了,我现在按照你的方向先看一看,谢谢!
sky-Z 2014-10-24
  • 打赏
  • 举报
回复
三星的话,应该是通过android层的hwc来实现的,你可以dumpsys SurfaceFlinger 确认下是不是有两个display 设备。 如果是hwc实现的话,那原因应该是hdmi和panel在方向上的差异,你可以debug下LocalDisplay里面的configureDisplayInTransactionLocked(),这个是在输出前设置display的信息的,可以尝试调整下hdmi display的方向。
podjman 2014-10-24
  • 打赏
  • 举报
回复
引用 1 楼 YKDSea 的回复:
你是做系统吗?你要先确认下你用的方案的hdmi输出的做法是什么样子的,各家都不太一样,最好直接问方案商。
谢谢回答 BSP提供方应该不会就这些问题作解答的,原始BSP是三星的,然后移植过来发现问题不少,就自己排查了些。
podjman 2014-10-24
  • 打赏
  • 举报
回复
还是未能解决问题。。。。有人知道这个问题该怎么入手吗?百度谷歌查遍了都解决不了
sky-Z 2014-10-23
  • 打赏
  • 举报
回复
你是做系统吗?你要先确认下你用的方案的hdmi输出的做法是什么样子的,各家都不太一样,最好直接问方案商。

21,616

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧