1
0
xorg-x11-server/u_randr_send_rrproviderchangenotify_event.patch
Stefan Dirsch 93fbf7ad2a Accepting request 204805 from home:michalsrb:branches:X11:XOrg
- Add U_randr_dont_directly_set_changed_bits_in_randr_screen.patch,
  U_randr_report_changes_when_we_disconnect_a_GPU_slave.patch,
  u_randr_send_rrproviderchangenotify_event.patch,
  u_randr_send_rrresourcechangenotify_event.patch,
  u_randr_deliver_output_and_crtc_events_of_attached_output.patch,
  u_randr_allow_rrselectinput_for_providerchange_and_resourcechange_events.patch
  * Send randr 1.4 events to allow tools to react to new providers. (fate#316408, fate#316409)

OBS-URL: https://build.opensuse.org/request/show/204805
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=463
2013-10-25 12:57:39 +00:00

162 lines
5.3 KiB
Diff

From 6ec75c2f85c14c805f4433a17a56774594d8641c Mon Sep 17 00:00:00 2001
From: Michal Srb <msrb@suse.com>
Date: Fri, 4 Oct 2013 15:59:34 +0300
Subject: [PATCH] randr: send RRProviderChangeNotify event
Send RRProviderChangeNotify event when a provider becomes output source or
offload sink.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Michal Srb <msrb@suse.com>
diff --git a/randr/randr.c b/randr/randr.c
old mode 100644
new mode 100755
index cb6fce7..fa0a4da
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -426,6 +426,8 @@ TellChanged(WindowPtr pWin, pointer value)
RREventPtr *pHead, pRREvent;
ClientPtr client;
ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr iter;
+ rrScrPrivPtr pSlaveScrPriv;
rrScrPriv(pScreen);
int i;
@@ -460,6 +462,24 @@ TellChanged(WindowPtr pWin, pointer value)
RRDeliverOutputEvent(client, pWin, output);
}
}
+
+ if (pRREvent->mask & RRProviderChangeNotifyMask) {
+ xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ if (pSlaveScrPriv->provider->changed)
+ RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+ }
+ xorg_list_for_each_entry(iter, &pScreen->offload_slave_list, offload_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ if (pSlaveScrPriv->provider->changed)
+ RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+ }
+ xorg_list_for_each_entry(iter, &pScreen->unattached_list, unattached_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ if (pSlaveScrPriv->provider->changed)
+ RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+ }
+ }
}
return WT_WALKCHILDREN;
}
@@ -496,6 +516,8 @@ RRTellChanged(ScreenPtr pScreen)
rrScrPriv(pScreen);
rrScrPrivPtr mastersp;
int i;
+ ScreenPtr iter;
+ rrScrPrivPtr pSlaveScrPriv;
if (pScreen->isGPU) {
master = pScreen->current_master;
@@ -519,6 +541,20 @@ RRTellChanged(ScreenPtr pScreen)
pScrPriv->outputs[i]->changed = FALSE;
for (i = 0; i < pScrPriv->numCrtcs; i++)
pScrPriv->crtcs[i]->changed = FALSE;
+
+ xorg_list_for_each_entry(iter, &master->output_slave_list, output_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ pSlaveScrPriv->provider->changed = FALSE;
+ }
+ xorg_list_for_each_entry(iter, &master->offload_slave_list, offload_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ pSlaveScrPriv->provider->changed = FALSE;
+ }
+ xorg_list_for_each_entry(iter, &master->unattached_list, unattached_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ pSlaveScrPriv->provider->changed = FALSE;
+ }
+
if (mastersp->layoutChanged) {
pScrPriv->layoutChanged = FALSE;
RRPointerScreenConfigured(master);
diff --git a/randr/randrstr.h b/randr/randrstr.h
old mode 100644
new mode 100755
index 2babfed..c933349
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -164,6 +164,7 @@ struct _rrProvider {
int nameLength;
RRPropertyPtr properties;
Bool pendingProperties;
+ Bool changed;
struct _rrProvider *offload_sink;
struct _rrProvider *output_source;
};
@@ -923,6 +924,9 @@ RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities);
extern _X_EXPORT Bool
RRProviderLookup(XID id, RRProviderPtr *provider_p);
+extern _X_EXPORT void
+RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider);
+
/* rrproviderproperty.c */
extern _X_EXPORT void
diff --git a/randr/rrprovider.c b/randr/rrprovider.c
old mode 100644
new mode 100755
index b321e62..2334ad2
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -304,6 +304,9 @@ ProcRRSetProviderOutputSource(ClientPtr client)
pScrPriv->rrProviderSetOutputSource(pScreen, provider, source_provider);
+ provider->changed = TRUE;
+ RRSetChanged(pScreen);
+
RRTellChanged (pScreen);
return Success;
@@ -333,6 +336,9 @@ ProcRRSetProviderOffloadSink(ClientPtr client)
pScrPriv->rrProviderSetOffloadSink(pScreen, provider, sink_provider);
+ provider->changed = TRUE;
+ RRSetChanged(pScreen);
+
RRTellChanged (pScreen);
return Success;
@@ -357,6 +363,7 @@ RRProviderCreate(ScreenPtr pScreen, const char *name,
provider->nameLength = nameLength;
memcpy(provider->name, name, nameLength);
provider->name[nameLength] = '\0';
+ provider->changed = FALSE;
if (!AddResource (provider->id, RRProviderType, (pointer) provider))
return NULL;
@@ -416,3 +423,21 @@ RRProviderLookup(XID id, RRProviderPtr *provider_p)
return TRUE;
return FALSE;
}
+
+void
+RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ rrScrPriv(pScreen);
+
+ xRRProviderChangeNotifyEvent pe = {
+ .type = RRNotify + RREventBase,
+ .subCode = RRNotify_ProviderChange,
+ .timestamp = pScrPriv->lastSetTime.milliseconds,
+ .window = pWin->drawable.id,
+ .provider = provider->id
+ };
+
+ WriteEventsToClient(client, 1, (xEvent *) &pe);
+}