RK3588 framework层实现开机后竖屏

rk3588实现开机后竖屏显示画面,步骤如下:

SurfaceFlinger.cpp
int64_t SurfaceFlinger::dispSyncPresentTimeOffset;
bool SurfaceFlinger::useHwcForRgbToYuv;
bool SurfaceFlinger::hasSyncFramework;
int64_t SurfaceFlinger::maxFrameBufferAcquiredBuffers;
uint32_t SurfaceFlinger::maxGraphicsWidth;
uint32_t SurfaceFlinger::maxGraphicsHeight;
bool SurfaceFlinger::hasWideColorDisplay;
---ui::Rotation SurfaceFlinger::internalDisplayOrientation = ui::ROTATION_0; // 删除
+++ui::Rotation SurfaceFlinger::internalDisplayOrientation = ui::ROTATION_90; // 修改为这行
void SurfaceFlinger::onInitializeDisplays() {
	......
    DisplayState d;
    d.what = DisplayState::eDisplayProjectionChanged |
             DisplayState::eLayerStackChanged;
    d.token = token;
    d.layerStack = 0;
	---d.orientation = ui::ROTATION_0; // 删除
    +++d.orientation = ui::ROTATION_90; // 修改为这行
    ALOGE("wzx orientation = %d",d.orientation);
    d.orientedDisplaySpaceRect.makeInvalid();
    d.layerStackSpaceRect.makeInvalid();
    ......
}
void SurfaceFlinger::processDisplayChanged(const wp<IBinder>& displayToken,
                                           const DisplayDeviceState& currentState,
                                           const DisplayDeviceState& drawingState) {
  	......
        if ((currentState.orientation != drawingState.orientation) ||
            (currentState.layerStackSpaceRect != drawingState.layerStackSpaceRect) ||
            (currentState.orientedDisplaySpaceRect != drawingState.orientedDisplaySpaceRect)) {
      
           ---display->setProjection(currentState.orientation, currentState.layerStackSpaceRect,
                                   currentState.orientedDisplaySpaceRect); // 删除
            +++display->setProjection(ui::ROTATION_90, currentState.layerStackSpaceRect,
                                   currentState.orientedDisplaySpaceRect); // 修改为这行
            if (isDisplayActiveLocked(display)) {
                mActiveDisplayTransformHint = display->getTransformHint();
            }
        }
    ......
}
DisplayDevice.cpp
void DisplayDevice::setProjection(ui::Rotation orientation, Rect layerStackSpaceRect,
                                  Rect orientedDisplaySpaceRect) {
	......
   
   // 新增如下四行
    +++orientedDisplaySpaceRect.left = 0;
    +++orientedDisplaySpaceRect.top = 0;
    +++orientedDisplaySpaceRect.right = 1080;
    +++orientedDisplaySpaceRect.bottom = 1920;

    // We need to take care of display rotation for globalTransform for case if the panel is not
    // installed aligned with device orientation.
    const auto transformOrientation = orientation + mPhysicalOrientation;
    getCompositionDisplay()->setProjection(transformOrientation, layerStackSpaceRect,
                                           orientedDisplaySpaceRect);
}

最后编译surfacefinger,替换就好啦,可以参考链接:link

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值