All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/udl: add vblank support
@ 2014-07-02 22:13 Stéphane Marchesin
  2014-07-02 22:13 ` [PATCH 2/2] drm/udl: Implement page_flip ioctl Stéphane Marchesin
  0 siblings, 1 reply; 6+ messages in thread
From: Stéphane Marchesin @ 2014-07-02 22:13 UTC (permalink / raw)
  To: dri-devel; +Cc: Stéphane Marchesin

This is needed to be able to send page flip completion events.
Also while I'm at it, fix the error paths on init.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
---
 drivers/gpu/drm/udl/udl_main.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c
index e1038a9..40436db 100644
--- a/drivers/gpu/drm/udl/udl_main.c
+++ b/drivers/gpu/drm/udl/udl_main.c
@@ -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);
 
-- 
2.0.0.526.g5318336

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] drm/udl: Implement page_flip ioctl
  2014-07-02 22:13 [PATCH 1/2] drm/udl: add vblank support Stéphane Marchesin
@ 2014-07-02 22:13 ` Stéphane Marchesin
  2014-07-08  7:15   ` David Herrmann
  2014-07-08  7:31   ` Chris Wilson
  0 siblings, 2 replies; 6+ messages in thread
From: Stéphane Marchesin @ 2014-07-02 22:13 UTC (permalink / raw)
  To: dri-devel; +Cc: Stéphane Marchesin

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.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
---
 drivers/gpu/drm/udl/udl_modeset.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
index cddc4fc..7dc3bd8 100644
--- a/drivers/gpu/drm/udl/udl_modeset.c
+++ b/drivers/gpu/drm/udl/udl_modeset.c
@@ -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)
-- 
2.0.0.526.g5318336

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/udl: Implement page_flip ioctl
  2014-07-02 22:13 ` [PATCH 2/2] drm/udl: Implement page_flip ioctl Stéphane Marchesin
@ 2014-07-08  7:15   ` David Herrmann
  2014-07-08  7:17     ` Dave Airlie
  2014-07-08  7:31   ` Chris Wilson
  1 sibling, 1 reply; 6+ messages in thread
From: David Herrmann @ 2014-07-08  7:15 UTC (permalink / raw)
  To: Stéphane Marchesin; +Cc: dri-devel

Hi

On Thu, Jul 3, 2014 at 12:13 AM, Stéphane Marchesin
<marcheu@chromium.org> wrote:
> 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.
>
> Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
> ---
>  drivers/gpu/drm/udl/udl_modeset.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
> index cddc4fc..7dc3bd8 100644
> --- a/drivers/gpu/drm/udl/udl_modeset.c
> +++ b/drivers/gpu/drm/udl/udl_modeset.c
> @@ -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;

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

> +
> +       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
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/udl: Implement page_flip ioctl
  2014-07-08  7:15   ` David Herrmann
@ 2014-07-08  7:17     ` Dave Airlie
  2014-07-08  7:19       ` David Herrmann
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Airlie @ 2014-07-08  7:17 UTC (permalink / raw)
  To: David Herrmann; +Cc: Stéphane Marchesin, dri-devel

On 8 July 2014 17:15, David Herrmann <dh.herrmann@gmail.com> wrote:
> Hi
>
> On Thu, Jul 3, 2014 at 12:13 AM, Stéphane Marchesin
> <marcheu@chromium.org> wrote:
>> 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.
>>
>> Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
>> ---
>>  drivers/gpu/drm/udl/udl_modeset.c | 21 +++++++++++++++++++++
>>  1 file changed, 21 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
>> index cddc4fc..7dc3bd8 100644
>> --- a/drivers/gpu/drm/udl/udl_modeset.c
>> +++ b/drivers/gpu/drm/udl/udl_modeset.c
>> @@ -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;
>
> 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
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/udl: Implement page_flip ioctl
  2014-07-08  7:17     ` Dave Airlie
@ 2014-07-08  7:19       ` David Herrmann
  0 siblings, 0 replies; 6+ messages in thread
From: David Herrmann @ 2014-07-08  7:19 UTC (permalink / raw)
  To: Dave Airlie; +Cc: Stéphane Marchesin, dri-devel

Hi

On Tue, Jul 8, 2014 at 9:17 AM, Dave Airlie <airlied@gmail.com> wrote:
> On 8 July 2014 17:15, David Herrmann <dh.herrmann@gmail.com> wrote:
>> Hi
>>
>> On Thu, Jul 3, 2014 at 12:13 AM, Stéphane Marchesin
>> <marcheu@chromium.org> wrote:
>>> 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.
>>>
>>> Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
>>> ---
>>>  drivers/gpu/drm/udl/udl_modeset.c | 21 +++++++++++++++++++++
>>>  1 file changed, 21 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
>>> index cddc4fc..7dc3bd8 100644
>>> --- a/drivers/gpu/drm/udl/udl_modeset.c
>>> +++ b/drivers/gpu/drm/udl/udl_modeset.c
>>> @@ -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;
>>
>> 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!

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
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/udl: Implement page_flip ioctl
  2014-07-02 22:13 ` [PATCH 2/2] drm/udl: Implement page_flip ioctl Stéphane Marchesin
  2014-07-08  7:15   ` David Herrmann
@ 2014-07-08  7:31   ` Chris Wilson
  1 sibling, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2014-07-08  7:31 UTC (permalink / raw)
  To: Stéphane Marchesin; +Cc: dri-devel

On Wed, Jul 02, 2014 at 03:13:43PM -0700, Stéphane Marchesin wrote:
> 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.
> 
> Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
> ---
>  drivers/gpu/drm/udl/udl_modeset.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
> index cddc4fc..7dc3bd8 100644
> --- a/drivers/gpu/drm/udl/udl_modeset.c
> +++ b/drivers/gpu/drm/udl/udl_modeset.c
> @@ -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);

Could we not save the damage from an earlier dirtyfb and limit the data
we have to send here?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-08  7:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-02 22:13 [PATCH 1/2] drm/udl: add vblank support Stéphane Marchesin
2014-07-02 22:13 ` [PATCH 2/2] drm/udl: Implement page_flip ioctl Stéphane Marchesin
2014-07-08  7:15   ` David Herrmann
2014-07-08  7:17     ` Dave Airlie
2014-07-08  7:19       ` David Herrmann
2014-07-08  7:31   ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.