From: Jaime Velasco Juan Subject: Re: [PATCH] drm/radeon/kms: really wait for VBLANK in PM code Date: Thu, 18 Feb 2010 18:08:39 +0000 Message-ID: <20100218180839.GA3386@pogo> References: <1266434608-802-1-git-send-email-zajec5@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="2fHTh5uZTiUOsy+g" Content-Transfer-Encoding: 8bit Return-path: Content-Disposition: inline In-Reply-To: <1266434608-802-1-git-send-email-zajec5@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net To: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= Cc: dri-devel@lists.sourceforge.net List-Id: dri-devel@lists.freedesktop.org --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit El mié. 17 de feb. de 2010, a las 20:23:28 +0100, Rafał Miłecki escribió: > Signed-off-by: Rafał Miłecki > Reported-by: Jaime Velasco Juan > --- > This should make the trick, Jaime can you check if this works for you? Does it > kill your corruptions? It doesn't work, it have the same problem than the current code: [ 8.682478] [drm] Requested: e: 68000 m: 80000 p: 16 [ 8.880126] [drm] Setting: e: 68000 m: 80000 p: 16 [ 9.280080] [drm] Requested: e: 30000 m: 40500 p: 16 [ 9.480118] [drm] Setting: e: 30000 m: 40500 p: 16 What about the attached version, does it seem ok to you?. It seems to fix the corruptions for me. Regards > --- > drivers/gpu/drm/radeon/radeon_pm.c | 11 ++++++++--- > 1 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c > index a8e151e..520197f 100644 > --- a/drivers/gpu/drm/radeon/radeon_pm.c > +++ b/drivers/gpu/drm/radeon/radeon_pm.c > @@ -337,10 +337,15 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev) > rdev->pm.req_vblank |= (1 << 1); > drm_vblank_get(rdev->ddev, 1); > } > - if (rdev->pm.active_crtcs) > - wait_event_interruptible_timeout( > + if (rdev->pm.active_crtcs) { > + /* We call __wait_* directly because of double condition check > + which we do not use. This call is suppossed to sleep until > + a wake_up happens or a timeout elapses */ > + long timeout = msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT); > + __wait_event_interruptible_timeout( > rdev->irq.vblank_queue, 0, > - msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT)); > + timeout); > + } > if (rdev->pm.req_vblank & (1 << 0)) { > rdev->pm.req_vblank &= ~(1 << 0); > drm_vblank_put(rdev->ddev, 0); > -- > 1.6.4.2 --2fHTh5uZTiUOsy+g Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-radeon-PM-Really-wait-for-vblank-before-reclocking.patch" >From b44da60bce551b7119b0eb2e521e2e7635b9b98e Mon Sep 17 00:00:00 2001 From: Jaime Velasco Juan Date: Mon, 15 Feb 2010 14:50:46 +0000 Subject: [PATCH] radeon/PM Really wait for vblank before reclocking The old code used a false condition so it always waited until timeout. Signed-off-by: Jaime Velasco Juan --- drivers/gpu/drm/radeon/radeon_pm.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index a8e151e..7d8c5d9 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -337,10 +337,18 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev) rdev->pm.req_vblank |= (1 << 1); drm_vblank_get(rdev->ddev, 1); } - if (rdev->pm.active_crtcs) - wait_event_interruptible_timeout( - rdev->irq.vblank_queue, 0, - msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT)); + if (rdev->pm.active_crtcs) { + /* We code the wait istead of using the usual + wait_event_interruptible_timeout because there is not + condition to check, we want to be always waken up by + the vblank IRQ handler */ + DEFINE_WAIT(reclock_wait); + prepare_to_wait(&rdev->irq.vblank_queue, + &reclock_wait, TASK_INTERRUPTIBLE); + if (!signal_pending(current)) + schedule_timeout(msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT)); + finish_wait(&rdev->irq.vblank_queue, &reclock_wait); + } if (rdev->pm.req_vblank & (1 << 0)) { rdev->pm.req_vblank &= ~(1 << 0); drm_vblank_put(rdev->ddev, 0); -- 1.7.0 --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel --2fHTh5uZTiUOsy+g--