feature: add rotation shader for rotating output#1655
Conversation
|
This shouldn't be necessary. One could just set up the regular composition scene graph and image to be rotated without an additional step here. |
Do you have other suggestion on the implemention? In fact I have tried several ways to rotate the image, adding a rotation shader is the best in terms of performance and the amount of code added. As the main problem is that, intel drm driver i915 does not support 90/270 degrees rotation on a portrait screen. So before apply the rotation shader, the image is rendered in landscape size on a portrait screen (drm rotation = normal), and then rotated after applied the rotation shader. |
5fbd420 to
3831a9e
Compare
3831a9e to
90ab765
Compare
|
Like @stellar-aria has observed in #1883, this is very useful for ARM devices. Also this PR assumes the device supports 180 rotation, but some devices don't not support any rotation at all. Such as the Adreno 740 mentioned in #1883. I can also confirm the Adreno 650 I have is the same. So maybe some sort of detection needs to be implemented. |
|
What needs to be done to get this merged? |
| { "composite-debug", no_argument, nullptr, 0 }, | ||
| { "disable-xres", no_argument, nullptr, 'x' }, | ||
| { "fade-out-duration", required_argument, nullptr, 0 }, | ||
| { "use-rotation-shader", required_argument, nullptr, 0 }, |
| break; | ||
| } | ||
|
|
||
| if (g_bEnableDRMRotationShader) { |
There was a problem hiding this comment.
This only handles ORIENTATION_90 (see the switch case just above this diff). Since with 270 DRM is used to flip the panel 180 degrees. This diff from @Drakulix fixes it
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index d6f01d2..84e2adb 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -2832,8 +2832,19 @@ static void apply_touchscreen_orientation(GamescopePanelOrientation orientation,
}
if (g_bEnableDRMRotationShader) {
- tx = 1.0 - *y;
- ty = *x;
+ switch ( orientation )
+ {
+ case GAMESCOPE_PANEL_ORIENTATION_180:
+ tx = *y;
+ ty = 1.0 - *x;
+ break;
+ default:
+ case GAMESCOPE_PANEL_ORIENTATION_0:
+ case GAMESCOPE_PANEL_ORIENTATION_AUTO:
+ tx = 1.0 - *y;
+ ty = *x;
+ break;
+ }
}
*x = tx;
There was a problem hiding this comment.
Updated, curious about the source of this change.
There was a problem hiding this comment.
It's from a downstream package for postmarketOS to get gamescope+steam running on an Ayaneo Pocket S2: https://gitlab.postmarketos.org/Drakulix/steam-session-pkgs/-/tree/main/pkgs/gamescope?ref_type=heads
Added a rotation shader to fix blank display problem on portrait screen with unsupported DRM rotation.
Once enabled, the DRM orientation is hardcoded to 0 degrees (left) or 180 degrees (right), and the rotation shader is hardcoded for 270 degrees rotation (counter clockwise 90 degrees)
Tested on: OneXPlayer X1 Intel
It could possibly fix an upstream issue: #819