summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCrydsch <[email protected]>2022-05-09 17:12:38 +0200
committerGitHub <[email protected]>2022-05-09 17:12:38 +0200
commitb2c2b5ee21d10e40c0d3a0fde2f3508f39f7ff9f (patch)
treef17e8acd459b588d3081c58dc53ce46c403288e9
parentdf3f64bfd2c103603ae87097d5e8efad0ed54181 (diff)
downloadraylib-b2c2b5ee21d10e40c0d3a0fde2f3508f39f7ff9f.tar.gz
raylib-b2c2b5ee21d10e40c0d3a0fde2f3508f39f7ff9f.zip
remove fps requirement for drm connector selection (#2468)
-rw-r--r--src/rcore.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/rcore.c b/src/rcore.c
index d899317b..552ad201 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -6591,7 +6591,7 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode: %d %ux%u@%u %s", i, mode->hdisplay, mode->vdisplay, mode->vrefresh,
(mode->flags & DRM_MODE_FLAG_INTERLACE) ? "interlaced" : "progressive");
- if ((mode->hdisplay < width) || (mode->vdisplay < height) || (mode->vrefresh < fps))
+ if ((mode->hdisplay < width) || (mode->vdisplay < height))
{
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode is too small");
continue;
@@ -6603,23 +6603,22 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
continue;
}
- if ((mode->hdisplay >= width) && (mode->vdisplay >= height) && (mode->vrefresh >= fps))
+ if (nearestIndex < 0)
{
- const int widthDiff = mode->hdisplay - width;
- const int heightDiff = mode->vdisplay - height;
- const int fpsDiff = mode->vrefresh - fps;
+ nearestIndex = i;
+ continue;
+ }
- if (nearestIndex < 0)
- {
- nearestIndex = i;
- continue;
- }
+ const int widthDiff = abs(mode->hdisplay - width);
+ const int heightDiff = abs(mode->vdisplay - height);
+ const int fpsDiff = abs(mode->vrefresh - fps);
- const int nearestWidthDiff = CORE.Window.connector->modes[nearestIndex].hdisplay - width;
- const int nearestHeightDiff = CORE.Window.connector->modes[nearestIndex].vdisplay - height;
- const int nearestFpsDiff = CORE.Window.connector->modes[nearestIndex].vrefresh - fps;
+ const int nearestWidthDiff = abs(CORE.Window.connector->modes[nearestIndex].hdisplay - width);
+ const int nearestHeightDiff = abs(CORE.Window.connector->modes[nearestIndex].vdisplay - height);
+ const int nearestFpsDiff = abs(CORE.Window.connector->modes[nearestIndex].vrefresh - fps);
- if ((widthDiff < nearestWidthDiff) || (heightDiff < nearestHeightDiff) || (fpsDiff < nearestFpsDiff)) nearestIndex = i;
+ if ((widthDiff < nearestWidthDiff) || (heightDiff < nearestHeightDiff) || (fpsDiff < nearestFpsDiff)) {
+ nearestIndex = i;
}
}