Hi,
I am working on an i.MX8MP custom board with Android 10_2.3.0. I am trying to change the display orientation from landscape to portrait in my Android image, so I added the following changes in my .mk files.
diff --git a/imx8m/BoardConfigCommon.mk b/imx8m/BoardConfigCommon.mk
index 92197b61..2b105592 100644
--- a/imx8m/BoardConfigCommon.mk
+++ b/imx8m/BoardConfigCommon.mk
@@ -10,7 +10,10 @@ HAVE_FSL_IMX_IPU \
PREBUILT_FSL_IMX_GPU \
BOARD_SOC_TYPE \
PRODUCT_MANUFACTURER \
-BOARD_VPU_ONLY
+BOARD_VPU_ONLY \
+SF_PRIMARY_DISPLAY_ORIENTATION
+
+SOONG_CONFIG_IMXPLUGIN_SF_PRIMARY_DISPLAY_ORIENTATION = 270
SOONG_CONFIG_IMXPLUGIN_BOARD_PLATFORM = imx8
SOONG_CONFIG_IMXPLUGIN_NUM_FRAMEBUFFER_SURFACE_BUFFERS = 3
diff --git a/imx8m/evk_8mm/BoardConfig.mk b/imx8m/evk_8mm/BoardConfig.mk
index ed30f771..cd8f4c89 100644
--- a/imx8m/evk_8mm/BoardConfig.mk
+++ b/imx8m/evk_8mm/BoardConfig.mk
@@ -117,6 +117,8 @@ TARGET_USES_MKE2FS := true
# define frame buffer count
NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
+SF_PRIMARY_DISPLAY_ORIENTATION := 270
+
ifeq ($(PRODUCT_IMX_DRM),true)
CMASIZE=736M
else
When I set SF_PRIMARY_DISPLAY_ORIENTATION := 270, the output appears in
When I set SF_PRIMARY_DISPLAY_ORIENTATION := 180, the output appears in a
,but not in the correct orientation. When i passed the
$ settings put system user_rotation 3 command in android 15 means gives me the correct_portrait_view
However, this command does not work on Android 11.
I will attach an image showing the orientation I am expecting in Android 10
Thanks &Regards
Subash.P
Hi,
surfaceflinger rotation information will not pass to HWC in Android10, please try the attachment in HAL and use 'settings put system accelerometer_rotation 0/1' for test.
diff --git a/display/display/Composer.cpp b/display/display/Composer.cpp
old mode 100644
new mode 100755
index 8dba110..282c4f8
--- a/display/display/Composer.cpp
+++ b/display/display/Composer.cpp
@@ -350,11 +350,40 @@ int Composer::clearWormHole(LayerVector& layers)
int Composer::composeLayer(Layer* layer, bool bypass)
{
+ int transform;
if (layer == NULL || mTarget == NULL) {
ALOGE("composeLayer: invalid layer or target");
return -EINVAL;
}
+
+ /*
+ 0 => 4
+ 4 => 3
+ 3 => 7
+ 7 => 0
+ */
+ ALOGI("liutest1 composeLayer transform:0x%x\n",layer->transform);
+
+ switch (layer->transform)
+ {
+ case 0:
+ transform = 4;
+ break;
+ case 4:
+ transform = 3;
+ break;
+ case 3:
+ transform = 7;
+ break;
+ case 7:
+ transform = 0;
+ break;
+
+ default:
+ ALOGI("liutest1 invalid transform:0x%x\n",layer->transform);
+ }
+
if (bypass && layer->isSolidColor()) {
ALOGV("composeLayer dim layer bypassed");
return 0;
@@ -392,7 +421,7 @@ int Composer::composeLayer(Layer* layer, bool bypass)
continue;
}
- setClipping(srect, drect, clip, layer->transform);
+ setClipping(srect, drect, clip, /*layer->transform*/transform);
ALOGV("index:%d, i:%d sourceCrop(l:%d,t:%d,r:%d,b:%d), "
"visible(l:%d,t:%d,r:%d,b:%d), "
"display(l:%d,t:%d,r:%d,b:%d)", layer->index, (int)i,
@@ -403,8 +432,9 @@ int Composer::composeLayer(Layer* layer, bool bypass)
ALOGV("zorder:0x%x, layer phys:0x%" PRIx64,
layer->zorder, layer->handle->phys);
}
- ALOGV("transform:0x%x, blend:0x%x, alpha:0x%x",
- layer->transform, layer->blendMode, layer->planeAlpha);
+ /*ALOGV*/ALOGI("liutest1 transform:0x%x:0x%x, blend:0x%x, alpha:0x%x",
+ layer->transform,transform, layer->blendMode, layer->planeAlpha);
+
setG2dSurface(dSurfaceX, mTarget, drect);
@@ -422,7 +452,7 @@ int Composer::composeLayer(Layer* layer, bool bypass)
return -EINVAL;
}
- convertRotation(layer->transform, sSurface, dSurface);
+ convertRotation(/*layer->transform*/transform, sSurface, dSurface);
if (!bypass) {
convertBlending(layer->blendMode, sSurface, dSurface);
}
Best Regards,
Zhiming
Hi @Zhiming_Liu
After applying your patch, I can see some changes on my screen, but the resolution is not good. Also, when I connect a mouse, it works in the way of landscape navigation, not in portrait navigation.
And also, the navigation bar is not visible.
Best Regards,
Subash P.