#!/bin/sh # This is a shell archive echo x files mkdir -p files > /dev/null 2>&1 echo x files/patch-drivers_gpu_drm_linux__fb.c sed 's/^X//' > files/patch-drivers_gpu_drm_linux__fb.c << 'SHAR_END' X--- drivers/gpu/drm/linux_fb.c.orig 2022-05-31 08:17:34 UTC X+++ drivers/gpu/drm/linux_fb.c X@@ -222,6 +222,33 @@ __register_framebuffer(struct linux_fb_info *fb_info) X fb_info->fbio.fb_fbd_dev = device_add_child(fb_info->fb_bsddev, "fbd", X device_get_unit(fb_info->fb_bsddev)); X X+/* This block should be removed after /sys/sys/fbio.h has been updated. */ X+#ifndef FB_FLAG_ROTATE_MASK /* Transitional, from /sys/sys/fbio.h */ X+#define FB_FLAG_ROTATE_0 0x00 /* rotate fb 0 degrees clockwise */ X+#define FB_FLAG_ROTATE_90 0x08 /* rotate fb 90 degrees clockwise */ X+#define FB_FLAG_ROTATE_180 0x10 /* rotate fb 180 degrees clockwise */ X+#define FB_FLAG_ROTATE_270 (FB_FLAG_ROTATE_90 | FB_FLAG_ROTATE_180) X+#define FB_FLAG_ROTATE_MASK 0x18 X+#define FB_FLAG_ROTATE_NODEFAULT 0x20 /* do not load console defaults */ X+#endif X+ X+ /* Pass the FB_ROTATE hints to FreeBSD's vt(4) fb_flags. */ X+ fb_info->fbio.fb_flags &= ~FB_FLAG_ROTATE_MASK; X+ switch (fb_info->fbcon_rotate_hint) { X+ case FB_ROTATE_UR: X+ fb_info->fbio.fb_flags |= FB_FLAG_ROTATE_0 | FB_FLAG_ROTATE_NODEFAULT; X+ break; X+ case FB_ROTATE_CW: X+ fb_info->fbio.fb_flags |= FB_FLAG_ROTATE_90 | FB_FLAG_ROTATE_NODEFAULT; X+ break; X+ case FB_ROTATE_UD: X+ fb_info->fbio.fb_flags |= FB_FLAG_ROTATE_180 | FB_FLAG_ROTATE_NODEFAULT; X+ break; X+ case FB_ROTATE_CCW: X+ fb_info->fbio.fb_flags |= FB_FLAG_ROTATE_270 | FB_FLAG_ROTATE_NODEFAULT; X+ break; X+ } X+ X /* tell vt_fb to initialize color map */ X fb_info->fbio.fb_cmsize = 0; X if (fb_info->fbio.fb_bpp == 0) { X@@ -281,7 +308,9 @@ linux_unregister_framebuffer(struct linux_fb_info *fb_ X int X linux_fb_get_options(const char *connector_name, char **option) X { X+ int rotation; X char tunable[64]; X+ char (*optbuf)[sizeof(",rotate=360")]; X X /* X * A user may use loader tunables to set a specific mode for the X@@ -295,6 +324,11 @@ linux_fb_get_options(const char *connector_name, char X * Example of a mode applied to all connectors not having a X * connector-specific mode: X * kern.vt.fb.default_mode="640x480" X+ * X+ * Example of a mode option applied to all connectors not having a X+ * connector-specific mode, where the angle is the number of degrees X+ * counter-clockwise to rotate the display: X+ * kern.vt.fb.default_mode=",rotate=270" X */ X snprintf(tunable, sizeof(tunable), "kern.vt.fb.modes.%s", X connector_name); X@@ -302,10 +336,26 @@ linux_fb_get_options(const char *connector_name, char X printf("[drm] Connector %s: get mode from tunables:\n", connector_name); X printf("[drm] - %s\n", tunable); X printf("[drm] - kern.vt.fb.default_mode\n"); X+ printf("[drm] - screen.rotate\n"); X } X *option = kern_getenv(tunable); X if (*option == NULL) X *option = kern_getenv("kern.vt.fb.default_mode"); X+ if (*option == NULL) { X+ if (getenv_int("screen.rotate", &rotation) != 0) { X+ switch (rotation) { X+ case 90: X+ case 270: X+ rotation = (rotation + 180) % 360; X+ case 180: X+ optbuf = malloc(sizeof(*optbuf), DRM_MEM_DRIVER, X+ M_WAITOK | M_ZERO); X+ snprintf(*optbuf, sizeof(*optbuf), ",rotate=%d", X+ rotation); X+ *option = *optbuf; X+ } X+ } X+ } X X return (*option != NULL ? 0 : -ENOENT); X } SHAR_END echo x files/patch-drivers_gpu_drm_drm__fb__helper.c sed 's/^X//' > files/patch-drivers_gpu_drm_drm__fb__helper.c << 'SHAR_END' X--- drivers/gpu/drm/drm_fb_helper.c.orig 2022-08-27 22:41:18 UTC X+++ drivers/gpu/drm/drm_fb_helper.c X@@ -1827,7 +1827,6 @@ static void drm_setup_crtcs_fb(struct drm_fb_helper *f X } X drm_connector_list_iter_end(&conn_iter); X X-#ifdef __linux__ X switch (sw_rotations) { X case DRM_MODE_ROTATE_0: X info->fbcon_rotate_hint = FB_ROTATE_UR; X@@ -1849,7 +1848,6 @@ static void drm_setup_crtcs_fb(struct drm_fb_helper *f X */ X info->fbcon_rotate_hint = FB_ROTATE_UR; X } X-#endif X } X X /* Note: Drops fb_helper->lock before returning. */ SHAR_END echo x files/patch-linuxkpi_gplv2_include_linux_fb.h sed 's/^X//' > files/patch-linuxkpi_gplv2_include_linux_fb.h << 'SHAR_END' X--- linuxkpi/gplv2/include/linux/fb.h.orig 2022-05-31 08:17:34 UTC X+++ linuxkpi/gplv2/include/linux/fb.h X@@ -47,6 +47,11 @@ struct linux_fb_info { X struct fb_var_screeninfo var; /* Current var */ X struct fb_fix_screeninfo fix; /* Current fix */ X X+ /* X+ * -1 by default, set to a FB_ROTATE_* value by the driver, if it knows X+ * a lcd is not mounted upright and fbcon should rotate to compensate. X+ */ X+ int fbcon_rotate_hint; X const struct fb_ops *fbops; X struct device *device; /* This is the parent */ X struct device *dev; /* This is this fb device */ SHAR_END exit