All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: vboxvideo: Add page-flip support
@ 2018-07-20 17:17 Steve Longerbeam
  2018-07-20 17:17   ` Steve Longerbeam
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Steve Longerbeam @ 2018-07-20 17:17 UTC (permalink / raw)
  To: devel, dri-devel; +Cc: Steve Longerbeam

Adds crtc page-flip support by passing the new requested framebuffer
to vbox_crtc_do_set_base().

There is no attempt to support vblank interrupts, so this page-flip
implementation does not try to sync the page-flip to vertical blanking,
so expect tearing effects. Is it possible to access the host vblank
intervals in VBOX?


Steve Longerbeam (2):
  staging: vboxvideo: Pass a new framebuffer to vbox_crtc_do_set_base
  staging: vboxvideo: Add page-flip support

 drivers/staging/vboxvideo/vbox_mode.c | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

-- 
2.7.4

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

* [PATCH 1/2] staging: vboxvideo: Pass a new framebuffer to vbox_crtc_do_set_base
  2018-07-20 17:17 [PATCH 0/2] staging: vboxvideo: Add page-flip support Steve Longerbeam
@ 2018-07-20 17:17   ` Steve Longerbeam
  2018-07-20 17:17   ` Steve Longerbeam
  2018-08-06  8:34 ` [PATCH 0/2] " Daniel Vetter
  2 siblings, 0 replies; 8+ messages in thread
From: Steve Longerbeam @ 2018-07-20 17:17 UTC (permalink / raw)
  To: devel, dri-devel
  Cc: Steve Longerbeam, Greg Kroah-Hartman, Hans de Goede,
	Cihangir Akturk, Peter Rosin, Paolo Cretaro, open list

This modifies vbox_crtc_do_set_base() to take a new framebuffer to
be activated, instead of the existing framebuffer attached to the crtc.
This change allows the function to be given the new framebuffer from
a page-flip request.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
 drivers/staging/vboxvideo/vbox_mode.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
