2023-08-11 15:46:37 +00:00
|
|
|
From 2b837f662b12330e2d5afa867f1b6c1476b93102 Mon Sep 17 00:00:00 2001
|
|
|
|
From: JohnnyonFlame <johnnyonflame@hotmail.com>
|
|
|
|
Date: Tue, 8 Aug 2023 04:01:53 -0300
|
|
|
|
Subject: [PATCH 6/7] drm resolution
|
|
|
|
|
|
|
|
---
|
|
|
|
src/video/kmsdrm/SDL_kmsdrmvideo.c | 39 +++++++++++++++++++++++++++++-
|
|
|
|
1 file changed, 38 insertions(+), 1 deletion(-)
|
|
|
|
|
2023-07-11 12:20:34 +00:00
|
|
|
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
2023-08-11 15:46:37 +00:00
|
|
|
index 663c4707c..39eff8c1d 100644
|
2023-07-11 12:20:34 +00:00
|
|
|
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
|
|
|
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
2023-08-11 15:46:37 +00:00
|
|
|
@@ -842,6 +842,24 @@ static void KMSDRM_AddDisplay(_THIS, drmModeConnector *connector, drmModeRes *re
|
2023-07-11 12:20:34 +00:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // batocera - set resolution
|
|
|
|
+ {
|
|
|
|
+ FILE* fdDrmMode;
|
|
|
|
+ int drmMode;
|
|
|
|
+ if((fdDrmMode = fopen("/var/run/drmMode", "r")) != NULL) {
|
|
|
|
+ if(fscanf(fdDrmMode, "%i", &drmMode) == 1) {
|
|
|
|
+ if(drmMode>=0 && drmMode<connector->count_modes) {
|
|
|
|
+ drmModeCrtc *pcrtc = KMSDRM_drmModeGetCrtc(viddata->drm_fd, encoder->crtc_id);
|
|
|
|
+ if(pcrtc != NULL) {
|
|
|
|
+ KMSDRM_drmModeSetCrtc(viddata->drm_fd, pcrtc->crtc_id, pcrtc->buffer_id, 0, 0, &connector->connector_id, 1, &connector->modes[drmMode]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ fclose(fdDrmMode);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //
|
|
|
|
+
|
|
|
|
/* Try to find a CRTC connected to this encoder */
|
|
|
|
crtc = KMSDRM_drmModeGetCrtc(viddata->drm_fd, encoder->crtc_id);
|
|
|
|
|
2023-08-11 15:46:37 +00:00
|
|
|
@@ -1383,8 +1401,27 @@ void KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
|
2023-07-11 12:20:34 +00:00
|
|
|
SDL_DisplayMode mode;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
+ // batocera
|
|
|
|
+ int wantedMode = 0;
|
|
|
|
+ {
|
|
|
|
+ FILE* fdDrmMode;
|
|
|
|
+ int drmMode;
|
|
|
|
+ if((fdDrmMode = fopen("/var/run/drmMode", "r")) != NULL) {
|
|
|
|
+ if(fscanf(fdDrmMode, "%i", &drmMode) == 1) {
|
|
|
|
+ if(drmMode>=0 && drmMode<conn->count_modes) {
|
|
|
|
+ wantedMode = drmMode;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ fclose(fdDrmMode);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //
|
|
|
|
+
|
|
|
|
for (i = 0; i < conn->count_modes; i++) {
|
|
|
|
- SDL_DisplayModeData *modedata = SDL_calloc(1, sizeof(SDL_DisplayModeData));
|
|
|
|
+ SDL_DisplayModeData *modedata;
|
|
|
|
+ if(i != wantedMode) continue; // batocera
|
|
|
|
+
|
|
|
|
+ modedata = SDL_calloc(1, sizeof(SDL_DisplayModeData));
|
|
|
|
|
|
|
|
if (modedata) {
|
|
|
|
modedata->mode_index = i;
|
2023-08-11 15:46:37 +00:00
|
|
|
--
|
|
|
|
2.20.1
|
2023-07-11 12:20:34 +00:00
|
|
|
|