Changeset View
Changeset View
Standalone View
Standalone View
graphics/drm-fbsd13-kmod/files/patch-drm_fb_helper_freebsd.c
- This file was added.
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); | |||||
} |