[PATCH 3/3] drm/radeon/kms: use num_crtc instead of hard-coded value 6

Alex Deucher alexdeucher at gmail.com
Wed Oct 26 06:24:33 PDT 2011


On Tue, Oct 25, 2011 at 10:40 PM, Ilija Hadzic
<ihadzic at research.bell-labs.com> wrote:
> radeon_driver_irq_preinstall_kms and radeon_driver_irq_uninstall_kms
> hard code the loop to 6 which happens to be the current maximum
> number of crtcs; if one day an ASIC with more crtcs comes out, this
> is a trouble waiting to happen. it's better to use num_crtc instead
> (for ASICs that have fewer than 6 CRTCs, this is still OK because
> higher numbers won't be looked at)
>

This is actually not quite right.  The number of HPD (Hot Plug Detect)
pins is not equal to the number of crtcs.  Radeons have supported 6
HPD pins long before we supported 6 crtcs (e.g., cards with more
connectors than crtcs).  The logic should probably look like:

#define RADEON_MAX_HPD_PINS 6

for (i = 0; i < rdev->num_crtc; i++) {
        rdev->irq.crtc_vblank_int[i] = false;
        rdev->irq.pflip[i] = false;
}

for (i = 0; i < RADEON_MAX_HPD_PINS; i++)
        rdev->irq.hpd[i] = false;

Alex

> Signed-off-by: Ilija Hadzic <ihadzic at research.bell-labs.com>
> ---
>  drivers/gpu/drm/radeon/radeon_irq_kms.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> index 9ec830c..a0f9d24 100644
> --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> @@ -69,7 +69,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
>        rdev->irq.gui_idle = false;
>        for (i = 0; i < rdev->num_crtc; i++)
>                rdev->irq.crtc_vblank_int[i] = false;
> -       for (i = 0; i < 6; i++) {
> +       for (i = 0; i < rdev->num_crtc; i++) {
>                rdev->irq.hpd[i] = false;
>                rdev->irq.pflip[i] = false;
>        }
> @@ -101,7 +101,7 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
>        rdev->irq.gui_idle = false;
>        for (i = 0; i < rdev->num_crtc; i++)
>                rdev->irq.crtc_vblank_int[i] = false;
> -       for (i = 0; i < 6; i++) {
> +       for (i = 0; i < rdev->num_crtc; i++) {
>                rdev->irq.hpd[i] = false;
>                rdev->irq.pflip[i] = false;
>        }
> --
> 1.7.7
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>


More information about the dri-devel mailing list