1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
From 9387b3b812eb87ff2c6a3c06b3cf0e04e8a5cba7 Mon Sep 17 00:00:00 2001
From: alphonsez1 <alphonsez743@gmail.com>
Date: Sat, 3 Sep 2022 13:49:11 -0700
Subject: [PATCH 2/2] Force orientation only to internal display.
---
src/drm.cpp | 85 ++++++++++++++++++++++++++++++++---------------------
1 file changed, 51 insertions(+), 34 deletions(-)
diff --git a/src/drm.cpp b/src/drm.cpp
index c4204be..29a3320 100644
--- a/src/drm.cpp
+++ b/src/drm.cpp
@@ -1299,25 +1299,33 @@ drm_prepare_basic( struct drm_t *drm, const struct FrameInfo_t *frameInfo )
drm->fbids_in_req.push_back( fb_id );
- switch ( g_drmModeOrientation )
+ drm_screen_type screenType = drm_get_screen_type(drm);
+ if ( screenType == DRM_SCREEN_TYPE_INTERNAL )
+ {
+ switch ( g_drmModeOrientation )
+ {
+ case PANEL_ORIENTATION_0:
+ add_plane_property(req, drm->primary, "rotation", DRM_MODE_ROTATE_0);
+ break;
+ case PANEL_ORIENTATION_270:
+ add_plane_property(req, drm->primary, "rotation", DRM_MODE_ROTATE_270);
+ break;
+ case PANEL_ORIENTATION_90:
+ add_plane_property(req, drm->primary, "rotation", DRM_MODE_ROTATE_90);
+ break;
+ case PANEL_ORIENTATION_180:
+ add_plane_property(req, drm->primary, "rotation", DRM_MODE_ROTATE_180);
+ break;
+ /* we are keeping the original method used for by default to prevent a sudden break in compatibility for devices using this method.*/
+ case PANEL_ORIENTATION_AUTO:
+ default:
+ add_plane_property(req, drm->primary, "rotation", g_bRotated ? DRM_MODE_ROTATE_270 : DRM_MODE_ROTATE_0);
+ break;
+ }
+ }
+ else
{
- case PANEL_ORIENTATION_0:
- add_plane_property(req, drm->primary, "rotation", DRM_MODE_ROTATE_0);
- break;
- case PANEL_ORIENTATION_270:
- add_plane_property(req, drm->primary, "rotation", DRM_MODE_ROTATE_270);
- break;
- case PANEL_ORIENTATION_90:
- add_plane_property(req, drm->primary, "rotation", DRM_MODE_ROTATE_90);
- break;
- case PANEL_ORIENTATION_180:
- add_plane_property(req, drm->primary, "rotation", DRM_MODE_ROTATE_180);
- break;
- /* we are keeping the original method used for by default to prevent a sudden break in compatibility for devices using this method.*/
- case PANEL_ORIENTATION_AUTO:
- default:
add_plane_property(req, drm->primary, "rotation", g_bRotated ? DRM_MODE_ROTATE_270 : DRM_MODE_ROTATE_0);
- break;
}
add_plane_property(req, drm->primary, "FB_ID", fb_id);
@@ -1568,25 +1576,34 @@ drm_prepare_liftoff( struct drm_t *drm, const struct FrameInfo_t *frameInfo, boo
liftoff_layer_set_property( drm->lo_layers[ i ], "SRC_W", entry.layerState[i].srcW );
liftoff_layer_set_property( drm->lo_layers[ i ], "SRC_H", entry.layerState[i].srcH );
- switch ( g_drmModeOrientation )
+ drm_screen_type screenType = drm_get_screen_type(drm);
+ if ( screenType == DRM_SCREEN_TYPE_INTERNAL )
{
- case PANEL_ORIENTATION_0:
- liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", DRM_MODE_ROTATE_0);
- break;
- case PANEL_ORIENTATION_270:
- liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", DRM_MODE_ROTATE_270);
- break;
- case PANEL_ORIENTATION_90:
- liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", DRM_MODE_ROTATE_90);
- break;
- case PANEL_ORIENTATION_180:
- liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", DRM_MODE_ROTATE_180);
- break;
- case PANEL_ORIENTATION_AUTO:
- default: /* We are using auto to ensure compatibility with devicess that used this method*/
- liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", g_bRotated ? DRM_MODE_ROTATE_270 : DRM_MODE_ROTATE_0);
- break;
+ switch ( g_drmModeOrientation )
+ {
+ case PANEL_ORIENTATION_0:
+ liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", DRM_MODE_ROTATE_0);
+ break;
+ case PANEL_ORIENTATION_270:
+ liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", DRM_MODE_ROTATE_270);
+ break;
+ case PANEL_ORIENTATION_90:
+ liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", DRM_MODE_ROTATE_90);
+ break;
+ case PANEL_ORIENTATION_180:
+ liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", DRM_MODE_ROTATE_180);
+ break;
+ case PANEL_ORIENTATION_AUTO:
+ default: /* We are using auto to ensure compatibility with devicess that used this method*/
+ liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", g_bRotated ? DRM_MODE_ROTATE_270 : DRM_MODE_ROTATE_0);
+ break;
+ }
}
+ else
+ {
+ liftoff_layer_set_property( drm->lo_layers[ i ], "rotation", g_bRotated ? DRM_MODE_ROTATE_270 : DRM_MODE_ROTATE_0);
+ }
+
liftoff_layer_set_property( drm->lo_layers[ i ], "CRTC_X", entry.layerState[i].crtcX);
liftoff_layer_set_property( drm->lo_layers[ i ], "CRTC_Y", entry.layerState[i].crtcY);
--
2.37.3
|