diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2010-04-06 12:35:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-04-26 10:47:52 -0400 |
commit | bc4ae10e707a7872095264607f049893e9656efb (patch) | |
tree | d549b74302aa550dc65705372f4ea9565891d930 | |
parent | 7f4be8b0c326cd9d0a62a4d85809979a3428c5de (diff) |
drm/radeon/kms/combios: verify dac_adj values are valid
commit 3a89b4a9ca7ce11e3b7d5119aea917b9fc29a302 upstream.
Some vbios dac_adj tables are all zeros. Check for that
case and use the default table if so.
Should fix fdo bug 27478.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_combios.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index e7b19440102e..81b832eec095 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -670,7 +670,9 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct | |||
670 | dac = RBIOS8(dac_info + 0x3) & 0xf; | 670 | dac = RBIOS8(dac_info + 0x3) & 0xf; |
671 | p_dac->ps2_pdac_adj = (bg << 8) | (dac); | 671 | p_dac->ps2_pdac_adj = (bg << 8) | (dac); |
672 | } | 672 | } |
673 | found = 1; | 673 | /* if the values are all zeros, use the table */ |
674 | if (p_dac->ps2_pdac_adj) | ||
675 | found = 1; | ||
674 | } | 676 | } |
675 | 677 | ||
676 | out: | 678 | out: |
@@ -812,7 +814,9 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
812 | bg = RBIOS8(dac_info + 0x10) & 0xf; | 814 | bg = RBIOS8(dac_info + 0x10) & 0xf; |
813 | dac = RBIOS8(dac_info + 0x11) & 0xf; | 815 | dac = RBIOS8(dac_info + 0x11) & 0xf; |
814 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); | 816 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); |
815 | found = 1; | 817 | /* if the values are all zeros, use the table */ |
818 | if (tv_dac->ps2_tvdac_adj) | ||
819 | found = 1; | ||
816 | } else if (rev > 1) { | 820 | } else if (rev > 1) { |
817 | bg = RBIOS8(dac_info + 0xc) & 0xf; | 821 | bg = RBIOS8(dac_info + 0xc) & 0xf; |
818 | dac = (RBIOS8(dac_info + 0xc) >> 4) & 0xf; | 822 | dac = (RBIOS8(dac_info + 0xc) >> 4) & 0xf; |
@@ -825,7 +829,9 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
825 | bg = RBIOS8(dac_info + 0xe) & 0xf; | 829 | bg = RBIOS8(dac_info + 0xe) & 0xf; |
826 | dac = (RBIOS8(dac_info + 0xe) >> 4) & 0xf; | 830 | dac = (RBIOS8(dac_info + 0xe) >> 4) & 0xf; |
827 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); | 831 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); |
828 | found = 1; | 832 | /* if the values are all zeros, use the table */ |
833 | if (tv_dac->ps2_tvdac_adj) | ||
834 | found = 1; | ||
829 | } | 835 | } |
830 | tv_dac->tv_std = radeon_combios_get_tv_info(rdev); | 836 | tv_dac->tv_std = radeon_combios_get_tv_info(rdev); |
831 | } | 837 | } |
@@ -842,7 +848,9 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
842 | (bg << 16) | (dac << 20); | 848 | (bg << 16) | (dac << 20); |
843 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; | 849 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; |
844 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; | 850 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; |
845 | found = 1; | 851 | /* if the values are all zeros, use the table */ |
852 | if (tv_dac->ps2_tvdac_adj) | ||
853 | found = 1; | ||
846 | } else { | 854 | } else { |
847 | bg = RBIOS8(dac_info + 0x4) & 0xf; | 855 | bg = RBIOS8(dac_info + 0x4) & 0xf; |
848 | dac = RBIOS8(dac_info + 0x5) & 0xf; | 856 | dac = RBIOS8(dac_info + 0x5) & 0xf; |
@@ -850,7 +858,9 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
850 | (bg << 16) | (dac << 20); | 858 | (bg << 16) | (dac << 20); |
851 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; | 859 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; |
852 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; | 860 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; |
853 | found = 1; | 861 | /* if the values are all zeros, use the table */ |
862 | if (tv_dac->ps2_tvdac_adj) | ||
863 | found = 1; | ||
854 | } | 864 | } |
855 | } else { | 865 | } else { |
856 | DRM_INFO("No TV DAC info found in BIOS\n"); | 866 | DRM_INFO("No TV DAC info found in BIOS\n"); |