drivers/x11: unifdef XFree86Server

This code was for the old GLcore build of the software rasteriser.  The
X server switched to a DRI driver for software indirect GLX long ago.

Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2010-11-29 17:37:54 -05:00
parent e5aa69f6a6
commit 1ccef926be
14 changed files with 10 additions and 401 deletions

View File

@ -42,7 +42,7 @@
*/
#if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server)
#if !defined(DISPATCH_FUNCTION_SIZE)
# define NEED_FUNCTION_POINTER
#endif
#include "glapi/glprocs.h"
@ -88,7 +88,6 @@ get_static_proc_offset(const char *funcName)
}
#if !defined(XFree86Server)
/**
* Return dispatch function address for the named static (built-in) function.
@ -113,16 +112,6 @@ get_static_proc_address(const char *funcName)
#endif
}
#else
static _glapi_proc
get_static_proc_address(const char *funcName)
{
(void) funcName;
return NULL;
}
#endif /* !defined(XFree86Server) */
/**

View File

@ -72,13 +72,4 @@ typedef struct {
int dummy;
} SISDRIContextRec, *SISDRIContextPtr;
#ifdef XFree86Server
#include "screenint.h"
Bool SISDRIScreenInit(ScreenPtr pScreen);
void SISDRICloseScreen(ScreenPtr pScreen);
Bool SISDRIFinishScreenInit(ScreenPtr pScreen);
#endif
#endif

View File

@ -41,11 +41,7 @@
#include <sys/time.h>
#include "dri_util.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
#else
#include "main/glheader.h"
#endif
#if defined(__linux__)
#include <signal.h>
#endif

View File

@ -35,9 +35,7 @@
#define VIA_DRIDDX_VERSION_MINOR 0
#define VIA_DRIDDX_VERSION_PATCH 0
#ifndef XFree86Server
typedef int Bool;
#endif
typedef struct {
drm_handle_t handle;

View File

@ -32,13 +32,6 @@
#include "main/glheader.h"
#ifdef XFree86Server
# include "xorg-server.h"
# include "resource.h"
# include "windowstr.h"
#else
# include <X11/Xlib.h>
# include <X11/Xlibint.h>
@ -51,7 +44,6 @@
# include <GL/glx.h>
# include <sys/time.h>
#endif

View File

@ -158,14 +158,12 @@ static short hpcr_rgbTbl[3][256] = {
/**
* Return the host's byte order as LSBFirst or MSBFirst ala X.
*/
#ifndef XFree86Server
static int host_byte_order( void )
{
int i = 1;
char *cptr = (char *) &i;
return (*cptr==1) ? LSBFirst : MSBFirst;
}
#endif
/**
@ -176,7 +174,7 @@ static int host_byte_order( void )
*/
static int check_for_xshm( XMesaDisplay *display )
{
#if defined(USE_XSHM) && !defined(XFree86Server)
#if defined(USE_XSHM)
int major, minor, ignore;
Bool pixmaps;
@ -227,16 +225,6 @@ gamma_adjust( GLfloat gamma, GLint value, GLint max )
static int
bits_per_pixel( XMesaVisual xmv )
{
#ifdef XFree86Server
const int depth = xmv->nplanes;
int i;
assert(depth > 0);
for (i = 0; i < screenInfo.numPixmapFormats; i++) {
if (screenInfo.formats[i].depth == depth)
return screenInfo.formats[i].bitsPerPixel;
}
return depth; /* should never get here, but this should be safe */
#else
XMesaDisplay *dpy = xmv->display;
XMesaVisualInfo visinfo = xmv->visinfo;
XMesaImage *img;
@ -257,7 +245,6 @@ bits_per_pixel( XMesaVisual xmv )
img->data = NULL;
XMesaDestroyImage( img );
return bitsPerPixel;
#endif
}
@ -271,7 +258,6 @@ bits_per_pixel( XMesaVisual xmv )
* Return: GL_TRUE - window exists
* GL_FALSE - window doesn't exist
*/
#ifndef XFree86Server
static GLboolean WindowExistsFlag;
static int window_exists_err_handler( XMesaDisplay* dpy, XErrorEvent* xerr )
@ -306,7 +292,6 @@ get_drawable_size( XMesaDisplay *dpy, Drawable d, GLuint *width, GLuint *height
*height = h;
return stat;
}
#endif
/**
@ -319,10 +304,6 @@ void
xmesa_get_window_size(XMesaDisplay *dpy, XMesaBuffer b,
GLuint *width, GLuint *height)
{
#ifdef XFree86Server
*width = MIN2(b->frontxrb->drawable->width, MAX_WIDTH);
*height = MIN2(b->frontxrb->drawable->height, MAX_HEIGHT);
#else
Status stat;
_glthread_LOCK_MUTEX(_xmesa_lock);
@ -335,7 +316,6 @@ xmesa_get_window_size(XMesaDisplay *dpy, XMesaBuffer b,
_mesa_warning(NULL, "XGetGeometry failed!\n");
*width = *height = 1;
}
#endif
}
@ -549,16 +529,11 @@ noFaultXAllocColor( int client,
XMesaColor *color,
int *exact, int *alloced )
{
#ifdef XFree86Server
Pixel *ppixIn;
xrgb *ctable;
#else
/* we'll try to cache ctable for better remote display performance */
static Display *prevDisplay = NULL;
static XMesaColormap prevCmap = 0;
static int prevCmapSize = 0;
static XMesaColor *ctable = NULL;
#endif
XMesaColor subColor;
int i, bestmatch;
double mindist; /* 3*2^16^2 exceeds long int precision. */
@ -566,14 +541,7 @@ noFaultXAllocColor( int client,
(void) client;
/* First try just using XAllocColor. */
#ifdef XFree86Server
if (AllocColor(cmap,
&color->red, &color->green, &color->blue,
&color->pixel,
client) == Success)
#else
if (XAllocColor(dpy, cmap, color))
#endif
{
*exact = 1;
*alloced = 1;
@ -584,14 +552,6 @@ noFaultXAllocColor( int client,
/* Retrieve color table entries. */
/* XXX alloca candidate. */
#ifdef XFree86Server
ppixIn = (Pixel *) MALLOC(cmapSize * sizeof(Pixel));
ctable = (xrgb *) MALLOC(cmapSize * sizeof(xrgb));
for (i = 0; i < cmapSize; i++) {
ppixIn[i] = i;
}
QueryColors(cmap, cmapSize, ppixIn, ctable);
#else
if (prevDisplay != dpy || prevCmap != cmap
|| prevCmapSize != cmapSize || !ctable) {
/* free previously cached color table */
@ -608,7 +568,6 @@ noFaultXAllocColor( int client,
prevCmap = cmap;
prevCmapSize = cmapSize;
}
#endif
/* Find best match. */
bestmatch = -1;
@ -632,14 +591,7 @@ noFaultXAllocColor( int client,
* fail if the cell is read/write. Otherwise, we're incrementing
* the cell's reference count.
*/
#ifdef XFree86Server
if (AllocColor(cmap,
&subColor.red, &subColor.green, &subColor.blue,
&subColor.pixel,
client) == Success) {
#else
if (XAllocColor(dpy, cmap, &subColor)) {
#endif
*alloced = 1;
}
else {
@ -651,12 +603,7 @@ noFaultXAllocColor( int client,
subColor.flags = DoRed | DoGreen | DoBlue;
*alloced = 0;
}
#ifdef XFree86Server
free(ppixIn);
free(ctable);
#else
/* don't free table, save it for next time */
#endif
*color = subColor;
*exact = 0;
@ -873,10 +820,8 @@ setup_8bit_hpcr(XMesaVisual v)
v->hpcr_clear_pixmap = XMesaCreatePixmap(v->display,
DefaultRootWindow(v->display),
16, 2, 8);
#ifndef XFree86Server
v->hpcr_clear_ximage = XGetImage(v->display, v->hpcr_clear_pixmap,
0, 0, 16, 2, AllPlanes, ZPixmap);
#endif
}
}
@ -1049,9 +994,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
int client = 0;
const int xclass = v->visualType;
#ifdef XFree86Server
client = (window) ? CLIENT_ID(window->id) : 0;
#endif
ASSERT(!b || b->xm_visual == v);
@ -1120,40 +1062,23 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
}
/* X11 graphics contexts */
#ifdef XFree86Server
b->gc = CreateScratchGC(v->display, window->depth);
#else
b->gc = XCreateGC( v->display, window, 0, NULL );
#endif
XMesaSetFunction( v->display, b->gc, GXcopy );
/* cleargc - for glClear() */
#ifdef XFree86Server
b->cleargc = CreateScratchGC(v->display, window->depth);
#else
b->cleargc = XCreateGC( v->display, window, 0, NULL );
#endif
XMesaSetFunction( v->display, b->cleargc, GXcopy );
/*
* Don't generate Graphics Expose/NoExpose events in swapbuffers().
* Patch contributed by Michael Pichler May 15, 1995.
*/
#ifdef XFree86Server
b->swapgc = CreateScratchGC(v->display, window->depth);
{
CARD32 v[1];
v[0] = FALSE;
dixChangeGC(NullClient, b->swapgc, GCGraphicsExposures, v, NULL);
}
#else
{
XGCValues gcvalues;
gcvalues.graphics_exposures = False;
b->swapgc = XCreateGC(v->display, window,
GCGraphicsExposures, &gcvalues);
}
#endif
XMesaSetFunction( v->display, b->swapgc, GXcopy );
/*
* Set fill style and tile pixmap once for all for HPCR stuff
@ -1175,9 +1100,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
/* Initialize the row buffer XImage for use in write_color_span() */
data = (char*) MALLOC(MAX_WIDTH*4);
#ifdef XFree86Server
b->rowimage = XMesaCreateImage(GET_VISUAL_DEPTH(v), MAX_WIDTH, 1, data);
#else
b->rowimage = XCreateImage( v->display,
v->visinfo->visual,
v->visinfo->depth,
@ -1186,7 +1108,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
MAX_WIDTH, 1, /*width, height*/
32, /*bitmap_pad*/
0 /*bytes_per_line*/ );
#endif
if (!b->rowimage)
return GL_FALSE;
}
@ -1334,7 +1255,6 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
XMesaVisual v;
GLint red_bits, green_bits, blue_bits, alpha_bits;
#ifndef XFree86Server
/* For debugging only */
if (_mesa_getenv("MESA_XSYNC")) {
/* This makes debugging X easier.
@ -1343,7 +1263,6 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
*/
XSynchronize( display, 1 );
}
#endif
/* Color-index rendering not supported. */
if (!rgb_flag)
@ -1360,14 +1279,12 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
* the struct but we may need some of the information contained in it
* at a later time.
*/
#ifndef XFree86Server
v->visinfo = (XVisualInfo *) MALLOC(sizeof(*visinfo));
if(!v->visinfo) {
free(v);
return NULL;
}
memcpy(v->visinfo, visinfo, sizeof(*visinfo));
#endif
/* check for MESA_GAMMA environment variable */
gamma = _mesa_getenv("MESA_GAMMA");
@ -1384,30 +1301,13 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
v->ximage_flag = ximage_flag;
#ifdef XFree86Server
/* We could calculate these values by ourselves. nplanes is either the sum
* of the red, green, and blue bits or the number index bits.
* ColormapEntries is either (1U << index_bits) or
* (1U << max(redBits, greenBits, blueBits)).
*/
assert(visinfo->nplanes > 0);
v->nplanes = visinfo->nplanes;
v->ColormapEntries = visinfo->ColormapEntries;
v->mesa_visual.redMask = visinfo->redMask;
v->mesa_visual.greenMask = visinfo->greenMask;
v->mesa_visual.blueMask = visinfo->blueMask;
v->visualID = visinfo->vid;
v->screen = 0; /* FIXME: What should be done here? */
#else
v->mesa_visual.redMask = visinfo->red_mask;
v->mesa_visual.greenMask = visinfo->green_mask;
v->mesa_visual.blueMask = visinfo->blue_mask;
v->visualID = visinfo->visualid;
v->screen = visinfo->screen;
#endif
#if defined(XFree86Server) || !(defined(__cplusplus) || defined(c_plusplus))
#if !(defined(__cplusplus) || defined(c_plusplus))
v->visualType = xmesa_convert_from_x_visual_type(visinfo->class);
#else
v->visualType = xmesa_convert_from_x_visual_type(visinfo->c_class);
@ -1461,9 +1361,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
PUBLIC
void XMesaDestroyVisual( XMesaVisual v )
{
#ifndef XFree86Server
free(v->visinfo);
#endif
free(v);
}
@ -1532,12 +1430,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
_mesa_enable_extension(mesaCtx, "GL_EXT_timer_query");
#endif
#ifdef XFree86Server
/* If we're running in the X server, do bounds checking to prevent
* segfaults and server crashes!
*/
mesaCtx->Const.CheckArrayBounds = GL_TRUE;
#endif
/* finish up xmesa context initializations */
c->swapbytes = CHECK_BYTE_ORDER(v) ? GL_FALSE : GL_TRUE;
@ -1602,9 +1494,7 @@ void XMesaDestroyContext( XMesaContext c )
PUBLIC XMesaBuffer
XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
{
#ifndef XFree86Server
XWindowAttributes attr;
#endif
XMesaBuffer b;
XMesaColormap cmap;
int depth;
@ -1613,12 +1503,8 @@ XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
assert(w);
/* Check that window depth matches visual depth */
#ifdef XFree86Server
depth = ((XMesaDrawable)w)->depth;
#else
XGetWindowAttributes( v->display, w, &attr );
depth = attr.depth;
#endif
if (GET_VISUAL_DEPTH(v) != depth) {
_mesa_warning(NULL, "XMesaCreateWindowBuffer: depth mismatch between visual (%d) and window (%d)!\n",
GET_VISUAL_DEPTH(v), depth);
@ -1626,9 +1512,6 @@ XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
}
/* Find colormap */
#ifdef XFree86Server
cmap = (ColormapPtr)LookupIDByType(wColormap(w), RT_COLORMAP);
#else
if (attr.colormap) {
cmap = attr.colormap;
}
@ -1638,7 +1521,6 @@ XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
/* OK, let's just allocate a new one and hope for the best */
cmap = XCreateColormap(v->display, w, attr.visual, AllocNone);
}
#endif
b = create_xmesa_buffer((XMesaDrawable) w, WINDOW, v, cmap);
if (!b)
@ -1748,7 +1630,6 @@ XMesaBuffer
XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
unsigned int width, unsigned int height)
{
#ifndef XFree86Server
XMesaWindow root;
XMesaDrawable drawable; /* X Pixmap Drawable */
XMesaBuffer b;
@ -1770,9 +1651,6 @@ XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
}
return b;
#else
return 0;
#endif
}
@ -1931,40 +1809,6 @@ XMesaBuffer XMesaGetCurrentReadBuffer( void )
}
#ifdef XFree86Server
PUBLIC
GLboolean XMesaForceCurrent(XMesaContext c)
{
if (c) {
_glapi_set_dispatch(c->mesa.CurrentDispatch);
if (&(c->mesa) != _mesa_get_current_context()) {
_mesa_make_current(&c->mesa, c->mesa.DrawBuffer, c->mesa.ReadBuffer);
}
}
else {
_mesa_make_current(NULL, NULL, NULL);
}
return GL_TRUE;
}
PUBLIC
GLboolean XMesaLoseCurrent(XMesaContext c)
{
(void) c;
_mesa_make_current(NULL, NULL, NULL);
return GL_TRUE;
}
PUBLIC
GLboolean XMesaCopyContext( XMesaContext xm_src, XMesaContext xm_dst, GLuint mask )
{
_mesa_copy_context(&xm_src->mesa, &xm_dst->mesa, mask);
return GL_TRUE;
}
#endif /* XFree86Server */
#ifndef FX
@ -2004,7 +1848,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
#endif
if (b->backxrb->ximage) {
/* Copy Ximage (back buf) from client memory to server window */
#if defined(USE_XSHM) && !defined(XFree86Server)
#if defined(USE_XSHM)
if (b->shm) {
/*_glthread_LOCK_MUTEX(_xmesa_lock);*/
XShmPutImage( b->xm_visual->display, b->frontxrb->drawable,
@ -2041,9 +1885,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
if (b->swAlpha)
_mesa_copy_soft_alpha_renderbuffers(ctx, &b->mesa_buffer);
}
#if !defined(XFree86Server)
XSync( b->xm_visual->display, False );
#endif
}
@ -2074,7 +1916,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
#endif
if (b->backxrb->ximage) {
/* Copy Ximage from host's memory to server's window */
#if defined(USE_XSHM) && !defined(XFree86Server)
#if defined(USE_XSHM)
if (b->shm) {
/* XXX assuming width and height aren't too large! */
XShmPutImage( b->xm_visual->display, b->frontxrb->drawable,
@ -2116,7 +1958,6 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
* Return: GL_TRUE = context is double buffered
* GL_FALSE = context is single buffered
*/
#ifndef XFree86Server
GLboolean XMesaGetBackBuffer( XMesaBuffer b,
XMesaPixmap *pixmap,
XMesaImage **ximage )
@ -2134,7 +1975,6 @@ GLboolean XMesaGetBackBuffer( XMesaBuffer b,
return GL_FALSE;
}
}
#endif /* XFree86Server */
/*
@ -2171,11 +2011,7 @@ GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height,
void XMesaFlush( XMesaContext c )
{
if (c && c->xm_visual) {
#ifdef XFree86Server
/* NOT_NEEDED */
#else
XSync( c->xm_visual->display, False );
#endif
}
}
@ -2234,15 +2070,11 @@ void XMesaGarbageCollect( void )
for (b=XMesaBufferList; b; b=next) {
next = b->Next;
if (b->display && b->frontxrb->drawable && b->type == WINDOW) {
#ifdef XFree86Server
/* NOT_NEEDED */
#else
XSync(b->display, False);
if (!window_exists( b->display, b->frontxrb->drawable )) {
/* found a dead window, free the ancillary info */
XMesaDestroyBuffer( b );
}
#endif
}
}
}

View File

@ -37,7 +37,7 @@
#include "main/renderbuffer.h"
#if defined(USE_XSHM) && !defined(XFree86Server)
#if defined(USE_XSHM)
static volatile int mesaXErrorFlag = 0;
/**
@ -170,7 +170,7 @@ alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
if (b->db_mode == BACK_XIMAGE) {
/* Deallocate the old backxrb->ximage, if any */
if (b->backxrb->ximage) {
#if defined(USE_XSHM) && !defined(XFree86Server)
#if defined(USE_XSHM)
if (b->shm) {
XShmDetach(b->xm_visual->display, &b->shminfo);
XDestroyImage(b->backxrb->ximage);
@ -188,10 +188,6 @@ alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
/* Allocate new back buffer */
if (b->shm == 0 || !alloc_back_shm_ximage(b, width, height)) {
/* Allocate a regular XImage for the back buffer. */
#ifdef XFree86Server
b->backxrb->ximage = XMesaCreateImage(b->xm_visual->BitsPerPixel,
width, height, NULL);
#else
b->backxrb->ximage = XCreateImage(b->xm_visual->display,
b->xm_visual->visinfo->visual,
GET_VISUAL_DEPTH(b->xm_visual),
@ -199,7 +195,6 @@ alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
NULL,
width, height,
8, 0); /* pad, bytes_per_line */
#endif
if (!b->backxrb->ximage) {
_mesa_warning(NULL, "alloc_back_buffer: XCreateImage failed.\n");
return;
@ -359,16 +354,8 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb)
if (b->num_alloced > 0) {
/* If no other buffer uses this X colormap then free the colors. */
if (!xmesa_find_buffer(b->display, b->cmap, b)) {
#ifdef XFree86Server
int client = 0;
if (b->frontxrb->drawable)
client = CLIENT_ID(b->frontxrb->drawable->id);
(void)FreeColors(b->cmap, client,
b->num_alloced, b->alloced_colors, 0);
#else
XFreeColors(b->display, b->cmap,
b->alloced_colors, b->num_alloced, 0);
#endif
}
}
@ -382,7 +369,7 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb)
if (fb->Visual.doubleBufferMode) {
/* free back ximage/pixmap/shmregion */
if (b->backxrb->ximage) {
#if defined(USE_XSHM) && !defined(XFree86Server)
#if defined(USE_XSHM)
if (b->shm) {
XShmDetach( b->display, &b->shminfo );
XDestroyImage( b->backxrb->ximage );

View File

@ -93,16 +93,12 @@ const int xmesa_kernel1[16] = {
static void
finish_or_flush( struct gl_context *ctx )
{
#ifdef XFree86Server
/* NOT_NEEDED */
#else
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
if (xmesa) {
_glthread_LOCK_MUTEX(_xmesa_lock);
XSync( xmesa->display, False );
_glthread_UNLOCK_MUTEX(_xmesa_lock);
}
#endif
}
@ -388,7 +384,6 @@ clear_buffers(struct gl_context *ctx, GLbitfield buffers)
}
#ifndef XFree86Server
/* XXX these functions haven't been tested in the Xserver environment */
@ -731,7 +726,6 @@ xmesa_CopyPixels( struct gl_context *ctx,
}
}
#endif /* XFree86Server */
@ -745,17 +739,9 @@ get_string( struct gl_context *ctx, GLenum name )
(void) ctx;
switch (name) {
case GL_RENDERER:
#ifdef XFree86Server
return (const GLubyte *) "Mesa GLX Indirect";
#else
return (const GLubyte *) "Mesa X11";
#endif
case GL_VENDOR:
#ifdef XFree86Server
return (const GLubyte *) "Mesa project: www.mesa3d.org";
#else
return NULL;
#endif
default:
return NULL;
}
@ -1087,7 +1073,6 @@ xmesa_init_driver_functions( XMesaVisual xmvisual,
}
else {
driver->Clear = clear_buffers;
#ifndef XFree86Server
driver->CopyPixels = xmesa_CopyPixels;
if (xmvisual->undithered_pf == PF_8R8G8B &&
xmvisual->dithered_pf == PF_8R8G8B &&
@ -1097,7 +1082,6 @@ xmesa_init_driver_functions( XMesaVisual xmvisual,
else if (xmvisual->undithered_pf == PF_5R6G5B) {
driver->DrawPixels = xmesa_DrawPixels_5R6G5B;
}
#endif
}
#if ENABLE_EXT_texure_compression_s3tc

View File

@ -140,16 +140,8 @@ static void FXgetImage( XMesaBuffer b )
GLuint x, y;
GLuint width, height;
#ifdef XFree86Server
x = b->frontxrb->pixmap->x;
y = b->frontxrb->pixmap->y;
width = b->frontxrb->pixmap->width;
height = b->frontxrb->pixmap->height;
depth = b->frontxrb->pixmap->depth;
#else
xmesa_get_window_size(b->display, b, &width, &height);
x = y = 0;
#endif
if (b->mesa_buffer.Width != width || b->mesa_buffer.Height != height) {
b->mesa_buffer.Width = MIN2((int)width, b->FXctx->width);
b->mesa_buffer.Height = MIN2((int)height, b->FXctx->height);

View File

@ -37,97 +37,3 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "glxheader.h"
#include "xmesaP.h"
#ifdef XFree86Server
#ifdef ROUNDUP
#undef ROUNDUP
#endif
#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3))
XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, char *data)
{
XMesaImage *image;
image = (XMesaImage *)xalloc(sizeof(XMesaImage));
if (image) {
image->width = width;
image->height = height;
image->data = data;
/* Always pad to 32 bits */
image->bytes_per_line = ROUNDUP((bitsPerPixel * width), 32);
image->bits_per_pixel = bitsPerPixel;
}
return image;
}
void XMesaDestroyImage(XMesaImage *image)
{
if (image->data)
free(image->data);
xfree(image);
}
unsigned long XMesaGetPixel(XMesaImage *image, int x, int y)
{
CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line);
CARD8 *i8;
CARD16 *i16;
CARD32 *i32;
switch (image->bits_per_pixel) {
case 8:
i8 = (CARD8 *)row;
return i8[x];
break;
case 15:
case 16:
i16 = (CARD16 *)row;
return i16[x];
break;
case 24: /* WARNING: architecture specific code */
i8 = (CARD8 *)row;
return (((CARD32)i8[x*3]) |
(((CARD32)i8[x*3+1])<<8) |
(((CARD32)i8[x*3+2])<<16));
break;
case 32:
i32 = (CARD32 *)row;
return i32[x];
break;
}
return 0;
}
#ifndef XMESA_USE_PUTPIXEL_MACRO
void XMesaPutPixel(XMesaImage *image, int x, int y, unsigned long pixel)
{
CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line);
CARD8 *i8;
CARD16 *i16;
CARD32 *i32;
switch (image->bits_per_pixel) {
case 8:
i8 = (CARD8 *)row;
i8[x] = (CARD8)pixel;
break;
case 15:
case 16:
i16 = (CARD16 *)row;
i16[x] = (CARD16)pixel;
break;
case 24: /* WARNING: architecture specific code */
i8 = (CARD8 *)__row;
i8[x*3] = (CARD8)(p);
i8[x*3+1] = (CARD8)(p>>8);
i8[x*3+2] = (CARD8)(p>>16);
case 32:
i32 = (CARD32 *)row;
i32[x] = (CARD32)pixel;
break;
}
}
#endif
#endif /* XFree86Server */

View File

@ -537,7 +537,6 @@ void xmesa_choose_point( struct gl_context *ctx )
#ifndef XFree86Server
/**
* Draw fast, XOR line with XDrawLine in front color buffer.
* WARNING: this isn't fully OpenGL conformant because different pixels
@ -567,7 +566,6 @@ xor_line(struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1)
XDrawLine(dpy, xrb->pixmap, gc, x0, y0, x1, y1);
XMesaSetFunction(dpy, gc, GXcopy); /* this gc is used elsewhere */
}
#endif /* XFree86Server */
#endif /* CHAN_BITS == 8 */
@ -660,7 +658,6 @@ get_line_func(struct gl_context *ctx)
}
}
#ifndef XFree86Server
if (ctx->DrawBuffer->_NumColorDrawBuffers == 1
&& ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT
&& swrast->_RasterMask == LOGIC_OP_BIT
@ -669,7 +666,6 @@ get_line_func(struct gl_context *ctx)
&& !ctx->Line.SmoothFlag) {
return xor_line;
}
#endif /* XFree86Server */
#endif /* CHAN_BITS == 8 */
return (swrast_line_func) NULL;

View File

@ -42,7 +42,6 @@
* generate BadMatch errors if the drawable isn't mapped.
*/
#ifndef XFree86Server
static int caught_xgetimage_error = 0;
static int (*old_xerror_handler)( XMesaDisplay *dpy, XErrorEvent *ev );
static unsigned long xgetimage_serial;
@ -87,7 +86,6 @@ static int check_xgetimage_errors( void )
/* return 0=no error, 1=error caught */
return caught_xgetimage_error;
}
#endif
/*
@ -97,7 +95,6 @@ static unsigned long read_pixel( XMesaDisplay *dpy,
XMesaDrawable d, int x, int y )
{
unsigned long p;
#ifndef XFree86Server
XMesaImage *pixel = NULL;
int error;
@ -113,9 +110,6 @@ static unsigned long read_pixel( XMesaDisplay *dpy,
if (pixel) {
XMesaDestroyImage( pixel );
}
#else
(*dpy->GetImage)(d, x, y, 1, 1, ZPixmap, ~0L, (pointer)&p);
#endif
return p;
}
@ -3763,7 +3757,6 @@ static void put_values_ci_ximage( PUT_VALUES_ARGS )
/***** Pixel reading *****/
/**********************************************************************/
#ifndef XFree86Server
/**
* Do clip testing prior to calling XGetImage. If any of the region lies
* outside the screen's bounds, XGetImage will return NULL.
@ -3806,7 +3799,6 @@ clip_for_xgetimage(struct gl_context *ctx, XMesaPixmap pixmap, GLuint *n, GLint
}
return 0;
}
#endif
/*
@ -3824,7 +3816,6 @@ get_row_ci(struct gl_context *ctx, struct gl_renderbuffer *rb,
y = YFLIP(xrb, y);
if (xrb->pixmap) {
#ifndef XFree86Server
XMesaImage *span = NULL;
int error;
int k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y);
@ -3850,11 +3841,6 @@ get_row_ci(struct gl_context *ctx, struct gl_renderbuffer *rb,
if (span) {
XMesaDestroyImage( span );
}
#else
(*xmesa->display->GetImage)(xrb->drawable,
x, y, n, 1, ZPixmap,
~0L, (pointer)index);
#endif
}
else if (xrb->ximage) {
XMesaImage *img = xrb->ximage;
@ -3882,14 +3868,6 @@ get_row_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb,
/* Read from Pixmap or Window */
XMesaImage *span = NULL;
int error;
#ifdef XFree86Server
span = XMesaCreateImage(xmesa->xm_visual->BitsPerPixel, n, 1, NULL);
span->data = (char *)MALLOC(span->height * span->bytes_per_line);
error = (!span->data);
(*xmesa->display->GetImage)(xrb->drawable,
x, YFLIP(xrb, y), n, 1, ZPixmap,
~0L, (pointer)span->data);
#else
int k;
y = YFLIP(xrb, y);
k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y);
@ -3900,7 +3878,6 @@ get_row_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb,
span = XGetImage( xmesa->display, xrb->pixmap,
x, y, n, 1, AllPlanes, ZPixmap );
error = check_xgetimage_errors();
#endif
if (span && !error) {
switch (xmesa->pixelformat) {
case PF_Truecolor:

View File

@ -72,13 +72,9 @@ and create a window, you must do the following to use the X/Mesa interface:
extern "C" {
#endif
#ifdef XFree86Server
#include "xmesa_xf86.h"
#else
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "xmesa_x.h"
#endif
#include "GL/gl.h"
#ifdef AMIWIN
@ -180,19 +176,6 @@ extern XMesaContext XMesaCreateContext( XMesaVisual v,
extern void XMesaDestroyContext( XMesaContext c );
#ifdef XFree86Server
/*
* These are the extra routines required for integration with XFree86.
* None of these routines should be user visible. -KEM
*/
extern GLboolean XMesaForceCurrent( XMesaContext c );
extern GLboolean XMesaLoseCurrent( XMesaContext c );
extern GLboolean XMesaCopyContext( XMesaContext src,
XMesaContext dst,
GLuint mask );
#endif /* XFree86Server */
/*

View File

@ -33,9 +33,6 @@
#include "fxmesa.h"
#include "xm_glide.h"
#endif
#ifdef XFree86Server
#include "xm_image.h"
#endif
extern _glthread_Mutex _xmesa_lock;
@ -88,13 +85,8 @@ struct xmesa_visual {
XMesaDisplay *display; /* The X11 display */
int screen, visualID;
int visualType;
#ifdef XFree86Server
GLint ColormapEntries;
GLint nplanes;
#else
XMesaVisualInfo visinfo; /* X's visual info (pointer to private copy) */
XVisualInfo *vishandle; /* Only used in fakeglx.c */
#endif
GLint BitsPerPixel; /* True bits per pixel for XImages */
GLboolean ximage_flag; /* Use XImage for back buffer (not pixmap)? */
@ -233,7 +225,7 @@ struct xmesa_buffer {
/* 0 = not available */
/* 1 = XImage support available */
/* 2 = Pixmap support available too */
#if defined(USE_XSHM) && !defined(XFree86Server)
#if defined(USE_XSHM)
XShmSegmentInfo shminfo;
#endif
@ -259,11 +251,7 @@ struct xmesa_buffer {
/* Used to do XAllocColor/XFreeColors accounting: */
int num_alloced;
#if defined(XFree86Server)
Pixel alloced_colors[256];
#else
unsigned long alloced_colors[256];
#endif
#if defined( FX )
/* For 3Dfx Glide only */
@ -578,9 +566,7 @@ extern void xmesa_register_swrast_functions( struct gl_context *ctx );
#define ENABLE_EXT_texure_compression_s3tc 0 /* SW texture compression */
#ifdef XFree86Server
#define ENABLE_EXT_timer_query 0
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define ENABLE_EXT_timer_query 1 /* should have 64-bit GLuint64EXT */
#else
#define ENABLE_EXT_timer_query 0 /* may not have 64-bit GLuint64EXT */