aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xquartz/xpr
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
committermarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
commita915739887477b28d924ecc8417ee107d125bd6c (patch)
treec02f315476b61892d1fd89182e18943dce8d6277 /xorg-server/hw/xquartz/xpr
parent6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 (diff)
downloadvcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.gz
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.bz2
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.zip
Switched to xorg-server-1.6.99.900.tar.gz
Diffstat (limited to 'xorg-server/hw/xquartz/xpr')
-rw-r--r--xorg-server/hw/xquartz/xpr/Makefile.am2
-rw-r--r--xorg-server/hw/xquartz/xpr/Makefile.in44
-rw-r--r--xorg-server/hw/xquartz/xpr/appledri.c80
-rw-r--r--xorg-server/hw/xquartz/xpr/appledri.h21
-rw-r--r--xorg-server/hw/xquartz/xpr/appledristr.h83
-rw-r--r--xorg-server/hw/xquartz/xpr/dri.c211
-rw-r--r--xorg-server/hw/xquartz/xpr/dri.h12
-rw-r--r--xorg-server/hw/xquartz/xpr/driWrap.c547
-rw-r--r--xorg-server/hw/xquartz/xpr/driWrap.h31
-rw-r--r--xorg-server/hw/xquartz/xpr/xpr.h14
-rw-r--r--xorg-server/hw/xquartz/xpr/xprAppleWM.c73
-rw-r--r--xorg-server/hw/xquartz/xpr/xprCursor.c2
-rw-r--r--xorg-server/hw/xquartz/xpr/xprEvent.c1
-rw-r--r--xorg-server/hw/xquartz/xpr/xprFrame.c66
-rw-r--r--xorg-server/hw/xquartz/xpr/xprScreen.c34
15 files changed, 1112 insertions, 109 deletions
diff --git a/xorg-server/hw/xquartz/xpr/Makefile.am b/xorg-server/hw/xquartz/xpr/Makefile.am
index e74580f73..ba7b25890 100644
--- a/xorg-server/hw/xquartz/xpr/Makefile.am
+++ b/xorg-server/hw/xquartz/xpr/Makefile.am
@@ -9,6 +9,7 @@ AM_CPPFLAGS = \
libXquartzXpr_la_SOURCES = \
appledri.c \
dri.c \
+ driWrap.c \
xprAppleWM.c \
xprCursor.c \
xprEvent.c \
@@ -20,6 +21,7 @@ libXquartzXpr_la_SOURCES = \
EXTRA_DIST = \
dri.h \
+ driWrap.h \
dristruct.h \
appledri.h \
appledristr.h \
diff --git a/xorg-server/hw/xquartz/xpr/Makefile.in b/xorg-server/hw/xquartz/xpr/Makefile.in
index 3eaafdd17..0137c8bed 100644
--- a/xorg-server/hw/xquartz/xpr/Makefile.in
+++ b/xorg-server/hw/xquartz/xpr/Makefile.in
@@ -37,8 +37,11 @@ host_triplet = @host@
subdir = hw/xquartz/xpr
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/shave.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -48,14 +51,15 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
$(top_builddir)/include/xorg-config.h \
$(top_builddir)/include/xkb-config.h \
$(top_builddir)/include/xwin-config.h \
- $(top_builddir)/include/kdrive-config.h
+ $(top_builddir)/include/kdrive-config.h \
+ $(top_builddir)/include/version-config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libXquartzXpr_la_LIBADD =
-am_libXquartzXpr_la_OBJECTS = appledri.lo dri.lo xprAppleWM.lo \
- xprCursor.lo xprEvent.lo xprFrame.lo xprScreen.lo x-hash.lo \
- x-hook.lo x-list.lo
+am_libXquartzXpr_la_OBJECTS = appledri.lo dri.lo driWrap.lo \
+ xprAppleWM.lo xprCursor.lo xprEvent.lo xprFrame.lo \
+ xprScreen.lo x-hash.lo x-hook.lo x-list.lo
libXquartzXpr_la_OBJECTS = $(am_libXquartzXpr_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -77,6 +81,7 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_MAKEFLAGS = @AM_MAKEFLAGS@
APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@
APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@
@@ -97,9 +102,12 @@ CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CXX = @CXX@
CYGPATH_W = @CYGPATH_W@
DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -128,7 +136,9 @@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
DRIPROTO_LIBS = @DRIPROTO_LIBS@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_CFLAGS = @DRI_CFLAGS@
DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DRI_LIBS = @DRI_LIBS@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
DUMPBIN = @DUMPBIN@
@@ -137,9 +147,13 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+F77 = @F77@
+FC = @FC@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GL_CFLAGS = @GL_CFLAGS@
@@ -178,12 +192,13 @@ LTCOMPILE = @LTCOMPILE@
LTCXXCOMPILE = @LTCXXCOMPILE@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
+MAIN_LIB = @MAIN_LIB@
+MAKEFLAGS = @MAKEFLAGS@
MAKEINFO = @MAKEINFO@
MAKE_HTML = @MAKE_HTML@
MAKE_PDF = @MAKE_PDF@
MAKE_PS = @MAKE_PS@
MAKE_TEXT = @MAKE_TEXT@
-MESA_SOURCE = @MESA_SOURCE@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
@@ -203,7 +218,6 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
@@ -213,6 +227,7 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PROJECTROOT = @PROJECTROOT@
PS2PDF = @PS2PDF@
+Q = @Q@
RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
@@ -226,11 +241,10 @@ STRIP = @STRIP@
TSLIB_CFLAGS = @TSLIB_CFLAGS@
TSLIB_LIBS = @TSLIB_LIBS@
UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
-VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
-VENDOR_NAME = @VENDOR_NAME@
+V = @V@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
-VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
+WINDRES = @WINDRES@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XDMCP_CFLAGS = @XDMCP_CFLAGS@
@@ -266,6 +280,7 @@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
XORG_SYS_LIBS = @XORG_SYS_LIBS@
XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@
XPBPROXY_LIBS = @XPBPROXY_LIBS@
+XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDL_INCS = @XSDL_INCS@
@@ -290,7 +305,6 @@ YFLAGS = @YFLAGS@
__XCONFIGFILE__ = @__XCONFIGFILE__@
abi_ansic = @abi_ansic@
abi_extension = @abi_extension@
-abi_font = @abi_font@
abi_videodrv = @abi_videodrv@
abi_xinput = @abi_xinput@
abs_builddir = @abs_builddir@
@@ -313,6 +327,7 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
+distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
driverdir = @driverdir@
dvidir = @dvidir@
@@ -344,7 +359,9 @@ psdir = @psdir@
sbindir = @sbindir@
sdkdir = @sdkdir@
sharedstatedir = @sharedstatedir@
+shavedir = @shavedir@
srcdir = @srcdir@
+symbol_visibility = @symbol_visibility@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
@@ -360,6 +377,7 @@ AM_CPPFLAGS = \
libXquartzXpr_la_SOURCES = \
appledri.c \
dri.c \
+ driWrap.c \
xprAppleWM.c \
xprCursor.c \
xprEvent.c \
@@ -371,6 +389,7 @@ libXquartzXpr_la_SOURCES = \
EXTRA_DIST = \
dri.h \
+ driWrap.h \
dristruct.h \
appledri.h \
appledristr.h \
@@ -434,6 +453,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/appledri.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/driWrap.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-hash.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-hook.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-list.Plo@am__quote@
diff --git a/xorg-server/hw/xquartz/xpr/appledri.c b/xorg-server/hw/xquartz/xpr/appledri.c
index 3667c0dea..4d1a82fcc 100644
--- a/xorg-server/hw/xquartz/xpr/appledri.c
+++ b/xorg-server/hw/xquartz/xpr/appledri.c
@@ -2,7 +2,7 @@
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
-Copyright (c) 2002 Apple Computer, Inc.
+Copyright (c) 2002, 2009 Apple Computer, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -39,8 +39,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <dix-config.h>
#endif
-#define NEED_REPLIES
-#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
@@ -64,6 +62,7 @@ static DISPATCH_PROC(ProcAppleDRIDispatch);
static DISPATCH_PROC(SProcAppleDRIDispatch);
static void AppleDRIResetProc(ExtensionEntry* extEntry);
+static int ProcAppleDRICreatePixmap(ClientPtr client);
static unsigned char DRIReqCode = 0;
static int DRIEventBase = 0;
@@ -274,6 +273,76 @@ ProcAppleDRIDestroySurface(
return (client->noClientException);
}
+static int
+ProcAppleDRICreatePixmap(ClientPtr client)
+{
+ REQUEST(xAppleDRICreatePixmapReq);
+ DrawablePtr pDrawable;
+ int rc;
+ char path[PATH_MAX];
+ xAppleDRICreatePixmapReply rep;
+ int width, height, pitch, bpp;
+ void *ptr;
+
+ REQUEST_SIZE_MATCH(xAppleDRICreatePixmapReq);
+
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ DixReadAccess);
+
+ if(rc != Success)
+ return rc;
+
+ if(!DRICreatePixmap(screenInfo.screens[stuff->screen],
+ (Drawable)stuff->drawable,
+ pDrawable,
+ path, PATH_MAX)) {
+ return BadValue;
+ }
+
+ if(!DRIGetPixmapData(pDrawable, &width, &height,
+ &pitch, &bpp, &ptr)) {
+ return BadValue;
+ }
+
+ rep.stringLength = strlen(path) + 1;
+
+ /* No need for swapping, because this only runs if LocalClient is true. */
+ rep.type = X_Reply;
+ rep.length = sizeof(rep) + rep.stringLength;
+ rep.sequenceNumber = client->sequence;
+ rep.width = width;
+ rep.height = height;
+ rep.pitch = pitch;
+ rep.bpp = bpp;
+ rep.size = pitch * height;
+
+ if(sizeof(rep) != sz_xAppleDRICreatePixmapReply)
+ ErrorF("error sizeof(rep) is %zu\n", sizeof(rep));
+
+ WriteReplyToClient(client, sizeof(rep), &rep);
+ (void)WriteToClient(client, rep.stringLength, path);
+
+ return (client->noClientException);
+}
+
+static int
+ProcAppleDRIDestroyPixmap(ClientPtr client)
+{
+ DrawablePtr pDrawable;
+ int rc;
+ REQUEST(xAppleDRIDestroyPixmapReq);
+ REQUEST_SIZE_MATCH(xAppleDRIDestroyPixmapReq);
+
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ DixReadAccess);
+
+ if(rc != Success)
+ return rc;
+
+ DRIDestroyPixmap(pDrawable);
+
+ return (client->noClientException);
+}
/* dispatch */
@@ -303,6 +372,11 @@ ProcAppleDRIDispatch (
return ProcAppleDRICreateSurface(client);
case X_AppleDRIDestroySurface:
return ProcAppleDRIDestroySurface(client);
+ case X_AppleDRICreatePixmap:
+ return ProcAppleDRICreatePixmap(client);
+ case X_AppleDRIDestroyPixmap:
+ return ProcAppleDRIDestroyPixmap(client);
+
default:
return BadRequest;
}
diff --git a/xorg-server/hw/xquartz/xpr/appledri.h b/xorg-server/hw/xquartz/xpr/appledri.h
index c4e43be12..36964c6cd 100644
--- a/xorg-server/hw/xquartz/xpr/appledri.h
+++ b/xorg-server/hw/xquartz/xpr/appledri.h
@@ -1,8 +1,9 @@
+/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
-Copyright (c) 2002 Apple Computer, Inc.
+Copyright (c) 2002, 2008, 2009 Apple Computer, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -45,6 +46,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define X_AppleDRICreateSurface 2
#define X_AppleDRIDestroySurface 3
#define X_AppleDRIAuthConnection 4
+#define X_AppleDRICreateSharedBuffer 5
+#define X_AppleDRISwapBuffers 6
+#define X_AppleDRICreatePixmap 7
+#define X_AppleDRIDestroyPixmap 8
+
/* Requests up to and including 18 were used in a previous version */
/* Events */
@@ -99,8 +105,19 @@ Bool XAppleDRIDestroySurface (Display *dpy, int screen, Drawable drawable);
Bool XAppleDRISynchronizeSurfaces (Display *dpy);
+Bool XAppleDRICreateSharedBuffer(Display *dpy, int screen, Drawable drawable,
+ Bool doubleSwap, char *path, size_t pathlen,
+ int *width, int *height);
+
+Bool XAppleDRISwapBuffers(Display *dpy, int screen, Drawable drawable);
+
+Bool XAppleDRICreatePixmap(Display *dpy, int screen, Drawable drawable,
+ int *width, int *height, int *pitch, int *bpp,
+ size_t *size, char *bufname, size_t bufnamesize);
+
+Bool XAppleDRIDestroyPixmap(Display *dpy, Pixmap pixmap);
+
_XFUNCPROTOEND
#endif /* _APPLEDRI_SERVER_ */
#endif /* _APPLEDRI_H_ */
-
diff --git a/xorg-server/hw/xquartz/xpr/appledristr.h b/xorg-server/hw/xquartz/xpr/appledristr.h
index 8649fd329..c569719b7 100644
--- a/xorg-server/hw/xquartz/xpr/appledristr.h
+++ b/xorg-server/hw/xquartz/xpr/appledristr.h
@@ -2,7 +2,7 @@
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
-Copyright (c) 2002 Apple Computer, Inc.
+Copyright (c) 2002, 2008, 2009 Apple Computer, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -153,12 +153,87 @@ typedef struct _AppleDRINotify {
BYTE type; /* always eventBase + event type */
BYTE kind;
CARD16 sequenceNumber B16;
- Time time B32; /* time of change */
- CARD16 pad1 B16;
+ CARD32 time B32; /* time of change */
+ CARD32 pad1 B32;
CARD32 arg B32;
CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
} xAppleDRINotifyEvent;
-#define sz_xAppleDRINotifyEvent 20
+#define sz_xAppleDRINotifyEvent 32
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 driReqType;
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
+ BOOL doubleSwap;
+ CARD8 pad1, pad2, pad3;
+} xAppleDRICreateSharedBufferReq;
+
+#define sz_xAppleDRICreateSharedBufferReq 16
+
+typedef struct {
+ BYTE type;
+ BYTE data1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 stringLength B32; /* 0 on error */
+ CARD32 width B32;
+ CARD32 height B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+} xAppleDRICreateSharedBufferReply;
+
+#define sz_xAppleDRICreateSharedBufferReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 driReqType;
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
+} xAppleDRISwapBuffersReq;
+
+#define sz_xAppleDRISwapBuffersReq 12
+
+typedef struct {
+ CARD8 reqType; /*1*/
+ CARD8 driReqType; /*2*/
+ CARD16 length B16; /*4*/
+ CARD32 screen B32; /*8*/
+ CARD32 drawable B32; /*12*/
+} xAppleDRICreatePixmapReq;
+
+#define sz_xAppleDRICreatePixmapReq 12
+
+typedef struct {
+ BYTE type; /*1*/
+ BOOL pad1; /*2*/
+ CARD16 sequenceNumber B16; /*4*/
+ CARD32 length B32; /*8*/
+ CARD32 width B32; /*12*/
+ CARD32 height B32; /*16*/
+ CARD32 pitch B32; /*20*/
+ CARD32 bpp B32; /*24*/
+ CARD32 size B32; /*28*/
+ CARD32 stringLength B32; /*32*/
+} xAppleDRICreatePixmapReply;
+
+#define sz_xAppleDRICreatePixmapReply 32
+
+typedef struct {
+ CARD8 reqType; /*1*/
+ CARD8 driReqType; /*2*/
+ CARD16 length B16; /*4*/
+ CARD32 drawable B32; /*8*/
+} xAppleDRIDestroyPixmapReq;
+
+#define sz_xAppleDRIDestroyPixmapReq 8
#ifdef _APPLEDRI_SERVER_
diff --git a/xorg-server/hw/xquartz/xpr/dri.c b/xorg-server/hw/xquartz/xpr/dri.c
index 50b478b9c..f570bee5d 100644
--- a/xorg-server/hw/xquartz/xpr/dri.c
+++ b/xorg-server/hw/xquartz/xpr/dri.c
@@ -2,7 +2,7 @@
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
-Copyright (c) 2002 Apple Computer, Inc.
+Copyright (c) 2002, 2009 Apple Computer, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -46,10 +46,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <unistd.h>
#endif
-#define NEED_REPLIES
-#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
@@ -68,6 +70,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "rootless.h"
#include "x-hash.h"
#include "x-hook.h"
+#include "driWrap.h"
#include <AvailabilityMacros.h>
@@ -77,11 +80,15 @@ static int DRIWindowPrivKeyIndex;
static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKeyIndex;
static int DRIPixmapPrivKeyIndex;
static DevPrivateKey DRIPixmapPrivKey = &DRIPixmapPrivKeyIndex;
+static int DRIPixmapBufferPrivKeyIndex;
+static DevPrivateKey DRIPixmapBufferPrivKey = &DRIPixmapBufferPrivKeyIndex;
static RESTYPE DRIDrawablePrivResType;
static x_hash_table *surface_hash; /* maps surface ids -> drawablePrivs */
+static Bool DRIFreePixmapImp(DrawablePtr pDrawable);
+
/* FIXME: don't hardcode this? */
#define CG_INFO_FILE "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Resources/Info-macos.plist"
@@ -90,6 +97,18 @@ static x_hash_table *surface_hash; /* maps surface ids -> drawablePrivs */
#define CG_REQUIRED_MINOR 157
#define CG_REQUIRED_MICRO 11
+typedef struct {
+ DrawablePtr pDrawable;
+ int refCount;
+ int bytesPerPixel;
+ int width;
+ int height;
+ char shmPath[PATH_MAX];
+ int fd; /* From shm_open (for now) */
+ size_t length; /* length of buffer */
+ void *buffer;
+} DRIPixmapBuffer, *DRIPixmapBufferPtr;
+
/* Returns version as major.minor.micro in 10.10.10 fixed form */
static unsigned int
get_cg_version (void)
@@ -241,7 +260,7 @@ DRIFinishScreenInit(ScreenPtr pScreen)
// ErrorF("[DRI] screen %d installation complete\n", pScreen->myNum);
- return TRUE;
+ return DRIWrapInit(pScreen);
}
void
@@ -408,7 +427,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
return pDRIDrawablePriv;
}
-/* Return FALSE if an error occurs. */
+/* Return NULL if an error occurs. */
static DRIDrawablePrivPtr
CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
DRIDrawablePrivPtr pDRIDrawablePriv;
@@ -417,7 +436,6 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
if (pDRIDrawablePriv == NULL) {
xp_error err;
- xp_window_changes wc;
/* allocate a DRI Window Private record */
if (!(pDRIDrawablePriv = xcalloc(1, sizeof(*pDRIDrawablePriv)))) {
@@ -439,18 +457,10 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
return NULL;
}
- wc.x = 0;
- wc.y = 0;
- wc.width = pPix->drawable.width;
- wc.height = pPix->drawable.height;
-
- err = xp_configure_surface(pDRIDrawablePriv->sid, XP_BOUNDS, &wc);
-
- if(err != Success) {
- xp_destroy_surface(pDRIDrawablePriv->sid);
- xfree(pDRIDrawablePriv);
- return NULL;
- }
+ /*
+ * The DRIUpdateSurface will be called to resize the surface
+ * after this function, if the export is successful.
+ */
/* save private off of preallocated index */
dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey,
@@ -491,21 +501,39 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
/* NOT_DONE */
return FALSE;
}
-
-
+
/* Finish initialization of new surfaces */
if (pDRIDrawablePriv->refCount == 0) {
unsigned int key[2] = {0};
xp_error err;
/* try to give the client access to the surface */
- if (client_id != 0 && wid != 0) {
+ if (client_id != 0) {
+ /*
+ * Xplugin accepts a 0 wid if the surface id is offscreen, such
+ * as for a pixmap.
+ */
err = xp_export_surface(wid, pDRIDrawablePriv->sid,
client_id, key);
if (err != Success) {
xp_destroy_surface(pDRIDrawablePriv->sid);
xfree(pDRIDrawablePriv);
+
+ /*
+ * Now set the dix privates to NULL that were previously set.
+ * This prevents reusing an invalid pointer.
+ */
+ if(pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr)pDrawable;
+
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
+ } else if(pDrawable->type == DRAWABLE_PIXMAP) {
+ PixmapPtr pPix = (PixmapPtr)pDrawable;
+
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL);
+ }
+
return FALSE;
}
}
@@ -591,8 +619,9 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix);
}
- if (pDRIDrawablePriv == NULL)
- return FALSE;
+ if (pDRIDrawablePriv == NULL) {
+ return DRIFreePixmapImp(pDrawable);
+ }
if (pDRIDrawablePriv->drawableIndex != -1) {
/* release drawable table entry */
@@ -785,3 +814,139 @@ DRISurfaceNotify(xp_surface_id id, int kind)
DRIDrawablePrivResType, FALSE);
}
}
+
+Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
+ DrawablePtr pDrawable, char *path,
+ size_t pathmax)
+{
+ DRIPixmapBufferPtr shared;
+ PixmapPtr pPix;
+
+ if(pDrawable->type != DRAWABLE_PIXMAP)
+ return FALSE;
+
+ pPix = (PixmapPtr)pDrawable;
+
+ shared = xalloc(sizeof(*shared));
+ if(NULL == shared) {
+ FatalError("failed to allocate DRIPixmapBuffer in %s\n", __func__);
+ }
+
+ shared->pDrawable = pDrawable;
+ shared->refCount = 1;
+
+ if(pDrawable->bitsPerPixel >= 24) {
+ shared->bytesPerPixel = 4;
+ } else if(pDrawable->bitsPerPixel <= 16) {
+ shared->bytesPerPixel = 2;
+ }
+
+ shared->width = pDrawable->width;
+ shared->height = pDrawable->height;
+
+ if(-1 == snprintf(shared->shmPath, sizeof(shared->shmPath),
+ "%d_0x%lx", getpid(),
+ (unsigned long)id)) {
+ FatalError("buffer overflow in %s\n", __func__);
+ }
+
+ shared->fd = shm_open(shared->shmPath,
+ O_RDWR | O_EXCL | O_CREAT,
+ S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH);
+
+ if(-1 == shared->fd) {
+ xfree(shared);
+ return FALSE;
+ }
+
+ shared->length = shared->width * shared->height * shared->bytesPerPixel;
+
+ if(-1 == ftruncate(shared->fd, shared->length)) {
+ ErrorF("failed to ftruncate (extend) file.");
+ shm_unlink(shared->shmPath);
+ close(shared->fd);
+ xfree(shared);
+ return FALSE;
+ }
+
+ shared->buffer = mmap(NULL, shared->length,
+ PROT_READ | PROT_WRITE,
+ MAP_FILE | MAP_SHARED, shared->fd, 0);
+
+ if(MAP_FAILED == shared->buffer) {
+ ErrorF("failed to mmap shared memory.");
+ shm_unlink(shared->shmPath);
+ close(shared->fd);
+ xfree(shared);
+ return FALSE;
+ }
+
+ strncpy(path, shared->shmPath, pathmax);
+ path[pathmax - 1] = '\0';
+
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, shared);
+
+ AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable);
+
+ return TRUE;
+}
+
+
+Bool DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height,
+ int *pitch, int *bpp, void **ptr) {
+ PixmapPtr pPix;
+ DRIPixmapBufferPtr shared;
+
+ if(pDrawable->type != DRAWABLE_PIXMAP)
+ return FALSE;
+
+ pPix = (PixmapPtr)pDrawable;
+
+ shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey);
+
+ if(NULL == shared)
+ return FALSE;
+
+ assert(pDrawable->width == shared->width);
+ assert(pDrawable->height == shared->height);
+
+ *width = shared->width;
+ *height = shared->height;
+ *bpp = shared->bytesPerPixel;
+ *pitch = shared->width * shared->bytesPerPixel;
+ *ptr = shared->buffer;
+
+ return TRUE;
+}
+
+static Bool
+DRIFreePixmapImp(DrawablePtr pDrawable) {
+ DRIPixmapBufferPtr shared;
+ PixmapPtr pPix;
+
+ if(pDrawable->type != DRAWABLE_PIXMAP)
+ return FALSE;
+
+ pPix = (PixmapPtr)pDrawable;
+
+ shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey);
+
+ if(NULL == shared)
+ return FALSE;
+
+ close(shared->fd);
+ munmap(shared->buffer, shared->length);
+ shm_unlink(shared->shmPath);
+ xfree(shared);
+
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (pointer)NULL);
+
+ return TRUE;
+}
+
+void
+DRIDestroyPixmap(DrawablePtr pDrawable) {
+ if(DRIFreePixmapImp(pDrawable))
+ FreeResourceByType(pDrawable->id, DRIDrawablePrivResType, FALSE);
+
+}
diff --git a/xorg-server/hw/xquartz/xpr/dri.h b/xorg-server/hw/xquartz/xpr/dri.h
index 8bb2e9e80..48fea3668 100644
--- a/xorg-server/hw/xquartz/xpr/dri.h
+++ b/xorg-server/hw/xquartz/xpr/dri.h
@@ -1,7 +1,7 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright (c) 2002 Apple Computer, Inc.
+Copyright (c) 2002, 2009 Apple Computer, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -125,4 +125,14 @@ extern void DRIQueryVersion(int *majorVersion,
int *minorVersion,
int *patchVersion);
+extern Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
+ DrawablePtr pDrawable, char *path,
+ size_t pathmax);
+
+extern Bool DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height,
+ int *pitch, int *bpp, void **ptr);
+
+
+extern void DRIDestroyPixmap(DrawablePtr pDrawable);
+
#endif
diff --git a/xorg-server/hw/xquartz/xpr/driWrap.c b/xorg-server/hw/xquartz/xpr/driWrap.c
new file mode 100644
index 000000000..8c57fd4bd
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/driWrap.c
@@ -0,0 +1,547 @@
+/*
+Copyright (c) 2009 Apple Computer, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stddef.h>
+#include "mi.h"
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "dixfontstr.h"
+#include "mivalidate.h"
+#include "driWrap.h"
+#include "dri.h"
+
+#include <OpenGL/OpenGL.h>
+
+typedef struct {
+ GCOps *originalOps;
+ GCOps *driOps;
+} DRIGCRec;
+
+typedef struct {
+ GCOps *originalOps;
+ CreateGCProcPtr CreateGC;
+} DRIWrapScreenRec;
+
+typedef struct {
+ Bool didSave;
+ int devKind;
+ DevUnion devPrivate;
+} DRISavedDrawableState;
+
+static int driGCKeyIndex;
+static DevPrivateKey driGCKey = &driGCKeyIndex;
+
+static int driWrapScreenKeyIndex;
+static DevPrivateKey driWrapScreenKey = &driWrapScreenKeyIndex;
+
+static GCOps driGCOps;
+
+#define wrap(priv, real, member, func) { \
+ priv->member = real->member; \
+ real->member = func; \
+ }
+
+#define unwrap(priv, real, member) { \
+ real->member = priv->member; \
+ }
+
+static DRIGCRec *
+DRIGetGCPriv(GCPtr pGC) {
+ return dixLookupPrivate(&pGC->devPrivates, driGCKey);
+}
+
+static void
+DRIUnwrapGC(GCPtr pGC) {
+ DRIGCRec *pGCPriv = DRIGetGCPriv(pGC);
+
+ pGC->ops = pGCPriv->originalOps;
+}
+
+static void
+DRIWrapGC(GCPtr pGC) {
+ DRIGCRec *pGCPriv = DRIGetGCPriv(pGC);
+
+ pGC->ops = pGCPriv->driOps;
+}
+
+static void
+DRISurfaceSetDrawable(DrawablePtr pDraw,
+ DRISavedDrawableState *saved) {
+ saved->didSave = FALSE;
+
+ if(pDraw->type == DRAWABLE_PIXMAP) {
+ int pitch, width, height, bpp;
+ void *buffer;
+
+ if(DRIGetPixmapData(pDraw, &width, &height, &pitch, &bpp, &buffer)) {
+ PixmapPtr pPix = (PixmapPtr)pDraw;
+
+ saved->devKind = pPix->devKind;
+ saved->devPrivate.ptr = pPix->devPrivate.ptr;
+ saved->didSave = TRUE;
+
+ pPix->devKind = pitch;
+ pPix->devPrivate.ptr = buffer;
+ }
+ }
+}
+
+static void
+DRISurfaceRestoreDrawable(DrawablePtr pDraw,
+ DRISavedDrawableState *saved) {
+ PixmapPtr pPix = (PixmapPtr)pDraw;
+
+ if(!saved->didSave)
+ return;
+
+ pPix->devKind = saved->devKind;
+ pPix->devPrivate.ptr = saved->devPrivate.ptr;
+}
+
+static void
+DRIFillSpans(DrawablePtr dst, GCPtr pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit,
+ int sorted) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRISetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc,
+ DDXPointPtr pptInit, int *pwidthInit,
+ int nspans, int sorted) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit, nspans, sorted);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPutImage(DrawablePtr dst, GCPtr pGC,
+ int depth, int x, int y, int w, int h,
+ int leftPad, int format, char *pBits) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pBits);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static RegionPtr
+DRICopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC,
+ int srcx, int srcy, int w, int h,
+ int dstx, int dsty) {
+ RegionPtr pReg;
+ DRISavedDrawableState pSrcSaved, dstSaved;
+
+ DRISurfaceSetDrawable(pSrc, &pSrcSaved);
+ DRISurfaceSetDrawable(dst, &dstSaved);
+
+ DRIUnwrapGC(pGC);
+
+ pReg = pGC->ops->CopyArea(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(pSrc, &pSrcSaved);
+ DRISurfaceRestoreDrawable(dst, &dstSaved);
+
+ return pReg;
+}
+
+static RegionPtr
+DRICopyPlane(DrawablePtr pSrc, DrawablePtr dst,
+ GCPtr pGC, int srcx, int srcy,
+ int w, int h, int dstx, int dsty,
+ unsigned long plane) {
+ RegionPtr pReg;
+ DRISavedDrawableState pSrcSaved, dstSaved;
+
+ DRISurfaceSetDrawable(pSrc, &pSrcSaved);
+ DRISurfaceSetDrawable(dst, &dstSaved);
+
+
+ DRIUnwrapGC(pGC);
+
+ pReg = pGC->ops->CopyPlane(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty,
+ plane);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(pSrc, &pSrcSaved);
+ DRISurfaceRestoreDrawable(dst, &dstSaved);
+
+ return pReg;
+}
+
+static void
+DRIPolyPoint(DrawablePtr dst, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyPoint(dst, pGC, mode, npt, pptInit);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolylines(DrawablePtr dst, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->Polylines(dst, pGC, mode, npt, pptInit);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolySegment(DrawablePtr dst, GCPtr pGC,
+ int nseg, xSegment *pSeg) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolySegment(dst, pGC, nseg, pSeg);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolyRectangle(DrawablePtr dst, GCPtr pGC,
+ int nRects, xRectangle *pRects) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyRectangle(dst, pGC, nRects, pRects);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+static void
+DRIPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc *parcs) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyArc(dst, pGC, narcs, parcs);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIFillPolygon(DrawablePtr dst, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr pptInit) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolyFillRect(DrawablePtr dst, GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPolyFillArc(DrawablePtr dst, GCPtr pGC,
+ int narcsInit, xArc *parcsInit) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyFillArc(dst, pGC, narcsInit, parcsInit);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static int
+DRIPolyText8(DrawablePtr dst, GCPtr pGC,
+ int x, int y, int count, char *chars) {
+ int ret;
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ ret = pGC->ops->PolyText8(dst, pGC, x, y, count, chars);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+
+ return ret;
+}
+
+static int
+DRIPolyText16(DrawablePtr dst, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars) {
+ int ret;
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ ret = pGC->ops->PolyText16(dst, pGC, x, y, count, chars);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+
+ return ret;
+}
+
+static void
+DRIImageText8(DrawablePtr dst, GCPtr pGC,
+ int x, int y, int count, char *chars) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->ImageText8(dst, pGC, x, y, count, chars);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIImageText16(DrawablePtr dst, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->ImageText16(dst, pGC, x, y, count, chars);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
+ int x, int y, unsigned int nglyphInit,
+ CharInfoPtr *ppciInit, pointer unused) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyphInit, ppciInit, unused);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void DRIPolyGlyphBlt(DrawablePtr dst, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase) {
+ DRISavedDrawableState saved;
+
+ DRISurfaceSetDrawable(dst, &saved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PolyGlyphBlt(dst, pGC, x, y, nglyph, ppci, pglyphBase);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(dst, &saved);
+}
+
+static void
+DRIPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
+ int dx, int dy, int xOrg, int yOrg) {
+ DRISavedDrawableState bitMapSaved, dstSaved;
+
+ DRISurfaceSetDrawable(&pBitMap->drawable, &bitMapSaved);
+ DRISurfaceSetDrawable(dst, &dstSaved);
+
+ DRIUnwrapGC(pGC);
+
+ pGC->ops->PushPixels(pGC, pBitMap, dst, dx, dy, xOrg, yOrg);
+
+ DRIWrapGC(pGC);
+
+ DRISurfaceRestoreDrawable(&pBitMap->drawable, &bitMapSaved);
+ DRISurfaceRestoreDrawable(dst, &dstSaved);
+}
+
+
+static GCOps driGCOps = {
+ DRIFillSpans,
+ DRISetSpans,
+ DRIPutImage,
+ DRICopyArea,
+ DRICopyPlane,
+ DRIPolyPoint,
+ DRIPolylines,
+ DRIPolySegment,
+ DRIPolyRectangle,
+ DRIPolyArc,
+ DRIFillPolygon,
+ DRIPolyFillRect,
+ DRIPolyFillArc,
+ DRIPolyText8,
+ DRIPolyText16,
+ DRIImageText8,
+ DRIImageText16,
+ DRIImageGlyphBlt,
+ DRIPolyGlyphBlt,
+ DRIPushPixels
+};
+
+
+static Bool
+DRICreateGC(GCPtr pGC) {
+ ScreenPtr pScreen = pGC->pScreen;
+ DRIWrapScreenRec *pScreenPriv;
+ DRIGCRec *pGCPriv;
+ Bool ret;
+
+ pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, driWrapScreenKey);
+
+ pGCPriv = DRIGetGCPriv(pGC);
+
+ unwrap(pScreenPriv, pScreen, CreateGC);
+ ret = pScreen->CreateGC(pGC);
+
+ if(ret) {
+ pGCPriv->originalOps = pGC->ops;
+ pGC->ops = &driGCOps;
+ pGCPriv->driOps = &driGCOps;
+ }
+
+ wrap(pScreenPriv, pScreen, CreateGC, DRICreateGC);
+
+ return ret;
+}
+
+
+/* Return false if an error occurred. */
+Bool
+DRIWrapInit(ScreenPtr pScreen) {
+ DRIWrapScreenRec *pScreenPriv;
+
+ if(!dixRequestPrivate(driGCKey, sizeof(DRIGCRec)))
+ return FALSE;
+
+ if(!dixRequestPrivate(driWrapScreenKey, sizeof(DRIWrapScreenRec)))
+ return FALSE;
+
+ pScreenPriv = xalloc(sizeof(*pScreenPriv));
+
+ if(NULL == pScreenPriv)
+ return FALSE;
+
+ pScreenPriv->CreateGC = pScreen->CreateGC;
+ pScreen->CreateGC = DRICreateGC;
+
+ dixSetPrivate(&pScreen->devPrivates, driWrapScreenKey, pScreenPriv);
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xquartz/xpr/driWrap.h b/xorg-server/hw/xquartz/xpr/driWrap.h
new file mode 100644
index 000000000..d31d5ddaf
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/driWrap.h
@@ -0,0 +1,31 @@
+/*
+Copyright (c) 2009 Apple Computer, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef DRIWRAP_H
+#include "scrnintstr.h"
+
+Bool DRIWrapInit(ScreenPtr pScreen);
+
+#endif /*DRIWRAP_H*/
diff --git a/xorg-server/hw/xquartz/xpr/xpr.h b/xorg-server/hw/xquartz/xpr/xpr.h
index ab79a42cd..c657e1586 100644
--- a/xorg-server/hw/xquartz/xpr/xpr.h
+++ b/xorg-server/hw/xquartz/xpr/xpr.h
@@ -47,4 +47,18 @@ Bool QuartzInitCursor(ScreenPtr pScreen);
void QuartzSuspendXCursor(ScreenPtr pScreen);
void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);
+/* If we are rooted, we need the root window and desktop levels to be below
+ * the menubar (24) but above native windows. Normal window level is 0.
+ * Floating window level is 3. The rest are filled in as appropriate.
+ * See CGWindowLevel.h
+ */
+
+#include <X11/extensions/applewmconst.h>
+static const int normal_window_levels[AppleWMNumWindowLevels+1] = {
+0, 3, 4, 5, INT_MIN + 30, INT_MIN + 29,
+};
+static const int rooted_window_levels[AppleWMNumWindowLevels+1] = {
+20, 21, 22, 23, 19, 18,
+};
+
#endif /* XPR_H */
diff --git a/xorg-server/hw/xquartz/xpr/xprAppleWM.c b/xorg-server/hw/xquartz/xpr/xprAppleWM.c
index fae9a0422..4b31e3a11 100644
--- a/xorg-server/hw/xquartz/xpr/xprAppleWM.c
+++ b/xorg-server/hw/xquartz/xpr/xprAppleWM.c
@@ -33,41 +33,41 @@
#include "xpr.h"
-#define _APPLEWM_SERVER_
-#include <X11/extensions/applewmstr.h>
+#include <X11/extensions/applewmproto.h>
#include "applewmExt.h"
#include "rootless.h"
+#include "rootlessCommon.h"
#include <Xplugin.h>
#include <X11/X.h>
#include "quartz.h"
#include "x-hash.h"
-/* This lookup table came straight from the Tiger X11 source. I tried to figure
- * it out based on CGWindowLevel.h, but I dunno... -JH
- */
-static const int normal_window_levels[AppleWMNumWindowLevels+1] = {
-0, 3, 4, 5, INT_MIN + 30, INT_MIN + 29,
-};
-static const int rooted_window_levels[AppleWMNumWindowLevels+1] = {
-202, 203, 204, 205, 201, 200
-};
-
static int xprSetWindowLevel(
WindowPtr pWin,
int level)
{
xp_window_id wid;
xp_window_changes wc;
+ RootlessWindowRec *winRec;
+ // AppleWMNumWindowLevels is allowed, but is only set by the server
+ // for the root window.
+ if (level < 0 || level >= AppleWMNumWindowLevels) {
+ return BadValue;
+ }
+
wid = x_cvt_vptr_to_uint(RootlessFrameForWindow (pWin, TRUE));
if (wid == 0)
return BadWindow;
RootlessStopDrawing (pWin, FALSE);
-
- //if (WINREC(WindowTable[pWin->drawable.pScreen->myNum]) == NULL)
- if (quartzHasRoot)
+ winRec = WINREC(pWin);
+
+ if(!winRec)
+ return BadWindow;
+
+ if(quartzEnableRootless)
wc.window_level = normal_window_levels[level];
else
wc.window_level = rooted_window_levels[level];
@@ -76,9 +76,39 @@ static int xprSetWindowLevel(
return BadValue;
}
+ winRec->level = level;
+
return Success;
}
+#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 3
+static int xprAttachTransient(WindowPtr pWinChild, WindowPtr pWinParent) {
+ xp_window_id child_wid, parent_wid;
+ xp_window_changes wc;
+
+ child_wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWinChild, TRUE));
+ if (child_wid == 0)
+ return BadWindow;
+
+ if(pWinParent) {
+ parent_wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWinParent, TRUE));
+ if (parent_wid == 0)
+ return BadWindow;
+ } else {
+ parent_wid = 0;
+ }
+
+ wc.transient_for = parent_wid;
+
+ RootlessStopDrawing (pWinChild, FALSE);
+
+ if (xp_configure_window(child_wid, XP_ATTACH_TRANSIENT, &wc) != Success) {
+ return BadValue;
+ }
+
+ return Success;
+}
+#endif
static int xprFrameDraw(
WindowPtr pWin,
@@ -104,14 +134,23 @@ static int xprFrameDraw(
return Success;
}
-
static AppleWMProcsRec xprAppleWMProcs = {
xp_disable_update,
xp_reenable_update,
xprSetWindowLevel,
xp_frame_get_rect,
xp_frame_hit_test,
- xprFrameDraw
+ xprFrameDraw,
+#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 3
+ xp_set_dock_proxy,
+ xprAttachTransient
+#elif defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 2
+ xp_set_dock_proxy,
+ NULL
+#else
+ NULL,
+ NULL
+#endif
};
diff --git a/xorg-server/hw/xquartz/xpr/xprCursor.c b/xorg-server/hw/xquartz/xpr/xprCursor.c
index 4345beea4..8c47b671c 100644
--- a/xorg-server/hw/xquartz/xpr/xprCursor.c
+++ b/xorg-server/hw/xquartz/xpr/xprCursor.c
@@ -128,7 +128,7 @@ load_cursor(CursorPtr src, int screen)
while (ycount-- > 0)
{
- xcount = (src->bits->width + 7) / 8;
+ xcount = bits_to_bytes(src->bits->width);
sptr = srow; mptr = mrow;
dptr = drow;
diff --git a/xorg-server/hw/xquartz/xpr/xprEvent.c b/xorg-server/hw/xquartz/xpr/xprEvent.c
index 08581c0e3..f8e985aba 100644
--- a/xorg-server/hw/xquartz/xpr/xprEvent.c
+++ b/xorg-server/hw/xquartz/xpr/xprEvent.c
@@ -32,7 +32,6 @@
#include "xpr.h"
-#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
diff --git a/xorg-server/hw/xquartz/xpr/xprFrame.c b/xorg-server/hw/xquartz/xpr/xprFrame.c
index 9a143ade0..6635f08d8 100644
--- a/xorg-server/hw/xquartz/xpr/xprFrame.c
+++ b/xorg-server/hw/xquartz/xpr/xprFrame.c
@@ -42,6 +42,7 @@
#include "dix.h"
#include <X11/Xatom.h>
#include "windowstr.h"
+#include "quartz.h"
#include "threadSafety.h"
@@ -120,7 +121,7 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
/*
* Create and display a new frame.
*/
-Bool
+static Bool
xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
int newX, int newY, RegionPtr pShape)
{
@@ -161,6 +162,14 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
mask |= XP_SHAPE;
}
+ pFrame->level = !IsRoot (pWin) ? AppleWMWindowLevelNormal : AppleWMNumWindowLevels;
+
+ if(quartzEnableRootless)
+ wc.window_level = normal_window_levels[pFrame->level];
+ else
+ wc.window_level = rooted_window_levels[pFrame->level];
+ mask |= XP_WINDOW_LEVEL;
+
err = xp_create_window(mask, &wc, (xp_window_id *) &pFrame->wid);
if (err != Success)
@@ -187,7 +196,7 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
/*
* Destroy a frame.
*/
-void
+static void
xprDestroyFrame(RootlessFrameID wid)
{
TA_SERVER();
@@ -203,7 +212,7 @@ xprDestroyFrame(RootlessFrameID wid)
/*
* Move a frame on screen.
*/
-void
+static void
xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
{
TA_SERVER();
@@ -220,7 +229,7 @@ xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
/*
* Resize and move a frame.
*/
-void
+static void
xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
int newX, int newY, unsigned int newW, unsigned int newH,
unsigned int gravity)
@@ -245,35 +254,43 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
/*
* Change frame stacking.
*/
-void
-xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
-{
+static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
xp_window_changes wc;
+ unsigned int mask = XP_STACKING;
TA_SERVER();
- /* Stack frame below nextWid it if it exists, or raise
+ /* Stack frame below nextWid it if it exists, or raise
frame above everything otherwise. */
- if (nextWid == NULL)
- {
+ if(nextWid == NULL) {
wc.stack_mode = XP_MAPPED_ABOVE;
wc.sibling = 0;
- }
- else
- {
+ } else {
wc.stack_mode = XP_MAPPED_BELOW;
wc.sibling = x_cvt_vptr_to_uint(nextWid);
}
- xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_STACKING, &wc);
+ if(window_hash) {
+ RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr((xp_window_id)wid), NULL);
+
+ if(winRec) {
+ if(quartzEnableRootless)
+ wc.window_level = normal_window_levels[winRec->level];
+ else
+ wc.window_level = rooted_window_levels[winRec->level];
+ mask |= XP_WINDOW_LEVEL;
+ }
+ }
+
+ xprConfigureWindow(x_cvt_vptr_to_uint(wid), mask, &wc);
}
/*
* Change the frame's shape.
*/
-void
+static void
xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
{
xp_window_changes wc;
@@ -300,7 +317,7 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
/*
* Unmap a frame.
*/
-void
+static void
xprUnmapFrame(RootlessFrameID wid)
{
xp_window_changes wc;
@@ -318,7 +335,7 @@ xprUnmapFrame(RootlessFrameID wid)
* Start drawing to a frame.
* Prepare for direct access to its backing buffer.
*/
-void
+static void
xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
{
void *data[2];
@@ -339,7 +356,7 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
/*
* Stop drawing to a frame.
*/
-void
+static void
xprStopDrawing(RootlessFrameID wid, Bool flush)
{
TA_SERVER();
@@ -351,7 +368,7 @@ xprStopDrawing(RootlessFrameID wid, Bool flush)
/*
* Flush drawing updates to the screen.
*/
-void
+static void
xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
{
TA_SERVER();
@@ -363,7 +380,7 @@ xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
/*
* Mark damaged rectangles as requiring redisplay to screen.
*/
-void
+static void
xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
int shift_x, int shift_y)
{
@@ -377,7 +394,7 @@ xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
* Called after the window associated with a frame has been switched
* to a new top-level parent.
*/
-void
+static void
xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
{
DeleteProperty(serverClient, oldWin, xa_native_window_id());
@@ -391,7 +408,7 @@ xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
/*
* Called to check if the frame should be reordered when it is restacked.
*/
-Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
+static Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
{
WindowPtr pWin = pFrame->win;
@@ -405,7 +422,7 @@ Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
* Copy area in frame to another part of frame.
* Used to accelerate scrolling.
*/
-void
+static void
xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
int dx, int dy)
{
@@ -473,6 +490,7 @@ xprGetXWindow(xp_window_id wid)
return winRec != NULL ? winRec->win : NULL;
}
+#ifdef UNUSED_CODE
/*
* Given the id of a physical window, try to find the top-level (or root)
* X window that it represents.
@@ -503,7 +521,7 @@ xprGetXWindowFromAppKit(int windowNumber)
return winRec != NULL ? winRec->win : NULL;
}
-
+#endif
/*
* The windowNumber is an AppKit window number. Returns TRUE if xpr is
diff --git a/xorg-server/hw/xquartz/xpr/xprScreen.c b/xorg-server/hw/xquartz/xpr/xprScreen.c
index da262f654..3387ecf0a 100644
--- a/xorg-server/hw/xquartz/xpr/xprScreen.c
+++ b/xorg-server/hw/xquartz/xpr/xprScreen.c
@@ -48,6 +48,8 @@
#include "applewmExt.h"
#include "micmap.h"
+#include "rootlessCommon.h"
+
#ifdef DAMAGE
# include "damage.h"
#endif
@@ -256,6 +258,9 @@ xprDisplayInit(void)
AppleDRIExtensionInit();
xprAppleWMInit();
+
+ if (!quartzEnableRootless)
+ RootlessHideAllWindows();
}
/*
@@ -272,22 +277,9 @@ xprAddScreen(int index, ScreenPtr pScreen)
if(depth == -1) {
depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
- //dfb->depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
- //dfb->bitsPerRGB = CGDisplayBitsPerSample(kCGDirectMainDisplay);
- //dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
}
switch(depth) {
-// case -8: // broken
-// dfb->visuals = (1 << StaticGray) | (1 << GrayScale);
-// dfb->preferredCVC = GrayScale;
-// dfb->depth = 8;
-// dfb->bitsPerRGB = 8;
-// dfb->bitsPerPixel = 8;
-// dfb->redMask = 0;
-// dfb->greenMask = 0;
-// dfb->blueMask = 0;
-// break;
case 8: // pseudo-working
dfb->visuals = PseudoColorMask;
dfb->preferredCVC = PseudoColor;
@@ -299,27 +291,27 @@ xprAddScreen(int index, ScreenPtr pScreen)
dfb->blueMask = 0;
break;
case 15:
- dfb->visuals = LARGE_VISUALS;
+ dfb->visuals = TrueColorMask; //LARGE_VISUALS;
dfb->preferredCVC = TrueColor;
dfb->depth = 15;
dfb->bitsPerRGB = 5;
dfb->bitsPerPixel = 16;
- dfb->redMask = 0x7c00;
- dfb->greenMask = 0x03e0;
- dfb->blueMask = 0x001f;
+ dfb->redMask = RM_ARGB(0,5,5,5);
+ dfb->greenMask = GM_ARGB(0,5,5,5);
+ dfb->blueMask = BM_ARGB(0,5,5,5);
break;
// case 24:
default:
if(depth != 24)
ErrorF("Unsupported color depth requested. Defaulting to 24bit. (depth=%d darwinDesiredDepth=%d CGDisplaySamplesPerPixel=%d CGDisplayBitsPerSample=%d)\n", darwinDesiredDepth, depth, (int)CGDisplaySamplesPerPixel(kCGDirectMainDisplay), (int)CGDisplayBitsPerSample(kCGDirectMainDisplay));
- dfb->visuals = LARGE_VISUALS;
+ dfb->visuals = TrueColorMask; //LARGE_VISUALS;
dfb->preferredCVC = TrueColor;
dfb->depth = 24;
dfb->bitsPerRGB = 8;
dfb->bitsPerPixel = 32;
- dfb->redMask = 0x00ff0000;
- dfb->greenMask = 0x0000ff00;
- dfb->blueMask = 0x000000ff;
+ dfb->redMask = RM_ARGB(0,8,8,8);
+ dfb->greenMask = GM_ARGB(0,8,8,8);
+ dfb->blueMask = BM_ARGB(0,8,8,8);
break;
}