From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 4/9] drm/omap: make modesetting synchronous
Date: Mon, 8 Sep 2014 15:53:18 +0300 [thread overview]
Message-ID: <540DA6BE.3020406@ti.com> (raw)
In-Reply-To: <20140903142525.GS15520@phenom.ffwll.local>
[-- Attachment #1.1: Type: text/plain, Size: 2647 bytes --]
On 03/09/14 17:25, Daniel Vetter wrote:
> On Wed, Sep 03, 2014 at 02:55:05PM +0300, Tomi Valkeinen wrote:
>> Currently modesetting is not done synchronously, but it queues work that
>> is done later. In theory this is fine, but the driver doesn't handle it
>> at properly. This means that if an application first does a full
>> modeset, then immediately afterwards starts page flipping, the page
>> flipping will not work properly as there's modeset work still in the
>> queue.
>>
>> The result with my test application was that a backbuffer was shown on
>> the screen.
>>
>> Fixing this properly would be rather big undertaking. Thus this patch
>> fixes the issue by making the modesetting synchronous, by waiting for
>> the queued work to be done at the end of omap_crtc->commit().
>>
>> The ugly part here is that the background work takes crtc->mutex, and
>> the modesetting also holds that lock, which means that the background
>> work never gets done. To get around this, we unclock, wait, and lock
>> again.
>>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>> drivers/gpu/drm/omapdrm/omap_crtc.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
>> index 193979f97bdb..3261fbf94957 100644
>> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
>> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
>> @@ -277,8 +277,13 @@ static void omap_crtc_prepare(struct drm_crtc *crtc)
>> static void omap_crtc_commit(struct drm_crtc *crtc)
>> {
>> struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
>> + struct drm_device *dev = crtc->dev;
>> DBG("%s", omap_crtc->name);
>> omap_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
>> +
>> + drm_modeset_unlock_all(dev);
>
> This will run afoul of the upcoming locking rework in the atomic work. And
> I'm fairly sure that the crtc helpers will fall over badly if someone
> submits a concurrent setCrtc while you've dropped the locks here.
>
> Can't you instead just drop the locking from the worker? As long as you
> synchronize like here at the right places it can't race. I expect that you
> might want to synchronize in the crtc_prepare hook, too. But beyond that
> it should work.
>
> As-is nacked because future headaches for me ;-)
Yes, it's ugly. But doing it with either queuing or caching would be a
major change. I was just trying to do smallish fixes to the driver for now.
How about only unlocking/locking the crtc->mutex as Rob suggested? I
think it should work, but I didn't try it yet. Would that be as bad for
the locking rework?
Tomi
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2014-09-08 12:53 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 11:55 [PATCH 1/9] drm/omap: fix encoder-crtc mapping Tomi Valkeinen
2014-09-03 11:55 ` [PATCH 2/9] drm/omap: page_flip: return -EBUSY if flip pending Tomi Valkeinen
2014-09-03 11:55 ` [PATCH 3/9] drm/omap: fix race issue with vsync irq and apply Tomi Valkeinen
2014-09-03 11:55 ` [PATCH 4/9] drm/omap: make modesetting synchronous Tomi Valkeinen
2014-09-03 14:25 ` Daniel Vetter
2014-09-03 15:05 ` Rob Clark
2014-09-03 15:21 ` Daniel Vetter
2014-09-03 16:00 ` Rob Clark
2014-09-03 19:20 ` Daniel Vetter
2014-09-08 12:53 ` Tomi Valkeinen [this message]
2014-09-08 13:24 ` Daniel Vetter
2014-09-08 13:39 ` Rob Clark
2014-09-08 13:50 ` Daniel Vetter
2014-09-08 13:57 ` Rob Clark
2014-09-03 11:55 ` [PATCH 5/9] drm/omap: clear omap_obj->paddr in omap_gem_put_paddr() Tomi Valkeinen
2014-09-03 11:55 ` [PATCH 6/9] drm/omap: add pin refcounting to omap_framebuffer Tomi Valkeinen
2014-09-03 11:55 ` [PATCH 7/9] drm/omap: fix omap_crtc_flush() to handle the workqueue Tomi Valkeinen
2014-09-03 14:27 ` Daniel Vetter
2014-09-08 13:03 ` Tomi Valkeinen
2014-09-08 13:31 ` Daniel Vetter
2014-09-09 7:07 ` Tomi Valkeinen
2014-09-09 10:43 ` Rob Clark
2014-09-09 10:54 ` Tomi Valkeinen
2014-09-03 11:55 ` [PATCH 8/9] drm/omap: fix preclose to wait for scheduled work Tomi Valkeinen
2014-09-03 14:32 ` Daniel Vetter
2014-09-08 13:09 ` Tomi Valkeinen
2014-09-03 11:55 ` [PATCH 9/9] drm/omap: add a comment why locking is missing Tomi Valkeinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=540DA6BE.3020406@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox