[Xquartz-changes] xserver: Branch 'master' - 3 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Thu May 13 08:28:45 PDT 2010
configure.ac | 2 -
glx/glxdri2.c | 23 +++++++++++++-
hw/xfree86/common/xf86.h | 12 +++----
hw/xfree86/common/xf86Privstr.h | 3 -
hw/xfree86/dri2/dri2.c | 64 +++++++++++++++++++++++++++++++++++-----
hw/xfree86/dri2/dri2.h | 9 +++++
hw/xfree86/dri2/dri2ext.c | 19 +++++++++++
include/misc.h | 12 -------
include/os.h | 34 ++++++++-------------
include/resource.h | 8 ++---
os/log.c | 2 -
11 files changed, 130 insertions(+), 58 deletions(-)
New commits:
commit ed777dd7be9da73bbfe45aef9448985ab6284c43
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Sat Mar 27 18:02:14 2010 -0700
Use _X_ATTRIBUTE_PRINTF _X_DEPRECATED _X_NORETURN
Use the values from xproto rather than duplicating the effort
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Keith Packard <keithp at keithp.com>
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index e9266ab..4544a4f 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -210,14 +210,14 @@ extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
const char *format, va_list args);
extern _X_EXPORT void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
- const char *format, ...) _printf_attribute(4,5);
+ const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
extern _X_EXPORT void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
- _printf_attribute(3,4);
+ _X_ATTRIBUTE_PRINTF(3,4);
extern _X_EXPORT void xf86MsgVerb(MessageType type, int verb, const char *format, ...)
- _printf_attribute(3,4);
-extern _X_EXPORT void xf86Msg(MessageType type, const char *format, ...) _printf_attribute(2,3);
-extern _X_EXPORT void xf86ErrorFVerb(int verb, const char *format, ...) _printf_attribute(2,3);
-extern _X_EXPORT void xf86ErrorF(const char *format, ...) _printf_attribute(1,2);
+ _X_ATTRIBUTE_PRINTF(3,4);
+extern _X_EXPORT void xf86Msg(MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(2,3);
+extern _X_EXPORT void xf86ErrorFVerb(int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(2,3);
+extern _X_EXPORT void xf86ErrorF(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,2);
extern _X_EXPORT const char *xf86TokenToString(SymTabPtr table, int token);
extern _X_EXPORT int xf86StringToToken(SymTabPtr table, const char *string);
extern _X_EXPORT void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
diff --git a/include/misc.h b/include/misc.h
index e4bdee4..62d813e 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -100,18 +100,6 @@ typedef unsigned long ATOM;
#define FALSE 0
#endif
-#ifdef __GNUC__
-#define X_DEPRECATED __attribute__((deprecated))
-#else
-#define X_DEPRECATED
-#endif
-
-#if defined(__GNUC__) && (__GNUC__ > 2)
-#define X_NORETURN __attribute__((noreturn))
-#else
-#define X_NORETURN
-#endif
-
#ifndef _XTYPEDEF_CALLBACKLISTPTR
typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
#define _XTYPEDEF_CALLBACKLISTPTR
diff --git a/include/os.h b/include/os.h
index d34e056..efa202c 100644
--- a/include/os.h
+++ b/include/os.h
@@ -218,20 +218,20 @@ extern _X_EXPORT int set_font_authorizations(
/*
* Use malloc(3) instead.
*/
-extern _X_EXPORT void *Xalloc(unsigned long /*amount*/) X_DEPRECATED;
+extern _X_EXPORT void *Xalloc(unsigned long /*amount*/) _X_DEPRECATED;
/*
* Use calloc(3) instead
*/
-extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/) X_DEPRECATED;
+extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/) _X_DEPRECATED;
/*
* Use realloc(3) instead
*/
extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/)
- X_DEPRECATED;
+ _X_DEPRECATED;
/*
* Use free(3) instead
*/
-extern _X_EXPORT void Xfree(void * /*ptr*/) X_DEPRECATED;
+extern _X_EXPORT void Xfree(void * /*ptr*/) _X_DEPRECATED;
#endif
@@ -263,9 +263,9 @@ extern _X_EXPORT char *Xstrdup(const char *s);
*/
extern _X_EXPORT char *XNFstrdup(const char *s);
-extern _X_EXPORT char *Xprintf(const char *fmt, ...);
+extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va);
-extern _X_EXPORT char *XNFprintf(const char *fmt, ...);
+extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va);
typedef void (*OsSigHandlerPtr)(int /* sig */);
@@ -299,7 +299,7 @@ extern _X_EXPORT void OsBlockSignals (void);
extern _X_EXPORT void OsReleaseSignals (void);
-extern _X_EXPORT void OsAbort (void) X_NORETURN;
+extern _X_EXPORT void OsAbort (void) _X_NORETURN;
#if !defined(WIN32)
extern _X_EXPORT int System(char *);
@@ -525,29 +525,21 @@ typedef enum {
X_UNKNOWN = -1 /* unknown -- this must always be last */
} MessageType;
-/* XXX Need to check which GCC versions have the format(printf) attribute. */
-#if defined(__GNUC__) && (__GNUC__ > 2)
-#define _printf_attribute(a,b) __attribute((format(__printf__,a,b)))
-#else
-#define _printf_attribute(a,b) /**/
-#endif
-
extern _X_EXPORT const char *LogInit(const char *fname, const char *backup);
extern _X_EXPORT void LogClose(void);
extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value);
extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args);
-extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _printf_attribute(2,3);
+extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format,
va_list args);
extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format,
- ...) _printf_attribute(3,4);
+ ...) _X_ATTRIBUTE_PRINTF(3,4);
extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
- _printf_attribute(2,3);
+ _X_ATTRIBUTE_PRINTF(2,3);
extern _X_EXPORT void FreeAuditTimer(void);
-extern _X_EXPORT void AuditF(const char *f, ...) _printf_attribute(1,2);
+extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
extern _X_EXPORT void VAuditF(const char *f, va_list args);
-extern _X_EXPORT void FatalError(const char *f, ...) _printf_attribute(1,2)
- X_NORETURN;
+extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
#ifdef DEBUG
#define DebugF ErrorF
@@ -556,7 +548,7 @@ extern _X_EXPORT void FatalError(const char *f, ...) _printf_attribute(1,2)
#endif
extern _X_EXPORT void VErrorF(const char *f, va_list args);
-extern _X_EXPORT void ErrorF(const char *f, ...) _printf_attribute(1,2);
+extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
extern _X_EXPORT void Error(char *str);
extern _X_EXPORT void LogPrintMarkers(void);
diff --git a/include/resource.h b/include/resource.h
index 56450d6..96f852a 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -256,24 +256,24 @@ extern _X_EXPORT pointer SecurityLookupIDByType(
ClientPtr client,
XID id,
RESTYPE rtype,
- Mask access_mode) X_DEPRECATED;
+ Mask access_mode) _X_DEPRECATED;
/* replaced by dixLookupResourceByClass */
extern _X_EXPORT pointer SecurityLookupIDByClass(
ClientPtr client,
XID id,
RESTYPE classes,
- Mask access_mode) X_DEPRECATED;
+ Mask access_mode) _X_DEPRECATED;
/* replaced by dixLookupResourceByType */
extern _X_EXPORT pointer LookupIDByType(
XID id,
- RESTYPE rtype) X_DEPRECATED;
+ RESTYPE rtype) _X_DEPRECATED;
/* replaced by dixLookupResourceByClass */
extern _X_EXPORT pointer LookupIDByClass(
XID id,
- RESTYPE classes) X_DEPRECATED;
+ RESTYPE classes) _X_DEPRECATED;
#endif /* RESOURCE_H */
diff --git a/os/log.c b/os/log.c
index 0781659..ce43319 100644
--- a/os/log.c
+++ b/os/log.c
@@ -403,7 +403,7 @@ LogMessage(MessageType type, const char *format, ...)
}
void
-AbortServer(void) X_NORETURN;
+AbortServer(void) _X_NORETURN;
void
AbortServer(void)
commit 421606a8ef447d10c2ee0986f20e752056a47675
Author: Kristian Høgsberg <krh at bitplanet.net>
Date: Tue May 11 10:52:18 2010 -0400
dri2: Send out event when auxillary buffers are invalidated
This lets the DRI2 clients rely on the server to notify them when they
need to get new buffers. Without this, OpenGL clients poll the server
in glViewport() which can be a performance problems and also isn't
completely correct behaviour.
We bump the DRI2 protocol minor to indicate the availability of the
event, which the DRI2 clients can use to avoid polling. This speeds up
various piglit and oglc test cases as well as real applications.
Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/configure.ac b/configure.ac
index 6110d8c..a25b1f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -781,7 +781,7 @@ RECORDPROTO="recordproto >= 1.13.99.1"
SCRNSAVERPROTO="scrnsaverproto >= 1.1"
RESOURCEPROTO="resourceproto"
DRIPROTO="xf86driproto >= 2.1.0"
-DRI2PROTO="dri2proto >= 2.2"
+DRI2PROTO="dri2proto >= 2.3"
XINERAMAPROTO="xineramaproto"
BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
XCALIBRATEPROTO="xcalibrateproto"
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 4f8e020..9df682e 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -429,6 +429,17 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
return &context->base;
}
+static void
+__glXDRIinvalidateBuffers(DrawablePtr pDraw, void *priv)
+{
+#if __DRI2_FLUSH_VERSION >= 3
+ __GLXDRIdrawable *private = priv;
+ __GLXDRIscreen *screen = private->screen;
+
+ (*screen->flush->invalidate)(private->driDrawable);
+#endif
+}
+
static __GLXdrawable *
__glXDRIscreenCreateDrawable(ClientPtr client,
__GLXscreen *screen,
@@ -459,7 +470,8 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private->base.waitGL = __glXDRIdrawableWaitGL;
private->base.waitX = __glXDRIdrawableWaitX;
- if (DRI2CreateDrawable(client, pDraw, drawId)) {
+ if (DRI2CreateDrawable(client, pDraw, drawId,
+ __glXDRIinvalidateBuffers, private)) {
free(private);
return NULL;
}
@@ -573,9 +585,18 @@ static const __DRIdri2LoaderExtension loaderExtension = {
dri2GetBuffersWithFormat,
};
+#ifdef __DRI_USE_INVALIDATE
+static const __DRIuseInvalidateExtension dri2UseInvalidate = {
+ { __DRI_USE_INVALIDATE, __DRI_USE_INVALIDATE_VERSION }
+};
+#endif
+
static const __DRIextension *loader_extensions[] = {
&systemTimeExtension.base,
&loaderExtension.base,
+#ifdef __DRI_USE_INVALIDATE
+ &dri2UseInvalidate,
+#endif
NULL
};
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 21f8118..e3bec33 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -96,6 +96,8 @@ typedef struct _DRI2Screen {
DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
HandleExposuresProcPtr HandleExposures;
+
+ ConfigNotifyProcPtr ConfigNotify;
} DRI2ScreenRec;
static DRI2ScreenPtr
@@ -165,9 +167,11 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
}
typedef struct DRI2DrawableRefRec {
- XID id;
- XID dri2_id;
- struct list link;
+ XID id;
+ XID dri2_id;
+ DRI2InvalidateProcPtr invalidate;
+ void *priv;
+ struct list link;
} DRI2DrawableRefRec, *DRI2DrawableRefPtr;
static DRI2DrawableRefPtr
@@ -184,7 +188,8 @@ DRI2LookupDrawableRef(DRI2DrawablePtr pPriv, XID id)
}
static int
-DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id)
+DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id,
+ DRI2InvalidateProcPtr invalidate, void *priv)
{
DRI2DrawableRefPtr ref;
@@ -200,13 +205,16 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id)
ref->id = id;
ref->dri2_id = dri2_id;
+ ref->invalidate = invalidate;
+ ref->priv = priv;
list_add(&ref->link, &pPriv->reference_list);
return Success;
}
int
-DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id)
+DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id,
+ DRI2InvalidateProcPtr invalidate, void *priv)
{
DRI2DrawablePtr pPriv;
XID dri2_id;
@@ -219,7 +227,7 @@ DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id)
return BadAlloc;
dri2_id = FakeClientID(client->index);
- rc = DRI2AddDrawableRef(pPriv, id, dri2_id);
+ rc = DRI2AddDrawableRef(pPriv, id, dri2_id, invalidate, priv);
if (rc != Success)
return rc;
@@ -456,6 +464,19 @@ DRI2GetBuffersWithFormat(DrawablePtr pDraw, int *width, int *height,
out_count, TRUE);
}
+static void
+DRI2InvalidateDrawable(DrawablePtr pDraw)
+{
+ DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
+ DRI2DrawableRefPtr ref;
+
+ if (!pPriv)
+ return;
+
+ list_for_each_entry(ref, &pPriv->reference_list, link)
+ ref->invalidate(pDraw, ref->priv);
+}
+
/*
* In the direct rendered case, we throttle the clients that have more
* than their share of outstanding swaps (and thus busy buffers) when a
@@ -766,6 +787,8 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
*/
*swap_target = pPriv->swap_count + pPriv->swapsPending;
+ DRI2InvalidateDrawable(pDraw);
+
return Success;
}
@@ -916,6 +939,30 @@ DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic)
return TRUE;
}
+static void
+DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw,
+ WindowPtr pSib)
+{
+ DrawablePtr pDraw = (DrawablePtr)pWin;
+ ScreenPtr pScreen = pDraw->pScreen;
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+ DRI2DrawablePtr dd = DRI2GetDrawable(pDraw);
+
+ if (ds->ConfigNotify) {
+ pScreen->ConfigNotify = ds->ConfigNotify;
+
+ (*pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
+
+ ds->ConfigNotify = pScreen->ConfigNotify;
+ pScreen->ConfigNotify = DRI2ConfigNotify;
+ }
+
+ if (!dd || (dd->width == w && dd->height == h))
+ return;
+
+ DRI2InvalidateDrawable(pDraw);
+}
+
Bool
DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
{
@@ -953,7 +1000,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
ds->ScheduleSwap = info->ScheduleSwap;
ds->ScheduleWaitMSC = info->ScheduleWaitMSC;
ds->GetMSC = info->GetMSC;
- cur_minor = 2;
+ cur_minor = 3;
} else {
cur_minor = 1;
}
@@ -984,6 +1031,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds);
+ ds->ConfigNotify = pScreen->ConfigNotify;
+ pScreen->ConfigNotify = DRI2ConfigNotify;
+
xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
for (i = 0; i < sizeof(driverTypeNames) / sizeof(driverTypeNames[0]); i++) {
if (i < ds->numDrivers && ds->driverNames[i]) {
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index 5415a0b..be44bdd 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -152,6 +152,10 @@ typedef int (*DRI2ScheduleWaitMSCProcPtr)(ClientPtr client,
CARD64 target_msc,
CARD64 divisor,
CARD64 remainder);
+
+typedef void (*DRI2InvalidateProcPtr)(DrawablePtr pDraw,
+ void *data);
+
/**
* Version of the DRI2InfoRec structure defined in this header
*/
@@ -199,7 +203,10 @@ extern _X_EXPORT Bool DRI2Connect(ScreenPtr pScreen,
extern _X_EXPORT Bool DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic);
extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client,
- DrawablePtr pDraw, XID id);
+ DrawablePtr pDraw,
+ XID id,
+ DRI2InvalidateProcPtr invalidate,
+ void *priv);
extern _X_EXPORT void DRI2DestroyDrawable(DrawablePtr pDraw);
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 58eaa10..9419326 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -154,6 +154,22 @@ ProcDRI2Authenticate(ClientPtr client)
return client->noClientException;
}
+static void
+DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv)
+{
+ xDRI2InvalidateBuffers event;
+ ClientPtr client = priv;
+
+ if (client->clientGone)
+ return;
+
+ event.type = DRI2EventBase + DRI2_InvalidateBuffers;
+ event.sequenceNumber = client->sequence;
+ event.drawable = pDraw->id;
+
+ WriteEventsToClient(client, 1, (xEvent *)&event);
+}
+
static int
ProcDRI2CreateDrawable(ClientPtr client)
{
@@ -167,7 +183,8 @@ ProcDRI2CreateDrawable(ClientPtr client)
&pDrawable, &status))
return status;
- status = DRI2CreateDrawable(client, pDrawable, stuff->drawable);
+ status = DRI2CreateDrawable(client, pDrawable, stuff->drawable,
+ DRI2InvalidateBuffersEvent, client);
if (status != Success)
return status;
commit f281db9a5e400c822e03a19937247baa20ecc213
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Wed May 12 23:57:58 2010 -0700
Remove ResNoAvoid definition, missed in the RAC removal
ResNoAvoid is #defined to ResBios, but ResBios was removed
from xf86str.h in 4b42448a2388d40f257774fbffdccaea87bd0347
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: Julien Cristau <jcristau at debian.org>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index b2095aa..39cd230 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -147,9 +147,6 @@ typedef struct _RootWinProp {
pointer data;
} RootWinProp, *RootWinPropPtr;
-/* private resource types */
-#define ResNoAvoid ResBios
-
/* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */
#define XLED1 ((unsigned long) 0x00000001)
#define XLED2 ((unsigned long) 0x00000002)
More information about the Xquartz-changes
mailing list