1
0
xorg-x11-server/u_randr_send_rrresourcechangenotify_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

171 lines
4.7 KiB
Diff

From 7fa3e6ac35602ba7025e9283e9b2a7ab21ab77fb Mon Sep 17 00:00:00 2001
From: Michal Srb <msrb@suse.com>
Date: Fri, 4 Oct 2013 16:11:18 +0300
Subject: [PATCH] randr: send RRResourceChangeNotify event
Send RRResourceChangeNotify event when provider, output or crtc was created or
destroyed. I.e. when the list of resources returned by RRGetScreenResources and
RRGetProviders changes.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Michal Srb <msrb@suse.com>
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
old mode 100644
new mode 100755
index e368dee..33b2b7d
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -466,6 +466,9 @@ xf86platformAddDevice(int index)
/* attach unbound to 0 protocol screen */
AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
+ RRResourcesChanged(xf86Screens[0]->pScreen);
+ RRTellChanged(xf86Screens[0]->pScreen);
+
return 0;
}
@@ -508,6 +511,8 @@ xf86platformRemoveDevice(int index)
xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
xf86_remove_platform_device(index);
+
+ RRResourcesChanged(xf86Screens[0]->pScreen);
RRTellChanged(xf86Screens[0]->pScreen);
out:
return;
diff --git a/randr/randr.c b/randr/randr.c
index fa0a4da..9cec6f6 100755
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -420,6 +420,32 @@ RRExtensionInit(void)
#endif
}
+void
+RRResourcesChanged(ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+ pScrPriv->resourcesChanged = TRUE;
+
+ RRSetChanged(pScreen);
+}
+
+static void
+RRDeliverResourceEvent(ClientPtr client, WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ rrScrPriv(pScreen);
+
+ xRRResourceChangeNotifyEvent re = {
+ .type = RRNotify + RREventBase,
+ .subCode = RRNotify_ResourceChange,
+ .timestamp = pScrPriv->lastSetTime.milliseconds,
+ .window = pWin->drawable.id
+ };
+
+ WriteEventsToClient(client, 1, (xEvent *) &re);
+}
+
static int
TellChanged(WindowPtr pWin, pointer value)
{
@@ -480,6 +506,12 @@ TellChanged(WindowPtr pWin, pointer value)
RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
}
}
+
+ if (pRREvent->mask & RRResourceChangeNotifyMask) {
+ if (pScrPriv->resourcesChanged) {
+ RRDeliverResourceEvent(client, pWin);
+ }
+ }
}
return WT_WALKCHILDREN;
}
@@ -536,7 +568,11 @@ RRTellChanged(ScreenPtr pScreen)
}
pScrPriv->changed = FALSE;
mastersp->changed = FALSE;
+
WalkTree(master, TellChanged, (pointer) master);
+
+ mastersp->resourcesChanged = FALSE;
+
for (i = 0; i < pScrPriv->numOutputs; i++)
pScrPriv->outputs[i]->changed = FALSE;
for (i = 0; i < pScrPriv->numCrtcs; i++)
diff --git a/randr/randrstr.h b/randr/randrstr.h
index c933349..15299fd 100755
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -301,6 +301,7 @@ typedef struct _rrScrPriv {
Bool changed; /* some config changed */
Bool configChanged; /* configuration changed */
Bool layoutChanged; /* screen layout changed */
+ Bool resourcesChanged; /* screen resources change */
CARD16 minWidth, minHeight;
CARD16 maxWidth, maxHeight;
@@ -486,6 +487,9 @@ extern _X_EXPORT int
extern _X_EXPORT void
RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
+extern _X_EXPORT void
+ RRResourcesChanged(ScreenPtr pScreen);
+
/* randr.c */
/* set a screen change on the primary screen */
extern _X_EXPORT void
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
old mode 100644
new mode 100755
index 2f76b62..99b3dca
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -102,6 +102,8 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
crtc->pScreen = pScreen;
pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
+ RRResourcesChanged(pScreen);
+
return crtc;
}
@@ -669,6 +671,8 @@ RRCrtcDestroyResource(pointer value, XID pid)
break;
}
}
+
+ RRResourcesChanged(pScreen);
}
if (crtc->scanout_pixmap)
diff --git a/randr/rroutput.c b/randr/rroutput.c
old mode 100644
new mode 100755
index 922d61f..2b0b82f
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -101,6 +101,9 @@ RROutputCreate(ScreenPtr pScreen,
return NULL;
pScrPriv->outputs[pScrPriv->numOutputs++] = output;
+
+ RRResourcesChanged(pScreen);
+
return output;
}
@@ -355,6 +358,8 @@ RROutputDestroyResource(pointer value, XID pid)
break;
}
}
+
+ RRResourcesChanged(pScreen);
}
if (output->modes) {
for (m = 0; m < output->numModes; m++)