diff options
| author | Thomas Zimmermann <[email protected]> | 2025-01-31 09:21:07 +0000 |
|---|---|---|
| committer | Thomas Zimmermann <[email protected]> | 2025-02-03 13:01:08 +0000 |
| commit | 255b3ff65d8ffd70db8c29dda6c8765d58fea2b6 (patch) | |
| tree | 159c2bd619cb9f5d78b8851cf5740d857ec5ee0a /drivers/gpu/drm/ast/ast_mode.c | |
| parent | drm/ast: Add support_wuxga flag to struct ast_device (diff) | |
| download | kernel-255b3ff65d8ffd70db8c29dda6c8765d58fea2b6.tar.gz kernel-255b3ff65d8ffd70db8c29dda6c8765d58fea2b6.zip | |
drm/ast: Always validate H/V sync flags
The ast driver matches DRM display modes against an internal list of
modes supported by the VBIOS. Matching H/V sync flags between modes is
preferred, but optional. If sync flags are not matching, the driver
would program the VBIOS settings to hardware and let the display handle
the difference.
DRM modes are generated from attached displays or standard mode lines.
Therefore differences to the VBIOS modes are not just cosmetical, but
signal possible incompatibility with the display hardware.
Hence make matching H/V sync flags mandatory. If the VBIOS does not
support a certain mode, we should report it as unsupported. Note that
the VBIOS mode tables all appear to refer to standard modes.
(If sync flags really make no difference to the VBIOS, the ast driver
shouldn't match them in the first place.)
Signed-off-by: Thomas Zimmermann <[email protected]>
Reviewed-by: Jocelyn Falempe <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Diffstat (limited to 'drivers/gpu/drm/ast/ast_mode.c')
| -rw-r--r-- | drivers/gpu/drm/ast/ast_mode.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index bc0c7db5ad46..a484292c9645 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -113,8 +113,8 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, { u32 refresh_rate_index = 0, refresh_rate; const struct ast_vbios_enhtable *best = NULL; + const struct ast_vbios_enhtable *loop; u32 hborder, vborder; - bool check_sync; switch (format->cpp[0] * 8) { case 8: @@ -176,36 +176,27 @@ static bool ast_get_vbios_mode_info(const struct drm_format_info *format, } refresh_rate = drm_mode_vrefresh(mode); - check_sync = vbios_mode->enh_table->flags & WideScreenMode; - while (1) { - const struct ast_vbios_enhtable *loop = vbios_mode->enh_table; + loop = vbios_mode->enh_table; - while (loop->refresh_rate != 0xff) { - if ((check_sync) && - (((mode->flags & DRM_MODE_FLAG_NVSYNC) && - (loop->flags & PVSync)) || - ((mode->flags & DRM_MODE_FLAG_PVSYNC) && - (loop->flags & NVSync)) || - ((mode->flags & DRM_MODE_FLAG_NHSYNC) && - (loop->flags & PHSync)) || - ((mode->flags & DRM_MODE_FLAG_PHSYNC) && - (loop->flags & NHSync)))) { - loop++; - continue; - } - if (loop->refresh_rate <= refresh_rate - && (!best || loop->refresh_rate > best->refresh_rate)) - best = loop; + while (loop->refresh_rate != 0xff) { + if (((mode->flags & DRM_MODE_FLAG_NVSYNC) && (loop->flags & PVSync)) || + ((mode->flags & DRM_MODE_FLAG_PVSYNC) && (loop->flags & NVSync)) || + ((mode->flags & DRM_MODE_FLAG_NHSYNC) && (loop->flags & PHSync)) || + ((mode->flags & DRM_MODE_FLAG_PHSYNC) && (loop->flags & NHSync))) { loop++; + continue; } - if (best || !check_sync) - break; - check_sync = 0; + if (loop->refresh_rate <= refresh_rate && + (!best || loop->refresh_rate > best->refresh_rate)) + best = loop; + loop++; } - if (best) - vbios_mode->enh_table = best; + if (!best) + return false; + + vbios_mode->enh_table = best; hborder = (vbios_mode->enh_table->flags & HBorder) ? 8 : 0; vborder = (vbios_mode->enh_table->flags & VBorder) ? 8 : 0; |
