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