bochs: add page_flip
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 19 Nov 2014 11:28:12 +0000 (12:28 +0100)
committerDave Airlie <airlied@redhat.com>
Thu, 20 Nov 2014 01:27:31 +0000 (11:27 +1000)
Implement crtc page_flip callback for bochsdrm.  The qemu stdvga has no
vblank signaling, so we have to fake it.  We do so by instantly calling
drm_send_vblank_event.  Tested with kmscon.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/bochs/bochs_kms.c

index 5ffd4895d040a08a911a129699a2c4c5fbbe5915..85f0f8cf1fb82974f14f5491acaca9dae02cfeb0 100644 (file)
@@ -109,11 +109,32 @@ static void bochs_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
 {
 }
 
+static int bochs_crtc_page_flip(struct drm_crtc *crtc,
+                               struct drm_framebuffer *fb,
+                               struct drm_pending_vblank_event *event,
+                               uint32_t page_flip_flags)
+{
+       struct bochs_device *bochs =
+               container_of(crtc, struct bochs_device, crtc);
+       struct drm_framebuffer *old_fb = crtc->primary->fb;
+       unsigned long irqflags;
+
+       crtc->primary->fb = fb;
+       bochs_crtc_mode_set_base(crtc, 0, 0, old_fb);
+       if (event) {
+               spin_lock_irqsave(&bochs->dev->event_lock, irqflags);
+               drm_send_vblank_event(bochs->dev, -1, event);
+               spin_unlock_irqrestore(&bochs->dev->event_lock, irqflags);
+       }
+       return 0;
+}
+
 /* These provide the minimum set of functions required to handle a CRTC */
 static const struct drm_crtc_funcs bochs_crtc_funcs = {
        .gamma_set = bochs_crtc_gamma_set,
        .set_config = drm_crtc_helper_set_config,
        .destroy = drm_crtc_cleanup,
+       .page_flip = bochs_crtc_page_flip,
 };
 
 static const struct drm_crtc_helper_funcs bochs_helper_funcs = {