Re: [PATCH 5/5] drm/radeon: rework page flip handling v3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 28, 2014 at 2:56 AM, Michel Dänzer <michel@xxxxxxxxxxx> wrote:
> On 27.05.2014 23:49, Christian König wrote:
>> From: Christian König <christian.koenig@xxxxxxx>
>>
>> Instead of trying to flip inside the vblank period when
>> the buffer is idle, offload blocking for idle to a kernel
>> thread and program the flip directly into the hardware.
>>
>> v2: add error handling, fix EBUSY handling
>> v3: add proper exclusive_lock handling
>
> [...]
>
>> +     /* update crtc fb */
>> +     crtc->primary->fb = fb;
>> +
>> +     /* We borrow the event spin lock for protecting flip_work */
>> +     spin_lock_irqsave(&crtc->dev->event_lock, flags);
>> +
>> +     if (radeon_crtc->flip_work) {
>> +             DRM_DEBUG_DRIVER("flip queue: crtc already busy\n");
>> +             spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>> +             drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base);
>> +             radeon_fence_unref(&work->fence);
>> +             kfree(work);
>> +             return -EBUSY;
>> +     }
>
> If we return -EBUSY, we shouldn't change crtc->primary->fb, should we? I
> wonder if crtc->primary->fb shouldn't be changed in
> radeon_flip_work_func(), when we're sure we can actually flip.

How about this?

Alex
From 2556af5d1bb1d1ffe8dfddc2e9f138546432560d Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@xxxxxxx>
Date: Tue, 3 Jun 2014 09:29:02 -0400
Subject: [PATCH] drm/radeon: update crtc->primary->fb in radeon_flip_work_func

To make sure we've actually flipped before updating it.

Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
 drivers/gpu/drm/radeon/radeon_display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 6b3de5c..d96d1ca 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -458,6 +458,9 @@ static void radeon_flip_work_func(struct work_struct *__work)
 	/* We borrow the event spin lock for protecting flip_work */
 	spin_lock_irqsave(&crtc->dev->event_lock, flags);
 
+	/* update crtc fb */
+	crtc->primary->fb = fb;
+
 	/* set the proper interrupt */
 	radeon_irq_kms_pflip_irq_get(rdev, radeon_crtc->crtc_id);
 
@@ -519,9 +522,6 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc,
 		work->fence = radeon_fence_ref(work->new_rbo->tbo.sync_obj);
 	spin_unlock(&work->new_rbo->tbo.bdev->fence_lock);
 
-	/* update crtc fb */
-	crtc->primary->fb = fb;
-
 	/* We borrow the event spin lock for protecting flip_work */
 	spin_lock_irqsave(&crtc->dev->event_lock, flags);
 
-- 
1.8.3.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux