From 85e4e5445218d70f627fb132a8e8f18470e6749d Mon Sep 17 00:00:00 2001 From: Roland Mainz Date: Mon, 26 Apr 2004 11:07:03 +0000 Subject: [PATCH] Work-in-progress for http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=542 - GLX support for PS DDX / part #1: Fix visual setup (attachment #243) --- Xprint/ps/PsInit.c | 45 ++++++++++++++++++++++++++++++--------------- mi/miinitext.c | 7 +------ 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Xprint/ps/PsInit.c b/Xprint/ps/PsInit.c index 224d08335..f2e064921 100644 --- a/Xprint/ps/PsInit.c +++ b/Xprint/ps/PsInit.c @@ -83,6 +83,7 @@ in this Software without prior written authorization from The Open Group. #include "Ps.h" #include "mi.h" +#include "micmap.h" #include "AttrValid.h" #include "../../mfb/mfb.h" @@ -100,6 +101,10 @@ int PsContextPrivateIndex; int PsPixmapPrivateIndex; int PsWindowPrivateIndex; +#ifdef GLXEXT +extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); +#endif /* GLXEXT */ + Bool InitializePsDriver(ndx, pScreen, argc, argv) int ndx; @@ -118,6 +123,8 @@ InitializePsDriver(ndx, pScreen, argc, argv) int nDepths; VisualPtr visuals; DepthPtr depths; + VisualID defaultVisual; + int rootDepth; /* * Register this driver's InitContext function with the print @@ -203,27 +210,35 @@ InitializePsDriver(ndx, pScreen, argc, argv) depths[0].depth = 24; depths[0].numVids = 1; - depths[0].vids = &visuals[0].vid; + depths[0].vids = (VisualID *)xalloc(sizeof(VisualID)); + depths[0].vids[0] = visuals[0].vid; depths[1].depth = 8; depths[1].numVids = 1; - depths[1].vids = &visuals[1].vid; + depths[1].vids = (VisualID *)xalloc(sizeof(VisualID)); + depths[1].vids[0] = visuals[1].vid; -/* THE FOLLOWING CAUSES SERVER DEFAULT VISUAL TO BE 24 BIT */ -/* miScreenInit(pScreen, (pointer)0, - pScreen->width, pScreen->height, - pScreen->width / (pScreen->mmWidth / 25.40), - pScreen->height / (pScreen->mmHeight / 25.40), - 0, 24, nDepths, - depths, visuals[1].vid, nVisuals, visuals); */ + /* Defaul visual is 8bit PseudoColor */ + defaultVisual = visuals[1].vid; + rootDepth = visuals[1].nplanes; + +#ifdef GLXEXT + { + miInitVisualsProcPtr proc = NULL; + + GlxWrapInitVisuals(&proc); + /* GlxInitVisuals ignores the last three arguments. */ + proc(&visuals, &depths, &nVisuals, &nDepths, + &rootDepth, &defaultVisual, 0, 0, 0); + } +#endif /* GLXEXT */ -/* THE FOLLOWING CAUSES SERVER DEFAULT VISUAL TO BE 8 BIT */ miScreenInit(pScreen, (pointer)0, - pScreen->width, pScreen->height, - (int) (pScreen->width / (pScreen->mmWidth / 25.40)), - (int) (pScreen->height / (pScreen->mmHeight / 25.40)), - 0, 8, nDepths, - depths, visuals[1].vid, nVisuals, visuals); + pScreen->width, pScreen->height, + (int) (pScreen->width / (pScreen->mmWidth / 25.40)), + (int) (pScreen->height / (pScreen->mmHeight / 25.40)), + 0, rootDepth, nDepths, + depths, defaultVisual, nVisuals, visuals); if( cfbCreateDefColormap(pScreen)==FALSE ) return FALSE; diff --git a/mi/miinitext.c b/mi/miinitext.c index ab452e10f..5b242498f 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/mi/miinitext.c,v 1.1.4.7 2004/04/15 10:17:22 eich Exp $ */ +/* $XdotOrg: xc/programs/Xserver/mi/miinitext.c,v 1.2 2004/04/23 19:54:26 eich Exp $ */ /* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.67 2003/01/12 02:44:27 dawes Exp $ */ /*********************************************************** @@ -69,7 +69,6 @@ SOFTWARE. #undef PANORAMIX #undef RES #undef XIE -#undef GLXEXT /* not yet */ #undef XINPUT #undef XV #undef SCREENSAVER @@ -379,14 +378,12 @@ InitExtensions(argc, argv) #endif #endif #ifdef GLXEXT -#ifndef XPRINT /* we don't want Glx in the Xprint server */ #ifndef __DARWIN__ GlxExtensionInit(); #else DarwinGlxExtensionInit(); #endif #endif -#endif #ifdef DPSEXT #ifndef XPRINT DPSExtensionInit(); @@ -408,14 +405,12 @@ InitVisualWrap() { miResetInitVisuals(); #ifdef GLXEXT -#ifndef XPRINT #ifndef __DARWIN__ GlxWrapInitVisuals(&miInitVisualsProc); #else DarwinGlxWrapInitVisuals(&miInitVisualsProc); #endif #endif -#endif } #else /* XFree86LOADER */