summaryrefslogtreecommitdiffstats
path: root/unix/xserver
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2012-01-23 15:54:11 +0000
committerPierre Ossman <ossman@cendio.se>2012-01-23 15:54:11 +0000
commit559a2e8f471edb9142eea892acc101d6fc58f0d6 (patch)
tree21efcef13a2cb0524019ab4cc0400dc1d9e2f079 /unix/xserver
parent2f4fd6b9203f0ade624ff8500c3a8a8c8711db61 (diff)
downloadtigervnc-559a2e8f471edb9142eea892acc101d6fc58f0d6.tar.gz
tigervnc-559a2e8f471edb9142eea892acc101d6fc58f0d6.zip
Fix a race condition where we might get updates thrown at us right after a
framebuffer switch, but before we've been given the pointer to the new framebuffer. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4839 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'unix/xserver')
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.cc10
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.h2
-rw-r--r--unix/xserver/hw/vnc/vncHooks.cc7
3 files changed, 19 insertions, 0 deletions
diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc
index 23dbee0c..5fc32c3a 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.cc
+++ b/unix/xserver/hw/vnc/XserverDesktop.cc
@@ -188,6 +188,16 @@ void XserverDesktop::serverReset(ScreenPtr pScreen_)
cmap = (ColormapPtr) retval;
}
+void XserverDesktop::blockUpdates()
+{
+ server->blockUpdates();
+}
+
+void XserverDesktop::unblockUpdates()
+{
+ server->unblockUpdates();
+}
+
void XserverDesktop::setFramebuffer(int w, int h, void* fbptr, int stride)
{
width_ = w;
diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h
index 39045835..0aba4ef6 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.h
+++ b/unix/xserver/hw/vnc/XserverDesktop.h
@@ -61,6 +61,8 @@ public:
// methods called from X server code
void serverReset(ScreenPtr pScreen);
+ void blockUpdates();
+ void unblockUpdates();
void setFramebuffer(int w, int h, void* fbptr, int stride);
void setColormap(ColormapPtr cmap);
void setColourMapEntries(ColormapPtr pColormap, int ndef, xColorItem* pdef);
diff --git a/unix/xserver/hw/vnc/vncHooks.cc b/unix/xserver/hw/vnc/vncHooks.cc
index 611ebcf5..b03b6aa0 100644
--- a/unix/xserver/hw/vnc/vncHooks.cc
+++ b/unix/xserver/hw/vnc/vncHooks.cc
@@ -605,6 +605,11 @@ static Bool vncHooksRandRSetConfig(ScreenPtr pScreen, Rotation rotation,
RegionRec reg;
BoxRec box;
+ // We need to prevent the RFB core from accessing the framebuffer
+ // for a while as there might be updates thrown our way inside
+ // rrSetConfig (i.e. before we have a pointer to the new framebuffer).
+ vncHooksScreen->desktop->blockUpdates();
+
rp->rrSetConfig = vncHooksScreen->RandRSetConfig;
ret = (*rp->rrSetConfig)(pScreen, rotation, rate, pSize);
rp->rrSetConfig = vncHooksRandRSetConfig;
@@ -617,6 +622,8 @@ static Bool vncHooksRandRSetConfig(ScreenPtr pScreen, Rotation rotation,
vncFbptr[pScreen->myNum],
vncFbstride[pScreen->myNum]);
+ vncHooksScreen->desktop->unblockUpdates();
+
// Mark entire screen as changed
box.x1 = 0;
box.y1 = 0;