[RFC xserver v3 13/14] present: Send a PresentWindowCrtcNotify event appropriately
Louis-Francis Ratté-Boulianne
lfrb at collabora.com
Wed Sep 27 05:19:12 UTC 2017
When the window has changed CRTC, send the event.
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
---
present/present.c | 5 +++++
present/present_event.c | 35 +++++++++++++++++++++++++++++++++++
present/present_priv.h | 3 +++
3 files changed, 43 insertions(+)
diff --git a/present/present.c b/present/present.c
index aa9c041df..c47b28b20 100644
--- a/present/present.c
+++ b/present/present.c
@@ -815,6 +815,11 @@ present_pixmap(WindowPtr window,
ret = present_get_ust_msc(screen, target_crtc, &ust, &crtc_msc);
+ /* Notify the client that the window is no longer on the same target CRTC
+ */
+ if (target_crtc != window_priv->crtc)
+ present_send_window_crtc_notify(window, serial, target_crtc);
+
target_msc = present_window_to_crtc_msc(window, target_crtc, window_msc, crtc_msc);
if (ret == Success) {
diff --git a/present/present_event.c b/present/present_event.c
index c222dd5ff..ac6edd9de 100644
--- a/present/present_event.c
+++ b/present/present_event.c
@@ -100,6 +100,14 @@ present_event_swap(xGenericEvent *from, xGenericEvent *to)
swapl(&c->serial);
swapl(&c->idle_fence);
}
+ case PresentWindowCrtcNotify:
+ {
+ xPresentWindowCrtcNotify *c = (xPresentWindowCrtcNotify *) to;
+ swapl(&c->eid);
+ swapl(&c->window);
+ swapl(&c->serial);
+ swapl(&c->crtc);
+ }
}
}
@@ -205,6 +213,33 @@ present_send_idle_notify(WindowPtr window, CARD32 serial, PixmapPtr pixmap, stru
}
}
+void
+present_send_window_crtc_notify(WindowPtr window, CARD32 serial, RRCrtcPtr crtc)
+{
+ present_window_priv_ptr window_priv = present_window_priv(window);
+
+ if (window_priv) {
+ xPresentWindowCrtcNotify in = {
+ .type = GenericEvent,
+ .extension = present_request,
+ .length = (sizeof(xPresentWindowCrtcNotify) - 32) >> 2,
+ .evtype = PresentWindowCrtcNotify,
+ .eid = 0,
+ .window = window->drawable.id,
+ .serial = serial,
+ .crtc = crtc ? crtc->id : 0
+ };
+ present_event_ptr event;
+
+ for (event = window_priv->events; event; event = event->next) {
+ if (event->mask & PresentWindowCrtcNotifyMask) {
+ in.eid = event->id;
+ WriteEventsToClient(event->client, 1, (xEvent *) &in);
+ }
+ }
+ }
+}
+
int
present_select_input(ClientPtr client, XID eid, WindowPtr window, CARD32 mask)
{
diff --git a/present/present_priv.h b/present/present_priv.h
index dfb4bdea9..408cc7a86 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -220,6 +220,9 @@ present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 se
void
present_send_idle_notify(WindowPtr window, CARD32 serial, PixmapPtr pixmap, present_fence_ptr idle_fence);
+void
+present_send_window_crtc_notify(WindowPtr window, CARD32 serial, RRCrtcPtr crtc);
+
int
present_select_input(ClientPtr client,
CARD32 eid,
--
2.13.0
More information about the xorg-devel
mailing list