From: =?iso-8859-2?q?Old=F8ich_Jedli=E8ka?= Subject: [PATCH v2] drm/radeon/kms: Fix for CS track check to allow at least one enabled component Date: Wed, 10 Feb 2010 23:54:13 +0100 Message-ID: <201002102354.13717.oldium.pro@seznam.cz> References: <201002102336.13227.oldium.pro@seznam.cz> <201002102345.30154.oldium.pro@seznam.cz> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <201002102345.30154.oldium.pro@seznam.cz> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net To: dri-devel@lists.sourceforge.net List-Id: dri-devel@lists.freedesktop.org The current code causes failing of rendering (discovered on my KDE 4.4) with message: r600_cs_track_check:252 mask 0x0000000F | 0xFFFFFFFF no cb for 1 The problem is in the check of "at least one component is enabled" in r600_cs_track_check() - it finds the first component and does not check the rest. My patch fixes this by introducing is_valid local variable and checking all enabled components. The check returns failure only when there is really no component enabled. Signed-off-by: Old=F8ich Jedli=E8ka --- drivers/gpu/drm/radeon/r600_cs.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600= _cs.c index 7cabb62..f1dab96 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c @@ -233,6 +233,7 @@ static int r600_cs_track_check(struct radeon_cs_parser = *p) struct r600_cs_track *track =3D p->track; u32 tmp; int r, i; + bool is_valid =3D false; = /* on legacy kernel we don't perform advanced check */ if (p->rdev =3D=3D NULL) @@ -247,17 +248,20 @@ static int r600_cs_track_check(struct radeon_cs_parse= r *p) for (i =3D 0; i < 8; i++) { if ((tmp >> (i * 4)) & 0xF) { /* at least one component is enabled */ - if (track->cb_color_bo[i] =3D=3D NULL) { - dev_warn(p->dev, "%s:%d mask 0x%08X | 0x%08X no cb for %d\n", - __func__, __LINE__, track->cb_target_mask, track->cb_shader_mask, i); - return -EINVAL; + if (track->cb_color_bo[i] !=3D NULL) { + /* perform rewrite of CB_COLOR[0-7]_SIZE */ + r =3D r600_cs_track_validate_cb(p, i); + if (r) + return r; + is_valid =3D true; } - /* perform rewrite of CB_COLOR[0-7]_SIZE */ - r =3D r600_cs_track_validate_cb(p, i); - if (r) - return r; } } + if (!is_valid) { + dev_warn(p->dev, "%s:%d mask 0x%08X | 0x%08X no cb found\n", + __func__, __LINE__, track->cb_target_mask, track->cb_shader_mask); + return -EINVAL; + } return 0; } = -- = 1.6.6.1 ---------------------------------------------------------------------------= --- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev --