diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-06-07 17:28:57 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-06-07 17:28:57 +0000 |
commit | c0190187060808fe0ad2a09b31f4244757572ff9 (patch) | |
tree | b028697436476ae3ff34218b0b233a233d8a7818 /xserver/hw/kdrive/ephyr | |
parent | 33eda071f5846d332b428de759c5b1649e9cf1ba (diff) |
Update to X server 1.14.1. Tested by many during t2k13. Thanks.
Diffstat (limited to 'xserver/hw/kdrive/ephyr')
-rw-r--r-- | xserver/hw/kdrive/ephyr/Makefile.am | 1 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/Makefile.in | 17 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/XF86dri.c | 18 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/ephyr.c | 119 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/ephyrdriext.c | 154 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/ephyrglxext.c | 271 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/ephyrhostglx.c | 131 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/ephyrhostglx.h | 9 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/ephyrhostproxy.c | 2 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/ephyrhostvideo.c | 4 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/ephyrinit.c | 2 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/ephyrproxyext.c | 2 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/ephyrvideo.c | 2 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/hostx.c | 40 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/hostx.h | 10 | ||||
-rw-r--r-- | xserver/hw/kdrive/ephyr/man/Makefile.in | 16 |
16 files changed, 528 insertions, 270 deletions
diff --git a/xserver/hw/kdrive/ephyr/Makefile.am b/xserver/hw/kdrive/ephyr/Makefile.am index 9d9b64ee5..2e0613a7c 100644 --- a/xserver/hw/kdrive/ephyr/Makefile.am +++ b/xserver/hw/kdrive/ephyr/Makefile.am @@ -5,7 +5,6 @@ INCLUDES = \ @KDRIVE_CFLAGS@ \ @XEPHYR_INCS@ \ @XEPHYR_CFLAGS@ \ - @DRIPROTO_CFLAGS@ \ -I$(top_srcdir) \ -I$(top_srcdir)/exa diff --git a/xserver/hw/kdrive/ephyr/Makefile.in b/xserver/hw/kdrive/ephyr/Makefile.in index 9bf196ee8..89a4ef49b 100644 --- a/xserver/hw/kdrive/ephyr/Makefile.in +++ b/xserver/hw/kdrive/ephyr/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -254,13 +254,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -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@ @@ -282,6 +278,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -306,6 +303,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -321,7 +319,6 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ @@ -420,6 +417,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -525,7 +523,6 @@ INCLUDES = \ @KDRIVE_CFLAGS@ \ @XEPHYR_INCS@ \ @XEPHYR_CFLAGS@ \ - @DRIPROTO_CFLAGS@ \ -I$(top_srcdir) \ -I$(top_srcdir)/exa @@ -592,7 +589,7 @@ all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -617,9 +614,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): diff --git a/xserver/hw/kdrive/ephyr/XF86dri.c b/xserver/hw/kdrive/ephyr/XF86dri.c index 74bf67678..9d742f394 100644 --- a/xserver/hw/kdrive/ephyr/XF86dri.c +++ b/xserver/hw/kdrive/ephyr/XF86dri.c @@ -151,7 +151,7 @@ XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion, GetReq(XF86DRIQueryVersion, req); req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRIQueryVersion; - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("QueryVersion... return False"); @@ -181,7 +181,7 @@ XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen, Bool *isCapable) req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRIQueryDirectRenderingCapable; req->screen = screen; - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("QueryDirectRenderingCapable... return False"); @@ -210,7 +210,7 @@ XF86DRIOpenConnection(Display * dpy, int screen, req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRIOpenConnection; req->screen = screen; - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("OpenConnection... return False"); @@ -260,7 +260,7 @@ XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic) req->screen = screen; req->magic = magic; rep.authenticated = 0; - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) { + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse) || !rep.authenticated) { UnlockDisplay(dpy); SyncHandle(); TRACE("AuthConnection... return False"); @@ -311,7 +311,7 @@ XF86DRIGetClientDriverName(Display * dpy, int screen, req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRIGetClientDriverName; req->screen = screen; - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("GetClientDriverName... return False"); @@ -362,7 +362,7 @@ XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID, req->screen = screen; *context = XAllocID(dpy); req->context = *context; - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("CreateContext... return False"); @@ -421,7 +421,7 @@ XF86DRICreateDrawable(Display * dpy, int screen, req->driReqType = X_XF86DRICreateDrawable; req->screen = screen; req->drawable = drawable; - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("CreateDrawable... return False"); @@ -503,7 +503,7 @@ XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, req->screen = screen; req->drawable = drawable; - if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) { + if (!_XReply(dpy, (xReply *) &rep, 1, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("GetDrawableInfo... return False"); @@ -585,7 +585,7 @@ XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer, req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRIGetDeviceInfo; req->screen = screen; - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("GetDeviceInfo... return False"); diff --git a/xserver/hw/kdrive/ephyr/ephyr.c b/xserver/hw/kdrive/ephyr/ephyr.c index 8eda539aa..e6520d035 100644 --- a/xserver/hw/kdrive/ephyr/ephyr.c +++ b/xserver/hw/kdrive/ephyr/ephyr.c @@ -42,10 +42,6 @@ extern int KdTsPhyScreen; -#ifdef GLXEXT -extern Bool noGlxVisualInit; -#endif - KdKeyboardInfo *ephyrKbd; KdPointerInfo *ephyrMouse; EphyrKeySyms ephyrKeySyms; @@ -419,23 +415,22 @@ ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations) struct { int width, height; } sizes[] = { - { - 1600, 1200}, { - 1400, 1050}, { - 1280, 960}, { - 1280, 1024}, { - 1152, 864}, { - 1024, 768}, { - 832, 624}, { - 800, 600}, { - 720, 400}, { - 480, 640}, { - 640, 480}, { - 640, 400}, { - 320, 240}, { - 240, 320}, { - 160, 160}, { - 0, 0} + {1600, 1200}, + {1400, 1050}, + {1280, 960}, + {1280, 1024}, + {1152, 864}, + {1024, 768}, + {832, 624}, + {800, 600}, + {720, 400}, + {480, 640}, + {640, 480}, + {640, 400}, + {320, 240}, + {240, 320}, + {160, 160}, + {0, 0} }; EPHYR_LOG("mark"); @@ -562,6 +557,8 @@ ephyrRandRSetConfig(ScreenPtr pScreen, if (wasEnabled) KdEnableScreen(pScreen); + RRScreenSizeNotify(pScreen); + return TRUE; bail4: @@ -594,6 +591,43 @@ ephyrRandRInit(ScreenPtr pScreen) pScrPriv->rrSetConfig = ephyrRandRSetConfig; return TRUE; } + +static Bool +ephyrResizeScreen (ScreenPtr pScreen, + int newwidth, + int newheight) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + RRScreenSize size = {0}; + Bool ret; + int t; + + if (screen->randr & (RR_Rotate_90|RR_Rotate_270)) { + t = newwidth; + newwidth = newheight; + newheight = t; + } + + if (newwidth == screen->width && newheight == screen->height) { + return FALSE; + } + + size.width = newwidth; + size.height = newheight; + + ret = ephyrRandRSetConfig (pScreen, screen->randr, 0, &size); + if (ret) { + RROutputPtr output; + + output = RRFirstOutput(pScreen); + if (!output) + return FALSE; + RROutputSetModes(output, NULL, 0, 0); + } + + return ret; +} #endif Bool @@ -624,12 +658,9 @@ ephyrInitScreen(ScreenPtr pScreen) } #endif /*XV*/ #ifdef XF86DRI - if (!ephyrNoDRI && !hostx_has_dri()) { + if (!ephyrNoDRI && !hostx_has_dri()) { EPHYR_LOG("host x does not support DRI. Disabling DRI forwarding\n"); ephyrNoDRI = TRUE; -#ifdef GLXEXT - noGlxVisualInit = FALSE; -#endif } if (!ephyrNoDRI) { ephyrDRIExtensionInit(pScreen); @@ -637,12 +668,6 @@ ephyrInitScreen(ScreenPtr pScreen) } #endif -#ifdef GLXEXT - if (ephyrNoDRI) { - noGlxVisualInit = FALSE; - } -#endif - return TRUE; } @@ -772,26 +797,6 @@ ephyrUpdateModifierState(unsigned int state) } } -static void -ephyrBlockSigio(void) -{ - sigset_t set; - - sigemptyset(&set); - sigaddset(&set, SIGIO); - sigprocmask(SIG_BLOCK, &set, 0); -} - -static void -ephyrUnblockSigio(void) -{ - sigset_t set; - - sigemptyset(&set); - sigaddset(&set, SIGIO); - sigprocmask(SIG_UNBLOCK, &set, 0); -} - static Bool ephyrCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) { @@ -808,11 +813,11 @@ int ephyrCurScreen; /*current event screen */ static void ephyrWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { - ephyrBlockSigio(); + OsBlockSIGIO(); ephyrCurScreen = pScreen->myNum; miPointerWarpCursor(inputInfo.pointer, pScreen, x, y); - ephyrUnblockSigio(); + OsReleaseSIGIO(); } miPointerScreenFuncRec ephyrPointerScreenFuncs = { @@ -963,6 +968,14 @@ ephyrPoll(void) break; #endif /* XF86DRI */ +#ifdef RANDR + case EPHYR_EV_CONFIGURE: + ephyrResizeScreen(screenInfo.screens[ev.data.configure.screen], + ev.data.configure.width, + ev.data.configure.height); + break; +#endif /* RANDR */ + default: break; } diff --git a/xserver/hw/kdrive/ephyr/ephyrdriext.c b/xserver/hw/kdrive/ephyr/ephyrdriext.c index 28486f516..144c6e1ac 100644 --- a/xserver/hw/kdrive/ephyr/ephyrdriext.c +++ b/xserver/hw/kdrive/ephyr/ephyrdriext.c @@ -517,18 +517,19 @@ EphyrMirrorHostVisuals(ScreenPtr a_screen) static int ProcXF86DRIQueryVersion(register ClientPtr client) { - xXF86DRIQueryVersionReply rep; + xXF86DRIQueryVersionReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .majorVersion = SERVER_XF86DRI_MAJOR_VERSION, + .minorVersion = SERVER_XF86DRI_MINOR_VERSION, + .patchVersion = SERVER_XF86DRI_PATCH_VERSION + }; REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq); EPHYR_LOG("enter\n"); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION; - rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION; - rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -536,7 +537,7 @@ ProcXF86DRIQueryVersion(register ClientPtr client) swaps(&rep.minorVersion); swapl(&rep.patchVersion); } - WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), &rep); EPHYR_LOG("leave\n"); return Success; } @@ -556,17 +557,19 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - if (!ephyrDRIQueryDirectRenderingCapable(stuff->screen, &isCapable)) { return BadValue; } - rep.isCapable = isCapable; - if (!LocalClient(client) || client->swapped) - rep.isCapable = 0; + if (!client->local || client->swapped) + isCapable = 0; + + rep = (xXF86DRIQueryDirectRenderingCapableReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .isCapable = isCapable + }; if (client->swapped) { swaps(&rep.sequenceNumber); @@ -574,7 +577,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client) } WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply), - (char *) &rep); + &rep); EPHYR_LOG("leave\n"); return Success; @@ -586,6 +589,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client) xXF86DRIOpenConnectionReply rep; drm_handle_t hSAREA; char *busIdString = NULL; + CARD32 busIdStringLength = 0; REQUEST(xXF86DRIOpenConnectionReq); REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq); @@ -600,26 +604,27 @@ ProcXF86DRIOpenConnection(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.busIdStringLength = 0; if (busIdString) - rep.busIdStringLength = strlen(busIdString); - rep.length = - bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) - - SIZEOF(xGenericReply) + - pad_to_int32(rep.busIdStringLength)); - - rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff); + busIdStringLength = strlen(busIdString); + + rep = (xXF86DRIOpenConnectionReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) - + SIZEOF(xGenericReply) + + pad_to_int32(busIdStringLength)), + .hSAREALow = (CARD32) (hSAREA & 0xffffffff), #if defined(LONG64) && !defined(__linux__) - rep.hSAREAHigh = (CARD32) (hSAREA >> 32); + .hSAREAHigh = (CARD32) (hSAREA >> 32), #else - rep.hSAREAHigh = 0; + .hSAREAHigh = 0, #endif + .busIdStringLength = busIdStringLength + }; - WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *) &rep); - if (rep.busIdStringLength) - WriteToClient(client, rep.busIdStringLength, busIdString); + WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep); + if (busIdStringLength) + WriteToClient(client, busIdStringLength, busIdString); free(busIdString); EPHYR_LOG("leave\n"); return Success; @@ -639,16 +644,18 @@ ProcXF86DRIAuthConnection(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.authenticated = 1; + rep = (xXF86DRIAuthConnectionReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .authenticated = 1 + }; if (!ephyrDRIAuthConnection(stuff->screen, stuff->magic)) { ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic); rep.authenticated = 0; } - WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), &rep); EPHYR_LOG("leave\n"); return Success; } @@ -675,7 +682,11 @@ ProcXF86DRICloseConnection(register ClientPtr client) static int ProcXF86DRIGetClientDriverName(register ClientPtr client) { - xXF86DRIGetClientDriverNameReply rep; + xXF86DRIGetClientDriverNameReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .clientDriverNameLength = 0 + }; char *clientDriverName; REQUEST(xXF86DRIGetClientDriverNameReq); @@ -692,18 +703,13 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client) (int *) &rep.ddxDriverMinorVersion, (int *) &rep.ddxDriverPatchVersion, &clientDriverName); - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.clientDriverNameLength = 0; if (clientDriverName) rep.clientDriverNameLength = strlen(clientDriverName); rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) - SIZEOF(xGenericReply) + pad_to_int32(rep.clientDriverNameLength)); - WriteToClient(client, - sizeof(xXF86DRIGetClientDriverNameReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRIGetClientDriverNameReply), &rep); if (rep.clientDriverNameLength) WriteToClient(client, rep.clientDriverNameLength, clientDriverName); EPHYR_LOG("leave\n"); @@ -713,7 +719,11 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client) static int ProcXF86DRICreateContext(register ClientPtr client) { - xXF86DRICreateContextReply rep; + xXF86DRICreateContextReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; ScreenPtr pScreen; VisualPtr visual; int i = 0; @@ -728,10 +738,6 @@ ProcXF86DRICreateContext(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - pScreen = screenInfo.screens[stuff->screen]; visual = pScreen->visuals; @@ -748,11 +754,11 @@ ProcXF86DRICreateContext(register ClientPtr client) if (!ephyrDRICreateContext(stuff->screen, stuff->visual, &context_id, - (drm_context_t *) & rep.hHWContext)) { + (drm_context_t *) &rep.hHWContext)) { return BadValue; } - WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRICreateContextReply), &rep); EPHYR_LOG("leave\n"); return Success; } @@ -916,7 +922,11 @@ destroyHostPeerWindow(const WindowPtr a_win) static int ProcXF86DRICreateDrawable(ClientPtr client) { - xXF86DRICreateDrawableReply rep; + xXF86DRICreateDrawableReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; DrawablePtr drawable = NULL; WindowPtr window = NULL; EphyrWindowPair *pair = NULL; @@ -932,10 +942,6 @@ ProcXF86DRICreateDrawable(ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0, DixReadAccess); if (rc != Success) @@ -958,7 +964,7 @@ ProcXF86DRICreateDrawable(ClientPtr client) if (!ephyrDRICreateDrawable(stuff->screen, remote_win, - (drm_drawable_t *) & rep.hHWDrawable)) { + (drm_drawable_t *) &rep.hHWDrawable)) { EPHYR_LOG_ERROR("failed to create dri drawable\n"); return BadValue; } @@ -974,7 +980,7 @@ ProcXF86DRICreateDrawable(ClientPtr client) EPHYR_LOG("paired window '%p' with remote '%d'\n", window, remote_win); } - WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), &rep); EPHYR_LOG("leave\n"); return Success; } @@ -1024,7 +1030,11 @@ ProcXF86DRIDestroyDrawable(register ClientPtr client) static int ProcXF86DRIGetDrawableInfo(register ClientPtr client) { - xXF86DRIGetDrawableInfoReply rep; + xXF86DRIGetDrawableInfoReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; DrawablePtr drawable; WindowPtr window = NULL; EphyrWindowPair *pair = NULL; @@ -1036,16 +1046,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client) REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq); EPHYR_LOG("enter\n"); - memset(&rep, 0, sizeof(rep)); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0, DixReadAccess); if (rc != Success || !drawable) { @@ -1136,18 +1141,18 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client) rep.length = bytes_to_int32(rep.length); - WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), &rep); if (rep.numClipRects) { WriteToClient(client, sizeof(drm_clip_rect_t) * rep.numClipRects, - (char *) clipRects); + clipRects); } if (rep.numBackClipRects) { WriteToClient(client, sizeof(drm_clip_rect_t) * rep.numBackClipRects, - (char *) backClipRects); + backClipRects); } free(clipRects); clipRects = NULL; @@ -1160,7 +1165,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client) static int ProcXF86DRIGetDeviceInfo(register ClientPtr client) { - xXF86DRIGetDeviceInfoReply rep; + xXF86DRIGetDeviceInfoReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; drm_handle_t hFrameBuffer; void *pDevPrivate; @@ -1173,10 +1182,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client) return BadValue; } - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - if (!ephyrDRIGetDeviceInfo(stuff->screen, &hFrameBuffer, (int *) &rep.framebufferOrigin, @@ -1193,16 +1198,15 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client) rep.hFrameBufferHigh = 0; #endif - rep.length = 0; if (rep.devPrivateSize) { rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) - SIZEOF(xGenericReply) + pad_to_int32(rep.devPrivateSize)); } - WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *) &rep); + WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep); if (rep.length) { - WriteToClient(client, rep.devPrivateSize, (char *) pDevPrivate); + WriteToClient(client, rep.devPrivateSize, pDevPrivate); } EPHYR_LOG("leave\n"); return Success; @@ -1225,7 +1229,7 @@ ProcXF86DRIDispatch(register ClientPtr client) } } - if (!LocalClient(client)) + if (!client->local) return DRIErrorBase + XF86DRIClientNotLocal; switch (stuff->data) { diff --git a/xserver/hw/kdrive/ephyr/ephyrglxext.c b/xserver/hw/kdrive/ephyr/ephyrglxext.c index dab028bf3..22d510891 100644 --- a/xserver/hw/kdrive/ephyr/ephyrglxext.c +++ b/xserver/hw/kdrive/ephyr/ephyrglxext.c @@ -61,10 +61,16 @@ int ephyrGLXGetFBConfigsSGIX(__GLXclientState * a_cl, GLbyte * a_pc); int ephyrGLXGetFBConfigsSGIXSwap(__GLXclientState * a_cl, GLbyte * a_pc); int ephyrGLXCreateContext(__GLXclientState * a_cl, GLbyte * a_pc); int ephyrGLXCreateContextSwap(__GLXclientState * a_cl, GLbyte * a_pc); +int ephyrGLXCreateNewContext(__GLXclientState * a_cl, GLbyte * a_pc); +int ephyrGLXCreateNewContextSwap(__GLXclientState * a_cl, GLbyte * a_pc); int ephyrGLXDestroyContext(__GLXclientState * a_cl, GLbyte * a_pc); int ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc); int ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc); int ephyrGLXMakeCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc); +int ephyrGLXMakeCurrentReadSGI(__GLXclientState * a_cl, GLbyte * a_pc); +int ephyrGLXMakeCurrentReadSGISwap(__GLXclientState * a_cl, GLbyte * a_pc); +int ephyrGLXMakeContextCurrent(__GLXclientState * a_cl, GLbyte * a_pc); +int ephyrGLXMakeContextCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc); int ephyrGLXGetString(__GLXclientState * a_cl, GLbyte * a_pc); int ephyrGLXGetStringSwap(__GLXclientState * a_cl, GLbyte * a_pc); int ephyrGLXGetIntegerv(__GLXclientState * a_cl, GLbyte * a_pc); @@ -108,6 +114,9 @@ ephyrHijackGLXExtension(void) dispatch_functions[X_GLXCreateContext][0] = ephyrGLXCreateContext; dispatch_functions[X_GLXCreateContext][1] = ephyrGLXCreateContextSwap; + dispatch_functions[X_GLXCreateNewContext][0] = ephyrGLXCreateNewContext; + dispatch_functions[X_GLXCreateNewContext][1] = ephyrGLXCreateNewContextSwap; + dispatch_functions[X_GLXDestroyContext][0] = ephyrGLXDestroyContext; dispatch_functions[X_GLXDestroyContext][1] = ephyrGLXDestroyContextSwap; @@ -123,14 +132,24 @@ ephyrHijackGLXExtension(void) dispatch_functions[61][0] = ephyrGLXGetIntegerv; dispatch_functions[61][1] = ephyrGLXGetIntegervSwap; + dispatch_functions[X_GLXMakeContextCurrent][0] = + ephyrGLXMakeContextCurrent; + dispatch_functions[X_GLXMakeContextCurrent][1] = + ephyrGLXMakeContextCurrentSwap; + /* * hijack some vendor priv entry point dispatch functions */ dispatch_functions = VendorPriv_dispatch_info.dispatch_functions; dispatch_functions[92][0] = ephyrGLXGetFBConfigsSGIX; dispatch_functions[92][1] = ephyrGLXGetFBConfigsSGIXSwap; + + dispatch_functions[89][0] = ephyrGLXMakeCurrentReadSGI; + dispatch_functions[89][1] = ephyrGLXMakeCurrentReadSGISwap; + EPHYR_LOG("hijacked glx entry points to forward requests to host X\n"); + return TRUE; } @@ -159,17 +178,19 @@ ephyrGLXQueryVersion(__GLXclientState * a_cl, GLbyte * a_pc) goto out; } EPHYR_LOG("major:%d, minor:%d\n", major, minor); - reply.majorVersion = major; - reply.minorVersion = minor; - reply.length = 0; - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; + reply = (xGLXQueryVersionReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .majorVersion = major, + .minorVersion = minor + }; if (client->swapped) { __glXSwapQueryVersionReply(client, &reply); } else { - WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply); + WriteToClient(client, sz_xGLXQueryVersionReply, &reply); } res = Success; @@ -215,11 +236,13 @@ ephyrGLXGetVisualConfigsReal(__GLXclientState * a_cl, } EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props); - reply.numVisuals = num_visuals; - reply.numProps = num_props; - reply.length = (num_visuals * __GLX_SIZE_CARD32 * num_props) >> 2; - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; + reply = (xGLXGetVisualConfigsReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = (num_visuals * __GLX_SIZE_CARD32 * num_props) >> 2, + .numVisuals = num_visuals, + .numProps = num_props + }; if (a_do_swap) { __GLX_SWAP_SHORT(&reply.sequenceNumber); @@ -228,7 +251,7 @@ ephyrGLXGetVisualConfigsReal(__GLXclientState * a_cl, __GLX_SWAP_INT(&reply.numProps); __GLX_SWAP_INT_ARRAY(props_buf, num_props); } - WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply); + WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply); props_per_visual_size = props_buf_size / num_visuals; for (i = 0; i < num_visuals; i++) { WriteToClient(client, @@ -269,11 +292,13 @@ ephyrGLXGetFBConfigsSGIXReal(__GLXclientState * a_cl, } EPHYR_LOG("num_visuals:%d, num_props:%d\n", num_visuals, num_props); - reply.numVisuals = num_visuals; - reply.numProps = num_props; - reply.length = props_buf_size >> 2; - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; + reply = (xGLXGetVisualConfigsReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = props_buf_size >> 2, + .numVisuals = num_visuals, + .numProps = num_props + }; if (a_do_swap) { __GLX_SWAP_SHORT(&reply.sequenceNumber); @@ -282,7 +307,7 @@ ephyrGLXGetFBConfigsSGIXReal(__GLXclientState * a_cl, __GLX_SWAP_INT(&reply.numProps); __GLX_SWAP_INT_ARRAY(props_buf, num_props); } - WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply); + WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply); props_per_visual_size = props_buf_size / num_visuals; for (i = 0; i < num_visuals; i++) { WriteToClient(client, @@ -351,7 +376,7 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc) ClientPtr client = a_cl->client; xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) a_pc; xGLXQueryServerStringReply reply; - char *server_string = NULL, *buf = NULL; + char *server_string = NULL; int length = 0; EPHYR_LOG("enter\n"); @@ -364,18 +389,14 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc) } EPHYR_LOG("string: %s\n", server_string); length = strlen(server_string) + 1; - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; - reply.length = __GLX_PAD(length) >> 2; - reply.n = length; - buf = calloc(reply.length << 2, 1); - if (!buf) { - EPHYR_LOG_ERROR("failed to allocate string\n;"); - return BadAlloc; - } - memcpy(buf, server_string, length); - - WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) &reply); + reply = (xGLXQueryServerStringReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = __GLX_PAD(length) >> 2, + .n = length + }; + + WriteToClient(client, sz_xGLXQueryServerStringReply, &reply); WriteToClient(client, (int) (reply.length << 2), server_string); res = Success; @@ -385,9 +406,6 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc) free(server_string); server_string = NULL; - free(buf); - buf = NULL; - return res; } @@ -446,7 +464,8 @@ ephyrGLXCreateContextReal(xGLXCreateContextReq * a_req, Bool a_do_swap) if (!ephyrHostGLXCreateContext(a_req->screen, host_w_attrs.visualid, a_req->context, - a_req->shareList, a_req->isDirect)) { + a_req->shareList, 0, + a_req->isDirect, X_GLXCreateContext)) { EPHYR_LOG_ERROR("ephyrHostGLXCreateContext() failed\n"); goto out; } @@ -456,6 +475,45 @@ ephyrGLXCreateContextReal(xGLXCreateContextReq * a_req, Bool a_do_swap) return res; } +static int +ephyrGLXCreateNewContextReal(xGLXCreateNewContextReq * a_req, Bool a_do_swap) +{ + int res = BadImplementation; + + __GLX_DECLARE_SWAP_VARIABLES; + + EPHYR_RETURN_VAL_IF_FAIL(a_req, BadValue); + EPHYR_LOG("enter\n"); + + if (a_do_swap) { + __GLX_SWAP_SHORT(&a_req->length); + __GLX_SWAP_INT(&a_req->context); + __GLX_SWAP_INT(&a_req->fbconfig); + __GLX_SWAP_INT(&a_req->screen); + __GLX_SWAP_INT(&a_req->renderType); + __GLX_SWAP_INT(&a_req->shareList); + } + + EPHYR_LOG("context creation requested. localid:%d, " + "screen:%d, fbconfig:%d, renderType:%d, direct:%d\n", + (int) a_req->context, (int) a_req->screen, + (int) a_req->fbconfig, (int) a_req->renderType, + (int) a_req->isDirect); + + if (!ephyrHostGLXCreateContext(a_req->screen, + a_req->fbconfig, + a_req->context, + a_req->shareList, a_req->renderType, + a_req->isDirect, X_GLXCreateNewContext)) { + EPHYR_LOG_ERROR("ephyrHostGLXCreateNewContext() failed\n"); + goto out; + } + res = Success; + out: + EPHYR_LOG("leave\n"); + return res; +} + int ephyrGLXCreateContext(__GLXclientState * cl, GLbyte * pc) { @@ -472,6 +530,22 @@ ephyrGLXCreateContextSwap(__GLXclientState * cl, GLbyte * pc) return ephyrGLXCreateContextReal(req, TRUE); } +int +ephyrGLXCreateNewContext(__GLXclientState * cl, GLbyte * pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + + return ephyrGLXCreateNewContextReal(req, FALSE); +} + +int +ephyrGLXCreateNewContextSwap(__GLXclientState * cl, GLbyte * pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + + return ephyrGLXCreateNewContextReal(req, TRUE); +} + static int ephyrGLXDestroyContextReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap) @@ -506,39 +580,50 @@ ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc) } static int -ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap) +ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLXDrawable write, + GLXDrawable read, GLXContextTag ctx, + GLXContextTag old_ctx, Bool a_do_swap) { int res = BadImplementation; - xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc; xGLXMakeCurrentReply reply; - DrawablePtr drawable = NULL; - int rc = 0; + DrawablePtr drawableR = NULL, drawableW = NULL; + GLXContextTag new_ctx = 0; EPHYR_LOG("enter\n"); - rc = dixLookupDrawable(&drawable, - req->drawable, a_cl->client, 0, DixReadAccess); - EPHYR_RETURN_VAL_IF_FAIL(drawable, BadValue); - EPHYR_RETURN_VAL_IF_FAIL(drawable->pScreen, BadValue); - EPHYR_LOG("screen nummber requested:%d\n", drawable->pScreen->myNum); - - memset(&reply, 0, sizeof(reply)); - if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawable->pScreen->myNum), - req->context, - req->oldContextTag, - (int *) &reply.contextTag)) { + res = dixLookupDrawable(&drawableW, write, a_cl->client, 0, DixReadAccess); + EPHYR_RETURN_VAL_IF_FAIL(drawableW, BadValue); + EPHYR_RETURN_VAL_IF_FAIL(drawableW->pScreen, BadValue); + EPHYR_LOG("screen nummber requested:%d\n", drawableW->pScreen->myNum); + + if (read != write) { + res = dixLookupDrawable(&drawableR, read, a_cl->client, 0, + DixReadAccess); + EPHYR_RETURN_VAL_IF_FAIL(drawableR, BadValue); + EPHYR_RETURN_VAL_IF_FAIL(drawableR->pScreen, BadValue); + } + else { + drawableR = drawableW; + } + + if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawableW->pScreen->myNum), + hostx_get_window(drawableR->pScreen->myNum), + ctx, old_ctx, (int *) &new_ctx)) { EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n"); goto out; } - reply.length = 0; - reply.type = X_Reply; - reply.sequenceNumber = a_cl->client->sequence; + reply = (xGLXMakeCurrentReply) { + .type = X_Reply, + .sequenceNumber = a_cl->client->sequence, + .length = 0, + .contextTag = new_ctx + }; if (a_do_swap) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.contextTag); } - WriteToClient(a_cl->client, sz_xGLXMakeCurrentReply, (char *) &reply); + WriteToClient(a_cl->client, sz_xGLXMakeCurrentReply, &reply); res = Success; out: @@ -549,13 +634,71 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap) int ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc) { - return ephyrGLXMakeCurrentReal(a_cl, a_pc, FALSE); + xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc; + return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->drawable, + req->context, req->oldContextTag, FALSE); } int ephyrGLXMakeCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc) { - return ephyrGLXMakeCurrentReal(a_cl, a_pc, TRUE); + xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->oldContextTag); + + return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->drawable, + req->context, req->oldContextTag, TRUE); +} + +int +ephyrGLXMakeCurrentReadSGI(__GLXclientState * a_cl, GLbyte * a_pc) +{ + xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) a_pc; + + return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readable, + req->context, req->oldContextTag, FALSE); +} + +int +ephyrGLXMakeCurrentReadSGISwap(__GLXclientState * a_cl, GLbyte * a_pc) +{ + xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) a_pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->readable); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->oldContextTag); + + return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readable, + req->context, req->oldContextTag, TRUE); +} + +int +ephyrGLXMakeContextCurrent(__GLXclientState * a_cl, GLbyte * a_pc) +{ + xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) a_pc; + + return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readdrawable, + req->context, req->oldContextTag, FALSE); +} + +int +ephyrGLXMakeContextCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc) +{ + xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) a_pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->readdrawable); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->oldContextTag); + + return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readdrawable, + req->context, req->oldContextTag, TRUE); } static int @@ -601,7 +744,7 @@ ephyrGLXGetStringReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap) __GLX_SWAP_REPLY_SIZE(); __GLX_SWAP_REPLY_HEADER(); } - WriteToClient(client, length, (char *) string); + WriteToClient(client, length, string); res = Success; out: @@ -681,16 +824,18 @@ ephyrGLXIsDirectReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap) EPHYR_LOG("enter\n"); - memset(&reply, 0, sizeof(reply)); if (!ephyrHostIsContextDirect(req->context, (int *) &is_direct)) { EPHYR_LOG_ERROR("ephyrHostIsContextDirect() failed\n"); goto out; } - reply.isDirect = is_direct; - reply.length = 0; - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; - WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply); + reply = (xGLXIsDirectReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .isDirect = is_direct + }; + + WriteToClient(client, sz_xGLXIsDirectReply, &reply); res = Success; out: diff --git a/xserver/hw/kdrive/ephyr/ephyrhostglx.c b/xserver/hw/kdrive/ephyr/ephyrhostglx.c index 6b9da6fb1..5c6c40f0b 100644 --- a/xserver/hw/kdrive/ephyr/ephyrhostglx.c +++ b/xserver/hw/kdrive/ephyr/ephyrhostglx.c @@ -52,6 +52,8 @@ #include "ephyrlog.h" #include "hostx.h" +static int glx_major, glx_minor; + enum VisualConfRequestType { EPHYR_GET_FB_CONFIG, EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX, @@ -99,6 +101,12 @@ ephyrHostGLXQueryVersion(int *a_major, int *a_minor) EPHYR_RETURN_VAL_IF_FAIL(a_major && a_minor, FALSE); EPHYR_LOG("enter\n"); + if (glx_major) { + *a_major = glx_major; + *a_minor = glx_minor; + return TRUE; + } + if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { EPHYR_LOG_ERROR("failed to get major opcode\n"); goto out; @@ -113,12 +121,12 @@ ephyrHostGLXQueryVersion(int *a_major, int *a_minor) req->glxCode = X_GLXQueryVersion; req->majorVersion = 2; req->minorVersion = 1; - _XReply(dpy, (xReply *) & reply, 0, False); + _XReply(dpy, (xReply *) &reply, 0, False); UnlockDisplay(dpy); SyncHandle(); - *a_major = reply.majorVersion; - *a_minor = reply.minorVersion; + *a_major = glx_major = reply.majorVersion; + *a_minor = glx_minor = reply.minorVersion; EPHYR_LOG("major:%d, minor:%d\n", *a_major, *a_minor); @@ -199,7 +207,7 @@ ephyrHostGLXGetStringFromServer(int a_screen_number, req->for_whom = default_screen; req->name = a_string_name; - _XReply(dpy, (xReply *) & reply, 0, False); + _XReply(dpy, (xReply *) &reply, 0, False); length = reply.length * 4; if (!length) { @@ -295,7 +303,7 @@ ephyrHostGLXGetVisualConfigsInternal(enum VisualConfRequestType a_type, break; } - if (!_XReply(dpy, (xReply *) & reply, 0, False)) { + if (!_XReply(dpy, (xReply *) &reply, 0, False)) { EPHYR_LOG_ERROR("unknown error\n"); UnlockDisplay(dpy); goto out; @@ -431,17 +439,20 @@ ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor, Bool ephyrHostGLXCreateContext(int a_screen, - int a_visual_id, + int a_generic_id, int a_context_id, - int a_share_list_ctxt_id, Bool a_direct) + int a_share_list_ctxt_id, + int a_render_type, + Bool a_direct, + int code) { Bool is_ok = FALSE; Display *dpy = hostx_get_display(); int major_opcode = 0, remote_context_id = 0; - xGLXCreateContextReq *req; - EPHYR_LOG("enter. screen:%d, visual:%d, contextid:%d, direct:%d\n", - a_screen, a_visual_id, a_context_id, a_direct); + EPHYR_LOG("enter. screen:%d, generic_id:%d, contextid:%d, rendertype:%d, " + "direct:%d\n", a_screen, a_generic_id, a_context_id, + a_render_type, a_direct); if (!hostx_allocate_resource_id_peer(a_context_id, &remote_context_id)) { EPHYR_LOG_ERROR("failed to peer the context id %d host X", @@ -456,15 +467,38 @@ ephyrHostGLXCreateContext(int a_screen, LockDisplay(dpy); - /* Send the glXCreateContext request */ - GetReq(GLXCreateContext, req); - req->reqType = major_opcode; - req->glxCode = X_GLXCreateContext; - req->context = remote_context_id; - req->visual = a_visual_id; - req->screen = DefaultScreen(dpy); - req->shareList = a_share_list_ctxt_id; - req->isDirect = a_direct; + switch (code) { + case X_GLXCreateContext: { + /* Send the glXCreateContext request */ + xGLXCreateContextReq *req; + GetReq(GLXCreateContext, req); + req->reqType = major_opcode; + req->glxCode = X_GLXCreateContext; + req->context = remote_context_id; + req->visual = a_generic_id; + req->screen = DefaultScreen(dpy); + req->shareList = a_share_list_ctxt_id; + req->isDirect = a_direct; + } + + case X_GLXCreateNewContext: { + /* Send the glXCreateNewContext request */ + xGLXCreateNewContextReq *req; + GetReq(GLXCreateNewContext, req); + req->reqType = major_opcode; + req->glxCode = X_GLXCreateNewContext; + req->context = remote_context_id; + req->fbconfig = a_generic_id; + req->screen = DefaultScreen(dpy); + req->renderType = a_render_type; + req->shareList = a_share_list_ctxt_id; + req->isDirect = a_direct; + } + + default: + /* This should never be reached !*/ + EPHYR_LOG("Internal error! Invalid CreateContext code!\n"); + } UnlockDisplay(dpy); SyncHandle(); @@ -512,20 +546,19 @@ ephyrHostDestroyContext(int a_ctxt_id) } Bool -ephyrHostGLXMakeCurrent(int a_drawable, +ephyrHostGLXMakeCurrent(int a_drawable, int a_readable, int a_glx_ctxt_id, int a_old_ctxt_tag, int *a_ctxt_tag) { Bool is_ok = FALSE; Display *dpy = hostx_get_display(); int32_t major_opcode = 0; int remote_glx_ctxt_id = 0; - xGLXMakeCurrentReq *req; xGLXMakeCurrentReply reply; EPHYR_RETURN_VAL_IF_FAIL(a_ctxt_tag, FALSE); - EPHYR_LOG("enter. drawable:%d, context:%d, oldtag:%d\n", - a_drawable, a_glx_ctxt_id, a_old_ctxt_tag); + EPHYR_LOG("enter. drawable:%d, read:%d, context:%d, oldtag:%d\n", + a_drawable, a_readable, a_glx_ctxt_id, a_old_ctxt_tag); if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { EPHYR_LOG_ERROR("failed to get major opcode\n"); @@ -538,15 +571,51 @@ ephyrHostGLXMakeCurrent(int a_drawable, LockDisplay(dpy); - GetReq(GLXMakeCurrent, req); - req->reqType = major_opcode; - req->glxCode = X_GLXMakeCurrent; - req->drawable = a_drawable; - req->context = remote_glx_ctxt_id; - req->oldContextTag = a_old_ctxt_tag; + /* If both drawables are the same, use the old MakeCurrent request. + * Otherwise, if we have GLX 1.3 or higher, use the MakeContextCurrent + * request which supports separate read and draw targets. Failing that, + * try the SGI MakeCurrentRead extension. Logic cribbed from Mesa. */ + if (a_drawable == a_readable) { + xGLXMakeCurrentReq *req; + + GetReq(GLXMakeCurrent, req); + req->reqType = major_opcode; + req->glxCode = X_GLXMakeCurrent; + req->drawable = a_drawable; + req->context = remote_glx_ctxt_id; + req->oldContextTag = a_old_ctxt_tag; + } + else if (glx_major > 1 || glx_minor >= 3) { + xGLXMakeContextCurrentReq *req; + + GetReq(GLXMakeContextCurrent, req); + req->reqType = major_opcode; + req->glxCode = X_GLXMakeContextCurrent; + req->drawable = a_drawable; + req->readdrawable = a_readable; + req->context = remote_glx_ctxt_id; + req->oldContextTag = a_old_ctxt_tag; + } + else { + xGLXVendorPrivateWithReplyReq *vpreq; + xGLXMakeCurrentReadSGIReq *req; + + GetReqExtra(GLXVendorPrivateWithReply, + (sz_xGLXMakeCurrentReadSGIReq - + sz_xGLXVendorPrivateWithReplyReq), + vpreq); + req = (xGLXMakeCurrentReadSGIReq *) vpreq; + req->reqType = major_opcode; + req->glxCode = X_GLXVendorPrivateWithReply; + req->vendorCode = X_GLXvop_MakeCurrentReadSGI; + req->drawable = a_drawable; + req->readable = a_readable; + req->context = remote_glx_ctxt_id; + req->oldContextTag = a_old_ctxt_tag; + } memset(&reply, 0, sizeof(reply)); - if (!_XReply(dpy, (xReply *) & reply, 0, False)) { + if (!_XReply(dpy, (xReply *) &reply, 0, False)) { EPHYR_LOG_ERROR("failed to get reply from host\n"); UnlockDisplay(dpy); SyncHandle(); @@ -666,7 +735,7 @@ ephyrHostIsContextDirect(int a_ctxt_id, int *a_is_direct) req->reqType = major_opcode; req->glxCode = X_GLXIsDirect; req->context = remote_glx_ctxt_id; - if (!_XReply(dpy, (xReply *) & reply, 0, False)) { + if (!_XReply(dpy, (xReply *) &reply, 0, False)) { EPHYR_LOG_ERROR("fail in reading reply from host\n"); UnlockDisplay(dpy); SyncHandle(); diff --git a/xserver/hw/kdrive/ephyr/ephyrhostglx.h b/xserver/hw/kdrive/ephyr/ephyrhostglx.h index 9c6012070..7ff515dc2 100644 --- a/xserver/hw/kdrive/ephyr/ephyrhostglx.h +++ b/xserver/hw/kdrive/ephyr/ephyrhostglx.h @@ -55,13 +55,16 @@ Bool ephyrHostGLXGetMajorOpcode(int32_t * a_opcode); Bool ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor, const char *a_extension_list); Bool ephyrHostGLXCreateContext(int a_screen, - int a_visual_id, + int a_generic_id, int a_context_id, - int a_shared_list_ctx_id, Bool a_direct); + int a_share_list_ctxt_id, + int a_render_type, + Bool a_direct, + int code); Bool ephyrHostDestroyContext(int a_ctxt_id); -Bool ephyrHostGLXMakeCurrent(int a_drawable, int a_glx_ctxt_id, +Bool ephyrHostGLXMakeCurrent(int a_drawable, int a_readable, int a_glx_ctxt_id, int a_olg_ctxt_tag, int *a_ctxt_tag); Bool ephyrHostGetIntegerValue(int a_current_context_tag, int a_int, int *a_val); diff --git a/xserver/hw/kdrive/ephyr/ephyrhostproxy.c b/xserver/hw/kdrive/ephyr/ephyrhostproxy.c index 410e6b6e4..a4f25c159 100644 --- a/xserver/hw/kdrive/ephyr/ephyrhostproxy.c +++ b/xserver/hw/kdrive/ephyr/ephyrhostproxy.c @@ -73,7 +73,7 @@ ephyrHostProxyDoForward(pointer a_request_buffer, GetXReq(forward_req); memmove(forward_req, in_req, 4); - if (!_XReply(dpy, (xReply *) & reply, 0, FALSE)) { + if (!_XReply(dpy, (xReply *) &reply, 0, FALSE)) { EPHYR_LOG_ERROR("failed to get reply\n"); goto out; } diff --git a/xserver/hw/kdrive/ephyr/ephyrhostvideo.c b/xserver/hw/kdrive/ephyr/ephyrhostvideo.c index 05a821b39..362aa055e 100644 --- a/xserver/hw/kdrive/ephyr/ephyrhostvideo.c +++ b/xserver/hw/kdrive/ephyr/ephyrhostvideo.c @@ -304,7 +304,7 @@ ephyrHostXVAdaptorArrayAt(const EphyrHostXVAdaptorArray * a_this, int a_index) if (a_index >= a_this->nb_adaptors) return NULL; - return (EphyrHostXVAdaptor *) & a_this->adaptors[a_index]; + return (EphyrHostXVAdaptor *) &a_this->adaptors[a_index]; } char @@ -668,7 +668,7 @@ ephyrHostXVQueryImageAttributes(int a_port_id, /* * read the reply */ - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { EPHYR_LOG_ERROR("QeryImageAttribute req failed\n"); goto out; } diff --git a/xserver/hw/kdrive/ephyr/ephyrinit.c b/xserver/hw/kdrive/ephyr/ephyrinit.c index a62b49d4b..5e2eb672f 100644 --- a/xserver/hw/kdrive/ephyr/ephyrinit.c +++ b/xserver/hw/kdrive/ephyr/ephyrinit.c @@ -36,7 +36,6 @@ extern Bool kdHasKbd; #ifdef GLXEXT extern Bool ephyrNoDRI; -extern Bool noGlxVisualInit; #endif extern Bool ephyrNoXV; @@ -233,7 +232,6 @@ ddxProcessArgument(int argc, char **argv, int i) } #ifdef GLXEXT else if (!strcmp(argv[i], "-nodri")) { - noGlxVisualInit = FALSE; ephyrNoDRI = TRUE; EPHYR_LOG("no direct rendering enabled\n"); return 1; diff --git a/xserver/hw/kdrive/ephyr/ephyrproxyext.c b/xserver/hw/kdrive/ephyr/ephyrproxyext.c index 3d86d2db1..c24238c04 100644 --- a/xserver/hw/kdrive/ephyr/ephyrproxyext.c +++ b/xserver/hw/kdrive/ephyr/ephyrproxyext.c @@ -75,7 +75,7 @@ ephyrProxyProcDispatch(ClientPtr a_client) reply.sequence_number = a_client->sequence; res = Success; - WriteToClient(a_client, 32, (char *) &reply); + WriteToClient(a_client, 32, &reply); out: return res; diff --git a/xserver/hw/kdrive/ephyr/ephyrvideo.c b/xserver/hw/kdrive/ephyr/ephyrvideo.c index 67eadd121..55dbd2e3a 100644 --- a/xserver/hw/kdrive/ephyr/ephyrvideo.c +++ b/xserver/hw/kdrive/ephyr/ephyrvideo.c @@ -495,7 +495,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this) port_priv_offset = a_this->adaptors[i].nPorts; for (j = 0; j < a_this->adaptors[i].nPorts; j++) { EphyrPortPriv *port_privs_base = - (EphyrPortPriv *) & a_this->adaptors[i]. + (EphyrPortPriv *) &a_this->adaptors[i]. pPortPrivates[port_priv_offset]; EphyrPortPriv *port_priv = &port_privs_base[j]; diff --git a/xserver/hw/kdrive/ephyr/hostx.c b/xserver/hw/kdrive/ephyr/hostx.c index 6988f1625..157ac36b2 100644 --- a/xserver/hw/kdrive/ephyr/hostx.c +++ b/xserver/hw/kdrive/ephyr/hostx.c @@ -345,7 +345,11 @@ hostx_init(void) attr.event_mask = ButtonPressMask | ButtonReleaseMask - | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask; + | PointerMotionMask + | KeyPressMask + | KeyReleaseMask + | ExposureMask + | StructureNotifyMask; EPHYR_DBG("mark"); @@ -693,12 +697,14 @@ hostx_screen_init(EphyrScreenInfo screen, XResizeWindow(HostX.dpy, host_screen->win, width, height); /* Ask the WM to keep our size static */ - size_hints = XAllocSizeHints(); - size_hints->max_width = size_hints->min_width = width; - size_hints->max_height = size_hints->min_height = height; - size_hints->flags = PMinSize | PMaxSize; - XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints); - XFree(size_hints); + if (host_screen->win_pre_existing == None) { + size_hints = XAllocSizeHints(); + size_hints->max_width = size_hints->min_width = width; + size_hints->max_height = size_hints->min_height = height; + size_hints->flags = PMinSize | PMaxSize; + XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints); + XFree(size_hints); + } XMapWindow(HostX.dpy, host_screen->win); @@ -875,7 +881,9 @@ host_screen_from_window(Window w) struct EphyrHostScreen *result = NULL; for (index = 0; index < HostX.n_screens; index++) { - if (HostX.screens[index].win == w || HostX.screens[index].peer_win == w) { + if (HostX.screens[index].win == w + || HostX.screens[index].peer_win == w + || HostX.screens[index].win_pre_existing == w) { result = &HostX.screens[index]; goto out; } @@ -1001,6 +1009,22 @@ hostx_get_event(EphyrHostXEvent * ev) ev->data.key_up.scancode = xev.xkey.keycode; return 1; + case ConfigureNotify: + { + struct EphyrHostScreen *host_screen = + host_screen_from_window(xev.xconfigure.window); + + if (host_screen && host_screen->win_pre_existing != None) { + ev->type = EPHYR_EV_CONFIGURE; + ev->data.configure.width = xev.xconfigure.width; + ev->data.configure.height = xev.xconfigure.height; + ev->data.configure.window = xev.xconfigure.window; + ev->data.configure.screen = host_screen->mynum; + return 1; + } + + return 0; + } default: break; diff --git a/xserver/hw/kdrive/ephyr/hostx.h b/xserver/hw/kdrive/ephyr/hostx.h index d6217119a..31c4053aa 100644 --- a/xserver/hw/kdrive/ephyr/hostx.h +++ b/xserver/hw/kdrive/ephyr/hostx.h @@ -47,7 +47,8 @@ typedef enum EphyrHostXEventType { EPHYR_EV_MOUSE_RELEASE, EPHYR_EV_KEY_PRESS, EPHYR_EV_KEY_RELEASE, - EPHYR_EV_EXPOSE + EPHYR_EV_EXPOSE, + EPHYR_EV_CONFIGURE, } EphyrHostXEventType; /* I can't believe it's not a KeySymsRec. */ @@ -89,6 +90,13 @@ struct EphyrHostXEvent { int window; } expose; + struct configure { + int width; + int height; + int screen; + int window; + } configure; + } data; int key_state; diff --git a/xserver/hw/kdrive/ephyr/man/Makefile.in b/xserver/hw/kdrive/ephyr/man/Makefile.in index b318f2a95..5ed90170f 100644 --- a/xserver/hw/kdrive/ephyr/man/Makefile.in +++ b/xserver/hw/kdrive/ephyr/man/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -179,13 +179,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -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@ @@ -207,6 +203,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -231,6 +228,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -246,7 +244,6 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ @@ -361,6 +358,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -480,7 +478,7 @@ all: all-am .SUFFIXES: .SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -506,9 +504,9 @@ $(top_srcdir)/manpages.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): |