On Tue, Apr 25, 2023 at 09:28:58AM -0600, [email protected] wrote:
> Hi,
>
> The orientation quirks applied at virtual console initialization in
> inteldrm_attachhook() are not applied at the corresponding place in
> amdgpu. Adding them to amdgpu causes the Steam Deck console to display
> upright instead of on its side.
The console starts as efifb, rasops_init() runs there. After root is
mounted amdgpu takes it over and runs rasops_init() again.
>
> ok?
I would prefer the include at the end of the file with the OpenBSD
specific functions.
ok jsg@ if you go with this:
Index: sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c,v
retrieving revision 1.29
diff -u -p -r1.29 amdgpu_drv.c
--- sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c 31 Mar 2023 02:04:27 -0000
1.29
+++ sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c 26 Apr 2023 01:36:16 -0000
@@ -2906,6 +2906,7 @@ MODULE_LICENSE("GPL and additional right
#endif /* __linux__ */
#include <drm/drm_drv.h>
+#include <drm/drm_utils.h>
#include "vga.h"
@@ -3564,6 +3565,7 @@ amdgpu_attachhook(struct device *self)
}
{
struct wsemuldisplaydev_attach_args aa;
+ int orientation_quirk;
task_set(&adev->switchtask, amdgpu_doswitch, ri);
task_set(&adev->burner_task, amdgpu_burner_cb, adev);
@@ -3572,6 +3574,14 @@ amdgpu_attachhook(struct device *self)
return;
ri->ri_flg = RI_CENTER | RI_VCONS | RI_WRONLY;
+
+ orientation_quirk = drm_get_panel_orientation_quirk(ri->ri_width,
+ ri->ri_height);
+ if (orientation_quirk == DRM_MODE_PANEL_ORIENTATION_LEFT_UP)
+ ri->ri_flg |= RI_ROTATE_CCW;
+ else if (orientation_quirk == DRM_MODE_PANEL_ORIENTATION_RIGHT_UP)
+ ri->ri_flg |= RI_ROTATE_CW;
+
rasops_init(ri, 160, 160);
ri->ri_hw = adev;