Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 4|回复: 4
打印 上一主题 下一主题

显示为横屏

[复制链接]

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
跳转到指定楼层
楼主
发表于 2016-4-29 17:04:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 zangcf 于 2016-4-29 17:07 编辑

从底层修改,让系统横屏。
横屏之后,再修改成半屏。
回复

使用道具 举报

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
沙发
 楼主| 发表于 2016-5-19 18:09:30 | 只看该作者
错误的log:
Displays (1 entries)
+ DisplayDevice: Built-in Screen
   type=0, hwcId=0, layerStack=0, (1080x1920), ANativeWindow=0x55ab0a1b00, orient= 0 (type=00000003), flips=17, isSecure=1, secureVis=0, powerMode=2, activeConfig=0, numLayers=1
   v:[0,0,1080,1920], f:[0,0,1080,1920], s:[-840,0,1080,1080],transform:[[0.000,-1.000,1080.000][1.000,0.000,0.000][0.000,0.000,1.000]]
   hworient= 1, mirror=-1
mAbandoned=0
-BufferQueue mMaxAcquiredBufferCount=1, mDequeueBufferCannotBlock=0, default-size=[1080x1920], default-format=1, transform-hint=00, FIFO(0)={}
this=0x55ab09fae0 (mConsumerName=FrameBufferSurface_0, mConnectedApi=1, mConsumerUsageBits=0x1a00, mOverrideMaxBufferCount=0, mId=0, mPid=213, producer=[213:/system/bin/surfaceflinger], consumer=[213:/system/bin/surfaceflinger])
    *BufferQueueDump mIsBackupBufInited=0, mAcquiredBufs(size=0), mMode=TRACK_CONSUMER
正确的log:
Displays (1 entries)
+ DisplayDevice: Built-in Screen
   type=0, hwcId=0, layerStack=0, (1080x1920), ANativeWindow=0x558eb6cad0, orient= 0 (type=00000003), flips=327, isSecure=1, secureVis=0, powerMode=2, activeConfig=0, numLayers=1
   v:[0,0,1920,1080], f:[0,0,1920,1080], s:[0,0,1080,1920],transform:[[0.000,-1.000,1080.000][1.000,0.000,0.000][0.000,0.000,1.000]]
   hworient= 1, mirror=-1
mAbandoned=0
-BufferQueue mMaxAcquiredBufferCount=1, mDequeueBufferCannotBlock=0, default-size=[1080x1920], default-format=1, transform-hint=00, FIFO(0)={}
this=0x558eb6aab0 (mConsumerName=FrameBufferSurface_0, mConnectedApi=1, mConsumerUsageBits=0x1a00, mOverrideMaxBufferCount=0, mId=0, mPid=213, producer=[213:/system/bin/surfaceflinger], consumer=[213:/system/bin/surfaceflinger])
    *BufferQueueDump mIsBackupBufInited=0, mAcquiredBufs(size=0), mMode=TRACK_CONSUMER

对应的版本::
void DisplayDevice::dump(String8& result) const {
    const Transform& tr(mGlobalTransform);
    result.appendFormat(
        "+ DisplayDevice: %s\n"
        "   type=%x, hwcId=%d, layerStack=%u, (%4dx%4d), ANativeWindow=%p, orient=%2d (type=%08x), "
        "flips=%u, isSecure=%d, secureVis=%d, powerMode=%d, activeConfig=%d, numLayers=%zu\n"
        "   v:[%d,%d,%d,%d], f:[%d,%d,%d,%d], s:[%d,%d,%d,%d],"
        "transform:[[%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f]]\n",
        mDisplayName.string(), mType, mHwcDisplayId,
        mLayerStack, mDisplayWidth, mDisplayHeight, mNativeWindow.get(),
        mOrientation, tr.getType(), getPageFlipCount(),
        mIsSecure, mSecureLayerVisible, mPowerMode, mActiveConfig,
        mVisibleLayersSortedByZ.size(),
        mViewport.left, mViewport.top, mViewport.right, mViewport.bottom,
        mFrame.left, mFrame.top, mFrame.right, mFrame.bottom,
        mScissor.left, mScissor.top, mScissor.right, mScissor.bottom,
        tr[0][0], tr[1][0], tr[2][0],
        tr[0][1], tr[1][1], tr[2][1],
        tr[0][2], tr[1][2], tr[2][2]);

#ifdef MTK_AOSP_ENHANCEMENT
    result.appendFormat(
        "   hworient=%2d, mirror=%d\n",
        mHwOrientation, mHwcMirrorId);
#endif

    String8 surfaceDump;
    mDisplaySurface->dump(surfaceDump);
    result.append(surfaceDump);
}
回复 支持 反对

