Hi Pekka, Thanks for the information, I will talk to my mentor Daniel and try to find out what I can do about this. Cheers, Zhao Junwang On Fri, Jul 17, 2015 at 2:08 PM, Pekka Paalanen wrote: > On Thu, 16 Jul 2015 20:20:39 +0800 > John Hunter wrote: > > > From: Zhao Junwang > > > > This supports the asynchronous commits, required for page-flipping > > Since it's virtual hw it's ok to commit async stuff right away, we > > never have to wait for vblank. > > Hi, > > in theory, yes. This is what a patch to bochs implemented not too long > ago, so AFAIK you are only replicating the existing behaviour. > > However, if userspace doing an async commit (or sync, I suppose) does > not incur any waits in the kernel in e.g. sending the page flip event, > then flip driven programs (e.g. a Wayland compositor, say, Weston) > will be running its rendering loop as a busy-loop, because the kernel > does not throttle it to the (virtual) display refresh rate. > > This will cause maximal CPU usage and poor user experience as > everything else needs to fight for CPU time and event dispatch to get > through, like input. > > I would hope someone could do a follow-up to implement a refresh cycle > emulation based on a clock. Userspace expects page flips to happen at > most at refresh rate when asking for vblank-synced flips. It's only > natural for userspace to drive its rendering loop based on the vblank > cycle. > > > Thanks, > pq > > > Cc: Maarten Lankhorst > > Cc: Daniel Vetter > > Signed-off-by: Zhao Junwang > > --- > > drivers/gpu/drm/bochs/bochs_mm.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/bochs/bochs_mm.c > b/drivers/gpu/drm/bochs/bochs_mm.c > > index c1d819c..37ac2ca 100644 > > --- a/drivers/gpu/drm/bochs/bochs_mm.c > > +++ b/drivers/gpu/drm/bochs/bochs_mm.c > > @@ -545,8 +545,15 @@ bochs_user_framebuffer_create(struct drm_device > *dev, > > return &bochs_fb->base; > > } > > > > +static int bochs_atomic_commit(struct drm_device *dev, > > + struct drm_atomic_state *a, > > + bool async) > > +{ > > + return drm_atomic_helper_commit(dev, a, false); > > +} > > + > > const struct drm_mode_config_funcs bochs_mode_funcs = { > > .fb_create = bochs_user_framebuffer_create, > > .atomic_check = drm_atomic_helper_check, > > - .atomic_commit = drm_atomic_helper_commit, > > + .atomic_commit = bochs_atomic_commit, > > }; > > -- Best regards Junwang Zhao Microprocessor Research and Develop Center Department of Computer Science &Technology Peking University Beijing, 100871, PRC