From patchwork Tue Apr 27 05:09:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Airlie X-Patchwork-Id: 95251 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3R5CP2R005495 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 27 Apr 2010 05:13:01 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1O6d4T-00028Y-ET; Tue, 27 Apr 2010 05:10:57 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.123] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1O6d4S-00028P-3D for dri-devel@lists.sourceforge.net; Tue, 27 Apr 2010 05:10:56 +0000 Received-SPF: neutral (sfi-mx-3.v28.ch3.sourceforge.com: 209.132.183.28 is neither permitted nor denied by domain of gmail.com) client-ip=209.132.183.28; envelope-from=airlied@gmail.com; helo=mx1.redhat.com; Received: from mx1.redhat.com ([209.132.183.28]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1O6d4Q-0006gP-RJ for dri-devel@lists.sourceforge.net; Tue, 27 Apr 2010 05:10:56 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3R5Ancv030276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 27 Apr 2010 01:10:49 -0400 Received: from localhost.localdomain (dhcp-0-222.bne.redhat.com [10.64.0.222]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3R5AlDR001274 for ; Tue, 27 Apr 2010 01:10:48 -0400 From: Dave Airlie To: dri-devel@lists.sf.net Subject: [PATCH] drm/radeon/kms: avoid executing dac detection table on r4xx + rv515. Date: Tue, 27 Apr 2010 15:09:25 +1000 Message-Id: <1272344965-10923-1-git-send-email-airlied@gmail.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: 1.1 (+) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.2 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) -0.2 AWL AWL: From: address is in the auto white-list X-Headers-End: 1O6d4Q-0006gP-RJ X-BeenThere: dri-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 27 Apr 2010 05:13:01 +0000 (UTC) diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index bcec2d7..6477ac5 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c @@ -1320,12 +1320,13 @@ bool atom_parse_data_header(struct atom_context *ctx, int index, return true; } -bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t * frev, - uint8_t * crev) +bool atom_parse_cmd_header_stack(struct atom_context *ctx, int index, uint8_t *frev, + uint8_t *crev, uint8_t *ps_size, uint8_t *ws_size) { int offset = index * 2 + 4; int idx = CU16(ctx->cmd_table + offset); u16 *mct = (u16 *)(ctx->bios + ctx->cmd_table + 4); + u16 table_attrib = CU16(idx + 4); if (!mct[index]) return false; @@ -1334,9 +1335,19 @@ bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t * frev, *frev = CU8(idx + 2); if (crev) *crev = CU8(idx + 3); + if (ps_size) + *ps_size = (table_attrib & 0xe00) >> 8; + if (ws_size) + *ws_size = (table_attrib & 0xff); return true; } +bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t *rev, + uint8_t *crev) +{ + return atom_parse_cmd_header_stack(ctx, index, rev, crev, NULL, NULL); +} + int atom_allocate_fb_scratch(struct atom_context *ctx) { int index = GetIndexIntoMasterTable(DATA, VRAM_UsageByFirmware); diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h index cd1b64a..ca21357 100644 --- a/drivers/gpu/drm/radeon/atom.h +++ b/drivers/gpu/drm/radeon/atom.h @@ -147,6 +147,8 @@ bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size, uint8_t *frev, uint8_t *crev, uint16_t *data_start); bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t *frev, uint8_t *crev); +bool atom_parse_cmd_header_stack(struct atom_context *ctx, int index, uint8_t *rev, + uint8_t *crev, uint8_t *ps_size, uint8_t *ws_size); int atom_allocate_fb_scratch(struct atom_context *ctx); #include "atom-types.h" #include "atombios.h" diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index c52fc30..36bcabd 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c @@ -1398,12 +1398,19 @@ atombios_dac_load_detect(struct drm_encoder *encoder, struct drm_connector *conn ATOM_DEVICE_CRT_SUPPORT)) { DAC_LOAD_DETECTION_PS_ALLOCATION args; int index = GetIndexIntoMasterTable(COMMAND, DAC_LoadDetection); - uint8_t frev, crev; + uint8_t frev, crev, ps_size; memset(&args, 0, sizeof(args)); - if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) + if (!atom_parse_cmd_header_stack(rdev->mode_info.atom_context, index, &frev, &crev, &ps_size, NULL)) return false; + + /* r4xx and some early rv5xx probe all DACs, this can cause distrubances in the force, + also on other DACs. - we can detect these tables as they have a 0 sized param stack */ + if (ps_size == 0) { + DRM_DEBUG("not executing dac load detection table due to buggy atom table\n"); + return false; + } args.sDacload.ucMisc = 0;