Created
October 28, 2019 20:32
-
-
Save psyke83/ea5d9b241332b3b4ade75d4def17f140 to your computer and use it in GitHub Desktop.
sdl2 modesetting example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c | |
index 3fe4dfb..f1d35fb 100644 | |
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c | |
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c | |
@@ -350,6 +350,7 @@ KMSDRM_VideoInit(_THIS) | |
SDL_bool found; | |
int ret = 0; | |
char *devname; | |
+ const char *mode_override; | |
SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); | |
drmModeRes *resources = NULL; | |
drmModeConnector *connector = NULL; | |
@@ -473,7 +474,11 @@ KMSDRM_VideoInit(_THIS) | |
vdata->saved_crtc->crtc_id, vdata->saved_crtc->buffer_id, vdata->saved_crtc->x, | |
vdata->saved_crtc->y, vdata->saved_crtc->width, vdata->saved_crtc->height); | |
data->crtc_id = encoder->crtc_id; | |
- data->cur_mode = vdata->saved_crtc->mode; | |
+ mode_override = SDL_getenv("SDL_VIDEO_KMSDRM_MODE"); | |
+ if (mode_override) | |
+ data->cur_mode = connector->modes[SDL_atoi(mode_override)]; | |
+ else | |
+ data->cur_mode = vdata->saved_crtc->mode; | |
vdata->crtc_id = encoder->crtc_id; | |
// select default mode if this one is not valid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment