mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-16 16:28:14 +00:00
remove fps requirement for drm connector selection (#2468)
This commit is contained in:
27
src/rcore.c
27
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,
|
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");
|
(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");
|
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode is too small");
|
||||||
continue;
|
continue;
|
||||||
@@ -6603,23 +6603,22 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode->hdisplay >= width) && (mode->vdisplay >= height) && (mode->vrefresh >= fps))
|
if (nearestIndex < 0)
|
||||||
{
|
{
|
||||||
const int widthDiff = mode->hdisplay - width;
|
nearestIndex = i;
|
||||||
const int heightDiff = mode->vdisplay - height;
|
continue;
|
||||||
const int fpsDiff = mode->vrefresh - fps;
|
}
|
||||||
|
|
||||||
if (nearestIndex < 0)
|
const int widthDiff = abs(mode->hdisplay - width);
|
||||||
{
|
const int heightDiff = abs(mode->vdisplay - height);
|
||||||
nearestIndex = i;
|
const int fpsDiff = abs(mode->vrefresh - fps);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int nearestWidthDiff = CORE.Window.connector->modes[nearestIndex].hdisplay - width;
|
const int nearestWidthDiff = abs(CORE.Window.connector->modes[nearestIndex].hdisplay - width);
|
||||||
const int nearestHeightDiff = CORE.Window.connector->modes[nearestIndex].vdisplay - height;
|
const int nearestHeightDiff = abs(CORE.Window.connector->modes[nearestIndex].vdisplay - height);
|
||||||
const int nearestFpsDiff = CORE.Window.connector->modes[nearestIndex].vrefresh - fps;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user