Page MenuHomeFreeBSD

D35984.id108695.diff
No OneTemporary

D35984.id108695.diff

Index: graphics/drm-fbsd13-kmod/files/patch-drm_fb_helper_freebsd.c
===================================================================
--- /dev/null
+++ graphics/drm-fbsd13-kmod/files/patch-drm_fb_helper_freebsd.c
@@ -0,0 +1,49 @@
+diff -ru drivers/gpu/drm/drm_fb_helper_freebsd.c drivers/gpu/drm/drm_fb_helper_freebsd.c
+--- drivers/gpu/drm/drm_fb_helper_freebsd.c 2022-04-26 02:24:02.000000000 -0600
++++ drivers/gpu/drm/drm_fb_helper_freebsd.c 2022-07-02 13:57:55.679647000 -0600
+@@ -48,7 +48,9 @@
+ int
+ fb_get_options(const char *connector_name, char **option)
+ {
++ int rotation;
+ char tunable[64];
++ char (*optbuf)[sizeof(",rotate=360")];
+
+ /*
+ * A user may use loader tunables to set a specific mode for the
+@@ -62,15 +64,34 @@
+ * Example of a mode applied to all connectors not having a
+ * connector-specific mode:
+ * kern.vt.fb.default_mode="640x480"
++ *
++ * Example of a mode option applied to all connectors not having a
++ * connector-specific mode, where the angle is the number of degrees
++ * counter-clockwise to rotate the display:
++ * kern.vt.fb.default_mode=",rotate=270"
+ */
+ snprintf(tunable, sizeof(tunable), "kern.vt.fb.modes.%s",
+ connector_name);
+ DRM_INFO("Connector %s: get mode from tunables:\n", connector_name);
+ DRM_INFO(" - %s\n", tunable);
+ DRM_INFO(" - kern.vt.fb.default_mode\n");
++ DRM_INFO(" - screen.rotate\n");
+ *option = kern_getenv(tunable);
+ if (*option == NULL)
+- *option = kern_getenv("kern.vt.fb.default_mode");
++ *option = kern_getenv("kern.vt.fb.default_mode");
++ if (*option == NULL) {
++ if (getenv_int("screen.rotate", &rotation) != 0) {
++ switch (rotation) {
++ case 90:
++ case 270:
++ rotation = (rotation + 180) % 360;
++ case 180:
++ optbuf = malloc(sizeof(*optbuf), DRM_MEM_DRIVER, M_WAITOK | M_ZERO);
++ snprintf(*optbuf, sizeof(*optbuf), ",rotate=%d", rotation);
++ *option = *optbuf;
++ }
++ }
++ }
+
+ return (*option != NULL ? 0 : -ENOENT);
+ }
Index: graphics/drm-fbsd13-kmod/files/patch-linux_fb.c
===================================================================
--- /dev/null
+++ graphics/drm-fbsd13-kmod/files/patch-linux_fb.c
@@ -0,0 +1,38 @@
+diff -ur drivers/gpu/drm/linux_fb.c drivers/gpu/drm/linux_fb.c
+--- drivers/gpu/drm/linux_fb.c 2022-04-26 02:24:02.000000000 -0600
++++ drivers/gpu/drm/linux_fb.c 2022-06-30 23:12:04.654472000 -0600
+@@ -662,6 +662,34 @@
+ fb_info->fbio.fb_fbd_dev = device_add_child(fb_info->fb_bsddev, "fbd",
+ device_get_unit(fb_info->fb_bsddev));
+
++#ifdef __FreeBSD__
++#ifndef FB_FLAG_ROTATE_MASK /* Transitional, from /sys/sys/fbio.h */
++#define FB_FLAG_ROTATE_0 0x00 /* rotate fb 0 degrees clockwise */
++#define FB_FLAG_ROTATE_90 0x08 /* rotate fb 90 degrees clockwise */
++#define FB_FLAG_ROTATE_180 0x10 /* rotate fb 180 degrees clockwise */
++#define FB_FLAG_ROTATE_270 (FB_FLAG_ROTATE_90 | FB_FLAG_ROTATE_180)
++#define FB_FLAG_ROTATE_MASK 0x18
++#define FB_FLAG_ROTATE_NODEFAULT 0x20 /* do not load console defaults */
++#endif
++
++ /* Pass the FB_ROTATE hints to FreeBSD's vt(4) fb_flags. */
++ fb_info->fbio.fb_flags &= ~FB_FLAG_ROTATE_MASK;
++ switch (fb_info->fbcon_rotate_hint) {
++ case FB_ROTATE_UR:
++ fb_info->fbio.fb_flags |= FB_FLAG_ROTATE_0 | FB_FLAG_ROTATE_NODEFAULT;
++ break;
++ case FB_ROTATE_CW:
++ fb_info->fbio.fb_flags |= FB_FLAG_ROTATE_90 | FB_FLAG_ROTATE_NODEFAULT;
++ break;
++ case FB_ROTATE_UD:
++ fb_info->fbio.fb_flags |= FB_FLAG_ROTATE_180 | FB_FLAG_ROTATE_NODEFAULT;
++ break;
++ case FB_ROTATE_CCW:
++ fb_info->fbio.fb_flags |= FB_FLAG_ROTATE_270 | FB_FLAG_ROTATE_NODEFAULT;
++ break;
++ }
++#endif
++
+ /*
+ * XXX we're deliberately not attaching because we already
+ * do the equivalent albeit with less fanfare in fbd_init

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 5, 8:30 AM (19 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29278336
Default Alt Text
D35984.id108695.diff (3 KB)

Event Timeline