使用道具 举报

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
板凳
 楼主| 发表于 2016-5-19 18:17:10 | 只看该作者
修改上面的不行:
还发现有不同的地方:
错误的log:
    type   |  handle  | hint | flag | tr | blnd |   format    |     source crop (l,t,r,b)      |          frame         | name
-----------+----------+------+------+----+------+-------------+--------------------------------+------------------------+------
       HWC | 55ab05b470 | 0002 | 0000 | 00 | 0100 | RGBx_8888   |    0.0,    0.0, 1080.0, 1080.0 |    0,    0, 1080, 1080 | BootAnimation
FB TARGET | 00000000 | 0000 | 0000 | 00 | 0105 | RGBA_8888   |    0.0,    0.0, 1080.0, 1920.0 |    0,    0, 1080, 1920 | HWC_FRAMEBUFFER_TARGET

正确的log:
    type   |  handle  | hint | flag | tr | blnd |   format    |     source crop (l,t,r,b)      |          frame         | name
-----------+----------+------+------+----+------+-------------+--------------------------------+------------------------+------
       HWC | 558eb22ed0 | 0002 | 0000 | 00 | 0100 | RGBx_8888   |    0.0,    0.0, 1080.0, 1920.0 |    0,    0, 1080, 1920 | BootAnimation
FB TARGET | 00000000 | 0000 | 0000 | 00 | 0105 | RGBA_8888   |    0.0,    0.0, 1080.0, 1920.0 |    0,    0, 1080, 1920 | HWC_FRAMEBUFFER_TARGET
回复 支持 反对

使用道具 举报

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
地板
 楼主| 发表于 2016-5-19 18:37:14 | 只看该作者
再加上修改这个文件:/media/doraemon/works/android/mtk/6735/vr_mouse/alps_VR_new/frameworks/native/services/surfaceflinger/DisplayHardware/HWComposer.cpp
    virtual void setFrame(const Rect& frame) {
                //为了显示下一个部分大小,增加可视区域,我们把这里强制增加到第二屏幕的位置。
                Rect myframe(frame);        //zcfdebug++
                if(myframe.bottom==960)myframe.bottom=1920;        //zcfdebug++
                if(myframe.bottom==1080)myframe.bottom=1920;        //zcfdebug++
        getLayer()->displayFrame = reinterpret_cast<hwc_rect_t const&>(myframe);
    }
    virtual void setCrop(const FloatRect& crop) {
                FloatRect myCrop(crop);
                if(myCrop.bottom==960)myCrop.bottom=1920;        //zcfdebug++
                if(myCrop.bottom==1080)myCrop.bottom=1920;        //zcfdebug++               
        if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_3)) {
            getLayer()->sourceCropf = reinterpret_cast<hwc_frect_t const&>(myCrop);
        } else {
            /*
             * Since h/w composer didn't support a flot crop rect before version 1.3,
             * using integer coordinates instead produces a different output from the GL code in
             * Layer::drawWithOpenGL(). The difference can be large if the buffer crop to
             * window size ratio is large and a window crop is defined
             * (i.e.: if we scale the buffer a lot and we also crop it with a window crop).
             */
            hwc_rect_t& r = getLayer()->sourceCrop;
            r.left  = int(ceilf(myCrop.left));
            r.top   = int(ceilf(myCrop.top));
            r.right = int(floorf(myCrop.right));
            r.bottom= int(floorf(myCrop.bottom));
        }
    }
回复 支持 反对

使用道具 举报

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
5#
 楼主| 发表于 2016-5-19 18:37:34 | 只看该作者
上面修改之后,就可以显示完全的log了。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, 2025-12-15 02:11 , Processed in 0.013048 second(s), 7 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表