From patchwork Wed Aug 15 21:36:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 1328831 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 8A10D3FD8C for ; Wed, 15 Aug 2012 21:39:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A92A29EF55 for ; Wed, 15 Aug 2012 14:39:30 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yx0-f177.google.com (mail-yx0-f177.google.com [209.85.213.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 164F79E7B3 for ; Wed, 15 Aug 2012 14:36:30 -0700 (PDT) Received: by mail-yx0-f177.google.com with SMTP id q9so2453843yen.36 for ; Wed, 15 Aug 2012 14:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=ZpKpWk3mPyJo9j5zj2yIIa7Gv+iUMdhpL1JdQEbpStM=; b=YRR+pNS1VN8+2I1le/XAD5LWGgE8Pgl7txOniVPfsOGUEG/hH9MpWIELdQjnkeC6oP DzF37vyWRkOZVpV82ZDQN8pVcg452OM0dGirenqVlnBqrXxR/bhfOmzeVVA+GfJnoYMH 9Yuhz04zaCNaOuS2G/WrrgiXFm+Ee81rB6fqfAac8odw2Eyfz65RJsrnaMHZJqY/ZAuh Tcb8QlS27olPldiev0Am0TcA/3M+oxPqwJ89GJp8sB1wqnhx+e4OtV+PreBImJfazbA8 rro7KWMfZNRHVjYm8/mB/Eb3oiM9WPPXesxaxDXDcoNWREYLr/JIrGhK3IUd3xS2xVeV w5gA== Received: by 10.236.115.38 with SMTP id d26mr21837777yhh.40.1345066590834; Wed, 15 Aug 2012 14:36:30 -0700 (PDT) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by mx.google.com with ESMTPS id i3sm2568249anl.0.2012.08.15.14.36.29 (version=SSLv3 cipher=OTHER); Wed, 15 Aug 2012 14:36:30 -0700 (PDT) From: alexdeucher@gmail.com To: airlied@gmail.com, dri-devel@lists.freedesktop.org Subject: [PATCH 4/5] drm/radeon/r5xx-r7xx: don't use radeon_crtc for vblank callback Date: Wed, 15 Aug 2012 17:36:12 -0400 Message-Id: <1345066573-1492-4-git-send-email-alexdeucher@gmail.com> X-Mailer: git-send-email 1.7.7.5 In-Reply-To: <1345066573-1492-1-git-send-email-alexdeucher@gmail.com> References: <1345066573-1492-1-git-send-email-alexdeucher@gmail.com> Cc: Alex Deucher X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Alex Deucher This might be called before we've allocated the radeon_crtcs Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/rs600.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 5301b3d..2abde19 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c @@ -46,19 +46,27 @@ void rs600_gpu_init(struct radeon_device *rdev); int rs600_mc_wait_for_idle(struct radeon_device *rdev); +static const u32 crtc_offsets[6] = +{ + 0, + AVIVO_D2CRTC_H_TOTAL - AVIVO_D1CRTC_H_TOTAL +}; + void avivo_wait_for_vblank(struct radeon_device *rdev, int crtc) { - struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc]; int i; - if (RREG32(AVIVO_D1CRTC_CONTROL + radeon_crtc->crtc_offset) & AVIVO_CRTC_EN) { + if (crtc >= rdev->num_crtc) + return; + + if (RREG32(AVIVO_D1CRTC_CONTROL + crtc_offsets[crtc]) & AVIVO_CRTC_EN) { for (i = 0; i < rdev->usec_timeout; i++) { - if (!(RREG32(AVIVO_D1CRTC_STATUS + radeon_crtc->crtc_offset) & AVIVO_D1CRTC_V_BLANK)) + if (!(RREG32(AVIVO_D1CRTC_STATUS + crtc_offsets[crtc]) & AVIVO_D1CRTC_V_BLANK)) break; udelay(1); } for (i = 0; i < rdev->usec_timeout; i++) { - if (RREG32(AVIVO_D1CRTC_STATUS + radeon_crtc->crtc_offset) & AVIVO_D1CRTC_V_BLANK) + if (RREG32(AVIVO_D1CRTC_STATUS + crtc_offsets[crtc]) & AVIVO_D1CRTC_V_BLANK) break; udelay(1); }