index b265fe9..688e80d 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -222,7 +222,9 @@ static bool vbox_set_up_input_mapping(struct vbox_private *vbox)
 }
 
 static int vbox_crtc_do_set_base(struct drm_crtc *crtc,
-				 struct drm_framebuffer *old_fb, int x, int y)
+				 struct drm_framebuffer *old_fb,
+				 struct drm_framebuffer *new_fb,
+				 int x, int y)
 {
 	struct vbox_private *vbox = crtc->dev->dev_private;
 	struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
@@ -245,7 +247,7 @@ static int vbox_crtc_do_set_base(struct drm_crtc *crtc,
 		vbox_bo_unreserve(bo);
 	}
 
-	vbox_fb = to_vbox_framebuffer(CRTC_FB(crtc));
+	vbox_fb = to_vbox_framebuffer(new_fb);
 	obj = vbox_fb->obj;
 	bo = gem_to_vbox_bo(obj);
 
@@ -281,7 +283,7 @@ static int vbox_crtc_do_set_base(struct drm_crtc *crtc,
 static int vbox_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 				   struct drm_framebuffer *old_fb)
 {
-	return vbox_crtc_do_set_base(crtc, old_fb, x, y);
+	return vbox_crtc_do_set_base(crtc, old_fb, CRTC_FB(crtc), x, y);
 }
 
 static int vbox_crtc_mode_set(struct drm_crtc *crtc,
-- 
2.7.4


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

* [PATCH 1/2] staging: vboxvideo: Pass a new framebuffer to vbox_crtc_do_set_base
@ 2018-07-20 17:17   ` Steve Longerbeam
  0 siblings, 0 replies; 8+ messages in thread
From: Steve Longerbeam @ 2018-07-20 17:17 UTC (permalink / raw)
  To: devel, dri-devel
  Cc: Steve Longerbeam, Greg Kroah-Hartman, Hans de Goede,
	Cihangir Akturk, Peter Rosin, Paolo Cretaro, open list

This modifies vbox_crtc_do_set_base() to take a new framebuffer to
be activated, instead of the existing framebuffer attached to the crtc.
This change allows the function to be given the new framebuffer from
a page-flip request.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
 drivers/staging/vboxvideo/vbox_mode.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
index b265fe9..688e80d 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -222,7 +222,9 @@ static bool vbox_set_up_input_mapping(struct vbox_private *vbox)
 }
 
 static int vbox_crtc_do_set_base(struct drm_crtc *crtc,
-				 struct drm_framebuffer *old_fb, int x, int y)
+				 struct drm_framebuffer *old_fb,
+				 struct drm_framebuffer *new_fb,
+				 int x, int y)
 {
 	struct vbox_private *vbox = crtc->dev->dev_private;
 	struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
@@ -245,7 +247,7 @@ static int vbox_crtc_do_set_base(struct drm_crtc *crtc,
 		vbox_bo_unreserve(bo);
 	}
 
-	vbox_fb = to_vbox_framebuffer(CRTC_FB(crtc));
+	vbox_fb = to_vbox_framebuffer(new_fb);
 	obj = vbox_fb->obj;
 	bo = gem_to_vbox_bo(obj);
 
@@ -281,7 +283,7 @@ static int vbox_crtc_do_set_base(struct drm_crtc *crtc,
 static int vbox_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 				   struct drm_framebuffer *old_fb)
 {
-	return vbox_crtc_do_set_base(crtc, old_fb, x, y);
+	return vbox_crtc_do_set_base(crtc, old_fb, CRTC_FB(crtc), x, y);
 }
 
 static int vbox_crtc_mode_set(struct drm_crtc *crtc,
-- 
2.7.4

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

* [PATCH 2/2] staging: vboxvideo: Add page-flip support
  2018-07-20 17:17 [PATCH 0/2] staging: vboxvideo: Add page-flip support Steve Longerbeam
@ 2018-07-20 17:17   ` Steve Longerbeam
  2018-07-20 17:17   ` Steve Longerbeam
  2018-08-06  8:34 ` [PATCH 0/2] " Daniel Vetter
  2 siblings, 0 replies; 8+ messages in thread
From: Steve Longerbeam @ 2018-07-20 17:17 UTC (permalink / raw)
  To: devel, dri-devel
  Cc: Steve Longerbeam, Greg Kroah-Hartman, Hans de Goede,
	Cihangir Akturk, Peter Rosin, Paolo Cretaro, open list

Adds crtc page-flip support by passing the new requested framebuffer
to vbox_crtc_do_set_base().

Note there is no attempt to support vblank interrupts, it's not
not known how to do this in VBOX or if it is even possible. Since
this page-flip implementation does not try to sync the page-flip
to vertical blanking, tearing effects are possible.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
 drivers/staging/vboxvideo/vbox_mode.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
index 688e80d..285d8ad 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -308,6 +308,31 @@ static int vbox_crtc_mode_set(struct drm_crtc *crtc,
 	return ret;
 }
 
+static int vbox_crtc_page_flip(struct drm_crtc *crtc,
+			       struct drm_framebuffer *fb,
+			       struct drm_pending_vblank_event *event,
+			       uint32_t page_flip_flags,
+			       struct drm_modeset_acquire_ctx *ctx)
+{
+	struct vbox_private *vbox = crtc->dev->dev_private;
+	struct drm_device *drm = vbox->dev;
+	unsigned long flags;
+	int rc;
+
+	rc = vbox_crtc_do_set_base(crtc, CRTC_FB(crtc), fb, 0, 0);
+	if (rc)
+		return rc;
+
+	spin_lock_irqsave(&drm->event_lock, flags);
+
+	if (event)
+		drm_crtc_send_vblank_event(crtc, event);
+
+	spin_unlock_irqrestore(&drm->event_lock, flags);
+
+	return 0;
+}
+
 static void vbox_crtc_disable(struct drm_crtc *crtc)
 {
 }
@@ -346,6 +371,7 @@ static const struct drm_crtc_funcs vbox_crtc_funcs = {
 	.reset = vbox_crtc_reset,
 	.set_config = drm_crtc_helper_set_config,
 	/* .gamma_set = vbox_crtc_gamma_set, */
+	.page_flip = vbox_crtc_page_flip,
 	.destroy = vbox_crtc_destroy,
 };
 
-- 
2.7.4


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

* [PATCH 2/2] staging: vboxvideo: Add page-flip support
@ 2018-07-20 17:17   ` Steve Longerbeam
  0 siblings, 0 replies; 8+ messages in thread
From: Steve Longerbeam @ 2018-07-20 17:17 UTC (permalink / raw)
  To: devel, dri-devel
  Cc: Steve Longerbeam, Paolo Cretaro, Hans de Goede,
	Greg Kroah-Hartman, open list, Cihangir Akturk, Peter Rosin

Adds crtc page-flip support by passing the new requested framebuffer
to vbox_crtc_do_set_base().

Note there is no attempt to support vblank interrupts, it's not
not known how to do this in VBOX or if it is even possible. Since
this page-flip implementation does not try to sync the page-flip
to vertical blanking, tearing effects are possible.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
 drivers/staging/vboxvideo/vbox_mode.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
index 688e80d..285d8ad 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -308,6 +308,31 @@ static int vbox_crtc_mode_set(struct drm_crtc *crtc,
 	return ret;
 }
 
+static int vbox_crtc_page_flip(struct drm_crtc *crtc,
+			       struct drm_framebuffer *fb,
+			       struct drm_pending_vblank_event *event,
+			       uint32_t page_flip_flags,
+			       struct drm_modeset_acquire_ctx *ctx)
+{
+	struct vbox_private *vbox = crtc->dev->dev_private;
+	struct drm_device *drm = vbox->dev;
+	unsigned long flags;
+	int rc;
+
+	rc = vbox_crtc_do_set_base(crtc, CRTC_FB(crtc), fb, 0, 0);
+	if (rc)
+		return rc;
+
+	spin_lock_irqsave(&drm->event_lock, flags);
+
+	if (event)
+		drm_crtc_send_vblank_event(crtc, event);
+
+	spin_unlock_irqrestore(&drm->event_lock, flags);
+
+	return 0;
+}
+
 static void vbox_crtc_disable(struct drm_crtc *crtc)
 {
 }
@@ -346,6 +371,7 @@ static const struct drm_crtc_funcs vbox_crtc_funcs = {
 	.reset = vbox_crtc_reset,
 	.set_config = drm_crtc_helper_set_config,
 	/* .gamma_set = vbox_crtc_gamma_set, */
+	.page_flip = vbox_crtc_page_flip,
 	.destroy = vbox_crtc_destroy,
 };
 
-- 
2.7.4

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

* Re: [PATCH 0/2] staging: vboxvideo: Add page-flip support
  2018-07-20 17:17 [PATCH 0/2] staging: vboxvideo: Add page-flip support Steve Longerbeam
  2018-07-20 17:17   ` Steve Longerbeam
  2018-07-20 17:17   ` Steve Longerbeam
@ 2018-08-06  8:34 ` Daniel Vetter
  2018-08-07 21:57   ` Steve Longerbeam
  2 siblings, 1 reply; 8+ messages in thread
From: Daniel Vetter @ 2018-08-06  8:34 UTC (permalink / raw)
  To: Steve Longerbeam; +Cc: devel, Steve Longerbeam, dri-devel

On Fri, Jul 20, 2018 at 10:17:29AM -0700, Steve Longerbeam wrote:
> Adds crtc page-flip support by passing the new requested framebuffer
> to vbox_crtc_do_set_base().
> 
> There is no attempt to support vblank interrupts, so this page-flip
> implementation does not try to sync the page-flip to vertical blanking,
> so expect tearing effects. Is it possible to access the host vblank
> intervals in VBOX?

I think it'd be great to move vboxvideo over to atomic instead, which is
required for destaging anyway, and would give you page flip support for
free.
-Daniel

> 
> 
> Steve Longerbeam (2):
>   staging: vboxvideo: Pass a new framebuffer to vbox_crtc_do_set_base
>   staging: vboxvideo: Add page-flip support
> 
>  drivers/staging/vboxvideo/vbox_mode.c | 34 +++++++++++++++++++++++++++++++---
>  1 file changed, 31 insertions(+), 3 deletions(-)
> 
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 0/2] staging: vboxvideo: Add page-flip support
  2018-08-06  8:34 ` [PATCH 0/2] " Daniel Vetter
@ 2018-08-07 21:57   ` Steve Longerbeam
  2018-08-30 21:48     ` Steve Longerbeam
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Longerbeam @ 2018-08-07 21:57 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: devel, Steve Longerbeam, dri-devel



On 08/06/2018 01:34 AM, Daniel Vetter wrote:
> On Fri, Jul 20, 2018 at 10:17:29AM -0700, Steve Longerbeam wrote:
>> Adds crtc page-flip support by passing the new requested framebuffer
>> to vbox_crtc_do_set_base().
>>
>> There is no attempt to support vblank interrupts, so this page-flip
>> implementation does not try to sync the page-flip to vertical blanking,
>> so expect tearing effects. Is it possible to access the host vblank
>> intervals in VBOX?
> I think it'd be great to move vboxvideo over to atomic instead, which is
> required for destaging anyway, and would give you page flip support for
> free.

Hi Daniel, yes I agree vboxvideo needs to move to the DRM atomic
framework.

Steve

>
>>
>> Steve Longerbeam (2):
>>    staging: vboxvideo: Pass a new framebuffer to vbox_crtc_do_set_base
>>    staging: vboxvideo: Add page-flip support
>>
>>   drivers/staging/vboxvideo/vbox_mode.c | 34 +++++++++++++++++++++++++++++++---
>>   1 file changed, 31 insertions(+), 3 deletions(-)
>>
>> -- 
>> 2.7.4
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 0/2] staging: vboxvideo: Add page-flip support
  2018-08-07 21:57   ` Steve Longerbeam
@ 2018-08-30 21:48     ` Steve Longerbeam
  0 siblings, 0 replies; 8+ messages in thread
From: Steve Longerbeam @ 2018-08-30 21:48 UTC (permalink / raw)
  To: Daniel Vetter, Greg Kroah-Hartman, Alex Deucher,
	Christian König, Hans de Goede, Roger He
  Cc: devel, Steve Longerbeam, dri-devel

Hi all,

On 08/07/2018 02:57 PM, Steve Longerbeam wrote:
>
>
> On 08/06/2018 01:34 AM, Daniel Vetter wrote:
>> On Fri, Jul 20, 2018 at 10:17:29AM -0700, Steve Longerbeam wrote:
>>> Adds crtc page-flip support by passing the new requested framebuffer
>>> to vbox_crtc_do_set_base().
>>>
>>> There is no attempt to support vblank interrupts, so this page-flip
>>> implementation does not try to sync the page-flip to vertical blanking,
>>> so expect tearing effects. Is it possible to access the host vblank
>>> intervals in VBOX?
>> I think it'd be great to move vboxvideo over to atomic instead, which is
>> required for destaging anyway, and would give you page flip support for
>> free.
>
> Hi Daniel, yes I agree vboxvideo needs to move to the DRM atomic
> framework.
>

Irrespective of moving vboxvideo to atomic framework, I still need to get an
answer to the question, is it possible to access the host vblank 
intervals in
order to sync page-flip to vblank, to prevent tearing. Is this possible 
somehow,
perhaps by calling into the VBOX hypervisor?

Thanks,
Steve

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

end of thread, other threads:[~2018-08-30 21:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20 17:17 [PATCH 0/2] staging: vboxvideo: Add page-flip support Steve Longerbeam
2018-07-20 17:17 ` [PATCH 1/2] staging: vboxvideo: Pass a new framebuffer to vbox_crtc_do_set_base Steve Longerbeam
2018-07-20 17:17   ` Steve Longerbeam
2018-07-20 17:17 ` [PATCH 2/2] staging: vboxvideo: Add page-flip support Steve Longerbeam
2018-07-20 17:17   ` Steve Longerbeam
2018-08-06  8:34 ` [PATCH 0/2] " Daniel Vetter
2018-08-07 21:57   ` Steve Longerbeam
2018-08-30 21:48     ` Steve Longerbeam

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.