drm: Fix respecting custom mode refresh rates

This was being overwritten by some dynamic refresh code.
This commit is contained in:
Joshua Ashton 2022-10-01 21:10:34 -02:30
parent 20062ec645
commit b87660561f
2 changed files with 9 additions and 0 deletions

View file

@ -493,6 +493,8 @@ static bool refresh_state( drm_t *drm )
conn->current.crtc_id = conn->initial_prop_values["CRTC_ID"];
conn->target_refresh = 0;
drm_log.debugf("found new connector '%s'", conn->name);
}
@ -755,6 +757,8 @@ static bool setup_best_connector(struct drm_t *drm, bool force)
return false;
}
best->target_refresh = mode->vrefresh;
if (!drm_set_mode(drm, mode)) {
return false;
}
@ -2280,6 +2284,9 @@ int drm_get_default_refresh(struct drm_t *drm)
if ( drm->preferred_refresh )
return drm->preferred_refresh;
if ( drm->connector && drm->connector->target_refresh )
return drm->connector->target_refresh;
if ( drm->connector && drm->connector->connector )
{
drmModeConnector *connector = drm->connector->connector;

View file

@ -87,6 +87,8 @@ struct connector {
char *make;
char *model;
int target_refresh;
struct {
uint32_t crtc_id;
} current, pending;