xserver: Branch 'master' - 4 commits
Keith Packard
keithp at kemper.freedesktop.org
Fri Jun 4 00:45:30 PDT 2010
composite/compinit.c | 14 ---
composite/compint.h | 22 +----
composite/compwindow.c | 171 ++++++++++-------------------------------
dix/window.c | 9 +-
hw/xfree86/doc/sgml/DESIGN.xml | 5 -
hw/xfree86/dri2/dri2.c | 10 +-
hw/xfree86/parser/scan.c | 29 +-----
include/scrnintstr.h | 2
xkb/xkbUtils.c | 4
9 files changed, 83 insertions(+), 183 deletions(-)
New commits:
commit d163266692235261e1e0cfa6b900f54e6ec63de5
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Thu Jun 3 18:59:04 2010 -0700
Stop searching for XF86Config files
xorg.conf has been used since the X11R6.7 release in April 2004.
6 years has been a generous transition period for users to
"mv XF86Config xorg.conf" and for distros to update their
configuration tools and packages.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: James Cloos <cloos at jhcloos.com>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 9771913..52e80a9 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -626,7 +626,6 @@ xf86pathIsSafe(const char *path)
#ifndef XCONFENV
#define XCONFENV "XORGCONFIG"
#endif
-#define XFREE86CFGFILE "XF86Config"
/* xorg.conf is based on XF86Config version 4. If we ever break
compatibility of the xorg.conf syntax, we'll bump this version number. */
#ifndef CONFIG_FILE_VERSION
@@ -988,11 +987,8 @@ xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
if (!projroot || !projroot[0])
projroot = PROJECTROOT;
- /* Search for a config file or a fallback */
+ /* Search for a config file */
configPath = OpenConfigFile(path, cmdline, projroot, XCONFIGFILE);
- if (!configPath)
- configPath = OpenConfigFile(path, cmdline, projroot,
- XFREE86CFGFILE);
return configPath;
}
commit 01c75522b6ed15e979347acd38e234e2cb9006c3
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Thu Jun 3 18:59:03 2010 -0700
Stop searching for XF86Config files
xorg.conf has been used since the X11R6.7 release in April 2004.
6 years has been a generous transition period for users to
"mv XF86Config xorg.conf" and for distros to update their
configuration tools and packages.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: James Cloos <cloos at jhcloos.com>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/hw/xfree86/doc/sgml/DESIGN.xml b/hw/xfree86/doc/sgml/DESIGN.xml
index 826a970..6c90a40 100644
--- a/hw/xfree86/doc/sgml/DESIGN.xml
+++ b/hw/xfree86/doc/sgml/DESIGN.xml
@@ -118,8 +118,9 @@ routines common to all the X servers in the sample implementation.
<title>The xorg.conf File</title>
<para>
-The xorg.conf file format is similar to the old format, with the following
-changes:
+The xorg.conf file format is based on the XF86Config format from XFree86 4.4,
+which is in turn similar to the old XFree86 3.x XF86Config format, with the
+following changes:
</para>
<sect2>
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 06710d5..9771913 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -601,7 +601,7 @@ xf86pathIsSafe(const char *path)
* %P projroot
* %C sysconfdir
* %D datadir
- * %M major version number
+ * %M config file format version number
* %% %
*/
@@ -627,16 +627,10 @@ xf86pathIsSafe(const char *path)
#define XCONFENV "XORGCONFIG"
#endif
#define XFREE86CFGFILE "XF86Config"
-#ifndef XF86_VERSION_MAJOR
-#ifdef XVERSION
-#if XVERSION > 40000000
-#define XF86_VERSION_MAJOR (XVERSION / 10000000)
-#else
-#define XF86_VERSION_MAJOR (XVERSION / 1000)
-#endif
-#else
-#define XF86_VERSION_MAJOR 4
-#endif
+/* xorg.conf is based on XF86Config version 4. If we ever break
+ compatibility of the xorg.conf syntax, we'll bump this version number. */
+#ifndef CONFIG_FILE_VERSION
+#define CONFIG_FILE_VERSION 4
#endif
#define BAIL_OUT do { \
@@ -771,11 +765,8 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
break;
case 'M':
if (!majorvers[0]) {
- if (XF86_VERSION_MAJOR < 0 || XF86_VERSION_MAJOR > 99) {
- fprintf(stderr, "XF86_VERSION_MAJOR is out of range\n");
- BAIL_OUT;
- } else
- sprintf(majorvers, "%d", XF86_VERSION_MAJOR);
+ snprintf(majorvers, sizeof(majorvers),
+ "%d", CONFIG_FILE_VERSION);
}
APPEND_STR(majorvers);
break;
commit 7f19a7a6e90a4fd7b7ec0256974f62e575218541
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Jun 4 14:15:04 2010 +1000
xkb: fix invalid memory writes in _XkbCopyGeom.
Classic strlen/strcpy mistake of
foo = malloc(strlen(bar));
strcpy(foo, bar);
Testcase: valgrind Xephyr :1
==8591== Invalid write of size 1
==8591== at 0x4A0638F: strcpy (mc_replace_strmem.c:311)
==8591== by 0x605593: _XkbCopyGeom (xkbUtils.c:1994)
==8591== by 0x605973: XkbCopyKeymap (xkbUtils.c:2118)
==8591== by 0x6122B3: InitKeyboardDeviceStruct (xkbInit.c:560)
==8591== by 0x4472E2: CoreKeyboardProc (devices.c:577)
==8591== by 0x447162: ActivateDevice (devices.c:530)
==8591== by 0x4475D6: InitCoreDevices (devices.c:672)
==8591== by 0x4449EE: main (main.c:254)
==8591== Address 0x6f96505 is 0 bytes after a block of size 53 alloc'd
==8591== at 0x4A0515D: malloc (vg_replace_malloc.c:195)
==8591== by 0x6054B7: _XkbCopyGeom (xkbUtils.c:1980)
==8591== by 0x605973: XkbCopyKeymap (xkbUtils.c:2118)
==8591== by 0x6122B3: InitKeyboardDeviceStruct (xkbInit.c:560)
==8591== by 0x4472E2: CoreKeyboardProc (devices.c:577)
==8591== by 0x447162: ActivateDevice (devices.c:530)
==8591== by 0x4475D6: InitCoreDevices (devices.c:672)
==8591== by 0x4449EE: main (main.c:254)
Reported-by: Dave Airlie <airlied at redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Reviewed-by-and-apologised-for: Daniel Stone <daniel at fooishbar.org>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index e3fb9dc..0766922 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1977,7 +1977,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
/* font */
if (src->geom->label_font) {
if (!dst->geom->label_font) {
- tmp = malloc(strlen(src->geom->label_font));
+ tmp = malloc(strlen(src->geom->label_font) + 1);
if (!tmp)
return FALSE;
dst->geom->label_font = tmp;
@@ -1985,7 +1985,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
else if (strlen(src->geom->label_font) !=
strlen(dst->geom->label_font)) {
tmp = realloc(dst->geom->label_font,
- strlen(src->geom->label_font));
+ strlen(src->geom->label_font) + 1);
if (!tmp)
return FALSE;
dst->geom->label_font = tmp;
commit 959a1eaf1c15a691141f1b0dc53757fe9b6e9b13
Author: Dave Airlie <airlied at redhat.com>
Date: Fri Jun 4 11:09:46 2010 +1000
composite: use config notify hook to do pixmap resize.
Since reallocating the backing pixmap can fail, we need to try and do
it before any other side effects of reconfiguring the window happen.
This changes the ConfigNotify hook to return status, and moves the
composite window reconfiguration wrappers to ConfigNotify. They all
basically did the same thing, so we can drop the MoveWindow,
ResizeWindow, ChangeBorderWidth wrappers, and allow ConfigNotify to do
all the work. If reallocation fails we fail before we send any
confiureNotify events, or enter the area we can't recover from.
The only place we now enforce 32k limits are in EXA/UXA/fb, so drivers
that don't use this should probably deal with it in their pixmap
allocate if they don't already.
This also breaks ABI, so we need an alternate fix for older servers,
working on the X server makes me realise why I'm a kernel hacker.
Signed-off-by: Dave Airlie <airlied at redhat.com>
Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/composite/compinit.c b/composite/compinit.c
index e4b68c8..b4deaf5 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -69,9 +69,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
pScreen->InstallColormap = cs->InstallColormap;
pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
pScreen->ReparentWindow = cs->ReparentWindow;
- pScreen->MoveWindow = cs->MoveWindow;
- pScreen->ResizeWindow = cs->ResizeWindow;
- pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
+ pScreen->ConfigNotify = cs->ConfigNotify;
pScreen->ClipNotify = cs->ClipNotify;
pScreen->UnrealizeWindow = cs->UnrealizeWindow;
@@ -362,14 +360,8 @@ compScreenInit (ScreenPtr pScreen)
cs->ClipNotify = pScreen->ClipNotify;
pScreen->ClipNotify = compClipNotify;
- cs->MoveWindow = pScreen->MoveWindow;
- pScreen->MoveWindow = compMoveWindow;
-
- cs->ResizeWindow = pScreen->ResizeWindow;
- pScreen->ResizeWindow = compResizeWindow;
-
- cs->ChangeBorderWidth = pScreen->ChangeBorderWidth;
- pScreen->ChangeBorderWidth = compChangeBorderWidth;
+ cs->ConfigNotify = pScreen->ConfigNotify;
+ pScreen->ConfigNotify = compConfigNotify;
cs->ReparentWindow = pScreen->ReparentWindow;
pScreen->ReparentWindow = compReparentWindow;
diff --git a/composite/compint.h b/composite/compint.h
index 845a196..93da4df 100644
--- a/composite/compint.h
+++ b/composite/compint.h
@@ -127,13 +127,9 @@ typedef struct _CompScreen {
UnrealizeWindowProcPtr UnrealizeWindow;
ClipNotifyProcPtr ClipNotify;
/*
- * Called from ConfigureWindow, these
- * three track changes to the offscreen storage
- * geometry
+ * Called from ConfigureWindow.
*/
- MoveWindowProcPtr MoveWindow;
- ResizeWindowProcPtr ResizeWindow;
- ChangeBorderWidthProcPtr ChangeBorderWidth;
+ ConfigNotifyProcPtr ConfigNotify;
/*
* Reparenting has an effect on Subwindows redirect
*/
@@ -280,16 +276,6 @@ void
compClipNotify (WindowPtr pWin, int dx, int dy);
void
-compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
-
-void
-compResizeWindow (WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib);
-
-void
-compChangeBorderWidth (WindowPtr pWin, unsigned int border_width);
-
-void
compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent);
Bool
@@ -316,4 +302,8 @@ CompositeRealChildHead (WindowPtr pWin);
int
DeleteWindowNoInputDevices(pointer value, XID wid);
+int
+compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
+ int bw, WindowPtr pSib);
+
#endif /* _COMPINT_H_ */
diff --git a/composite/compwindow.c b/composite/compwindow.c
index 3b16bf9..0f3898c 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -335,132 +335,6 @@ compImplicitRedirect (WindowPtr pWin, WindowPtr pParent)
}
void
-compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
-
- compCheckTree (pScreen);
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- WindowPtr pParent;
- int draw_x, draw_y;
- unsigned int w, h, bw;
-
- /* if this is a root window, can't be moved */
- if (!(pParent = pWin->parent))
- return;
-
- bw = wBorderWidth (pWin);
- draw_x = pParent->drawable.x + x + (int)bw;
- draw_y = pParent->drawable.y + y + (int)bw;
- w = pWin->drawable.width;
- h = pWin->drawable.height;
- compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
- }
- compCheckTree (pScreen);
-
- pScreen->MoveWindow = cs->MoveWindow;
- (*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
- cs->MoveWindow = pScreen->MoveWindow;
- pScreen->MoveWindow = compMoveWindow;
-
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow (pWin);
- if (cw->pOldPixmap)
- {
- (*pScreen->DestroyPixmap) (cw->pOldPixmap);
- cw->pOldPixmap = NullPixmap;
- }
- }
-
- compCheckTree (pScreen);
-}
-
-void
-compResizeWindow (WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
-
- compCheckTree (pScreen);
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- WindowPtr pParent;
- int draw_x, draw_y;
- unsigned int bw;
-
- /* if this is a root window, can't be moved */
- if (!(pParent = pWin->parent))
- return;
-
- bw = wBorderWidth (pWin);
- draw_x = pParent->drawable.x + x + (int)bw;
- draw_y = pParent->drawable.y + y + (int)bw;
- compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
- }
- compCheckTree (pScreen);
-
- pScreen->ResizeWindow = cs->ResizeWindow;
- (*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
- cs->ResizeWindow = pScreen->ResizeWindow;
- pScreen->ResizeWindow = compResizeWindow;
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow (pWin);
- if (cw->pOldPixmap)
- {
- (*pScreen->DestroyPixmap) (cw->pOldPixmap);
- cw->pOldPixmap = NullPixmap;
- }
- }
- compCheckTree (pWin->drawable.pScreen);
-}
-
-void
-compChangeBorderWidth (WindowPtr pWin, unsigned int bw)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
-
- compCheckTree (pScreen);
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- WindowPtr pParent;
- int draw_x, draw_y;
- unsigned int w, h;
-
- /* if this is a root window, can't be moved */
- if (!(pParent = pWin->parent))
- return;
-
- draw_x = pWin->drawable.x;
- draw_y = pWin->drawable.y;
- w = pWin->drawable.width;
- h = pWin->drawable.height;
- compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
- }
- compCheckTree (pScreen);
-
- pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
- (*pScreen->ChangeBorderWidth) (pWin, bw);
- cs->ChangeBorderWidth = pScreen->ChangeBorderWidth;
- pScreen->ChangeBorderWidth = compChangeBorderWidth;
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow (pWin);
- if (cw->pOldPixmap)
- {
- (*pScreen->DestroyPixmap) (cw->pOldPixmap);
- cw->pOldPixmap = NullPixmap;
- }
- }
- compCheckTree (pWin->drawable.pScreen);
-}
-
-void
compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
@@ -822,3 +696,48 @@ CompositeRealChildHead (WindowPtr pWin)
return pChildBefore;
}
}
+
+int
+compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
+ int bw, WindowPtr pSib)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen (pScreen);
+ Bool ret = 0;
+ WindowPtr pParent = pWin->parent;
+ CompWindowPtr cw;
+ int draw_x, draw_y;
+ Bool alloc_ret;
+
+ if (cs->ConfigNotify)
+ {
+ pScreen->ConfigNotify = cs->ConfigNotify;
+ ret = (*pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
+ cs->ConfigNotify = pScreen->ConfigNotify;
+ pScreen->ConfigNotify = compConfigNotify;
+
+ if (ret)
+ return ret;
+ }
+
+ if (pWin->redirectDraw == RedirectDrawNone)
+ return Success;
+
+ compCheckTree (pScreen);
+
+ draw_x = pParent->drawable.x + x + bw;
+ draw_y = pParent->drawable.y + y + bw;
+ alloc_ret = compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
+
+ cw = GetCompWindow (pWin);
+ if (cw->pOldPixmap)
+ {
+ (*pScreen->DestroyPixmap) (cw->pOldPixmap);
+ cw->pOldPixmap = NullPixmap;
+ }
+ compCheckTree (pScreen);
+
+ if (alloc_ret == FALSE)
+ return BadAlloc;
+ return Success;
+}
diff --git a/dix/window.c b/dix/window.c
index 9e1f491..ea729db 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -2302,7 +2302,14 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
ActuallyDoSomething:
if (pWin->drawable.pScreen->ConfigNotify)
- (*pWin->drawable.pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
+ {
+ int ret;
+ ret = (*pWin->drawable.pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
+ if (ret) {
+ client->errorValue = 0;
+ return ret;
+ }
+ }
if (SubStrSend(pWin, pParent))
{
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 9ec4caa..45a8271 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -977,7 +977,7 @@ DRI2Authenticate(ScreenPtr pScreen, uint32_t magic)
return TRUE;
}
-static void
+static int
DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw,
WindowPtr pSib)
{
@@ -985,20 +985,24 @@ DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw,
ScreenPtr pScreen = pDraw->pScreen;
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
DRI2DrawablePtr dd = DRI2GetDrawable(pDraw);
+ int ret;
if (ds->ConfigNotify) {
pScreen->ConfigNotify = ds->ConfigNotify;
- (*pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
+ ret = (*pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
ds->ConfigNotify = pScreen->ConfigNotify;
pScreen->ConfigNotify = DRI2ConfigNotify;
+ if (ret)
+ return ret;
}
if (!dd || (dd->width == w && dd->height == h))
- return;
+ return Success;
DRI2InvalidateDrawable(pDraw);
+ return Success;
}
Bool
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index d67b264..361c484 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -396,7 +396,7 @@ typedef void (* PostChangeSaveUnderProcPtr)(
WindowPtr /*pLayerWin*/,
WindowPtr /*firstChild*/);
-typedef void (* ConfigNotifyProcPtr)(
+typedef int (* ConfigNotifyProcPtr)(
WindowPtr /*pWin*/,
int /*x*/,
int /*y*/,
More information about the xorg-commit
mailing list