drm/udl: add vblank support
Subsystems (3)
PATCH 1/2 drm/udl: add vblank support
This is needed to be able to send page flip completion events. Also while I'm at it, fix the error paths on init.
--- drivers/gpu/drm/udl/udl_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/gpu/drm/udl/udl_main.c +15 -0
@@ -307,10 +307,23 @@ int udl_driver_load(struct drm_device *dev, unsigned long flags)DRM_DEBUG ("\n" ); ret =udl_modeset_init (dev); +if (ret) + goto err; ret =udl_fbdev_init (dev); +if (ret) + goto err; + + ret =drm_vblank_init (dev,1 ); +if (ret) + goto err_fb; +return 0 ; +err_fb: +udl_fbdev_cleanup (dev); err: +if (udl->urbs.count) +udl_free_urb_list (dev);kfree (udl);DRM_ERROR ("%d\n" , ret);return ret;
@@ -326,6 +339,8 @@ int udl_driver_unload(struct drm_device *dev) {struct udl_device *udl = dev->dev_private; +drm_vblank_cleanup (dev); +if (udl->urbs.count)udl_free_urb_list (dev);
Signature · 6 lines
2.0.0.526.g5318336 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/2 drm/udl: Implement page_flip ioctl
This is a very crude page_flip implementation for UDL. There are ways to make it better (make it asynchronous, make it do actual vsynced flips...) but that's for another patch.
--- drivers/gpu/drm/udl/udl_modeset.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/gpu/drm/udl/udl_modeset.c +21 -0
@@ -363,6 +363,26 @@ static void udl_crtc_destroy(struct drm_crtc *crtc)kfree (crtc); } +static int udl_crtc_page_flip (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +struct drm_pending_vblank_event *event, +uint32_t page_flip_flags) +{ +struct udl_framebuffer *ufb =to_udl_fb (fb); +struct drm_device *dev = crtc->dev; +unsigned long flags; + +udl_handle_damage (ufb,0 ,0 , fb->width, fb->height); + +spin_lock_irqsave (&dev->event_lock, flags); +if (event) +drm_send_vblank_event (dev,0 , event); +spin_unlock_irqrestore (&dev->event_lock, flags); + crtc->fb = fb; + +return 0 ; +} +static void udl_crtc_prepare (struct drm_crtc *crtc) { }
@@ -384,6 +404,7 @@ static struct drm_crtc_helper_funcs udl_helper_funcs = {static const struct drm_crtc_funcs udl_crtc_funcs = { .set_config = drm_crtc_helper_set_config, .destroy = udl_crtc_destroy, + .page_flip = udl_crtc_page_flip, };static int udl_crtc_init (struct drm_device *dev)
Signature · 6 lines
2.0.0.526.g5318336 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/udl: Implement page_flip ioctl
Hi
Quoted 23 lines · Stéphane Marchesin
This is a very crude
page_flipimplementation for UDL. There are ways to make it better (make it asynchronous, make it do actual vsynced flips...) but that's for another patch.Signed-off-by Stéphane Marchesin <[email protected]>--- drivers/gpu/drm/udl/udl_modeset.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)drivers/gpu/drm/udl/udl_modeset.c +6
-0@@ -363,6 +363,26 @@ static void udl_crtc_destroy(struct drm_crtc *crtc)kfree (crtc); } +static int udl_crtc_page_flip (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +struct drm_pending_vblank_event *event, +uint32_t page_flip_flags) +{ +struct udl_framebuffer *ufb =to_udl_fb (fb);
drivers/gpu/drm/udl/udl_modeset.c static void udl_crtc_destroy(struct drm_crtc *crtc) · line 381
Quoted 10 lines
drivers/gpu/drm/udl/udl_modeset.c +10
-0+struct drm_device *dev = crtc->dev; +unsigned long flags; + +udl_handle_damage (ufb,0 ,0 , fb->width, fb->height); + +spin_lock_irqsave (&dev->event_lock, flags); +if (event) +drm_send_vblank_event (dev,0 , event); +spin_unlock_irqrestore (&dev->event_lock, flags); + crtc->fb = fb;
Doesn't this break user-space that expects page-flip events to not occur more often than the refresh-rate? For instance, weston re-renders on each page-flip event. With this patch, it will never sleep on udl as it immediately gets the page-flip event back?
Thanks
David
Quoted 18 lines
drivers/gpu/drm/udl/udl_modeset.c +5
-1+ +return 0 ; +} +static void udl_crtc_prepare (struct drm_crtc *crtc) { }@@ -384,6 +404,7 @@ static struct drm_crtc_helper_funcs udl_helper_funcs = {static const struct drm_crtc_funcs udl_crtc_funcs = { .set_config = drm_crtc_helper_set_config, .destroy = udl_crtc_destroy, + .page_flip = udl_crtc_page_flip, };static int udl_crtc_init (struct drm_device *dev) --2.0.0.526.g5318336
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerRe: [PATCH 2/2] drm/udl: Implement page_flip ioctl
Quoted 34 lines · David Herrmann
Hi
Quoted 30 lines · Stéphane Marchesin
This is a very crude
page_flipimplementation for UDL. There are ways to make it better (make it asynchronous, make it do actual vsynced flips...) but that's for another patch.Signed-off-by Stéphane Marchesin <[email protected]>--- drivers/gpu/drm/udl/udl_modeset.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)drivers/gpu/drm/udl/udl_modeset.c +13
-0@@ -363,6 +363,26 @@ static void udl_crtc_destroy(struct drm_crtc *crtc)kfree (crtc); } +static int udl_crtc_page_flip (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +struct drm_pending_vblank_event *event, +uint32_t page_flip_flags) +{ +struct udl_framebuffer *ufb =to_udl_fb (fb); +struct drm_device *dev = crtc->dev; +unsigned long flags; + +udl_handle_damage (ufb,0 ,0 , fb->width, fb->height); + +spin_lock_irqsave (&dev->event_lock, flags); +if (event)
Quoted 8 lines
drivers/gpu/drm/udl/udl_modeset.c static void udl_crtc_destroy(struct drm_crtc *crtc) · line 381
Quoted 3 lines
drivers/gpu/drm/udl/udl_modeset.c +3
-0+drm_send_vblank_event (dev,0 , event); +spin_unlock_irqrestore (&dev->event_lock, flags); + crtc->fb = fb;Doesn't this break user-space that expects page-flip events to not occur more often than the refresh-rate? For instance, weston re-renders on each page-flip event. With this patch, it will never sleep on udl as it immediately gets the page-flip event back?
I don't think you can update the USB device quicker than the refresh rate :-P
though that might change if we ever get USB3!
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/udl: Implement page_flip ioctl
Hi
Quoted 44 lines · Dave Airlie
Quoted 34 lines · David Herrmann
Hi
Quoted 30 lines · Stéphane Marchesin
This is a very crude
page_flipimplementation for UDL. There are ways to make it better (make it asynchronous, make it do actual vsynced flips...) but that's for another patch.Signed-off-by Stéphane Marchesin <[email protected]>--- drivers/gpu/drm/udl/udl_modeset.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)drivers/gpu/drm/udl/udl_modeset.c +13
-0@@ -363,6 +363,26 @@ static void udl_crtc_destroy(struct drm_crtc *crtc)kfree (crtc); } +static int udl_crtc_page_flip (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +struct drm_pending_vblank_event *event, +uint32_t page_flip_flags) +{ +struct udl_framebuffer *ufb =to_udl_fb (fb); +struct drm_device *dev = crtc->dev; +unsigned long flags; + +udl_handle_damage (ufb,0 ,0 , fb->width, fb->height); + +spin_lock_irqsave (&dev->event_lock, flags); +if (event)Quoted 8 lines
drivers/gpu/drm/udl/udl_modeset.c static void udl_crtc_destroy(struct drm_crtc *crtc) · line 381
Quoted 3 lines
drivers/gpu/drm/udl/udl_modeset.c +3
-0+drm_send_vblank_event (dev,0 , event); +spin_unlock_irqrestore (&dev->event_lock, flags); + crtc->fb = fb;Doesn't this break user-space that expects page-flip events to not occur more often than the refresh-rate? For instance, weston re-renders on each page-flip event. With this patch, it will never sleep on udl as it immediately gets the page-flip event back?
Quoted 3 lines
I don't think you can update the USB device quicker than the refresh rate :-P
though that might change if we ever get USB3!
Fair enough. I will keep it in mind and if something turns up, we can always add a 60Hz software-timer.
Thanks
David
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/udl: Implement page_flip ioctl
In reply to Stéphane MarchesinQuoted 17 lines · Stéphane Marchesin
This is a very crude
page_flipimplementation for UDL. There are ways to make it better (make it asynchronous, make it do actual vsynced flips...) but that's for another patch.Signed-off-by Stéphane Marchesin <[email protected]>--- drivers/gpu/drm/udl/udl_modeset.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)drivers/gpu/drm/udl/udl_modeset.c +0
-0@@ -363,6 +363,26 @@ static void udl_crtc_destroy(struct drm_crtc *crtc)kfree (crtc); }
drivers/gpu/drm/udl/udl_modeset.c static void udl_crtc_destroy(struct drm_crtc *crtc) · line 375
Quoted 10 lines
drivers/gpu/drm/udl/udl_modeset.c +10
-0+static int udl_crtc_page_flip (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +struct drm_pending_vblank_event *event, +uint32_t page_flip_flags) +{ +struct udl_framebuffer *ufb =to_udl_fb (fb); +struct drm_device *dev = crtc->dev; +unsigned long flags; + +udl_handle_damage (ufb,0 ,0 , fb->width, fb->height);
Could we not save the damage from an earlier dirtyfb and limit the data we have to send here?
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre