All of lore.kernel.org
 help / color / mirror / Atom feed
* [REPOST PATCH 1/2] Add CRTC ID to vblank events
@ 2017-04-04 16:51 Daniel Stone
  2017-04-04 16:52 ` [PATCH libdrm 2/2] Add CRTC ID to vblank event Daniel Stone
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Stone @ 2017-04-04 16:51 UTC (permalink / raw)
  To: dri-devel

Hi,
Following the annual tradition, I've rebased Ander/Maarten's patches
to include the CRTC ID in vblank events. Specifically, this makes it
possible to know which CRTC an atomic request-completion event refers
to.

I'm using this in Weston, for which I can ack it as good API, and a
second opinion of this should be on the way shortly.

Cheers,
Daniel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH libdrm 2/2] Add CRTC ID to vblank event
  2017-04-04 16:51 [REPOST PATCH 1/2] Add CRTC ID to vblank events Daniel Stone
@ 2017-04-04 16:52 ` Daniel Stone
  2017-04-04 16:52   ` [PATCH kernel 1/2] drm: Pass CRTC ID in userspace vblank events Daniel Stone
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Daniel Stone @ 2017-04-04 16:52 UTC (permalink / raw)
  To: dri-devel; +Cc: Maarten Lankhorst

From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>

When using the atomic API, one request can span multiple CRTCs, however
one event is generated per CRTC. As we cannot disambiguate the CRTC with
user data (since we only have one piece of user data to pass in), newer
kernels can include the CRTC ID in the page flip event.

Add a new vfunc to dispatch vblank events carrying a CRTC ID to clients
who negotiate a higher interface version.

[daniels: Rebased, include new cap, call page_flip_handler if it is set
          but page_flip_handler2 isn't even on newer contexts, write a
	  commit message.]

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Maarten Lankhorst <maarten.lankhorst@intel.com>
---
 include/drm/drm.h |  3 ++-
 xf86drm.h         |  9 ++++++++-
 xf86drmMode.c     | 24 ++++++++++++++++--------
 3 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/include/drm/drm.h b/include/drm/drm.h
index 09d4262f..c4492372 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -641,6 +641,7 @@ struct drm_gem_open {
 #define DRM_CAP_CURSOR_HEIGHT		0x9
 #define DRM_CAP_ADDFB2_MODIFIERS	0x10
 #define DRM_CAP_PAGE_FLIP_TARGET	0x11
+#define DRM_CAP_CRTC_IN_VBLANK_EVENT	0x12
 
 /** DRM_IOCTL_GET_CAP ioctl argument type */
 struct drm_get_cap {
@@ -846,7 +847,7 @@ struct drm_event_vblank {
 	__u32 tv_sec;
 	__u32 tv_usec;
 	__u32 sequence;
-	__u32 reserved;
+	__u32 crtc_id;
 };
 
 /* typedef area */
diff --git a/xf86drm.h b/xf86drm.h
index 0d927018..d75ca8ce 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -728,7 +728,7 @@ extern void drmMsg(const char *format, ...) DRM_PRINTFLIKE(1, 2);
 extern int drmSetMaster(int fd);
 extern int drmDropMaster(int fd);
 
-#define DRM_EVENT_CONTEXT_VERSION 2
+#define DRM_EVENT_CONTEXT_VERSION 3
 
 typedef struct _drmEventContext {
 
@@ -748,6 +748,13 @@ typedef struct _drmEventContext {
 				  unsigned int tv_usec,
 				  void *user_data);
 
+	void (*page_flip_handler2)(int fd,
+				   unsigned int sequence,
+				   unsigned int tv_sec,
+				   unsigned int tv_usec,
+				   unsigned int crtc_id,
+				   void *user_data);
+
 } drmEventContext, *drmEventContextPtr;
 
 extern int drmHandleEvent(int fd, drmEventContextPtr evctx);
diff --git a/xf86drmMode.c b/xf86drmMode.c
index fb47fa8b..b71520aa 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -889,6 +889,7 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
 	int len, i;
 	struct drm_event *e;
 	struct drm_event_vblank *vblank;
+	void *user_data;
 
 	/* The DRM read semantics guarantees that we always get only
 	 * complete events. */
@@ -915,15 +916,22 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
 					      U642VOID (vblank->user_data));
 			break;
 		case DRM_EVENT_FLIP_COMPLETE:
-			if (evctx->version < 2 ||
-			    evctx->page_flip_handler == NULL)
-				break;
 			vblank = (struct drm_event_vblank *) e;
-			evctx->page_flip_handler(fd,
-						 vblank->sequence,
-						 vblank->tv_sec,
-						 vblank->tv_usec,
-						 U642VOID (vblank->user_data));
+			user_data = U642VOID (vblank->user_data);
+
+			if (evctx->version >= 3 && evctx->page_flip_handler2)
+				evctx->page_flip_handler2(fd,
+							 vblank->sequence,
+							 vblank->tv_sec,
+							 vblank->tv_usec,
+							 vblank->crtc_id,
+							 user_data);
+			else if (evctx->version >= 2 && evctx->page_flip_handler)
+				evctx->page_flip_handler(fd,
+							 vblank->sequence,
+							 vblank->tv_sec,
+							 vblank->tv_usec,
+							 user_data);
 			break;
 		default:
 			break;
-- 
2.12.2

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

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

* [PATCH kernel 1/2] drm: Pass CRTC ID in userspace vblank events
  2017-04-04 16:52 ` [PATCH libdrm 2/2] Add CRTC ID to vblank event Daniel Stone
@ 2017-04-04 16:52   ` Daniel Stone
  2017-04-04 17:58     ` Sean Paul
  2017-04-04 17:12   ` [PATCH libdrm 2/2] Add CRTC ID to vblank event Emil Velikov
       [not found]   ` <20170404165221.28240-1-daniels-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
  2 siblings, 1 reply; 11+ messages in thread
From: Daniel Stone @ 2017-04-04 16:52 UTC (permalink / raw)
  To: dri-devel; +Cc: Maarten Lankhorst

From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>

With the atomic API, it is possible that a single commit affects
multiple crtcs. If the user requests an event with that commit, one
event will be sent for each CRTC, but it is not possible to distinguish
which crtc an event is for in user space. To solve this, the reserved
field in struct drm_vblank_event is repurposed to include the crtc_id
which the event is for.

The DRM_CAP_CRTC_IN_VBLANK_EVENT is added to allow userspace to query if
the crtc field will be set properly.

[daniels: Rebased, using Maarten's forward-port.]

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Maarten Lankhorst <maarten.lankhorst@intel.com>
---
 drivers/gpu/drm/drm_ioctl.c | 3 +++
 drivers/gpu/drm/drm_irq.c   | 2 ++
 include/uapi/drm/drm.h      | 3 ++-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 7d6deaa91281..0793e2da9d21 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -286,6 +286,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
 	case DRM_CAP_ADDFB2_MODIFIERS:
 		req->value = dev->mode_config.allow_fb_modifiers;
 		break;
+	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
+		req->value = 1;
+		break;
 	default:
 		return -EINVAL;
 	}
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index dac1b2593cb1..8c866cac62dd 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1026,6 +1026,7 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
 
 	e->pipe = pipe;
 	e->event.sequence = drm_vblank_count(dev, pipe);
+	e->event.crtc_id = crtc->base.id;
 	list_add_tail(&e->base.link, &dev->vblank_event_list);
 }
 EXPORT_SYMBOL(drm_crtc_arm_vblank_event);
@@ -1056,6 +1057,7 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
 		now = get_drm_timestamp();
 	}
 	e->pipe = pipe;
+	e->event.crtc_id = crtc->base.id;
 	send_vblank_event(dev, e, seq, &now);
 }
 EXPORT_SYMBOL(drm_crtc_send_vblank_event);
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index b2c52843bc70..42d9f64ce416 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -647,6 +647,7 @@ struct drm_gem_open {
 #define DRM_CAP_CURSOR_HEIGHT		0x9
 #define DRM_CAP_ADDFB2_MODIFIERS	0x10
 #define DRM_CAP_PAGE_FLIP_TARGET	0x11
+#define DRM_CAP_CRTC_IN_VBLANK_EVENT	0x12
 
 /** DRM_IOCTL_GET_CAP ioctl argument type */
 struct drm_get_cap {
@@ -851,7 +852,7 @@ struct drm_event_vblank {
 	__u32 tv_sec;
 	__u32 tv_usec;
 	__u32 sequence;
-	__u32 reserved;
+	__u32 crtc_id; /* 0 on older kernels that do not support this */
 };
 
 /* typedef area */
-- 
2.11.0

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

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

* Re: [PATCH libdrm 2/2] Add CRTC ID to vblank event
  2017-04-04 16:52 ` [PATCH libdrm 2/2] Add CRTC ID to vblank event Daniel Stone
  2017-04-04 16:52   ` [PATCH kernel 1/2] drm: Pass CRTC ID in userspace vblank events Daniel Stone
@ 2017-04-04 17:12   ` Emil Velikov
  2017-04-04 17:14     ` Daniel Stone
  2017-04-04 20:49     ` [PATCH libdrm v2 1/2] Headers: Sync drm{,_mode}.h with the kernel Daniel Stone
       [not found]   ` <20170404165221.28240-1-daniels-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
  2 siblings, 2 replies; 11+ messages in thread
From: Emil Velikov @ 2017-04-04 17:12 UTC (permalink / raw)
  To: Daniel Stone; +Cc: Maarten Lankhorst, ML dri-devel

Hi Daniel,

Zero objections against the patch, just a couple of small notes.

On 4 April 2017 at 17:52, Daniel Stone <daniels@collabora.com> wrote:
> From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
>
> When using the atomic API, one request can span multiple CRTCs, however
> one event is generated per CRTC. As we cannot disambiguate the CRTC with
> user data (since we only have one piece of user data to pass in), newer
> kernels can include the CRTC ID in the page flip event.
>
> Add a new vfunc to dispatch vblank events carrying a CRTC ID to clients
> who negotiate a higher interface version.
>
> [daniels: Rebased, include new cap, call page_flip_handler if it is set
>           but page_flip_handler2 isn't even on newer contexts, write a
>           commit message.]
>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@intel.com>
> ---
>  include/drm/drm.h |  3 ++-
>  xf86drm.h         |  9 ++++++++-
>  xf86drmMode.c     | 24 ++++++++++++++++--------
>  3 files changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/include/drm/drm.h b/include/drm/drm.h
> index 09d4262f..c4492372 100644
> --- a/include/drm/drm.h
> +++ b/include/drm/drm.h
> @@ -641,6 +641,7 @@ struct drm_gem_open {
>  #define DRM_CAP_CURSOR_HEIGHT          0x9
>  #define DRM_CAP_ADDFB2_MODIFIERS       0x10
>  #define DRM_CAP_PAGE_FLIP_TARGET       0x11
> +#define DRM_CAP_CRTC_IN_VBLANK_EVENT   0x12
>
>  /** DRM_IOCTL_GET_CAP ioctl argument type */
>  struct drm_get_cap {
> @@ -846,7 +847,7 @@ struct drm_event_vblank {
>         __u32 tv_sec;
>         __u32 tv_usec;
>         __u32 sequence;
> -       __u32 reserved;
> +       __u32 crtc_id;
>  };
>
Please split these to a separate commit as mentioned in
include/drm/README "When and how to update these files" ?

>  /* typedef area */
> diff --git a/xf86drm.h b/xf86drm.h
> index 0d927018..d75ca8ce 100644
> --- a/xf86drm.h
> +++ b/xf86drm.h
> @@ -728,7 +728,7 @@ extern void drmMsg(const char *format, ...) DRM_PRINTFLIKE(1, 2);
>  extern int drmSetMaster(int fd);
>  extern int drmDropMaster(int fd);
>
> -#define DRM_EVENT_CONTEXT_VERSION 2
> +#define DRM_EVENT_CONTEXT_VERSION 3
>
We really want to fix weston to _not_ use this define, but to set the
version it actually supports/implements.
I'll send a patch for that in a minute.

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

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

* Re: [PATCH libdrm 2/2] Add CRTC ID to vblank event
  2017-04-04 17:12   ` [PATCH libdrm 2/2] Add CRTC ID to vblank event Emil Velikov
@ 2017-04-04 17:14     ` Daniel Stone
  2017-04-04 20:49     ` [PATCH libdrm v2 1/2] Headers: Sync drm{,_mode}.h with the kernel Daniel Stone
  1 sibling, 0 replies; 11+ messages in thread
From: Daniel Stone @ 2017-04-04 17:14 UTC (permalink / raw)
  To: Emil Velikov; +Cc: Maarten Lankhorst, ML dri-devel

Hi Emil,

On Tue, 2017-04-04 at 18:12 +0100, Emil Velikov wrote:
> On 4 April 2017 at 17:52, Daniel Stone <daniels@collabora.com> wrote:
> > @@ -846,7 +847,7 @@ struct drm_event_vblank {
> >         __u32 tv_sec;
> >         __u32 tv_usec;
> >         __u32 sequence;
> > -       __u32 reserved;
> > +       __u32 crtc_id;
> >  };
> > 
> 
> Please split these to a separate commit as mentioned in
> include/drm/README "When and how to update these files" ?

OK, will do.

> > @@ -728,7 +728,7 @@ extern void drmMsg(const char *format, ...)
> > DRM_PRINTFLIKE(1, 2);
> >  extern int drmSetMaster(int fd);
> >  extern int drmDropMaster(int fd);
> > 
> > -#define DRM_EVENT_CONTEXT_VERSION 2
> > +#define DRM_EVENT_CONTEXT_VERSION 3
> > 
> 
> We really want to fix weston to _not_ use this define, but to set the
> version it actually supports/implements.
> I'll send a patch for that in a minute.

One step ahead of you:
-       evctx.version = DRM_EVENT_CONTEXT_VERSION;
-       evctx.page_flip_handler = page_flip_handler;
+       evctx.version = 3;

https://lists.freedesktop.org/archives/wayland-devel/2017-April/033747.
html

Cheers,
Daniel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH kernel 1/2] drm: Pass CRTC ID in userspace vblank events
  2017-04-04 16:52   ` [PATCH kernel 1/2] drm: Pass CRTC ID in userspace vblank events Daniel Stone
@ 2017-04-04 17:58     ` Sean Paul
  2017-04-04 20:53       ` Daniel Stone
  0 siblings, 1 reply; 11+ messages in thread
From: Sean Paul @ 2017-04-04 17:58 UTC (permalink / raw)
  To: Daniel Stone; +Cc: Maarten Lankhorst, dri-devel

On Tue, Apr 04, 2017 at 05:52:21PM +0100, Daniel Stone wrote:
> From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> 
> With the atomic API, it is possible that a single commit affects
> multiple crtcs. If the user requests an event with that commit, one
> event will be sent for each CRTC, but it is not possible to distinguish
> which crtc an event is for in user space. To solve this, the reserved
> field in struct drm_vblank_event is repurposed to include the crtc_id
> which the event is for.
> 
> The DRM_CAP_CRTC_IN_VBLANK_EVENT is added to allow userspace to query if
> the crtc field will be set properly.
> 
> [daniels: Rebased, using Maarten's forward-port.]
> 
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> Signed-off-by: Daniel Stone <daniels@collabora.com>

Yeah, this seems like good use of the reserved field to me.

Reviewed-by: Sean Paul <seanpaul@chromium.org>


> Cc: Maarten Lankhorst <maarten.lankhorst@intel.com>
> ---
>  drivers/gpu/drm/drm_ioctl.c | 3 +++
>  drivers/gpu/drm/drm_irq.c   | 2 ++
>  include/uapi/drm/drm.h      | 3 ++-
>  3 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 7d6deaa91281..0793e2da9d21 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -286,6 +286,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
>  	case DRM_CAP_ADDFB2_MODIFIERS:
>  		req->value = dev->mode_config.allow_fb_modifiers;
>  		break;
> +	case DRM_CAP_CRTC_IN_VBLANK_EVENT:
> +		req->value = 1;
> +		break;
>  	default:
>  		return -EINVAL;
>  	}
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index dac1b2593cb1..8c866cac62dd 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -1026,6 +1026,7 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
>  
>  	e->pipe = pipe;
>  	e->event.sequence = drm_vblank_count(dev, pipe);
> +	e->event.crtc_id = crtc->base.id;
>  	list_add_tail(&e->base.link, &dev->vblank_event_list);
>  }
>  EXPORT_SYMBOL(drm_crtc_arm_vblank_event);
> @@ -1056,6 +1057,7 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
>  		now = get_drm_timestamp();
>  	}
>  	e->pipe = pipe;
> +	e->event.crtc_id = crtc->base.id;
>  	send_vblank_event(dev, e, seq, &now);
>  }
>  EXPORT_SYMBOL(drm_crtc_send_vblank_event);
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index b2c52843bc70..42d9f64ce416 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -647,6 +647,7 @@ struct drm_gem_open {
>  #define DRM_CAP_CURSOR_HEIGHT		0x9
>  #define DRM_CAP_ADDFB2_MODIFIERS	0x10
>  #define DRM_CAP_PAGE_FLIP_TARGET	0x11
> +#define DRM_CAP_CRTC_IN_VBLANK_EVENT	0x12
>  
>  /** DRM_IOCTL_GET_CAP ioctl argument type */
>  struct drm_get_cap {
> @@ -851,7 +852,7 @@ struct drm_event_vblank {
>  	__u32 tv_sec;
>  	__u32 tv_usec;
>  	__u32 sequence;
> -	__u32 reserved;
> +	__u32 crtc_id; /* 0 on older kernels that do not support this */
>  };
>  
>  /* typedef area */
> -- 
> 2.11.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH libdrm v2 1/2] Headers: Sync drm{,_mode}.h with the kernel
  2017-04-04 17:12   ` [PATCH libdrm 2/2] Add CRTC ID to vblank event Emil Velikov
  2017-04-04 17:14     ` Daniel Stone
@ 2017-04-04 20:49     ` Daniel Stone
  2017-04-04 20:49       ` [PATCH libdrm v2 2/2] Add CRTC ID to vblank event Daniel Stone
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Stone @ 2017-04-04 20:49 UTC (permalink / raw)
  To: dri-devel

Generated using make headers_install, based on drm-misc-next commit
5db06a8a98f515f67446a69c57577c4c363ec65d.

This clarifies the comments around modifiers such that they are
per-framebuffer rather than per-plane, adds the beginnings of aspect
ratio mode flags, link status properties, and updates the 'reserved'
field from vblank events to include the CRTC ID.

The define -> enum conversion from
dee7a4fee730ca8908f335b6b66174cba4598ecd was manually reverted from this
sync, to avoid any potential ABI issues.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 include/drm/drm.h      |  3 ++-
 include/drm/drm_mode.h | 45 ++++++++++++++++++++++++++++++++++-----------
 2 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/include/drm/drm.h b/include/drm/drm.h
index f6fd5c2c..1e7a4bc7 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -641,6 +641,7 @@ struct drm_gem_open {
 #define DRM_CAP_CURSOR_HEIGHT		0x9
 #define DRM_CAP_ADDFB2_MODIFIERS	0x10
 #define DRM_CAP_PAGE_FLIP_TARGET	0x11
+#define DRM_CAP_CRTC_IN_VBLANK_EVENT	0x12
 
 /** DRM_IOCTL_GET_CAP ioctl argument type */
 struct drm_get_cap {
@@ -845,7 +846,7 @@ struct drm_event_vblank {
 	__u32 tv_sec;
 	__u32 tv_usec;
 	__u32 sequence;
-	__u32 reserved;
+	__u32 crtc_id; /* 0 on older kernels that do not support this */
 };
 
 /* typedef area */
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index df0e3504..309c478f 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -47,7 +47,15 @@ extern "C" {
 #define DRM_MODE_TYPE_DRIVER	(1<<6)
 
 /* Video mode flags */
-/* bit compatible with the xorg definitions. */
+/* bit compatible with the xrandr RR_ definitions (bits 0-13)
+ *
+ * ABI warning: Existing userspace really expects
+ * the mode flags to match the xrandr definitions. Any
+ * changes that don't match the xrandr definitions will
+ * likely need a new client cap or some other mechanism
+ * to avoid breaking existing userspace. This includes
+ * allocating new flags in the previously unused bits!
+ */
 #define DRM_MODE_FLAG_PHSYNC			(1<<0)
 #define DRM_MODE_FLAG_NHSYNC			(1<<1)
 #define DRM_MODE_FLAG_PVSYNC			(1<<2)
@@ -77,6 +85,19 @@ extern "C" {
 #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
 #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
 
+/* Picture aspect ratio options */
+#define DRM_MODE_PICTURE_ASPECT_NONE		0
+#define DRM_MODE_PICTURE_ASPECT_4_3		1
+#define DRM_MODE_PICTURE_ASPECT_16_9		2
+
+/* Aspect ratio flag bitmask (4 bits 22:19) */
+#define DRM_MODE_FLAG_PIC_AR_MASK		(0x0F<<19)
+#define  DRM_MODE_FLAG_PIC_AR_NONE \
+			(DRM_MODE_PICTURE_ASPECT_NONE<<19)
+#define  DRM_MODE_FLAG_PIC_AR_4_3 \
+			(DRM_MODE_PICTURE_ASPECT_4_3<<19)
+#define  DRM_MODE_FLAG_PIC_AR_16_9 \
+			(DRM_MODE_PICTURE_ASPECT_16_9<<19)
 
 /* DPMS flags */
 /* bit compatible with the xorg definitions. */
@@ -92,11 +113,6 @@ extern "C" {
 #define DRM_MODE_SCALE_CENTER		2 /* Centered, no scaling */
 #define DRM_MODE_SCALE_ASPECT		3 /* Full screen, preserve aspect */
 
-/* Picture aspect ratio options */
-#define DRM_MODE_PICTURE_ASPECT_NONE	0
-#define DRM_MODE_PICTURE_ASPECT_4_3	1
-#define DRM_MODE_PICTURE_ASPECT_16_9	2
-
 /* Dithering mode options */
 #define DRM_MODE_DITHERING_OFF	0
 #define DRM_MODE_DITHERING_ON	1
@@ -107,6 +123,10 @@ extern "C" {
 #define DRM_MODE_DIRTY_ON       1
 #define DRM_MODE_DIRTY_ANNOTATE 2
 
+/* Link Status options */
+#define DRM_MODE_LINK_STATUS_GOOD	0
+#define DRM_MODE_LINK_STATUS_BAD	1
+
 struct drm_mode_modeinfo {
 	__u32 clock;
 	__u16 hdisplay;
@@ -392,17 +412,20 @@ struct drm_mode_fb_cmd2 {
 	 * offsets[1].  Note that offsets[0] will generally
 	 * be 0 (but this is not required).
 	 *
-	 * To accommodate tiled, compressed, etc formats, a per-plane
+	 * To accommodate tiled, compressed, etc formats, a
 	 * modifier can be specified.  The default value of zero
 	 * indicates "native" format as specified by the fourcc.
-	 * Vendor specific modifier token.  This allows, for example,
-	 * different tiling/swizzling pattern on different planes.
-	 * See discussion above of DRM_FORMAT_MOD_xxx.
+	 * Vendor specific modifier token.  Note that even though
+	 * it looks like we have a modifier per-plane, we in fact
+	 * do not. The modifier for each plane must be identical.
+	 * Thus all combinations of different data layouts for
+	 * multi plane formats must be enumerated as separate
+	 * modifiers.
 	 */
 	__u32 handles[4];
 	__u32 pitches[4]; /* pitch for each plane */
 	__u32 offsets[4]; /* offset of each plane */
-	__u64 modifier[4]; /* ie, tiling, compressed (per plane) */
+	__u64 modifier[4]; /* ie, tiling, compress */
 };
 
 #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
-- 
2.11.0

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

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

* [PATCH libdrm v2 2/2] Add CRTC ID to vblank event
  2017-04-04 20:49     ` [PATCH libdrm v2 1/2] Headers: Sync drm{,_mode}.h with the kernel Daniel Stone
@ 2017-04-04 20:49       ` Daniel Stone
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Stone @ 2017-04-04 20:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Maarten Lankhorst

From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>

When using the atomic API, one request can span multiple CRTCs, however
one event is generated per CRTC. As we cannot disambiguate the CRTC with
user data (since we only have one piece of user data to pass in), newer
kernels can include the CRTC ID in the page flip event.

Add a new vfunc to dispatch vblank events carrying a CRTC ID to clients
who negotiate a higher interface version.

[daniels: Rebased, include new cap, call page_flip_handler if it is set
          but page_flip_handler2 isn't even on newer contexts, write a
	  commit message.]

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Maarten Lankhorst <maarten.lankhorst@intel.com>
---
 xf86drm.h     |  9 ++++++++-
 xf86drmMode.c | 24 ++++++++++++++++--------
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/xf86drm.h b/xf86drm.h
index 0d927018..d75ca8ce 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -728,7 +728,7 @@ extern void drmMsg(const char *format, ...) DRM_PRINTFLIKE(1, 2);
 extern int drmSetMaster(int fd);
 extern int drmDropMaster(int fd);
 
-#define DRM_EVENT_CONTEXT_VERSION 2
+#define DRM_EVENT_CONTEXT_VERSION 3
 
 typedef struct _drmEventContext {
 
@@ -748,6 +748,13 @@ typedef struct _drmEventContext {
 				  unsigned int tv_usec,
 				  void *user_data);
 
+	void (*page_flip_handler2)(int fd,
+				   unsigned int sequence,
+				   unsigned int tv_sec,
+				   unsigned int tv_usec,
+				   unsigned int crtc_id,
+				   void *user_data);
+
 } drmEventContext, *drmEventContextPtr;
 
 extern int drmHandleEvent(int fd, drmEventContextPtr evctx);
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 0266bc10..d3bc20ea 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -889,6 +889,7 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
 	int len, i;
 	struct drm_event *e;
 	struct drm_event_vblank *vblank;
+	void *user_data;
 
 	/* The DRM read semantics guarantees that we always get only
 	 * complete events. */
@@ -915,15 +916,22 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
 					      U642VOID (vblank->user_data));
 			break;
 		case DRM_EVENT_FLIP_COMPLETE:
-			if (evctx->version < 2 ||
-			    evctx->page_flip_handler == NULL)
-				break;
 			vblank = (struct drm_event_vblank *) e;
-			evctx->page_flip_handler(fd,
-						 vblank->sequence,
-						 vblank->tv_sec,
-						 vblank->tv_usec,
-						 U642VOID (vblank->user_data));
+			user_data = U642VOID (vblank->user_data);
+
+			if (evctx->version >= 3 && evctx->page_flip_handler2)
+				evctx->page_flip_handler2(fd,
+							 vblank->sequence,
+							 vblank->tv_sec,
+							 vblank->tv_usec,
+							 vblank->crtc_id,
+							 user_data);
+			else if (evctx->version >= 2 && evctx->page_flip_handler)
+				evctx->page_flip_handler(fd,
+							 vblank->sequence,
+							 vblank->tv_sec,
+							 vblank->tv_usec,
+							 user_data);
 			break;
 		default:
 			break;
-- 
2.11.0

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

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

* Re: [PATCH kernel 1/2] drm: Pass CRTC ID in userspace vblank events
  2017-04-04 17:58     ` Sean Paul
@ 2017-04-04 20:53       ` Daniel Stone
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Stone @ 2017-04-04 20:53 UTC (permalink / raw)
  To: Sean Paul; +Cc: dri-devel, Maarten Lankhorst

Hi,

On 4 April 2017 at 18:58, Sean Paul <seanpaul@chromium.org> wrote:
> On Tue, Apr 04, 2017 at 05:52:21PM +0100, Daniel Stone wrote:
>> With the atomic API, it is possible that a single commit affects
>> multiple crtcs. If the user requests an event with that commit, one
>> event will be sent for each CRTC, but it is not possible to distinguish
>> which crtc an event is for in user space. To solve this, the reserved
>> field in struct drm_vblank_event is repurposed to include the crtc_id
>> which the event is for.
>>
>> The DRM_CAP_CRTC_IN_VBLANK_EVENT is added to allow userspace to query if
>> the crtc field will be set properly.
>>
>> [daniels: Rebased, using Maarten's forward-port.]
>
> Yeah, this seems like good use of the reserved field to me.
>
> Reviewed-by: Sean Paul <seanpaul@chromium.org>

Thanks Sean for the review! I've pushed this to drm-misc-next ...
without your R-b tag, as I botched my first dim. Oops.

libdrm v2 has been sent, and Weston atomic will be revved to use this
with its real version number when that gets merged and released. FWIW,
the Weston side was also acked by Pekka Paalanen, though I'll let him
add his thoughts in his own words tomorrow.

Cheers,
Daniel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH libdrm 2/2] Add CRTC ID to vblank event
       [not found]   ` <20170404165221.28240-1-daniels-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
@ 2017-04-05  9:26     ` Pekka Paalanen
  0 siblings, 0 replies; 11+ messages in thread
From: Pekka Paalanen @ 2017-04-05  9:26 UTC (permalink / raw)
  To: Daniel Stone
  Cc: Emil Velikov, Sean Paul, Maarten Lankhorst,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	wayland-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 5311 bytes --]

On Tue,  4 Apr 2017 17:52:20 +0100
Daniel Stone <daniels-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org> wrote:

> From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> When using the atomic API, one request can span multiple CRTCs, however
> one event is generated per CRTC. As we cannot disambiguate the CRTC with
> user data (since we only have one piece of user data to pass in), newer
> kernels can include the CRTC ID in the page flip event.
> 
> Add a new vfunc to dispatch vblank events carrying a CRTC ID to clients
> who negotiate a higher interface version.
> 
> [daniels: Rebased, include new cap, call page_flip_handler if it is set
>           but page_flip_handler2 isn't even on newer contexts, write a
> 	  commit message.]
> 
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> Signed-off-by: Daniel Stone <daniels-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> Cc: Maarten Lankhorst <maarten.lankhorst-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
>  include/drm/drm.h |  3 ++-
>  xf86drm.h         |  9 ++++++++-
>  xf86drmMode.c     | 24 ++++++++++++++++--------
>  3 files changed, 26 insertions(+), 10 deletions(-)
> 

Hi,

I'm replying to this patch to keep the scope rather than the split ones
which are needed together and have unrelated changes.

> diff --git a/include/drm/drm.h b/include/drm/drm.h
> index 09d4262f..c4492372 100644
> --- a/include/drm/drm.h
> +++ b/include/drm/drm.h
> @@ -641,6 +641,7 @@ struct drm_gem_open {
>  #define DRM_CAP_CURSOR_HEIGHT		0x9
>  #define DRM_CAP_ADDFB2_MODIFIERS	0x10
>  #define DRM_CAP_PAGE_FLIP_TARGET	0x11
> +#define DRM_CAP_CRTC_IN_VBLANK_EVENT	0x12
>  
>  /** DRM_IOCTL_GET_CAP ioctl argument type */
>  struct drm_get_cap {
> @@ -846,7 +847,7 @@ struct drm_event_vblank {
>  	__u32 tv_sec;
>  	__u32 tv_usec;
>  	__u32 sequence;
> -	__u32 reserved;
> +	__u32 crtc_id;
>  };
>  
>  /* typedef area */
> diff --git a/xf86drm.h b/xf86drm.h
> index 0d927018..d75ca8ce 100644
> --- a/xf86drm.h
> +++ b/xf86drm.h
> @@ -728,7 +728,7 @@ extern void drmMsg(const char *format, ...) DRM_PRINTFLIKE(1, 2);
>  extern int drmSetMaster(int fd);
>  extern int drmDropMaster(int fd);
>  
> -#define DRM_EVENT_CONTEXT_VERSION 2
> +#define DRM_EVENT_CONTEXT_VERSION 3
>  
>  typedef struct _drmEventContext {
>  
> @@ -748,6 +748,13 @@ typedef struct _drmEventContext {
>  				  unsigned int tv_usec,
>  				  void *user_data);
>  
> +	void (*page_flip_handler2)(int fd,
> +				   unsigned int sequence,
> +				   unsigned int tv_sec,
> +				   unsigned int tv_usec,
> +				   unsigned int crtc_id,
> +				   void *user_data);
> +
>  } drmEventContext, *drmEventContextPtr;
>  
>  extern int drmHandleEvent(int fd, drmEventContextPtr evctx);
> diff --git a/xf86drmMode.c b/xf86drmMode.c
> index fb47fa8b..b71520aa 100644
> --- a/xf86drmMode.c
> +++ b/xf86drmMode.c
> @@ -889,6 +889,7 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
>  	int len, i;
>  	struct drm_event *e;
>  	struct drm_event_vblank *vblank;
> +	void *user_data;
>  
>  	/* The DRM read semantics guarantees that we always get only
>  	 * complete events. */
> @@ -915,15 +916,22 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
>  					      U642VOID (vblank->user_data));
>  			break;
>  		case DRM_EVENT_FLIP_COMPLETE:
> -			if (evctx->version < 2 ||
> -			    evctx->page_flip_handler == NULL)
> -				break;
>  			vblank = (struct drm_event_vblank *) e;
> -			evctx->page_flip_handler(fd,
> -						 vblank->sequence,
> -						 vblank->tv_sec,
> -						 vblank->tv_usec,
> -						 U642VOID (vblank->user_data));
> +			user_data = U642VOID (vblank->user_data);
> +
> +			if (evctx->version >= 3 && evctx->page_flip_handler2)
> +				evctx->page_flip_handler2(fd,
> +							 vblank->sequence,
> +							 vblank->tv_sec,
> +							 vblank->tv_usec,
> +							 vblank->crtc_id,
> +							 user_data);
> +			else if (evctx->version >= 2 && evctx->page_flip_handler)
> +				evctx->page_flip_handler(fd,
> +							 vblank->sequence,
> +							 vblank->tv_sec,
> +							 vblank->tv_usec,
> +							 user_data);
>  			break;
>  		default:
>  			break;

This is excellent.

I have browsed through Weston's DRM backend as of Daniel's atomic
series v9, and the end result looks good. It depends on the CRTC ID in
the pageflip events.

There Weston runs each CRTC independently, but at opportunity will
coalesce updates to several CRTCs into the same atomic commit. As the
repaint state machines are per CRTC in Weston, it is necessary to know
which CRTC completed the pageflip at a time to avoid stalling
everything until the last one or not being able to coalesce across
CRTCs at all. Being able to coalesce across CRTCs is important
particularly for modesets where programming all CRTCs in one go
improves the chances of the transition succeeding in hardware.

I also cannot think of needing anything more in the event.

For instance, if DRM flip queue depth was grown beyond the current of
one, we can use the user data pointer to identify which atomic commit
is completing.

This patch gets all thumbs up from me on behalf of Weston.


Thanks,
pq

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 172 bytes --]

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

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

* [PATCH libdrm v2 1/2] headers: Sync drm{,_mode}.h with the kernel
  2016-10-12  9:41 [PATCH libdrm] Add support for DRM_MODE_PAGE_FLIP_TARGET_* flags Michel Dänzer
@ 2016-10-13  8:04 ` Michel Dänzer
  0 siblings, 0 replies; 11+ messages in thread
From: Michel Dänzer @ 2016-10-13  8:04 UTC (permalink / raw)
  To: dri-devel

From: Michel Dänzer <michel.daenzer@amd.com>

Generated using make headers_install, based on linus master commit
b67be92feb486f800d80d72c67fd87b47b79b18e.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 include/drm/drm.h      | 17 +++++++++++++++++
 include/drm/drm_mode.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/include/drm/drm.h b/include/drm/drm.h
index b4ebaa9..f6fd5c2 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -59,6 +59,10 @@ typedef unsigned long drm_handle_t;
 
 #endif
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 #define DRM_NAME	"drm"	  /**< Name in kernel, /dev, and /proc */
 #define DRM_MIN_ORDER	5	  /**< At least 2^5 bytes = 32 bytes */
 #define DRM_MAX_ORDER	22	  /**< Up to 2^22 bytes = 4MB */
@@ -636,6 +640,7 @@ struct drm_gem_open {
 #define DRM_CAP_CURSOR_WIDTH		0x8
 #define DRM_CAP_CURSOR_HEIGHT		0x9
 #define DRM_CAP_ADDFB2_MODIFIERS	0x10
+#define DRM_CAP_PAGE_FLIP_TARGET	0x11
 
 /** DRM_IOCTL_GET_CAP ioctl argument type */
 struct drm_get_cap {
@@ -685,8 +690,16 @@ struct drm_prime_handle {
 	__s32 fd;
 };
 
+#if defined(__cplusplus)
+}
+#endif
+
 #include "drm_mode.h"
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 #define DRM_IOCTL_BASE			'd'
 #define DRM_IO(nr)			_IO(DRM_IOCTL_BASE,nr)
 #define DRM_IOR(nr,type)		_IOR(DRM_IOCTL_BASE,nr,type)
@@ -878,4 +891,8 @@ typedef struct drm_agp_info drm_agp_info_t;
 typedef struct drm_scatter_gather drm_scatter_gather_t;
 typedef struct drm_set_version drm_set_version_t;
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 7a7856e..df0e350 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -29,6 +29,10 @@
 
 #include "drm.h"
 
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
 #define DRM_DISPLAY_INFO_LEN	32
 #define DRM_CONNECTOR_NAME_LEN	32
 #define DRM_DISPLAY_MODE_LEN	32
@@ -202,6 +206,7 @@ struct drm_mode_get_plane_res {
 #define DRM_MODE_ENCODER_VIRTUAL 5
 #define DRM_MODE_ENCODER_DSI	6
 #define DRM_MODE_ENCODER_DPMST	7
+#define DRM_MODE_ENCODER_DPI	8
 
 struct drm_mode_get_encoder {
 	__u32 encoder_id;
@@ -241,6 +246,7 @@ struct drm_mode_get_encoder {
 #define DRM_MODE_CONNECTOR_eDP		14
 #define DRM_MODE_CONNECTOR_VIRTUAL      15
 #define DRM_MODE_CONNECTOR_DSI		16
+#define DRM_MODE_CONNECTOR_DPI		17
 
 struct drm_mode_get_connector {
 
@@ -514,7 +520,13 @@ struct drm_color_lut {
 
 #define DRM_MODE_PAGE_FLIP_EVENT 0x01
 #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
-#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT|DRM_MODE_PAGE_FLIP_ASYNC)
+#define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4
+#define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8
+#define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \
+				   DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)
+#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
+				  DRM_MODE_PAGE_FLIP_ASYNC | \
+				  DRM_MODE_PAGE_FLIP_TARGET)
 
 /*
  * Request a page flip on the specified crtc.
@@ -537,8 +549,7 @@ struct drm_color_lut {
  * 'as soon as possible', meaning that it not delay waiting for vblank.
  * This may cause tearing on the screen.
  *
- * The reserved field must be zero until we figure out something
- * clever to use it for.
+ * The reserved field must be zero.
  */
 
 struct drm_mode_crtc_page_flip {
@@ -549,6 +560,34 @@ struct drm_mode_crtc_page_flip {
 	__u64 user_data;
 };
 
+/*
+ * Request a page flip on the specified crtc.
+ *
+ * Same as struct drm_mode_crtc_page_flip, but supports new flags and
+ * re-purposes the reserved field:
+ *
+ * The sequence field must be zero unless either of the
+ * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When
+ * the ABSOLUTE flag is specified, the sequence field denotes the absolute
+ * vblank sequence when the flip should take effect. When the RELATIVE
+ * flag is specified, the sequence field denotes the relative (to the
+ * current one when the ioctl is called) vblank sequence when the flip
+ * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to
+ * make sure the vblank sequence before the target one has passed before
+ * calling this ioctl. The purpose of the
+ * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify
+ * the target for when code dealing with a page flip runs during a
+ * vertical blank period.
+ */
+
+struct drm_mode_crtc_page_flip_target {
+	__u32 crtc_id;
+	__u32 fb_id;
+	__u32 flags;
+	__u32 sequence;
+	__u64 user_data;
+};
+
 /* create a dumb scanout buffer */
 struct drm_mode_create_dumb {
 	__u32 height;
@@ -621,4 +660,8 @@ struct drm_mode_destroy_blob {
 	__u32 blob_id;
 };
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif
-- 
2.9.3

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

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

end of thread, other threads:[~2017-04-05  9:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 16:51 [REPOST PATCH 1/2] Add CRTC ID to vblank events Daniel Stone
2017-04-04 16:52 ` [PATCH libdrm 2/2] Add CRTC ID to vblank event Daniel Stone
2017-04-04 16:52   ` [PATCH kernel 1/2] drm: Pass CRTC ID in userspace vblank events Daniel Stone
2017-04-04 17:58     ` Sean Paul
2017-04-04 20:53       ` Daniel Stone
2017-04-04 17:12   ` [PATCH libdrm 2/2] Add CRTC ID to vblank event Emil Velikov
2017-04-04 17:14     ` Daniel Stone
2017-04-04 20:49     ` [PATCH libdrm v2 1/2] Headers: Sync drm{,_mode}.h with the kernel Daniel Stone
2017-04-04 20:49       ` [PATCH libdrm v2 2/2] Add CRTC ID to vblank event Daniel Stone
     [not found]   ` <20170404165221.28240-1-daniels-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2017-04-05  9:26     ` [PATCH libdrm " Pekka Paalanen
  -- strict thread matches above, loose matches on Subject: below --
2016-10-12  9:41 [PATCH libdrm] Add support for DRM_MODE_PAGE_FLIP_TARGET_* flags Michel Dänzer
2016-10-13  8:04 ` [PATCH libdrm v2 1/2] headers: Sync drm{,_mode}.h with the kernel Michel Dänzer

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.