mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
drm/ast: Add reduced blanking modes for wide screen mode
Signed-off-by: Egbert Eich <eich@suse.com> Tested-by: Steven You2 Liang <liangyou2@lenovo.com> Signed-off-by: Y.C. Chen <yc_chen@aspeedtech.com> v3: based on [PATCH 1/2] drm/ast: Add missing entry to dclk_table[]. Add reduced blanking modes, improve mode matching to identify these modes by thier sync polarities. [airlied: argh whitespace damage] Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
b2efb3f0a1
commit
94d12b137c
2 changed files with 56 additions and 24 deletions
|
@ -80,6 +80,8 @@ static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mo
|
|||
struct ast_private *ast = crtc->dev->dev_private;
|
||||
u32 refresh_rate_index = 0, mode_id, color_index, refresh_rate;
|
||||
u32 hborder, vborder;
|
||||
bool check_sync;
|
||||
struct ast_vbios_enhtable *best = NULL;
|
||||
|
||||
switch (crtc->primary->fb->bits_per_pixel) {
|
||||
case 8:
|
||||
|
@ -141,14 +143,34 @@ static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mo
|
|||
}
|
||||
|
||||
refresh_rate = drm_mode_vrefresh(mode);
|
||||
while (vbios_mode->enh_table->refresh_rate < refresh_rate) {
|
||||
vbios_mode->enh_table++;
|
||||
if ((vbios_mode->enh_table->refresh_rate > refresh_rate) ||
|
||||
(vbios_mode->enh_table->refresh_rate == 0xff)) {
|
||||
vbios_mode->enh_table--;
|
||||
break;
|
||||
check_sync = vbios_mode->enh_table->flags & WideScreenMode;
|
||||
do {
|
||||
struct ast_vbios_enhtable *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;
|
||||
loop++;
|
||||
}
|
||||
}
|
||||
if (best || !check_sync)
|
||||
break;
|
||||
check_sync = 0;
|
||||
} while (1);
|
||||
if (best)
|
||||
vbios_mode->enh_table = best;
|
||||
|
||||
hborder = (vbios_mode->enh_table->flags & HBorder) ? 8 : 0;
|
||||
vborder = (vbios_mode->enh_table->flags & VBorder) ? 8 : 0;
|
||||
|
@ -419,8 +441,10 @@ static void ast_set_sync_reg(struct drm_device *dev, struct drm_display_mode *mo
|
|||
struct ast_private *ast = dev->dev_private;
|
||||
u8 jreg;
|
||||
|
||||
jreg = ast_io_read8(ast, AST_IO_MISC_PORT_READ);
|
||||
jreg |= (vbios_mode->enh_table->flags & SyncNN);
|
||||
jreg = ast_io_read8(ast, AST_IO_MISC_PORT_READ);
|
||||
jreg &= ~0xC0;
|
||||
if (vbios_mode->enh_table->flags & NVSync) jreg |= 0x80;
|
||||
if (vbios_mode->enh_table->flags & NHSync) jreg |= 0x40;
|
||||
ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue