[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ui/gtk: skip any extra draw of same guest scanout blob res
From: |
Dongwon Kim |
Subject: |
Re: [PATCH] ui/gtk: skip any extra draw of same guest scanout blob res |
Date: |
Fri, 17 Sep 2021 09:34:39 -0700 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
On Fri, Sep 17, 2021 at 12:02:02PM +0200, Gerd Hoffmann wrote:
> Hi,
>
> > + bool draw_submitted;
> > + QemuMutex mutex;
>
> Why the mutex? I think all the code runs while holding the BQL so it
> should be serialized.
Guest drawing process using blob is serialized (gd_egl_flush->scheduling
draw call->gd_egl_draw) but an asynchronous draw event from another thread
is causing a problem.
I initially thought using a flag (draw_submitted) would be enough to get this
worked around, but it wasn't as the asynchronous draw could take it over before,
dambuf->draw_submitted = false;
happens during normal draw sequence. I thought mutex would be a reasonable
solution for this case.
>
> > +#ifdef CONFIG_GBM
> > + if (dmabuf) {
> > + qemu_mutex_lock(&dmabuf->mutex);
> > + if (!dmabuf->draw_submitted) {
> > + qemu_mutex_unlock(&dmabuf->mutex);
> > + return;
> > + } else {
> > + dmabuf->draw_submitted = false;
> > + }
> > + }
> > +#endif
>
> Factoring out that into helper functions is probably a good idea. Then
> have stub functions for the CONFIG_GBM=no case and *alot* less #ifdefs
> in the code ...
I will look into this part.
Thanks,
DW
>
> thanks,
> Gerd
>