diff options
author | Ben Skeggs <skeggsb@gmail.com> | 2008-09-30 11:57:45 +1000 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2008-09-30 11:57:45 +1000 |
commit | 8cd046c9b1da31e4ff178816bdfe2ee3451a1553 (patch) | |
tree | 6b9de732a9d75c3005a80b078af0c97b9cb6c0ab /src/mesa | |
parent | 8c14bd6992e338da8e467775b0237c8db7cbe44d (diff) | |
parent | 5dc8e67078be8b8c42a809311debd275ac7d64a7 (diff) |
Merge remote branch 'origin/gallium-0.2' into gallium-0.2
Diffstat (limited to 'src/mesa')
490 files changed, 2625 insertions, 7493 deletions
diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c index c12d42148b..ade6251848 100644 --- a/src/mesa/drivers/allegro/amesa.c +++ b/src/mesa/drivers/allegro/amesa.c @@ -21,11 +21,11 @@ #include <stdio.h> #include <stdlib.h> #include <allegro.h> -#include "buffers.h" -#include "context.h" -#include "imports.h" -#include "matrix.h" -#include "mtypes.h" +#include "main/buffers.h" +#include "main/context.h" +#include "main/imports.h" +#include "main/matrix.h" +#include "main/mtypes.h" #include "GL/amesa.h" diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 7d6e6ef766..986f751bdc 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -23,35 +23,36 @@ */ -#include "glheader.h" -#include "imports.h" -#include "arrayobj.h" -#include "buffers.h" -#include "context.h" -#include "framebuffer.h" -#include "mipmap.h" -#include "queryobj.h" -#include "renderbuffer.h" -#include "texcompress.h" -#include "texformat.h" -#include "teximage.h" -#include "texobj.h" -#include "texstore.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/arrayobj.h" +#include "main/buffers.h" +#include "main/context.h" +#include "main/framebuffer.h" +#include "main/mipmap.h" +#include "main/queryobj.h" +#include "main/renderbuffer.h" +#include "main/texcompress.h" +#include "main/texformat.h" +#include "main/teximage.h" +#include "main/texobj.h" +#include "main/texstore.h" #if FEATURE_ARB_vertex_buffer_object -#include "bufferobj.h" +#include "main/bufferobj.h" #endif #if FEATURE_EXT_framebuffer_object -#include "fbobject.h" -#include "texrender.h" +#include "main/fbobject.h" +#include "main/texrender.h" #endif #include "shader/program.h" #include "shader/prog_execute.h" #include "shader/shader_api.h" -#include "driverfuncs.h" #include "tnl/tnl.h" #include "swrast/swrast.h" +#include "driverfuncs.h" + /** diff --git a/src/mesa/drivers/directfb/idirectfbgl_mesa.c b/src/mesa/drivers/directfb/idirectfbgl_mesa.c index a364ada1f1..93593403c1 100644 --- a/src/mesa/drivers/directfb/idirectfbgl_mesa.c +++ b/src/mesa/drivers/directfb/idirectfbgl_mesa.c @@ -36,16 +36,16 @@ #include <direct/interface.h> #undef CLAMP -#include "glheader.h" -#include "buffers.h" -#include "context.h" -#include "extensions.h" -#include "framebuffer.h" -#include "renderbuffer.h" -#include "imports.h" -#include "texformat.h" -#include "teximage.h" -#include "texstore.h" +#include "main/glheader.h" +#include "main/buffers.h" +#include "main/context.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" +#include "main/imports.h" +#include "main/texformat.h" +#include "main/teximage.h" +#include "main/texstore.h" #include "vbo/vbo.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c index ee87e63852..003c06a8ff 100644 --- a/src/mesa/drivers/dos/dmesa.c +++ b/src/mesa/drivers/dos/dmesa.c @@ -31,9 +31,9 @@ */ -#include "context.h" -#include "imports.h" -#include "mtypes.h" +#include "main/context.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "video.h" diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index 166621cd6c..2fa36bab3f 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -42,10 +42,7 @@ SHARED_INCLUDES = \ -I$(TOP)/src/mesa/drivers/dri/common \ -Iserver \ -I$(TOP)/include \ - -I$(TOP)/include/GL/internal \ -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/main \ - -I$(TOP)/src/mesa/glapi \ -I$(TOP)/src/egl/main \ -I$(TOP)/src/egl/drivers/dri \ $(LIBDRM_CFLAGS) diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c deleted file mode 100644 index 5747307f3b..0000000000 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ /dev/null @@ -1,535 +0,0 @@ -/************************************************************************** - * - * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA - * 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 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 - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * - **************************************************************************/ -/* - * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com> - * Keith Whitwell <keithw-at-tungstengraphics-dot-com> - */ - -#include <xf86drm.h> -#include <stdlib.h> -#include "glthread.h" -#include "errno.h" -#include "dri_bufmgr.h" -#include "string.h" -#include "imports.h" -#include "dri_bufpool.h" - -_glthread_DECLARE_STATIC_MUTEX(bmMutex); - -/* - * TODO: Introduce fence pools in the same way as - * buffer object pools. - */ - - - -typedef struct _DriFenceObject -{ - int fd; - _glthread_Mutex mutex; - int refCount; - const char *name; - drmFence fence; -} DriFenceObject; - -typedef struct _DriBufferObject -{ - DriBufferPool *pool; - _glthread_Mutex mutex; - int refCount; - const char *name; - unsigned flags; - unsigned hint; - unsigned alignment; - void *private; - /* user-space buffer: */ - unsigned userBuffer; - void *userData; - unsigned userSize; -} DriBufferObject; - - -void -bmError(int val, const char *file, const char *function, int line) -{ - _mesa_printf("Fatal video memory manager error \"%s\".\n" - "Check kernel logs or set the LIBGL_DEBUG\n" - "environment variable to \"verbose\" for more info.\n" - "Detected in file %s, line %d, function %s.\n", - strerror(-val), file, line, function); -#ifndef NDEBUG - abort(); -#else - abort(); -#endif -} - -DriFenceObject * -driFenceBuffers(int fd, char *name, unsigned flags) -{ - DriFenceObject *fence = (DriFenceObject *) malloc(sizeof(*fence)); - int ret; - - if (!fence) - BM_CKFATAL(-EINVAL); - - _glthread_LOCK_MUTEX(bmMutex); - fence->refCount = 1; - fence->name = name; - fence->fd = fd; - _glthread_INIT_MUTEX(fence->mutex); - ret = drmFenceBuffers(fd, flags, &fence->fence); - _glthread_UNLOCK_MUTEX(bmMutex); - if (ret) { - free(fence); - BM_CKFATAL(ret); - } - return fence; -} - - -unsigned -driFenceType(DriFenceObject * fence) -{ - unsigned ret; - - _glthread_LOCK_MUTEX(bmMutex); - ret = fence->fence.flags; - _glthread_UNLOCK_MUTEX(bmMutex); - - return ret; -} - - -DriFenceObject * -driFenceReference(DriFenceObject * fence) -{ - _glthread_LOCK_MUTEX(bmMutex); - ++fence->refCount; - _glthread_UNLOCK_MUTEX(bmMutex); - return fence; -} - -void -driFenceUnReference(DriFenceObject * fence) -{ - if (!fence) - return; - - _glthread_LOCK_MUTEX(bmMutex); - if (--fence->refCount == 0) { - drmFenceDestroy(fence->fd, &fence->fence); - free(fence); - } - _glthread_UNLOCK_MUTEX(bmMutex); -} - -void -driFenceFinish(DriFenceObject * fence, unsigned type, int lazy) -{ - int ret; - unsigned flags = (lazy) ? DRM_FENCE_FLAG_WAIT_LAZY : 0; - - _glthread_LOCK_MUTEX(fence->mutex); - ret = drmFenceWait(fence->fd, flags, &fence->fence, type); - _glthread_UNLOCK_MUTEX(fence->mutex); - BM_CKFATAL(ret); -} - -int -driFenceSignaled(DriFenceObject * fence, unsigned type) -{ - int signaled; - int ret; - - if (fence == NULL) - return GL_TRUE; - - _glthread_LOCK_MUTEX(fence->mutex); - ret = drmFenceSignaled(fence->fd, &fence->fence, type, &signaled); - _glthread_UNLOCK_MUTEX(fence->mutex); - BM_CKFATAL(ret); - return signaled; -} - - -extern drmBO * -driBOKernel(struct _DriBufferObject *buf) -{ - drmBO *ret; - - assert(buf->private != NULL); - ret = buf->pool->kernel(buf->pool, buf->private); - if (!ret) - BM_CKFATAL(-EINVAL); - - return ret; -} - -void -driBOWaitIdle(struct _DriBufferObject *buf, int lazy) -{ - struct _DriBufferPool *pool; - void *priv; - - _glthread_LOCK_MUTEX(buf->mutex); - pool = buf->pool; - priv = buf->private; - _glthread_UNLOCK_MUTEX(buf->mutex); - - assert(priv != NULL); - BM_CKFATAL(buf->pool->waitIdle(pool, priv, lazy)); -} - -void * -driBOMap(struct _DriBufferObject *buf, unsigned flags, unsigned hint) -{ - if (buf->userBuffer) { - return buf->userData; - } - else { - void *virtual; - - assert(buf->private != NULL); - - _glthread_LOCK_MUTEX(buf->mutex); - BM_CKFATAL(buf->pool->map(buf->pool, buf->private, flags, hint, &virtual)); - _glthread_UNLOCK_MUTEX(buf->mutex); - return virtual; - } -} - -void -driBOUnmap(struct _DriBufferObject *buf) -{ - if (!buf->userBuffer) { - assert(buf->private != NULL); - - buf->pool->unmap(buf->pool, buf->private); - } -} - -unsigned long -driBOOffset(struct _DriBufferObject *buf) -{ - unsigned long ret; - - assert(buf->private != NULL); - - _glthread_LOCK_MUTEX(buf->mutex); - ret = buf->pool->offset(buf->pool, buf->private); - _glthread_UNLOCK_MUTEX(buf->mutex); - return ret; -} - -unsigned -driBOFlags(struct _DriBufferObject *buf) -{ - unsigned ret; - - assert(buf->private != NULL); - - _glthread_LOCK_MUTEX(buf->mutex); - ret = buf->pool->flags(buf->pool, buf->private); - _glthread_UNLOCK_MUTEX(buf->mutex); - return ret; -} - -struct _DriBufferObject * -driBOReference(struct _DriBufferObject *buf) -{ - _glthread_LOCK_MUTEX(bmMutex); - if (++buf->refCount == 1) { - BM_CKFATAL(-EINVAL); - } - _glthread_UNLOCK_MUTEX(bmMutex); - return buf; -} - -void -driBOUnReference(struct _DriBufferObject *buf) -{ - int tmp; - - if (!buf) - return; - - _glthread_LOCK_MUTEX(bmMutex); - tmp = --buf->refCount; - _glthread_UNLOCK_MUTEX(bmMutex); - if (!tmp) { - if (buf->private) - buf->pool->destroy(buf->pool, buf->private); - free(buf); - } -} - -void -driBOData(struct _DriBufferObject *buf, - unsigned size, const void *data, unsigned flags) -{ - void *virtual; - int newBuffer; - struct _DriBufferPool *pool; - - assert(!buf->userBuffer); /* XXX just do a memcpy? */ - - _glthread_LOCK_MUTEX(buf->mutex); - pool = buf->pool; - if (!pool->create) { - _mesa_error(NULL, GL_INVALID_OPERATION, - "driBOData called on invalid buffer\n"); - BM_CKFATAL(-EINVAL); - } - newBuffer = !buf->private || (pool->size(pool, buf->private) < size) || - pool->map(pool, buf->private, DRM_BO_FLAG_WRITE, - DRM_BO_HINT_DONT_BLOCK, &virtual); - - if (newBuffer) { - if (buf->private) - pool->destroy(pool, buf->private); - if (!flags) - flags = buf->flags; - buf->private = pool->create(pool, size, flags, DRM_BO_HINT_DONT_FENCE, - buf->alignment); - if (!buf->private) - BM_CKFATAL(-ENOMEM); - BM_CKFATAL(pool->map(pool, buf->private, - DRM_BO_FLAG_WRITE, - DRM_BO_HINT_DONT_BLOCK, &virtual)); - } - - if (data != NULL) - memcpy(virtual, data, size); - - BM_CKFATAL(pool->unmap(pool, buf->private)); - _glthread_UNLOCK_MUTEX(buf->mutex); -} - -void -driBOSubData(struct _DriBufferObject *buf, - unsigned long offset, unsigned long size, const void *data) -{ - void *virtual; - - assert(!buf->userBuffer); /* XXX just do a memcpy? */ - - _glthread_LOCK_MUTEX(buf->mutex); - if (size && data) { - BM_CKFATAL(buf->pool->map(buf->pool, buf->private, - DRM_BO_FLAG_WRITE, 0, &virtual)); - memcpy((unsigned char *) virtual + offset, data, size); - BM_CKFATAL(buf->pool->unmap(buf->pool, buf->private)); - } - _glthread_UNLOCK_MUTEX(buf->mutex); -} - -void -driBOGetSubData(struct _DriBufferObject *buf, - unsigned long offset, unsigned long size, void *data) -{ - void *virtual; - - assert(!buf->userBuffer); /* XXX just do a memcpy? */ - - _glthread_LOCK_MUTEX(buf->mutex); - if (size && data) { - BM_CKFATAL(buf->pool->map(buf->pool, buf->private, - DRM_BO_FLAG_READ, 0, &virtual)); - memcpy(data, (unsigned char *) virtual + offset, size); - BM_CKFATAL(buf->pool->unmap(buf->pool, buf->private)); - } - _glthread_UNLOCK_MUTEX(buf->mutex); -} - -void -driBOSetStatic(struct _DriBufferObject *buf, - unsigned long offset, - unsigned long size, void *virtual, unsigned flags) -{ - assert(!buf->userBuffer); /* XXX what to do? */ - - _glthread_LOCK_MUTEX(buf->mutex); - if (buf->private != NULL) { - _mesa_error(NULL, GL_INVALID_OPERATION, - "Invalid buffer for setStatic\n"); - BM_CKFATAL(-EINVAL); - } - if (buf->pool->setstatic == NULL) { - _mesa_error(NULL, GL_INVALID_OPERATION, - "Invalid buffer pool for setStatic\n"); - BM_CKFATAL(-EINVAL); - } - - if (!flags) - flags = buf->flags; - - buf->private = buf->pool->setstatic(buf->pool, offset, size, - virtual, flags); - if (!buf->private) { - _mesa_error(NULL, GL_OUT_OF_MEMORY, - "Invalid buffer pool for setStatic\n"); - BM_CKFATAL(-ENOMEM); - } - _glthread_UNLOCK_MUTEX(buf->mutex); -} - - - -void -driGenBuffers(struct _DriBufferPool *pool, - const char *name, - unsigned n, - struct _DriBufferObject *buffers[], - unsigned alignment, unsigned flags, unsigned hint) -{ - struct _DriBufferObject *buf; - int i; - - flags = (flags) ? flags : DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_MEM_VRAM | - DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE; - - - for (i = 0; i < n; ++i) { - buf = (struct _DriBufferObject *) calloc(1, sizeof(*buf)); - if (!buf) - BM_CKFATAL(-ENOMEM); - - _glthread_INIT_MUTEX(buf->mutex); - _glthread_LOCK_MUTEX(buf->mutex); - _glthread_LOCK_MUTEX(bmMutex); - buf->refCount = 1; - _glthread_UNLOCK_MUTEX(bmMutex); - buf->flags = flags; - buf->hint = hint; - buf->name = name; - buf->alignment = alignment; - buf->pool = pool; - _glthread_UNLOCK_MUTEX(buf->mutex); - buffers[i] = buf; - } -} - -void -driGenUserBuffer(struct _DriBufferPool *pool, - const char *name, - struct _DriBufferObject **buffers, - void *ptr, unsigned bytes) -{ - const unsigned alignment = 1, flags = 0, hint = 0; - - driGenBuffers(pool, name, 1, buffers, alignment, flags, hint); - - (*buffers)->userBuffer = 1; - (*buffers)->userData = ptr; - (*buffers)->userSize = bytes; -} - - -void -driDeleteBuffers(unsigned n, struct _DriBufferObject *buffers[]) -{ - int i; - - for (i = 0; i < n; ++i) { - driBOUnReference(buffers[i]); - } -} - - -void -driInitBufMgr(int fd) -{ - ; -} - - -void -driBOCreateList(int target, drmBOList * list) -{ - _glthread_LOCK_MUTEX(bmMutex); - BM_CKFATAL(drmBOCreateList(target, list)); - _glthread_UNLOCK_MUTEX(bmMutex); -} - -void -driBOResetList(drmBOList * list) -{ - _glthread_LOCK_MUTEX(bmMutex); - BM_CKFATAL(drmBOResetList(list)); - _glthread_UNLOCK_MUTEX(bmMutex); -} - -void -driBOAddListItem(drmBOList * list, struct _DriBufferObject *buf, - unsigned flags, unsigned mask) -{ - int newItem; - - _glthread_LOCK_MUTEX(buf->mutex); - _glthread_LOCK_MUTEX(bmMutex); - BM_CKFATAL(drmAddValidateItem(list, driBOKernel(buf), - flags, mask, &newItem)); - _glthread_UNLOCK_MUTEX(bmMutex); - - /* - * Tell userspace pools to validate the buffer. This should be a - * noop if the pool is already validated. - * FIXME: We should have a list for this as well. - */ - - if (buf->pool->validate) { - BM_CKFATAL(buf->pool->validate(buf->pool, buf->private)); - } - - _glthread_UNLOCK_MUTEX(buf->mutex); -} - -void -driBOFence(struct _DriBufferObject *buf, struct _DriFenceObject *fence) -{ - _glthread_LOCK_MUTEX(buf->mutex); - BM_CKFATAL(buf->pool->fence(buf->pool, buf->private, fence)); - _glthread_UNLOCK_MUTEX(buf->mutex); - -} - -void -driBOValidateList(int fd, drmBOList * list) -{ - _glthread_LOCK_MUTEX(bmMutex); - BM_CKFATAL(drmBOValidateList(fd, list)); - _glthread_UNLOCK_MUTEX(bmMutex); -} - -void -driPoolTakeDown(struct _DriBufferPool *pool) -{ - pool->takeDown(pool); - -} diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h deleted file mode 100644 index ee4ce2cbde..0000000000 --- a/src/mesa/drivers/dri/common/dri_bufmgr.h +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************** - * - * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA - * 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 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 - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * - **************************************************************************/ -/* - * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com> - * Keith Whitwell <keithw-at-tungstengraphics-dot-com> - */ - -#ifndef _DRI_BUFMGR_H_ -#define _DRI_BUFMGR_H_ -#include <xf86drm.h> - - -struct _DriFenceObject; -struct _DriBufferObject; -struct _DriBufferPool; - -extern struct _DriFenceObject *driFenceBuffers(int fd, char *name, - unsigned flags); - -extern struct _DriFenceObject *driFenceReference(struct _DriFenceObject *fence); - -extern void driFenceUnReference(struct _DriFenceObject *fence); - -extern void -driFenceFinish(struct _DriFenceObject *fence, unsigned type, int lazy); - -extern int driFenceSignaled(struct _DriFenceObject *fence, unsigned type); -extern unsigned driFenceType(struct _DriFenceObject *fence); - -/* - * Return a pointer to the libdrm buffer object this DriBufferObject - * uses. - */ - -extern drmBO *driBOKernel(struct _DriBufferObject *buf); -extern void *driBOMap(struct _DriBufferObject *buf, unsigned flags, - unsigned hint); -extern void driBOUnmap(struct _DriBufferObject *buf); -extern unsigned long driBOOffset(struct _DriBufferObject *buf); -extern unsigned driBOFlags(struct _DriBufferObject *buf); -extern struct _DriBufferObject *driBOReference(struct _DriBufferObject *buf); -extern void driBOUnReference(struct _DriBufferObject *buf); -extern void driBOData(struct _DriBufferObject *r_buf, - unsigned size, const void *data, unsigned flags); -extern void driBOSubData(struct _DriBufferObject *buf, - unsigned long offset, unsigned long size, - const void *data); -extern void driBOGetSubData(struct _DriBufferObject *buf, - unsigned long offset, unsigned long size, - void *data); -extern void driGenBuffers(struct _DriBufferPool *pool, - const char *name, - unsigned n, - struct _DriBufferObject *buffers[], - unsigned alignment, unsigned flags, unsigned hint); -extern void driGenUserBuffer(struct _DriBufferPool *pool, - const char *name, - struct _DriBufferObject *buffers[], - void *ptr, unsigned bytes); -extern void driDeleteBuffers(unsigned n, struct _DriBufferObject *buffers[]); -extern void driInitBufMgr(int fd); -extern void driBOCreateList(int target, drmBOList * list); -extern void driBOResetList(drmBOList * list); -extern void driBOAddListItem(drmBOList * list, struct _DriBufferObject *buf, - unsigned flags, unsigned mask); -extern void driBOValidateList(int fd, drmBOList * list); - -extern void driBOFence(struct _DriBufferObject *buf, - struct _DriFenceObject *fence); - -extern void driPoolTakeDown(struct _DriBufferPool *pool); -extern void driBOSetStatic(struct _DriBufferObject *buf, - unsigned long offset, - unsigned long size, void *virtual, unsigned flags); -extern void driBOWaitIdle(struct _DriBufferObject *buf, int lazy); -extern void driPoolTakeDown(struct _DriBufferPool *pool); - -#endif diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index ce540624a5..ceedd914fb 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -26,7 +26,7 @@ #define MAP_FAILED ((void *)-1) #endif -#include "imports.h" +#include "main/imports.h" #define None 0 #include "dri_util.h" diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 1a8f020c77..0feb57b3c6 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -51,7 +51,7 @@ #include <drm.h> #include <drm_sarea.h> #include <xf86drm.h> -#include "glheader.h" +#include "main/glheader.h" #include "GL/internal/glcore.h" #include "GL/internal/dri_interface.h" diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c index d34da53479..15af99136c 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.c +++ b/src/mesa/drivers/dri/common/drirenderbuffer.c @@ -1,9 +1,9 @@ -#include "mtypes.h" +#include "main/mtypes.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" +#include "main/imports.h" #include "drirenderbuffer.h" -#include "framebuffer.h" -#include "renderbuffer.h" -#include "imports.h" /** diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h index 747f92fcdb..cf55286b30 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.h +++ b/src/mesa/drivers/dri/common/drirenderbuffer.h @@ -10,7 +10,7 @@ #ifndef DRIRENDERBUFFER_H #define DRIRENDERBUFFER_H -#include "mtypes.h" +#include "main/mtypes.h" #include "dri_util.h" diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h index ea5b9973dd..3143ea2b10 100644 --- a/src/mesa/drivers/dri/common/extension_helper.h +++ b/src/mesa/drivers/dri/common/extension_helper.h @@ -26,7 +26,7 @@ */ #include "utils.h" -#include "dispatch.h" +#include "glapi/dispatch.h" #ifndef NULL # define NULL 0 diff --git a/src/mesa/drivers/dri/common/mmio.h b/src/mesa/drivers/dri/common/mmio.h index dc43d1cdc9..ce95d8c907 100644 --- a/src/mesa/drivers/dri/common/mmio.h +++ b/src/mesa/drivers/dri/common/mmio.h @@ -33,7 +33,7 @@ #ifndef MMIO_H #define MMIO_H -#include "glheader.h" +#include "main/glheader.h" #if defined( __powerpc__ ) diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h index a1e56eb148..f2868cb58a 100644 --- a/src/mesa/drivers/dri/common/spantmp2.h +++ b/src/mesa/drivers/dri/common/spantmp2.h @@ -33,7 +33,7 @@ * \author Ian Romanick <idr@us.ibm.com> */ -#include "colormac.h" +#include "main/colormac.h" #include "spantmp_common.h" #ifndef DBG diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index b4af7c96e3..ff174a251d 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -43,10 +43,10 @@ */ #include "texmem.h" -#include "simple_list.h" -#include "imports.h" -#include "macros.h" -#include "texformat.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/texformat.h" #include <assert.h> diff --git a/src/mesa/drivers/dri/common/texmem.h b/src/mesa/drivers/dri/common/texmem.h index ffed7dd66e..9c065da8b4 100644 --- a/src/mesa/drivers/dri/common/texmem.h +++ b/src/mesa/drivers/dri/common/texmem.h @@ -38,8 +38,8 @@ #ifndef DRI_TEXMEM_H #define DRI_TEXMEM_H -#include "mtypes.h" -#include "mm.h" +#include "main/mtypes.h" +#include "main/mm.h" #include "xf86drm.h" struct dri_tex_heap; diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 431c26a19d..2a1ded3871 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -31,10 +31,10 @@ #include <string.h> #include <stdlib.h> -#include "mtypes.h" -#include "extensions.h" +#include "main/mtypes.h" +#include "main/extensions.h" +#include "glapi/dispatch.h" #include "utils.h" -#include "dispatch.h" int driDispatchRemapTable[ driDispatchRemapTable_size ]; @@ -524,17 +524,14 @@ GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32, * \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it. */ - -/* XXX: need to re-add msaa support after gallium-0.1 merge - */ - __DRIconfig ** driCreateConfigs(GLenum fb_format, GLenum fb_type, - const u_int8_t * depth_bits, const u_int8_t * stencil_bits, + const uint8_t * depth_bits, const uint8_t * stencil_bits, unsigned num_depth_stencil_bits, - const GLenum * db_modes, unsigned num_db_modes) + const GLenum * db_modes, unsigned num_db_modes, + const u_int8_t * msaa_samples, unsigned num_msaa_modes) { - static const u_int8_t bits_table[4][4] = { + static const uint8_t bits_table[4][4] = { /* R G B A */ { 3, 3, 2, 0 }, /* Any GL_UNSIGNED_BYTE_3_3_2 */ { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */ @@ -542,7 +539,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */ }; - static const u_int32_t masks_table_rgb[6][4] = { + static const uint32_t masks_table_rgb[6][4] = { { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */ { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */ { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */ @@ -551,7 +548,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, { 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 } /* 8_8_8_8_REV */ }; - static const u_int32_t masks_table_rgba[6][4] = { + static const uint32_t masks_table_rgba[6][4] = { { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */ { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */ { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */ @@ -560,7 +557,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 }, /* 8_8_8_8_REV */ }; - static const u_int32_t masks_table_bgr[6][4] = { + static const uint32_t masks_table_bgr[6][4] = { { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */ { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */ { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */ @@ -569,7 +566,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }, /* 8_8_8_8_REV */ }; - static const u_int32_t masks_table_bgra[6][4] = { + static const uint32_t masks_table_bgra[6][4] = { { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */ { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */ { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */ @@ -578,7 +575,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, { 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 }, /* 8_8_8_8_REV */ }; - static const u_int8_t bytes_per_pixel[6] = { + static const uint8_t bytes_per_pixel[6] = { 1, /* 3_3_2 */ 1, /* 2_3_3_REV */ 2, /* 5_6_5 */ @@ -587,14 +584,12 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, 4 /* 8_8_8_8_REV */ }; - const u_int8_t * bits; - const u_int32_t * masks; + const uint8_t * bits; + const uint32_t * masks; int index; __DRIconfig **configs, **c; __GLcontextModes *modes; - unsigned i; - unsigned j; - unsigned k; + unsigned i, j, k, h; unsigned num_modes; unsigned num_accum_bits = 2; @@ -667,7 +662,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, break; } - num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits; + num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes; configs = _mesa_calloc((num_modes + 1) * sizeof *configs); if (configs == NULL) return NULL; @@ -675,66 +670,72 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, c = configs; for ( k = 0 ; k < num_depth_stencil_bits ; k++ ) { for ( i = 0 ; i < num_db_modes ; i++ ) { - for ( j = 0 ; j < num_accum_bits ; j++ ) { - *c = _mesa_malloc (sizeof **c); - modes = &(*c)->modes; - c++; - - memset(modes, 0, sizeof *modes); - modes->redBits = bits[0]; - modes->greenBits = bits[1]; - modes->blueBits = bits[2]; - modes->alphaBits = bits[3]; - modes->redMask = masks[0]; - modes->greenMask = masks[1]; - modes->blueMask = masks[2]; - modes->alphaMask = masks[3]; - modes->rgbBits = modes->redBits + modes->greenBits - + modes->blueBits + modes->alphaBits; - - modes->accumRedBits = 16 * j; - modes->accumGreenBits = 16 * j; - modes->accumBlueBits = 16 * j; - modes->accumAlphaBits = (masks[3] != 0) ? 16 * j : 0; - modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; - - modes->stencilBits = stencil_bits[k]; - modes->depthBits = depth_bits[k]; - - modes->transparentPixel = GLX_NONE; - modes->transparentRed = GLX_DONT_CARE; - modes->transparentGreen = GLX_DONT_CARE; - modes->transparentBlue = GLX_DONT_CARE; - modes->transparentAlpha = GLX_DONT_CARE; - modes->transparentIndex = GLX_DONT_CARE; - modes->visualType = GLX_DONT_CARE; - modes->renderType = GLX_RGBA_BIT; - modes->drawableType = GLX_WINDOW_BIT; - modes->rgbMode = GL_TRUE; - - if ( db_modes[i] == GLX_NONE ) { - modes->doubleBufferMode = GL_FALSE; - } - else { - modes->doubleBufferMode = GL_TRUE; - modes->swapMethod = db_modes[i]; - } - - modes->haveAccumBuffer = ((modes->accumRedBits + + for ( h = 0 ; h < num_msaa_modes; h++ ) { + for ( j = 0 ; j < num_accum_bits ; j++ ) { + *c = _mesa_malloc (sizeof **c); + modes = &(*c)->modes; + c++; + + memset(modes, 0, sizeof *modes); + modes->redBits = bits[0]; + modes->greenBits = bits[1]; + modes->blueBits = bits[2]; + modes->alphaBits = bits[3]; + modes->redMask = masks[0]; + modes->greenMask = masks[1]; + modes->blueMask = masks[2]; + modes->alphaMask = masks[3]; + modes->rgbBits = modes->redBits + modes->greenBits + + modes->blueBits + modes->alphaBits; + + modes->accumRedBits = 16 * j; + modes->accumGreenBits = 16 * j; + modes->accumBlueBits = 16 * j; + modes->accumAlphaBits = (masks[3] != 0) ? 16 * j : 0; + modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; + + modes->stencilBits = stencil_bits[k]; + modes->depthBits = depth_bits[k]; + + modes->transparentPixel = GLX_NONE; + modes->transparentRed = GLX_DONT_CARE; + modes->transparentGreen = GLX_DONT_CARE; + modes->transparentBlue = GLX_DONT_CARE; + modes->transparentAlpha = GLX_DONT_CARE; + modes->transparentIndex = GLX_DONT_CARE; + modes->visualType = GLX_DONT_CARE; + modes->renderType = GLX_RGBA_BIT; + modes->drawableType = GLX_WINDOW_BIT; + modes->rgbMode = GL_TRUE; + + if ( db_modes[i] == GLX_NONE ) { + modes->doubleBufferMode = GL_FALSE; + } + else { + modes->doubleBufferMode = GL_TRUE; + modes->swapMethod = db_modes[i]; + } + + modes->samples = msaa_samples[h]; + modes->sampleBuffers = modes->samples ? 1 : 0; + + + modes->haveAccumBuffer = ((modes->accumRedBits + modes->accumGreenBits + modes->accumBlueBits + modes->accumAlphaBits) > 0); - modes->haveDepthBuffer = (modes->depthBits > 0); - modes->haveStencilBuffer = (modes->stencilBits > 0); - - modes->bindToTextureRgb = GL_TRUE; - modes->bindToTextureRgba = GL_TRUE; - modes->bindToMipmapTexture = GL_FALSE; - modes->bindToTextureTargets = modes->rgbMode ? - __DRI_ATTRIB_TEXTURE_1D_BIT | - __DRI_ATTRIB_TEXTURE_2D_BIT | - __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT : - 0; + modes->haveDepthBuffer = (modes->depthBits > 0); + modes->haveStencilBuffer = (modes->stencilBits > 0); + + modes->bindToTextureRgb = GL_TRUE; + modes->bindToTextureRgba = GL_TRUE; + modes->bindToMipmapTexture = GL_FALSE; + modes->bindToTextureTargets = modes->rgbMode ? + __DRI_ATTRIB_TEXTURE_1D_BIT | + __DRI_ATTRIB_TEXTURE_2D_BIT | + __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT : + 0; + } } } } diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index 9ac3b51447..4e27bd21a1 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -30,7 +30,7 @@ #include <GL/gl.h> #include <GL/internal/dri_interface.h> -#include "context.h" +#include "main/context.h" typedef struct __DRIutilversionRec2 __DRIutilversion2; @@ -129,9 +129,10 @@ struct __DRIconfigRec { extern __DRIconfig ** driCreateConfigs(GLenum fb_format, GLenum fb_type, - const u_int8_t * depth_bits, const u_int8_t * stencil_bits, + const uint8_t * depth_bits, const uint8_t * stencil_bits, unsigned num_depth_stencil_bits, - const GLenum * db_modes, unsigned num_db_modes); + const GLenum * db_modes, unsigned num_db_modes, + const uint8_t * msaa_samples, unsigned num_msaa_modes); const __DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b); diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index 0008ab1c34..d610253fe6 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -26,11 +26,11 @@ * Ian Romanick <idr@us.ibm.com> */ -#include "glheader.h" +#include "main/glheader.h" #include "xf86drm.h" -#include "mtypes.h" -#include "macros.h" -#include "dd.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/dd.h" #include "vblank.h" #include "xmlpool.h" diff --git a/src/mesa/drivers/dri/common/vblank.h b/src/mesa/drivers/dri/common/vblank.h index b3a0dadab1..8b2c761a11 100644 --- a/src/mesa/drivers/dri/common/vblank.h +++ b/src/mesa/drivers/dri/common/vblank.h @@ -29,7 +29,7 @@ #ifndef DRI_VBLANK_H #define DRI_VBLANK_H -#include "context.h" +#include "main/context.h" #include "dri_util.h" #include "xmlconfig.h" diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c index f6ae75520c..46ba2ffbfe 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.c +++ b/src/mesa/drivers/dri/common/xmlconfig.c @@ -27,7 +27,7 @@ * \author Felix Kuehling */ -#include "glheader.h" +#include "main/glheader.h" #include <string.h> #include <assert.h> @@ -35,7 +35,7 @@ #include <fcntl.h> #include <unistd.h> #include <errno.h> -#include "imports.h" +#include "main/imports.h" #include "dri_util.h" #include "xmlconfig.h" diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c index d3a936dd34..f1194d7ce8 100644 --- a/src/mesa/drivers/dri/fb/fb_dri.c +++ b/src/mesa/drivers/dri/fb/fb_dri.c @@ -47,14 +47,14 @@ #include "drirenderbuffer.h" #include "buffers.h" -#include "extensions.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "vbo/vbo.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" -#include "tnl/t_context.h" +#include "tnl/tcontext.h" #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" diff --git a/src/mesa/drivers/dri/fb/fb_egl.c b/src/mesa/drivers/dri/fb/fb_egl.c index cc6a266df3..35c268441c 100644 --- a/src/mesa/drivers/dri/fb/fb_egl.c +++ b/src/mesa/drivers/dri/fb/fb_egl.c @@ -14,20 +14,20 @@ #include "utils.h" #include "buffers.h" -#include "extensions.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "vbo/vbo.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" -#include "tnl/t_context.h" +#include "tnl/tcontext.h" #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" #include "drirenderbuffer.h" #include "eglconfig.h" -#include "eglcontext.h" +#include "eglmain/context.h" #include "egldisplay.h" #include "egldriver.h" #include "eglglobals.h" diff --git a/src/mesa/drivers/dri/ffb/ffb_bitmap.c b/src/mesa/drivers/dri/ffb/ffb_bitmap.c index 1aa66859a6..f89c0412df 100644 --- a/src/mesa/drivers/dri/ffb/ffb_bitmap.c +++ b/src/mesa/drivers/dri/ffb/ffb_bitmap.c @@ -30,8 +30,8 @@ #include "ffb_lock.h" #include "ffb_bitmap.h" #include "swrast/swrast.h" -#include "image.h" -#include "macros.h" +#include "main/image.h" +#include "main/macros.h" /* Compute ceiling of integer quotient of A divided by B: */ #define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 ) diff --git a/src/mesa/drivers/dri/ffb/ffb_clear.c b/src/mesa/drivers/dri/ffb/ffb_clear.c index 1040f42634..776fb487f8 100644 --- a/src/mesa/drivers/dri/ffb/ffb_clear.c +++ b/src/mesa/drivers/dri/ffb/ffb_clear.c @@ -25,10 +25,10 @@ * David S. Miller <davem@redhat.com> */ -#include "mtypes.h" -#include "extensions.h" +#include "main/mtypes.h" +#include "main/extensions.h" -#include "mm.h" +#include "main/mm.h" #include "ffb_dd.h" #include "ffb_span.h" #include "ffb_depth.h" diff --git a/src/mesa/drivers/dri/ffb/ffb_context.h b/src/mesa/drivers/dri/ffb/ffb_context.h index 0ab75fce47..77f87d41c3 100644 --- a/src/mesa/drivers/dri/ffb/ffb_context.h +++ b/src/mesa/drivers/dri/ffb/ffb_context.h @@ -5,7 +5,7 @@ #include "dri_util.h" #include "drm.h" -#include "mtypes.h" +#include "main/mtypes.h" #include "ffb_xmesa.h" diff --git a/src/mesa/drivers/dri/ffb/ffb_dd.c b/src/mesa/drivers/dri/ffb/ffb_dd.c index f64a577d1f..cf83b91f0d 100644 --- a/src/mesa/drivers/dri/ffb/ffb_dd.c +++ b/src/mesa/drivers/dri/ffb/ffb_dd.c @@ -25,8 +25,9 @@ * David S. Miller <davem@redhat.com> */ -#include "mtypes.h" -#include "mm.h" +#include "main/mtypes.h" +#include "main/mm.h" +#include "main/extensions.h" #include "ffb_dd.h" #include "ffb_span.h" #include "ffb_depth.h" @@ -35,7 +36,6 @@ #include "ffb_tris.h" #include "ffb_clear.h" #include "ffb_lock.h" -#include "extensions.h" #define FFB_DATE "20021125" diff --git a/src/mesa/drivers/dri/ffb/ffb_dd.h b/src/mesa/drivers/dri/ffb/ffb_dd.h index e065ebbecd..1198cda30a 100644 --- a/src/mesa/drivers/dri/ffb/ffb_dd.h +++ b/src/mesa/drivers/dri/ffb/ffb_dd.h @@ -28,7 +28,7 @@ #ifndef _FFB_DD_H #define _FFB_DD_H -#include "context.h" +#include "main/context.h" void ffbDDInitDriverFuncs(GLcontext *ctx); void ffbDDExtensionsInit(GLcontext *ctx); diff --git a/src/mesa/drivers/dri/ffb/ffb_depth.c b/src/mesa/drivers/dri/ffb/ffb_depth.c index cca6212f50..71f204d21e 100644 --- a/src/mesa/drivers/dri/ffb/ffb_depth.c +++ b/src/mesa/drivers/dri/ffb/ffb_depth.c @@ -25,7 +25,7 @@ * David S. Miller <davem@redhat.com> */ -#include "mtypes.h" +#include "main/mtypes.h" #include "swrast/swrast.h" #include "ffb_dd.h" #include "ffb_span.h" @@ -33,7 +33,6 @@ #include "ffb_depth.h" #include "ffb_lock.h" -#include "swrast/swrast.h" #undef DEPTH_TRACE diff --git a/src/mesa/drivers/dri/ffb/ffb_lines.c b/src/mesa/drivers/dri/ffb/ffb_lines.c index 8294701464..19dff50935 100644 --- a/src/mesa/drivers/dri/ffb/ffb_lines.c +++ b/src/mesa/drivers/dri/ffb/ffb_lines.c @@ -25,8 +25,9 @@ * David S. Miller <davem@redhat.com> */ -#include "mtypes.h" -#include "mm.h" +#include "main/mtypes.h" +#include "main/mm.h" +#include "main/extensions.h" #include "ffb_dd.h" #include "ffb_span.h" #include "ffb_depth.h" @@ -35,7 +36,6 @@ #include "ffb_lines.h" #include "ffb_tris.h" #include "ffb_lock.h" -#include "extensions.h" #undef FFB_LINE_TRACE diff --git a/src/mesa/drivers/dri/ffb/ffb_points.c b/src/mesa/drivers/dri/ffb/ffb_points.c index d00255ccee..9c37a47aeb 100644 --- a/src/mesa/drivers/dri/ffb/ffb_points.c +++ b/src/mesa/drivers/dri/ffb/ffb_points.c @@ -25,7 +25,7 @@ * David S. Miller <davem@redhat.com> */ -#include "mtypes.h" +#include "main/mtypes.h" #include "ffb_dd.h" #include "ffb_context.h" #include "ffb_vb.h" diff --git a/src/mesa/drivers/dri/ffb/ffb_span.c b/src/mesa/drivers/dri/ffb/ffb_span.c index 59ac414678..0d3d604095 100644 --- a/src/mesa/drivers/dri/ffb/ffb_span.c +++ b/src/mesa/drivers/dri/ffb/ffb_span.c @@ -25,7 +25,7 @@ * David S. Miller <davem@redhat.com> */ -#include "mtypes.h" +#include "main/mtypes.h" #include "ffb_dd.h" #include "ffb_span.h" #include "ffb_context.h" diff --git a/src/mesa/drivers/dri/ffb/ffb_state.c b/src/mesa/drivers/dri/ffb/ffb_state.c index 880ad8be0a..ee0fe4e0db 100644 --- a/src/mesa/drivers/dri/ffb/ffb_state.c +++ b/src/mesa/drivers/dri/ffb/ffb_state.c @@ -25,9 +25,18 @@ * David S. Miller <davem@redhat.com> */ -#include "mtypes.h" -#include "colormac.h" -#include "mm.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/mm.h" +#include "main/extensions.h" +#include "main/enums.h" + +#include "vbo/vbo.h" +#include "tnl/tnl.h" +#include "tnl/t_pipeline.h" +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" + #include "ffb_dd.h" #include "ffb_span.h" #include "ffb_depth.h" @@ -36,15 +45,6 @@ #include "ffb_tris.h" #include "ffb_state.h" #include "ffb_lock.h" -#include "extensions.h" -#include "enums.h" - -#include "swrast/swrast.h" -#include "vbo/vbo.h" -#include "tnl/tnl.h" -#include "swrast_setup/swrast_setup.h" - -#include "tnl/t_pipeline.h" #undef STATE_TRACE diff --git a/src/mesa/drivers/dri/ffb/ffb_stencil.c b/src/mesa/drivers/dri/ffb/ffb_stencil.c index d535b1b778..921a83d274 100644 --- a/src/mesa/drivers/dri/ffb/ffb_stencil.c +++ b/src/mesa/drivers/dri/ffb/ffb_stencil.c @@ -25,7 +25,7 @@ * David S. Miller <davem@redhat.com> */ -#include "mtypes.h" +#include "main/mtypes.h" #include "ffb_dd.h" #include "ffb_span.h" #include "ffb_context.h" diff --git a/src/mesa/drivers/dri/ffb/ffb_tex.c b/src/mesa/drivers/dri/ffb/ffb_tex.c index 6503b0f4e7..69d30aedba 100644 --- a/src/mesa/drivers/dri/ffb/ffb_tex.c +++ b/src/mesa/drivers/dri/ffb/ffb_tex.c @@ -25,8 +25,8 @@ * David S. Miller <davem@redhat.com> */ -#include "glheader.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/mtypes.h" #include "ffb_tex.h" /* No texture unit, all software. */ diff --git a/src/mesa/drivers/dri/ffb/ffb_tris.c b/src/mesa/drivers/dri/ffb/ffb_tris.c index c2857f61bd..d785c15718 100644 --- a/src/mesa/drivers/dri/ffb/ffb_tris.c +++ b/src/mesa/drivers/dri/ffb/ffb_tris.c @@ -25,12 +25,12 @@ * David S. Miller <davem@redhat.com> */ -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" #include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" #include "swrast/s_context.h" +#include "swrast_setup/swrast_setup.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" diff --git a/src/mesa/drivers/dri/ffb/ffb_vb.c b/src/mesa/drivers/dri/ffb/ffb_vb.c index edc9d79124..f9c6fd1f31 100644 --- a/src/mesa/drivers/dri/ffb/ffb_vb.c +++ b/src/mesa/drivers/dri/ffb/ffb_vb.c @@ -28,7 +28,7 @@ #include "ffb_xmesa.h" #include "ffb_context.h" #include "ffb_vb.h" -#include "imports.h" +#include "main/imports.h" #include "tnl/t_context.h" #include "swrast_setup/swrast_setup.h" #include "math/m_translate.h" diff --git a/src/mesa/drivers/dri/ffb/ffb_vb.h b/src/mesa/drivers/dri/ffb/ffb_vb.h index af669bce30..238b9940bf 100644 --- a/src/mesa/drivers/dri/ffb/ffb_vb.h +++ b/src/mesa/drivers/dri/ffb/ffb_vb.h @@ -2,8 +2,8 @@ #ifndef _FFB_VB_H #define _FFB_VB_H -#include "mtypes.h" -#include "macros.h" +#include "main/mtypes.h" +#include "main/macros.h" #include "tnl/t_context.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c b/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c index 1f9fecdcf7..90f44b0e91 100644 --- a/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c +++ b/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c @@ -25,20 +25,20 @@ * David S. Miller <davem@redhat.com> */ -#include "glheader.h" +#include "main/glheader.h" #include "api_noop.h" -#include "context.h" +#include "main/context.h" #include "light.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" -#include "simple_list.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/simple_list.h" #include "vtxfmt.h" #include "ffb_xmesa.h" #include "ffb_context.h" #include "ffb_vb.h" #include "tnl/tnl.h" -#include "tnl/t_context.h" +#include "tnl/tcontext.h" #include "ffb_vtxfmt.h" diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 3b7aa45903..679f8561d2 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -26,12 +26,12 @@ */ #include "ffb_xmesa.h" -#include "context.h" -#include "framebuffer.h" -#include "matrix.h" -#include "renderbuffer.h" -#include "simple_list.h" -#include "imports.h" +#include "main/context.h" +#include "main/framebuffer.h" +#include "main/matrix.h" +#include "main/renderbuffer.h" +#include "main/simple_list.h" +#include "main/imports.h" #include "utils.h" #include "swrast/swrast.h" @@ -226,7 +226,7 @@ ffbCreateContext(const __GLcontextModes *mesaVis, fmesa->driScreen = sPriv; fmesa->ffb_sarea = FFB_DRISHARE(sPriv->pSAREA); - /* Register and framebuffer hw pointers. */ + /* Register and framebuffer pointers. */ fmesa->regs = ffbScreen->regs; fmesa->sfb32 = ffbScreen->sfb32; diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.h b/src/mesa/drivers/dri/ffb/ffb_xmesa.h index bc8cfe9f21..255da4c5f8 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.h +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.h @@ -4,7 +4,7 @@ #include <sys/time.h> #include "dri_util.h" -#include "mtypes.h" +#include "main/mtypes.h" #include "ffb_drishare.h" #include "ffb_regs.h" #include "ffb_dac.h" diff --git a/src/mesa/drivers/dri/gamma/gamma_context.c b/src/mesa/drivers/dri/gamma/gamma_context.c index b1dcbfcdcf..c91bedce3a 100644 --- a/src/mesa/drivers/dri/gamma/gamma_context.c +++ b/src/mesa/drivers/dri/gamma/gamma_context.c @@ -24,7 +24,7 @@ * 3DLabs Gamma driver. * */ -#include "gamma_context.h" +#include "gammacontext.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -35,16 +35,16 @@ #include "drivers/common/driverfuncs.h" -#include "context.h" -#include "simple_list.h" -#include "imports.h" -#include "matrix.h" -#include "extensions.h" +#include "main/context.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/matrix.h" +#include "main/extensions.h" #if defined(USE_X86_ASM) #include "x86/common_x86_asm.h" #endif -#include "simple_list.h" -#include "mm.h" +#include "main/simple_list.h" +#include "main/mm.h" #include "gamma_vb.h" diff --git a/src/mesa/drivers/dri/gamma/gamma_context.h b/src/mesa/drivers/dri/gamma/gamma_context.h index 5f4ceb2439..a32ccb6007 100644 --- a/src/mesa/drivers/dri/gamma/gamma_context.h +++ b/src/mesa/drivers/dri/gamma/gamma_context.h @@ -31,12 +31,12 @@ #include "drm_sarea.h" #include "colormac.h" #include "gamma_regs.h" -#include "gamma_macros.h" +#include "gamma_main/macros.h" #include "gamma_screen.h" -#include "macros.h" -#include "mtypes.h" +#include "main/macros.h" +#include "main/mtypes.h" #include "glint_dri.h" -#include "mm.h" +#include "main/mm.h" typedef union { unsigned int i; diff --git a/src/mesa/drivers/dri/gamma/gamma_dd.c b/src/mesa/drivers/dri/gamma/gamma_dd.c index 63e3ab8fa5..7a81ef5993 100644 --- a/src/mesa/drivers/dri/gamma/gamma_dd.c +++ b/src/mesa/drivers/dri/gamma/gamma_dd.c @@ -23,14 +23,14 @@ * */ -#include "gamma_context.h" +#include "gammacontext.h" #include "gamma_vb.h" #include "gamma_lock.h" #if defined(USE_X86_ASM) #include "x86/common_x86_asm.h" #endif -#include "context.h" +#include "main/context.h" #include "swrast/swrast.h" #define GAMMA_DATE "20021125" diff --git a/src/mesa/drivers/dri/gamma/gamma_inithw.c b/src/mesa/drivers/dri/gamma/gamma_inithw.c index 79b54aacb5..525ad89354 100644 --- a/src/mesa/drivers/dri/gamma/gamma_inithw.c +++ b/src/mesa/drivers/dri/gamma/gamma_inithw.c @@ -24,7 +24,7 @@ * */ -#include "gamma_context.h" +#include "gammacontext.h" #include "glint_dri.h" void gammaInitHW( gammaContextPtr gmesa ) diff --git a/src/mesa/drivers/dri/gamma/gamma_lock.c b/src/mesa/drivers/dri/gamma/gamma_lock.c index 97eea75541..8f2d01688c 100644 --- a/src/mesa/drivers/dri/gamma/gamma_lock.c +++ b/src/mesa/drivers/dri/gamma/gamma_lock.c @@ -1,5 +1,5 @@ -#include "gamma_context.h" +#include "gammacontext.h" #include "gamma_lock.h" #include "drirenderbuffer.h" diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c index 211d7787ef..1b9fd169f4 100644 --- a/src/mesa/drivers/dri/gamma/gamma_render.c +++ b/src/mesa/drivers/dri/gamma/gamma_render.c @@ -25,15 +25,15 @@ * */ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" -#include "tnl/t_context.h" +#include "tnl/tcontext.h" -#include "gamma_context.h" +#include "gammacontext.h" #include "gamma_tris.h" #include "gamma_vb.h" diff --git a/src/mesa/drivers/dri/gamma/gamma_screen.c b/src/mesa/drivers/dri/gamma/gamma_screen.c index 0b91d059e9..f899ebec96 100644 --- a/src/mesa/drivers/dri/gamma/gamma_screen.c +++ b/src/mesa/drivers/dri/gamma/gamma_screen.c @@ -23,11 +23,11 @@ * */ -#include "gamma_context.h" +#include "gammacontext.h" #include "gamma_vb.h" #include "glint_dri.h" -#include "imports.h" +#include "main/imports.h" gammaScreenPtr gammaCreateScreen( __DRIscreenPrivate *sPriv ) { diff --git a/src/mesa/drivers/dri/gamma/gamma_span.c b/src/mesa/drivers/dri/gamma/gamma_span.c index 81b4630139..cdaaac3f3a 100644 --- a/src/mesa/drivers/dri/gamma/gamma_span.c +++ b/src/mesa/drivers/dri/gamma/gamma_span.c @@ -1,5 +1,5 @@ -#include "gamma_context.h" +#include "gammacontext.h" #include "gamma_lock.h" #include "colormac.h" diff --git a/src/mesa/drivers/dri/gamma/gamma_state.c b/src/mesa/drivers/dri/gamma/gamma_state.c index 9e7626a6fd..59272f9bc9 100644 --- a/src/mesa/drivers/dri/gamma/gamma_state.c +++ b/src/mesa/drivers/dri/gamma/gamma_state.c @@ -24,10 +24,10 @@ * 3DLabs Gamma driver */ -#include "gamma_context.h" -#include "gamma_macros.h" +#include "gammacontext.h" +#include "gamma_main/macros.h" #include "buffers.h" -#include "macros.h" +#include "main/macros.h" #include "glint_dri.h" #include "colormac.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/gamma/gamma_tex.c b/src/mesa/drivers/dri/gamma/gamma_tex.c index 3b4ee4e581..2ffb790f28 100644 --- a/src/mesa/drivers/dri/gamma/gamma_tex.c +++ b/src/mesa/drivers/dri/gamma/gamma_tex.c @@ -2,19 +2,19 @@ #include <stdlib.h> #include <stdio.h> -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "simple_list.h" -#include "enums.h" -#include "texstore.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/texstore.h" #include "teximage.h" -#include "texformat.h" +#include "main/texformat.h" #include "texobj.h" #include "swrast/swrast.h" -#include "mm.h" -#include "gamma_context.h" +#include "main/mm.h" +#include "gammacontext.h" #include "colormac.h" diff --git a/src/mesa/drivers/dri/gamma/gamma_texmem.c b/src/mesa/drivers/dri/gamma/gamma_texmem.c index 94ecb5c2f6..4cb47e179e 100644 --- a/src/mesa/drivers/dri/gamma/gamma_texmem.c +++ b/src/mesa/drivers/dri/gamma/gamma_texmem.c @@ -2,16 +2,16 @@ #include <stdlib.h> #include <stdio.h> -#include "glheader.h" +#include "main/glheader.h" #include "colormac.h" -#include "macros.h" -#include "mtypes.h" -#include "simple_list.h" -#include "enums.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/simple_list.h" +#include "main/enums.h" -#include "mm.h" +#include "main/mm.h" #include "glint_dri.h" -#include "gamma_context.h" +#include "gammacontext.h" #include "gamma_lock.h" void gammaDestroyTexObj(gammaContextPtr gmesa, gammaTextureObjectPtr t) diff --git a/src/mesa/drivers/dri/gamma/gamma_texstate.c b/src/mesa/drivers/dri/gamma/gamma_texstate.c index b9bd6d4cee..b3a318d581 100644 --- a/src/mesa/drivers/dri/gamma/gamma_texstate.c +++ b/src/mesa/drivers/dri/gamma/gamma_texstate.c @@ -2,14 +2,14 @@ #include <stdlib.h> #include <stdio.h> -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "simple_list.h" -#include "enums.h" - -#include "mm.h" -#include "gamma_context.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/simple_list.h" +#include "main/enums.h" + +#include "main/mm.h" +#include "gammacontext.h" static void gammaSetTexImages( gammaContextPtr gmesa, struct gl_texture_object *tObj ) diff --git a/src/mesa/drivers/dri/gamma/gamma_tris.c b/src/mesa/drivers/dri/gamma/gamma_tris.c index 83bf56a141..2903daf3f1 100644 --- a/src/mesa/drivers/dri/gamma/gamma_tris.c +++ b/src/mesa/drivers/dri/gamma/gamma_tris.c @@ -25,19 +25,19 @@ * 3DLabs Gamma driver. */ -#include "gamma_context.h" +#include "gammacontext.h" #include "gamma_vb.h" #include "gamma_tris.h" -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" #include "colormac.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" -#include "tnl/t_context.h" +#include "tnl/tcontext.h" #include "tnl/t_pipeline.h" diff --git a/src/mesa/drivers/dri/gamma/gamma_vb.c b/src/mesa/drivers/dri/gamma/gamma_vb.c index f23f585fc0..23ca0714c5 100644 --- a/src/mesa/drivers/dri/gamma/gamma_vb.c +++ b/src/mesa/drivers/dri/gamma/gamma_vb.c @@ -25,17 +25,17 @@ * 3DLabs Gamma driver. */ -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/macros.h" #include "colormac.h" #include "swrast_setup/swrast_setup.h" -#include "tnl/t_context.h" +#include "tnl/tcontext.h" #include "tnl/tnl.h" -#include "gamma_context.h" +#include "gammacontext.h" #include "gamma_vb.h" #include "gamma_tris.h" diff --git a/src/mesa/drivers/dri/gamma/gamma_vb.h b/src/mesa/drivers/dri/gamma/gamma_vb.h index feda25c4c6..8701226f59 100644 --- a/src/mesa/drivers/dri/gamma/gamma_vb.h +++ b/src/mesa/drivers/dri/gamma/gamma_vb.h @@ -28,7 +28,7 @@ #ifndef GAMMAVB_INC #define GAMMAVB_INC -#include "mtypes.h" +#include "main/mtypes.h" #include "swrast/swrast.h" #define _GAMMA_NEW_VERTEX (_NEW_TEXTURE | \ diff --git a/src/mesa/drivers/dri/gamma/gamma_xmesa.c b/src/mesa/drivers/dri/gamma/gamma_xmesa.c index 43e33b66a5..2a28902e1e 100644 --- a/src/mesa/drivers/dri/gamma/gamma_xmesa.c +++ b/src/mesa/drivers/dri/gamma/gamma_xmesa.c @@ -24,10 +24,10 @@ * 3DLabs Gamma driver */ -#include "gamma_context.h" +#include "gammacontext.h" #include "gamma_vb.h" -#include "context.h" -#include "matrix.h" +#include "main/context.h" +#include "main/matrix.h" #include "glint_dri.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index c13b21aeb3..c281a4990e 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -32,14 +32,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "glheader.h" -#include "context.h" -#include "matrix.h" -#include "simple_list.h" -#include "extensions.h" -#include "framebuffer.h" -#include "imports.h" -#include "points.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/matrix.h" +#include "main/simple_list.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/imports.h" +#include "main/points.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/i810/i810context.h b/src/mesa/drivers/dri/i810/i810context.h index 4708042059..4b8c71d7c6 100644 --- a/src/mesa/drivers/dri/i810/i810context.h +++ b/src/mesa/drivers/dri/i810/i810context.h @@ -30,8 +30,8 @@ typedef struct i810_context_t *i810ContextPtr; typedef struct i810_texture_object_t *i810TextureObjectPtr; #include "drm.h" -#include "mtypes.h" -#include "mm.h" +#include "main/mtypes.h" +#include "main/mm.h" #include "i810screen.h" #include "i810tex.h" diff --git a/src/mesa/drivers/dri/i810/i810ioctl.c b/src/mesa/drivers/dri/i810/i810ioctl.c index 95726fb252..3df9c2ac47 100644 --- a/src/mesa/drivers/dri/i810/i810ioctl.c +++ b/src/mesa/drivers/dri/i810/i810ioctl.c @@ -1,17 +1,17 @@ #include <unistd.h> /* for usleep() */ -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" -#include "dd.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/dd.h" #include "swrast/swrast.h" -#include "mm.h" +#include "main/mm.h" #include "i810screen.h" #include "i810_dri.h" -#include "i810context.h" +#include "main/context.h" #include "i810ioctl.h" #include "i810state.h" diff --git a/src/mesa/drivers/dri/i810/i810render.c b/src/mesa/drivers/dri/i810/i810render.c index d0225969b6..1d98e00688 100644 --- a/src/mesa/drivers/dri/i810/i810render.c +++ b/src/mesa/drivers/dri/i810/i810render.c @@ -31,11 +31,11 @@ * dma buffers. Use strip/fan hardware acceleration where possible. * */ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index ea26e72fa8..48603f5d79 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -32,14 +32,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "framebuffer.h" -#include "fbobject.h" -#include "matrix.h" -#include "renderbuffer.h" -#include "simple_list.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/framebuffer.h" +#include "main/fbobject.h" +#include "main/matrix.h" +#include "main/renderbuffer.h" +#include "main/simple_list.h" #include "utils.h" #include "i810screen.h" @@ -75,8 +75,8 @@ i810FillInModes( __DRIscreenPrivate *psp, GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */ }; - u_int8_t depth_bits_array[2]; - u_int8_t stencil_bits_array[2]; + uint8_t depth_bits_array[2]; + uint8_t stencil_bits_array[2]; depth_bits_array[0] = depth_bits; depth_bits_array[1] = depth_bits; diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c index 59511de973..510723f445 100644 --- a/src/mesa/drivers/dri/i810/i810span.c +++ b/src/mesa/drivers/dri/i810/i810span.c @@ -1,14 +1,14 @@ -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "swrast/swrast.h" #include "i810screen.h" #include "i810_dri.h" #include "i810span.h" #include "i810ioctl.h" -#include "swrast/swrast.h" #define DBG 0 diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c index 1446324716..1e7a6cfe47 100644 --- a/src/mesa/drivers/dri/i810/i810state.c +++ b/src/mesa/drivers/dri/i810/i810state.c @@ -1,11 +1,16 @@ #include <stdio.h> -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "dd.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/dd.h" +#include "main/colormac.h" +#include "swrast/swrast.h" +#include "tnl/tnl.h" +#include "tnl/t_pipeline.h" +#include "vbo/vbo.h" +#include "swrast_setup/swrast_setup.h" #include "texmem.h" @@ -19,12 +24,6 @@ #include "i810tris.h" #include "i810ioctl.h" -#include "swrast/swrast.h" -#include "tnl/tnl.h" -#include "vbo/vbo.h" -#include "swrast_setup/swrast_setup.h" - -#include "tnl/t_pipeline.h" static INLINE GLuint i810PackColor(GLuint format, GLubyte r, GLubyte g, diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index 730bc90eaf..ba4e6b5b0b 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -22,20 +22,21 @@ * */ -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "simple_list.h" -#include "enums.h" -#include "texstore.h" -#include "texformat.h" -#include "teximage.h" -#include "texmem.h" -#include "texobj.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/texstore.h" +#include "main/texformat.h" +#include "main/teximage.h" +#include "main/texobj.h" +#include "main/colormac.h" +#include "main/texobj.h" +#include "main/mm.h" #include "swrast/swrast.h" -#include "colormac.h" -#include "texobj.h" -#include "mm.h" + +#include "texmem.h" #include "i810screen.h" #include "i810_dri.h" diff --git a/src/mesa/drivers/dri/i810/i810tex.h b/src/mesa/drivers/dri/i810/i810tex.h index c6ab4c8e6d..d980927030 100644 --- a/src/mesa/drivers/dri/i810/i810tex.h +++ b/src/mesa/drivers/dri/i810/i810tex.h @@ -26,8 +26,8 @@ #ifndef I810TEX_INC #define I810TEX_INC -#include "mtypes.h" -#include "mm.h" +#include "main/mtypes.h" +#include "main/mm.h" #include "i810context.h" #include "i810_3d_reg.h" diff --git a/src/mesa/drivers/dri/i810/i810texmem.c b/src/mesa/drivers/dri/i810/i810texmem.c index 9c24fcd8f5..5ad66dbf5c 100644 --- a/src/mesa/drivers/dri/i810/i810texmem.c +++ b/src/mesa/drivers/dri/i810/i810texmem.c @@ -23,18 +23,17 @@ * */ -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "simple_list.h" -#include "enums.h" -#include "colormac.h" -#include "mm.h" -#include "texformat.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/colormac.h" +#include "main/mm.h" +#include "main/texformat.h" #include "i810screen.h" #include "i810_dri.h" - #include "i810context.h" #include "i810tex.h" #include "i810state.h" diff --git a/src/mesa/drivers/dri/i810/i810texstate.c b/src/mesa/drivers/dri/i810/i810texstate.c index 558aef9eee..0e09f54c41 100644 --- a/src/mesa/drivers/dri/i810/i810texstate.c +++ b/src/mesa/drivers/dri/i810/i810texstate.c @@ -22,14 +22,13 @@ * */ -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "texformat.h" -#include "simple_list.h" -#include "enums.h" - -#include "mm.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/texformat.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/mm.h" #include "i810screen.h" #include "i810_dri.h" diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c index 0d5f5d9369..b508496fb6 100644 --- a/src/mesa/drivers/dri/i810/i810tris.c +++ b/src/mesa/drivers/dri/i810/i810tris.c @@ -30,11 +30,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" -#include "enums.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/enums.h" +#include "main/colormac.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/i810/i810tris.h b/src/mesa/drivers/dri/i810/i810tris.h index 3d0dd916ca..ab026be0a5 100644 --- a/src/mesa/drivers/dri/i810/i810tris.h +++ b/src/mesa/drivers/dri/i810/i810tris.h @@ -26,7 +26,7 @@ #ifndef I810TRIS_INC #define I810TRIS_INC -#include "mtypes.h" +#include "main/mtypes.h" extern void i810PrintRenderState( const char *msg, GLuint state ); extern void i810InitTriFuncs( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/i810/i810vb.c b/src/mesa/drivers/dri/i810/i810vb.c index 3439192b0d..30890dc9b7 100644 --- a/src/mesa/drivers/dri/i810/i810vb.c +++ b/src/mesa/drivers/dri/i810/i810vb.c @@ -24,18 +24,17 @@ */ -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/colormac.h" #include "swrast_setup/swrast_setup.h" #include "tnl/t_context.h" #include "i810screen.h" #include "i810_dri.h" - #include "i810context.h" #include "i810vb.h" #include "i810ioctl.h" diff --git a/src/mesa/drivers/dri/i810/i810vb.h b/src/mesa/drivers/dri/i810/i810vb.h index 55d0d2409e..1f704e4569 100644 --- a/src/mesa/drivers/dri/i810/i810vb.h +++ b/src/mesa/drivers/dri/i810/i810vb.h @@ -26,7 +26,7 @@ #ifndef I810VB_INC #define I810VB_INC -#include "mtypes.h" +#include "main/mtypes.h" #include "swrast/swrast.h" #define _I810_NEW_VERTEX (_NEW_TEXTURE | \ diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index 116b52511f..09b1ec922f 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -26,7 +26,7 @@ **************************************************************************/ #include "i830_context.h" -#include "imports.h" +#include "main/imports.h" #include "texmem.h" #include "intel_tex.h" #include "tnl/tnl.h" diff --git a/src/mesa/drivers/dri/i915/i830_metaops.c b/src/mesa/drivers/dri/i915/i830_metaops.c index acfb3af910..2cce661c86 100644 --- a/src/mesa/drivers/dri/i915/i830_metaops.c +++ b/src/mesa/drivers/dri/i915/i830_metaops.c @@ -25,10 +25,10 @@ * **************************************************************************/ -#include "glheader.h" -#include "enums.h" -#include "mtypes.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/enums.h" +#include "main/mtypes.h" +#include "main/macros.h" #include "utils.h" #include "intel_screen.h" diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index e44a7dfca1..d9cad0c4bf 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -26,11 +26,11 @@ **************************************************************************/ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "enums.h" -#include "dd.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/enums.h" +#include "main/dd.h" #include "texmem.h" diff --git a/src/mesa/drivers/dri/i915/i830_tex.c b/src/mesa/drivers/dri/i915/i830_tex.c index c0126ba19a..34ac42a78e 100644 --- a/src/mesa/drivers/dri/i915/i830_tex.c +++ b/src/mesa/drivers/dri/i915/i830_tex.c @@ -25,18 +25,18 @@ * **************************************************************************/ -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "simple_list.h" -#include "enums.h" -#include "image.h" -#include "texstore.h" -#include "texformat.h" -#include "texmem.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/mm.h" +#include "main/texstore.h" +#include "main/texformat.h" #include "swrast/swrast.h" -#include "mm.h" +#include "texmem.h" #include "i830_context.h" #include "i830_reg.h" diff --git a/src/mesa/drivers/dri/i915/i830_texblend.c b/src/mesa/drivers/dri/i915/i830_texblend.c index dca72adeca..09f7f37e76 100644 --- a/src/mesa/drivers/dri/i915/i830_texblend.c +++ b/src/mesa/drivers/dri/i915/i830_texblend.c @@ -25,15 +25,14 @@ * **************************************************************************/ -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "simple_list.h" -#include "enums.h" -#include "texformat.h" -#include "texstore.h" - -#include "mm.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/texformat.h" +#include "main/texstore.h" +#include "main/mm.h" #include "intel_screen.h" #include "intel_tex.h" diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 314bbe32b6..c718bb0055 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -25,9 +25,9 @@ * **************************************************************************/ -#include "mtypes.h" -#include "enums.h" -#include "texformat.h" +#include "main/mtypes.h" +#include "main/enums.h" +#include "main/texformat.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 40a50ff772..0ab27704d5 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "glapi.h" +#include "glapi/glapi.h" #include "i830_context.h" #include "i830_reg.h" diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 940b02513d..efcac911aa 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -26,7 +26,7 @@ **************************************************************************/ #include "i915_context.h" -#include "imports.h" +#include "main/imports.h" #include "intel_tex.h" #include "intel_tris.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/dri/i915/i915_debug.c b/src/mesa/drivers/dri/i915/i915_debug.c index 8eb1c5b49e..f7bb7ea44c 100644 --- a/src/mesa/drivers/dri/i915/i915_debug.c +++ b/src/mesa/drivers/dri/i915/i915_debug.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "imports.h" +#include "main/imports.h" #include "i915_reg.h" #include "i915_context.h" @@ -177,7 +177,7 @@ static GLboolean debug_variable_length_prim( struct debug_stream *stream ) #define BITS( dw, hi, lo, ... ) \ do { \ - unsigned himask = ~0UL >> (31 - (hi)); \ + unsigned himask = 0xffffffffU >> (31 - (hi)); \ PRINTF("\t\t "); \ PRINTF(__VA_ARGS__); \ PRINTF(": 0x%x\n", ((dw) & himask) >> (lo)); \ diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 1876218ca0..8bd761ec6a 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -25,9 +25,9 @@ * **************************************************************************/ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/prog_instruction.h" #include "shader/prog_parameter.h" diff --git a/src/mesa/drivers/dri/i915/i915_metaops.c b/src/mesa/drivers/dri/i915/i915_metaops.c index bfe97f13e5..90a78c6082 100644 --- a/src/mesa/drivers/dri/i915/i915_metaops.c +++ b/src/mesa/drivers/dri/i915/i915_metaops.c @@ -25,10 +25,10 @@ * **************************************************************************/ -#include "glheader.h" -#include "enums.h" -#include "mtypes.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/enums.h" +#include "main/mtypes.h" +#include "main/macros.h" #include "utils.h" #include "intel_screen.h" diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c index f79d00ddcf..49193297a8 100644 --- a/src/mesa/drivers/dri/i915/i915_program.c +++ b/src/mesa/drivers/dri/i915/i915_program.c @@ -27,9 +27,9 @@ #include <strings.h> -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "tnl/t_context.h" #include "intel_batchbuffer.h" diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index c814f8d532..9d04358e4f 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -26,11 +26,11 @@ **************************************************************************/ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "enums.h" -#include "dd.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/enums.h" +#include "main/dd.h" #include "tnl/tnl.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/dri/i915/i915_tex.c b/src/mesa/drivers/dri/i915/i915_tex.c index cb55bf6125..e38d8fe79d 100644 --- a/src/mesa/drivers/dri/i915/i915_tex.c +++ b/src/mesa/drivers/dri/i915/i915_tex.c @@ -25,18 +25,18 @@ * **************************************************************************/ -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "simple_list.h" -#include "enums.h" -#include "image.h" -#include "texstore.h" -#include "texformat.h" -#include "texmem.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/mm.h" +#include "main/texstore.h" +#include "main/texformat.h" #include "swrast/swrast.h" -#include "mm.h" +#include "texmem.h" #include "i915_context.h" #include "i915_reg.h" diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index b5085f49d4..d44a2f47b3 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -31,7 +31,7 @@ #include "intel_mipmap_tree.h" #include "intel_tex_layout.h" -#include "macros.h" +#include "main/macros.h" #include "intel_context.h" #define FILE_DEBUG_FLAG DEBUG_TEXTURE diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 48137f025f..ae42b102db 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -25,9 +25,9 @@ * **************************************************************************/ -#include "mtypes.h" -#include "enums.h" -#include "texformat.h" +#include "main/mtypes.h" +#include "main/enums.h" +#include "main/texformat.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 19f2206285..edbbe23e09 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -27,11 +27,11 @@ -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/colormac.h" #include "tnl/t_context.h" #include "tnl/t_vertex.h" @@ -44,7 +44,7 @@ #include "i915_reg.h" #include "i915_context.h" -#include "glapi.h" +#include "glapi/glapi.h" static void i915_render_prevalidate(struct intel_context *intel) diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.h b/src/mesa/drivers/dri/i915/intel_ioctl.h deleted file mode 100644 index 8d79e9d73b..0000000000 --- a/src/mesa/drivers/dri/i915/intel_ioctl.h +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * 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 TUNGSTEN GRAPHICS 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 INTEL_IOCTL_H -#define INTEL_IOCTL_H - -#include "intel_context.h" - -extern void intelWaitAgeLocked( intelContextPtr intel, int age, GLboolean unlock ); - -extern void intelClear(GLcontext *ctx, GLbitfield mask); - -extern void intelPageFlip( const __DRIdrawablePrivate *dpriv ); - -extern void intelRotateWindow(intelContextPtr intel, - __DRIdrawablePrivate *dPriv, GLuint srcBuffer); - -extern void intelWaitForIdle( intelContextPtr intel ); -extern void intelFlushBatch( intelContextPtr intel, GLboolean refill ); -extern void intelFlushBatchLocked( intelContextPtr intel, - GLboolean ignore_cliprects, - GLboolean refill, - GLboolean allow_unlock); -extern void intelRefillBatchLocked( intelContextPtr intel, GLboolean allow_unlock ); -extern void intelFinish( GLcontext *ctx ); -extern void intelFlush( GLcontext *ctx ); -extern void intelglFlush( GLcontext *ctx ); - -extern void *intelAllocateAGP( intelContextPtr intel, GLsizei size ); -extern void intelFreeAGP( intelContextPtr intel, void *pointer ); - -extern void *intelAllocateMemoryMESA( __DRInativeDisplay *dpy, int scrn, - GLsizei size, GLfloat readfreq, - GLfloat writefreq, GLfloat priority ); - -extern void intelFreeMemoryMESA( __DRInativeDisplay *dpy, int scrn, - GLvoid *pointer ); - -extern GLuint intelGetMemoryOffsetMESA( __DRInativeDisplay *dpy, int scrn, const GLvoid *pointer ); -extern GLboolean intelIsAgpMemory( intelContextPtr intel, const GLvoid *pointer, - GLint size ); - -extern GLuint intelAgpOffsetFromVirtual( intelContextPtr intel, const GLvoid *p ); - -extern void intelWaitIrq( intelContextPtr intel, int seq ); -extern uint32_t intelGetLastFrame (intelContextPtr intel); -extern int intelEmitIrqLocked( intelContextPtr intel ); -#endif diff --git a/src/mesa/drivers/dri/i915/intel_pixel_read.c b/src/mesa/drivers/dri/i915/intel_pixel_read.c index 120c887abd..56087aacd4 100644 --- a/src/mesa/drivers/dri/i915/intel_pixel_read.c +++ b/src/mesa/drivers/dri/i915/intel_pixel_read.c @@ -25,12 +25,12 @@ * **************************************************************************/ -#include "glheader.h" -#include "enums.h" -#include "mtypes.h" -#include "macros.h" -#include "image.h" -#include "bufferobj.h" +#include "main/glheader.h" +#include "main/enums.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/image.h" +#include "main/bufferobj.h" #include "swrast/swrast.h" #include "intel_screen.h" diff --git a/src/mesa/drivers/dri/i915/intel_render.c b/src/mesa/drivers/dri/i915/intel_render.c index 838d450378..467abe4d7c 100644 --- a/src/mesa/drivers/dri/i915/intel_render.c +++ b/src/mesa/drivers/dri/i915/intel_render.c @@ -30,12 +30,12 @@ * dma buffers. Use strip/fan hardware acceleration where possible. * */ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/enums.h" #include "tnl/t_context.h" #include "tnl/t_vertex.h" diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 7e7935510a..f2db48272b 100644..120000 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -1,690 +1 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * 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 TUNGSTEN GRAPHICS 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. - * - **************************************************************************/ - -#include "glheader.h" -#include "context.h" -#include "framebuffer.h" -#include "matrix.h" -#include "renderbuffer.h" -#include "simple_list.h" -#include "utils.h" -#include "vblank.h" -#include "xmlpool.h" - - -#include "intel_screen.h" - -#include "intel_tex.h" -#include "intel_span.h" -#include "intel_tris.h" -#include "intel_ioctl.h" - -#include "i830_dri.h" - -PUBLIC const char __driConfigOptions[] = -DRI_CONF_BEGIN - DRI_CONF_SECTION_PERFORMANCE - DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) - DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) - DRI_CONF_SECTION_END - DRI_CONF_SECTION_QUALITY - DRI_CONF_FORCE_S3TC_ENABLE(false) - DRI_CONF_ALLOW_LARGE_TEXTURES(1) - DRI_CONF_SECTION_END -DRI_CONF_END; -const GLuint __driNConfigOptions = 4; - -#ifdef USE_NEW_INTERFACE -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; -#endif /*USE_NEW_INTERFACE*/ - -extern const struct dri_extension card_extensions[]; - -/** - * Map all the memory regions described by the screen. - * \return GL_TRUE if success, GL_FALSE if error. - */ -GLboolean -intelMapScreenRegions(__DRIscreenPrivate *sPriv) -{ - intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private; - - if (intelScreen->front.handle) { - if (drmMap(sPriv->fd, - intelScreen->front.handle, - intelScreen->front.size, - (drmAddress *)&intelScreen->front.map) != 0) { - _mesa_problem(NULL, "drmMap(frontbuffer) failed!"); - return GL_FALSE; - } - } - else { - _mesa_warning(NULL, "no front buffer handle in intelMapScreenRegions!"); - } - - if (drmMap(sPriv->fd, - intelScreen->back.handle, - intelScreen->back.size, - (drmAddress *)&intelScreen->back.map) != 0) { - intelUnmapScreenRegions(intelScreen); - return GL_FALSE; - } - - if (drmMap(sPriv->fd, - intelScreen->depth.handle, - intelScreen->depth.size, - (drmAddress *)&intelScreen->depth.map) != 0) { - intelUnmapScreenRegions(intelScreen); - return GL_FALSE; - } - - if (drmMap(sPriv->fd, - intelScreen->tex.handle, - intelScreen->tex.size, - (drmAddress *)&intelScreen->tex.map) != 0) { - intelUnmapScreenRegions(intelScreen); - return GL_FALSE; - } - - if (0) - printf("Mappings: front: %p back: %p depth: %p tex: %p\n", - intelScreen->front.map, - intelScreen->back.map, - intelScreen->depth.map, - intelScreen->tex.map); - return GL_TRUE; -} - - -void -intelUnmapScreenRegions(intelScreenPrivate *intelScreen) -{ -#define REALLY_UNMAP 1 - if (intelScreen->front.map) { -#if REALLY_UNMAP - if (drmUnmap(intelScreen->front.map, intelScreen->front.size) != 0) - printf("drmUnmap front failed!\n"); -#endif - intelScreen->front.map = NULL; - } - if (intelScreen->back.map) { -#if REALLY_UNMAP - if (drmUnmap(intelScreen->back.map, intelScreen->back.size) != 0) - printf("drmUnmap back failed!\n"); -#endif - intelScreen->back.map = NULL; - } - if (intelScreen->depth.map) { -#if REALLY_UNMAP - drmUnmap(intelScreen->depth.map, intelScreen->depth.size); - intelScreen->depth.map = NULL; -#endif - } - if (intelScreen->tex.map) { -#if REALLY_UNMAP - drmUnmap(intelScreen->tex.map, intelScreen->tex.size); - intelScreen->tex.map = NULL; -#endif - } -} - - -static void -intelPrintDRIInfo(intelScreenPrivate *intelScreen, - __DRIscreenPrivate *sPriv, - I830DRIPtr gDRIPriv) -{ - fprintf(stderr, "*** Front size: 0x%x offset: 0x%x pitch: %d\n", - intelScreen->front.size, intelScreen->front.offset, - intelScreen->front.pitch); - fprintf(stderr, "*** Back size: 0x%x offset: 0x%x pitch: %d\n", - intelScreen->back.size, intelScreen->back.offset, - intelScreen->back.pitch); - fprintf(stderr, "*** Depth size: 0x%x offset: 0x%x pitch: %d\n", - intelScreen->depth.size, intelScreen->depth.offset, - intelScreen->depth.pitch); - fprintf(stderr, "*** Rotated size: 0x%x offset: 0x%x pitch: %d\n", - intelScreen->rotated.size, intelScreen->rotated.offset, - intelScreen->rotated.pitch); - fprintf(stderr, "*** Texture size: 0x%x offset: 0x%x\n", - intelScreen->tex.size, intelScreen->tex.offset); - fprintf(stderr, "*** Memory : 0x%x\n", gDRIPriv->mem); -} - - -static void -intelPrintSAREA(const drmI830Sarea *sarea) -{ - fprintf(stderr, "SAREA: sarea width %d height %d\n", sarea->width, sarea->height); - fprintf(stderr, "SAREA: pitch: %d\n", sarea->pitch); - fprintf(stderr, - "SAREA: front offset: 0x%08x size: 0x%x handle: 0x%x\n", - sarea->front_offset, sarea->front_size, - (unsigned) sarea->front_handle); - fprintf(stderr, - "SAREA: back offset: 0x%08x size: 0x%x handle: 0x%x\n", - sarea->back_offset, sarea->back_size, - (unsigned) sarea->back_handle); - fprintf(stderr, "SAREA: depth offset: 0x%08x size: 0x%x handle: 0x%x\n", - sarea->depth_offset, sarea->depth_size, - (unsigned) sarea->depth_handle); - fprintf(stderr, "SAREA: tex offset: 0x%08x size: 0x%x handle: 0x%x\n", - sarea->tex_offset, sarea->tex_size, - (unsigned) sarea->tex_handle); - fprintf(stderr, "SAREA: rotation: %d\n", sarea->rotation); - fprintf(stderr, - "SAREA: rotated offset: 0x%08x size: 0x%x\n", - sarea->rotated_offset, sarea->rotated_size); - fprintf(stderr, "SAREA: rotated pitch: %d\n", sarea->rotated_pitch); -} - - -/** - * A number of the screen parameters are obtained/computed from - * information in the SAREA. This function updates those parameters. - */ -void -intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, - drmI830Sarea *sarea) -{ - intelScreen->width = sarea->width; - intelScreen->height = sarea->height; - - intelScreen->front.offset = sarea->front_offset; - intelScreen->front.pitch = sarea->pitch * intelScreen->cpp; - intelScreen->front.handle = sarea->front_handle; - intelScreen->front.size = sarea->front_size; - - intelScreen->back.offset = sarea->back_offset; - intelScreen->back.pitch = sarea->pitch * intelScreen->cpp; - intelScreen->back.handle = sarea->back_handle; - intelScreen->back.size = sarea->back_size; - - intelScreen->depth.offset = sarea->depth_offset; - intelScreen->depth.pitch = sarea->pitch * intelScreen->cpp; - intelScreen->depth.handle = sarea->depth_handle; - intelScreen->depth.size = sarea->depth_size; - - intelScreen->tex.offset = sarea->tex_offset; - intelScreen->logTextureGranularity = sarea->log_tex_granularity; - intelScreen->tex.handle = sarea->tex_handle; - intelScreen->tex.size = sarea->tex_size; - - intelScreen->rotated.offset = sarea->rotated_offset; - intelScreen->rotated.pitch = sarea->rotated_pitch * intelScreen->cpp; - intelScreen->rotated.size = sarea->rotated_size; - intelScreen->current_rotation = sarea->rotation; - matrix23Rotate(&intelScreen->rotMatrix, - sarea->width, sarea->height, sarea->rotation); - intelScreen->rotatedWidth = sarea->virtualX; - intelScreen->rotatedHeight = sarea->virtualY; - - if (0) - intelPrintSAREA(sarea); -} - - -static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) -{ - intelScreenPrivate *intelScreen; - I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv; - drmI830Sarea *sarea; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; - - if (sPriv->devPrivSize != sizeof(I830DRIRec)) { - fprintf(stderr,"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n"); - return GL_FALSE; - } - - /* Allocate the private area */ - intelScreen = (intelScreenPrivate *)CALLOC(sizeof(intelScreenPrivate)); - if (!intelScreen) { - fprintf(stderr,"\nERROR! Allocating private area failed\n"); - return GL_FALSE; - } - /* parse information in __driConfigOptions */ - driParseOptionInfo (&intelScreen->optionCache, - __driConfigOptions, __driNConfigOptions); - - intelScreen->driScrnPriv = sPriv; - sPriv->private = (void *)intelScreen; - intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset; - sarea = (drmI830Sarea *) - (((GLubyte *)sPriv->pSAREA)+intelScreen->sarea_priv_offset); - - intelScreen->deviceID = gDRIPriv->deviceID; - intelScreen->mem = gDRIPriv->mem; - intelScreen->cpp = gDRIPriv->cpp; - - switch (gDRIPriv->bitsPerPixel) { - case 15: intelScreen->fbFormat = DV_PF_555; break; - case 16: intelScreen->fbFormat = DV_PF_565; break; - case 32: intelScreen->fbFormat = DV_PF_8888; break; - } - - intelUpdateScreenFromSAREA(intelScreen, sarea); - - if (0) - intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv); - - if (!intelMapScreenRegions(sPriv)) { - fprintf(stderr,"\nERROR! mapping regions\n"); - _mesa_free(intelScreen); - sPriv->private = NULL; - return GL_FALSE; - } - - intelScreen->drmMinor = sPriv->drmMinor; - - /* Determine if IRQs are active? */ - { - int ret; - drmI830GetParam gp; - - gp.param = I830_PARAM_IRQ_ACTIVE; - gp.value = &intelScreen->irq_active; - - ret = drmCommandWriteRead( sPriv->fd, DRM_I830_GETPARAM, - &gp, sizeof(gp)); - if (ret) { - fprintf(stderr, "drmI830GetParam: %d\n", ret); - return GL_FALSE; - } - } - - /* Determine if batchbuffers are allowed */ - { - int ret; - drmI830GetParam gp; - - gp.param = I830_PARAM_ALLOW_BATCHBUFFER; - gp.value = &intelScreen->allow_batchbuffer; - - ret = drmCommandWriteRead( sPriv->fd, DRM_I830_GETPARAM, - &gp, sizeof(gp)); - if (ret) { - fprintf(stderr, "drmI830GetParam: (%d) %d\n", gp.param, ret); - return GL_FALSE; - } - } - - if (glx_enable_extension != NULL) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); - (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" ); - (*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" ); - } - - sPriv->psc->allocateMemory = (void *) intelAllocateMemoryMESA; - sPriv->psc->freeMemory = (void *) intelFreeMemoryMESA; - sPriv->psc->memoryOffset = (void *) intelGetMemoryOffsetMESA; - - return GL_TRUE; -} - - -static void intelDestroyScreen(__DRIscreenPrivate *sPriv) -{ - intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private; - - intelUnmapScreenRegions(intelScreen); - - driDestroyOptionInfo (&intelScreen->optionCache); - - FREE(intelScreen); - sPriv->private = NULL; -} - - -static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv, - __DRIdrawablePrivate *driDrawPriv, - const __GLcontextModes *mesaVis, - GLboolean isPixmap ) -{ - intelScreenPrivate *screen = (intelScreenPrivate *) driScrnPriv->private; - - if (isPixmap) { - return GL_FALSE; /* not implemented */ - } else { - GLboolean swStencil = (mesaVis->stencilBits > 0 && - mesaVis->depthBits != 24); - - struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); - - { - driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, - screen->front.map, - screen->cpp, - screen->front.offset, screen->front.pitch, - driDrawPriv); - intelSetSpanFunctions(frontRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); - } - - if (mesaVis->doubleBufferMode) { - driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, - screen->back.map, - screen->cpp, - screen->back.offset, screen->back.pitch, - driDrawPriv); - intelSetSpanFunctions(backRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); - } - - if (mesaVis->depthBits == 16) { - driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, - screen->depth.map, - screen->cpp, - screen->depth.offset, screen->depth.pitch, - driDrawPriv); - intelSetSpanFunctions(depthRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - else if (mesaVis->depthBits == 24) { - driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, - screen->depth.map, - screen->cpp, - screen->depth.offset, screen->depth.pitch, - driDrawPriv); - intelSetSpanFunctions(depthRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - - if (mesaVis->stencilBits > 0 && !swStencil) { - driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, - screen->depth.map, - screen->cpp, - screen->depth.offset, screen->depth.pitch, - driDrawPriv); - intelSetSpanFunctions(stencilRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); - } - - _mesa_add_soft_renderbuffers(fb, - GL_FALSE, /* color */ - GL_FALSE, /* depth */ - swStencil, - mesaVis->accumRedBits > 0, - GL_FALSE, /* alpha */ - GL_FALSE /* aux */); - driDrawPriv->driverPrivate = (void *) fb; - - return (driDrawPriv->driverPrivate != NULL); - } -} - -static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) -{ - _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); -} - - -/** - * Get information about previous buffer swaps. - */ -static int -intelGetSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ) -{ - intelContextPtr intel; - - if ( (dPriv == NULL) || (dPriv->driContextPriv == NULL) - || (dPriv->driContextPriv->driverPrivate == NULL) - || (sInfo == NULL) ) { - return -1; - } - - intel = dPriv->driContextPriv->driverPrivate; - sInfo->swap_count = intel->swap_count; - sInfo->swap_ust = intel->swap_ust; - sInfo->swap_missed_count = intel->swap_missed_count; - - sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0) - ? driCalculateSwapUsage( dPriv, 0, intel->swap_missed_ust ) - : 0.0; - - return 0; -} - - -/* There are probably better ways to do this, such as an - * init-designated function to register chipids and createcontext - * functions. - */ -extern GLboolean i830CreateContext( const __GLcontextModes *mesaVis, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate); - -extern GLboolean i915CreateContext( const __GLcontextModes *mesaVis, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate); - - - - -static GLboolean intelCreateContext( const __GLcontextModes *mesaVis, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate) -{ - __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private; - - switch (intelScreen->deviceID) { - case PCI_CHIP_845_G: - case PCI_CHIP_I830_M: - case PCI_CHIP_I855_GM: - case PCI_CHIP_I865_G: - return i830CreateContext( mesaVis, driContextPriv, - sharedContextPrivate ); - - case PCI_CHIP_I915_G: - case PCI_CHIP_I915_GM: - case PCI_CHIP_I945_G: - case PCI_CHIP_I945_GM: - case PCI_CHIP_I945_GME: - case PCI_CHIP_G33_G: - case PCI_CHIP_Q35_G: - case PCI_CHIP_Q33_G: - return i915CreateContext( mesaVis, driContextPriv, - sharedContextPrivate ); - - default: - fprintf(stderr, "Unrecognized deviceID %x\n", intelScreen->deviceID); - return GL_FALSE; - } -} - - -static const struct __DriverAPIRec intelAPI = { - .InitDriver = intelInitDriver, - .DestroyScreen = intelDestroyScreen, - .CreateContext = intelCreateContext, - .DestroyContext = intelDestroyContext, - .CreateBuffer = intelCreateBuffer, - .DestroyBuffer = intelDestroyBuffer, - .SwapBuffers = intelSwapBuffers, - .MakeCurrent = intelMakeCurrent, - .UnbindContext = intelUnbindContext, - .GetSwapInfo = intelGetSwapInfo, - .GetMSC = driGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL, - .CopySubBuffer = intelCopySubBuffer -}; - - -static __GLcontextModes * -intelFillInModes( unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer ) -{ - __GLcontextModes * modes; - __GLcontextModes * m; - unsigned num_modes; - unsigned depth_buffer_factor; - unsigned back_buffer_factor; - GLenum fb_format; - GLenum fb_type; - - /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't - * support pageflipping at all. - */ - static const GLenum back_buffer_modes[] = { - GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML - }; - - uint8_t depth_bits_array[3]; - uint8_t stencil_bits_array[3]; - - - depth_bits_array[0] = 0; - depth_bits_array[1] = depth_bits; - depth_bits_array[2] = depth_bits; - - /* Just like with the accumulation buffer, always provide some modes - * with a stencil buffer. It will be a sw fallback, but some apps won't - * care about that. - */ - stencil_bits_array[0] = 0; - stencil_bits_array[1] = 0; - stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits; - - depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1; - back_buffer_factor = (have_back_buffer) ? 3 : 1; - - num_modes = depth_buffer_factor * back_buffer_factor * 4; - - if ( pixel_bits == 16 ) { - fb_format = GL_RGB; - fb_type = GL_UNSIGNED_SHORT_5_6_5; - } - else { - fb_format = GL_BGRA; - fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; - } - - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); - m = modes; - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - - /* Mark the visual as slow if there are "fake" stencil bits. - */ - for ( m = modes ; m != NULL ; m = m->next ) { - if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) { - m->visualRating = GLX_SLOW_CONFIG; - } - } - - return modes; -} - - -/** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. - * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. - */ -PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) - -{ - __DRIscreenPrivate *psp; - static const __DRIversion ddx_expected = { 1, 5, 0 }; - static const __DRIversion dri_expected = { 4, 0, 0 }; - static const __DRIversion drm_expected = { 1, 4, 0 }; - - dri_interface = interface; - - if ( ! driCheckDriDdxDrmVersions2( "i915", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { - return NULL; - } - - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &intelAPI); - if ( psp != NULL ) { - I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - *driver_modes = intelFillInModes( dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - 1 ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } - - return (void *) psp; -} +../intel/intel_screen.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/i915/intel_state.c b/src/mesa/drivers/dri/i915/intel_state.c index d1ca11dec4..09aa62da36 100644 --- a/src/mesa/drivers/dri/i915/intel_state.c +++ b/src/mesa/drivers/dri/i915/intel_state.c @@ -26,12 +26,12 @@ **************************************************************************/ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "enums.h" -#include "colormac.h" -#include "dd.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/enums.h" +#include "main/colormac.h" +#include "main/dd.h" #include "intel_screen.h" #include "intel_context.h" diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index 5f4b852212..06210035af 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -31,13 +31,13 @@ * primitives into it. */ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "enums.h" -#include "texobj.h" -#include "state.h" -#include "dd.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/enums.h" +#include "main/texobj.h" +#include "main/state.h" +#include "main/dd.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -109,6 +109,7 @@ void intel_flush_prim(struct intel_context *intel) BATCH_LOCALS; dri_bo *aper_array[2]; dri_bo *vb_bo; + unsigned int offset, count; /* Must be called after an intel_start_prim. */ assert(intel->prim.primitive != ~0); @@ -116,11 +117,19 @@ void intel_flush_prim(struct intel_context *intel) if (intel->prim.count == 0) return; - /* Keep a reference on the BO as it may get finished as we start the - * batch emit. + /* Clear the current prims out of the context state so that a batch flush + * flush triggered by wait_flips or emit_state doesn't loop back to + * flush_prim again. */ vb_bo = intel->prim.vb_bo; dri_bo_reference(vb_bo); + count = intel->prim.count; + intel->prim.count = 0; + offset = intel->prim.start_offset; + intel->prim.start_offset = intel->prim.current_offset; + if (!IS_9XX(intel->intelScreen->deviceID)) + intel->prim.start_offset = ALIGN(intel->prim.start_offset, 128); + intel->prim.flush = NULL; intel_wait_flips(intel); @@ -145,7 +154,7 @@ void intel_flush_prim(struct intel_context *intel) assert((intel->batch->dirty_state & (1<<1)) == 0); #if 0 - printf("emitting %d..%d=%d vertices size %d\n", intel->prim.start_offset, + printf("emitting %d..%d=%d vertices size %d\n", offset, intel->prim.current_offset, intel->prim.count, intel->vertex_size * 4); #endif @@ -154,9 +163,8 @@ void intel_flush_prim(struct intel_context *intel) BEGIN_BATCH(5, LOOP_CLIPRECTS); OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(0) | I1_LOAD_S(1) | 1); - assert((intel->prim.start_offset & !S0_VB_OFFSET_MASK) == 0); - OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, - intel->prim.start_offset); + assert((offset & !S0_VB_OFFSET_MASK) == 0); + OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, offset); OUT_BATCH((intel->vertex_size << S1_VERTEX_WIDTH_SHIFT) | (intel->vertex_size << S1_VERTEX_PITCH_SHIFT)); @@ -164,7 +172,7 @@ void intel_flush_prim(struct intel_context *intel) PRIM_INDIRECT | PRIM_INDIRECT_SEQUENTIAL | intel->prim.primitive | - intel->prim.count); + count); OUT_BATCH(0); /* Beginning vertex index */ ADVANCE_BATCH(); } else { @@ -174,10 +182,9 @@ void intel_flush_prim(struct intel_context *intel) OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(0) | I1_LOAD_S(2) | 1); /* S0 */ - assert((intel->prim.start_offset & !S0_VB_OFFSET_MASK_830) == 0); + assert((offset & !S0_VB_OFFSET_MASK_830) == 0); OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, - intel->prim.start_offset | - (intel->vertex_size << S0_VB_PITCH_SHIFT_830) | + offset | (intel->vertex_size << S0_VB_PITCH_SHIFT_830) | S0_VB_ENABLE_830); /* S1 * This is somewhat unfortunate -- VB width is tied up with @@ -194,19 +201,13 @@ void intel_flush_prim(struct intel_context *intel) PRIM_INDIRECT | PRIM_INDIRECT_SEQUENTIAL | intel->prim.primitive | - intel->prim.count); + count); OUT_BATCH(0); /* Beginning vertex index */ ADVANCE_BATCH(); } intel->no_batch_wrap = GL_FALSE; - intel->prim.flush = NULL; - intel->prim.start_offset = intel->prim.current_offset; - if (!IS_9XX(intel->intelScreen->deviceID)) - intel->prim.start_offset = ALIGN(intel->prim.start_offset, 128); - intel->prim.count = 0; - dri_bo_unreference(vb_bo); } diff --git a/src/mesa/drivers/dri/i915/intel_tris.h b/src/mesa/drivers/dri/i915/intel_tris.h index 0e08986221..55b60a47f9 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.h +++ b/src/mesa/drivers/dri/i915/intel_tris.h @@ -28,7 +28,7 @@ #ifndef INTELTRIS_INC #define INTELTRIS_INC -#include "mtypes.h" +#include "main/mtypes.h" #define INTEL_VB_SIZE (32 * 1024) /** 3 dwords of state_immediate and 2 of 3dprim, in intel_flush_prim */ diff --git a/src/mesa/drivers/dri/i915/server/i830_common.h b/src/mesa/drivers/dri/i915/server/i830_common.h deleted file mode 100644 index 2b0fee82a8..0000000000 --- a/src/mesa/drivers/dri/i915/server/i830_common.h +++ /dev/null @@ -1,211 +0,0 @@ -/************************************************************************** - -Copyright 2001 VA Linux Systems Inc., Fremont, California. -Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. - -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 -on 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 -ATI, VA LINUX SYSTEMS AND/OR THEIR 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 _I830_COMMON_H_ -#define _I830_COMMON_H_ - - -#define I830_NR_TEX_REGIONS 255 /* maximum due to use of chars for next/prev */ -#define I830_LOG_MIN_TEX_REGION_SIZE 14 - - -/* Driver specific DRM command indices - * NOTE: these are not OS specific, but they are driver specific - */ -#define DRM_I830_INIT 0x00 -#define DRM_I830_FLUSH 0x01 -#define DRM_I830_FLIP 0x02 -#define DRM_I830_BATCHBUFFER 0x03 -#define DRM_I830_IRQ_EMIT 0x04 -#define DRM_I830_IRQ_WAIT 0x05 -#define DRM_I830_GETPARAM 0x06 -#define DRM_I830_SETPARAM 0x07 -#define DRM_I830_ALLOC 0x08 -#define DRM_I830_FREE 0x09 -#define DRM_I830_INIT_HEAP 0x0a -#define DRM_I830_CMDBUFFER 0x0b -#define DRM_I830_DESTROY_HEAP 0x0c - -typedef struct { - enum { - I830_INIT_DMA = 0x01, - I830_CLEANUP_DMA = 0x02, - I830_RESUME_DMA = 0x03 - } func; - unsigned int mmio_offset; - int sarea_priv_offset; - unsigned int ring_start; - unsigned int ring_end; - unsigned int ring_size; - unsigned int front_offset; - unsigned int back_offset; - unsigned int depth_offset; - unsigned int w; - unsigned int h; - unsigned int pitch; - unsigned int pitch_bits; - unsigned int back_pitch; - unsigned int depth_pitch; - unsigned int cpp; - unsigned int chipset; -} drmI830Init; - -typedef struct { - drmTextureRegion texList[I830_NR_TEX_REGIONS+1]; - int last_upload; /* last time texture was uploaded */ - int last_enqueue; /* last time a buffer was enqueued */ - int last_dispatch; /* age of the most recently dispatched buffer */ - int ctxOwner; /* last context to upload state */ - int texAge; - int pf_enabled; /* is pageflipping allowed? */ - int pf_active; - int pf_current_page; /* which buffer is being displayed? */ - int perf_boxes; /* performance boxes to be displayed */ - int width, height; /* screen size in pixels */ - - drm_handle_t front_handle; - int front_offset; - int front_size; - - drm_handle_t back_handle; - int back_offset; - int back_size; - - drm_handle_t depth_handle; - int depth_offset; - int depth_size; - - drm_handle_t tex_handle; - int tex_offset; - int tex_size; - int log_tex_granularity; - int pitch; - int rotation; /* 0, 90, 180 or 270 */ - int rotated_offset; - int rotated_size; - int rotated_pitch; - int virtualX, virtualY; - - unsigned int front_tiled; - unsigned int back_tiled; - unsigned int depth_tiled; - unsigned int rotated_tiled; - unsigned int rotated2_tiled; - - int pipeA_x; - int pipeA_y; - int pipeA_w; - int pipeA_h; - int pipeB_x; - int pipeB_y; - int pipeB_w; - int pipeB_h; -} drmI830Sarea; - -/* Flags for perf_boxes - */ -#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */ -#define I830_BOX_FLIP 0x2 /* populated by kernel */ -#define I830_BOX_WAIT 0x4 /* populated by kernel & client */ -#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */ -#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */ - - -typedef struct { - int start; /* agp offset */ - int used; /* nr bytes in use */ - int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ - int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/ - int num_cliprects; /* mulitpass with multiple cliprects? */ - drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */ -} drmI830BatchBuffer; - -typedef struct { - char *buf; /* agp offset */ - int sz; /* nr bytes in use */ - int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ - int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/ - int num_cliprects; /* mulitpass with multiple cliprects? */ - drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */ -} drmI830CmdBuffer; - -typedef struct { - int *irq_seq; -} drmI830IrqEmit; - -typedef struct { - int irq_seq; -} drmI830IrqWait; - -typedef struct { - int param; - int *value; -} drmI830GetParam; - -#define I830_PARAM_IRQ_ACTIVE 1 -#define I830_PARAM_ALLOW_BATCHBUFFER 2 - -typedef struct { - int param; - int value; -} drmI830SetParam; - -#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1 -#define I830_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 -#define I830_SETPARAM_ALLOW_BATCHBUFFER 3 - - -/* A memory manager for regions of shared memory: - */ -#define I830_MEM_REGION_AGP 1 - -typedef struct { - int region; - int alignment; - int size; - int *region_offset; /* offset from start of fb or agp */ -} drmI830MemAlloc; - -typedef struct { - int region; - int region_offset; -} drmI830MemFree; - -typedef struct { - int region; - int size; - int start; -} drmI830MemInitHeap; - -typedef struct { - int region; -} drmI830MemDestroyHeap; - - -#endif /* _I830_DRM_H_ */ diff --git a/src/mesa/drivers/dri/i915/server/i830_dri.h b/src/mesa/drivers/dri/i915/server/i830_dri.h deleted file mode 100644 index 313eb759b0..0000000000 --- a/src/mesa/drivers/dri/i915/server/i830_dri.h +++ /dev/null @@ -1,72 +0,0 @@ - -#ifndef _I830_DRI_H -#define _I830_DRI_H - -#include "xf86drm.h" -#include "i830_common.h" - -#define I830_MAX_DRAWABLES 256 - -#define I830_MAJOR_VERSION 1 -#define I830_MINOR_VERSION 3 -#define I830_PATCHLEVEL 0 - -#define I830_REG_SIZE 0x80000 - -typedef struct _I830DRIRec { - drm_handle_t regs; - drmSize regsSize; - - drmSize backbufferSize; - drm_handle_t backbuffer; - - drmSize depthbufferSize; - drm_handle_t depthbuffer; - - drmSize rotatedSize; - drm_handle_t rotatedbuffer; - - drm_handle_t textures; - int textureSize; - - drm_handle_t agp_buffers; - drmSize agp_buf_size; - - int deviceID; - int width; - int height; - int mem; - int cpp; - int bitsPerPixel; - - int fbOffset; - int fbStride; - - int backOffset; - int backPitch; - - int depthOffset; - int depthPitch; - - int rotatedOffset; - int rotatedPitch; - - int logTextureGranularity; - int textureOffset; - - int irq; - int sarea_priv_offset; -} I830DRIRec, *I830DRIPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} I830ConfigPrivRec, *I830ConfigPrivPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} I830DRIContextRec, *I830DRIContextPtr; - - -#endif diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index 0458bf5983..fa8121e02d 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -34,8 +34,8 @@ #include "brw_state.h" #include "brw_defines.h" #include "brw_util.h" -#include "macros.h" -#include "enums.h" +#include "main/macros.h" +#include "main/enums.h" static void prepare_cc_vp( struct brw_context *brw ) { diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c index 22981fd2d9..38d8b704d7 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.c +++ b/src/mesa/drivers/dri/i965/brw_clip.c @@ -29,9 +29,9 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "intel_batchbuffer.h" diff --git a/src/mesa/drivers/dri/i965/brw_clip_line.c b/src/mesa/drivers/dri/i965/brw_clip_line.c index 0930e6a573..c87e5b9a12 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_line.c +++ b/src/mesa/drivers/dri/i965/brw_clip_line.c @@ -29,11 +29,11 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" - +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/program.h" + #include "intel_batchbuffer.h" #include "brw_defines.h" diff --git a/src/mesa/drivers/dri/i965/brw_clip_point.c b/src/mesa/drivers/dri/i965/brw_clip_point.c index 2346980a56..d17b199b89 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_point.c +++ b/src/mesa/drivers/dri/i965/brw_clip_point.c @@ -29,11 +29,11 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" - +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/program.h" + #include "intel_batchbuffer.h" #include "brw_defines.h" diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c index 51045f9188..82d1e87357 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_state.c +++ b/src/mesa/drivers/dri/i965/brw_clip_state.c @@ -32,7 +32,7 @@ #include "brw_context.h" #include "brw_state.h" #include "brw_defines.h" -#include "macros.h" +#include "main/macros.h" struct brw_clip_unit_key { unsigned int total_grf; diff --git a/src/mesa/drivers/dri/i965/brw_clip_tri.c b/src/mesa/drivers/dri/i965/brw_clip_tri.c index 00039011b9..8459b59b46 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_tri.c +++ b/src/mesa/drivers/dri/i965/brw_clip_tri.c @@ -29,11 +29,11 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" - +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/program.h" + #include "intel_batchbuffer.h" #include "brw_defines.h" diff --git a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c index 6f20d798d8..d7ca517927 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c +++ b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c @@ -29,11 +29,11 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" - +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/program.h" + #include "intel_batchbuffer.h" #include "brw_defines.h" diff --git a/src/mesa/drivers/dri/i965/brw_clip_util.c b/src/mesa/drivers/dri/i965/brw_clip_util.c index c32bd4ec24..9d3b0be694 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_util.c +++ b/src/mesa/drivers/dri/i965/brw_clip_util.c @@ -30,11 +30,11 @@ */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" - +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/program.h" + #include "intel_batchbuffer.h" #include "brw_defines.h" diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index b4e2619929..92629016d9 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -30,11 +30,15 @@ */ +#include "main/imports.h" +#include "main/api_noop.h" +#include "main/vtxfmt.h" +#include "shader/shader_api.h" + #include "brw_context.h" #include "brw_defines.h" #include "brw_draw.h" #include "brw_vs.h" -#include "imports.h" #include "intel_tex.h" #include "intel_blit.h" #include "intel_batchbuffer.h" @@ -43,10 +47,7 @@ #include "tnl/t_pipeline.h" #include "utils.h" -#include "api_noop.h" -#include "vtxfmt.h" -#include "shader/shader_api.h" /*************************************** * Mesa's Driver Functions @@ -146,7 +147,8 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, brw->emit_state_always = 0; - ctx->FragmentProgram._MaintainTexEnvProgram = 1; + ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; + ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; brw_draw_init( brw ); diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 330d5714da..b04487ecee 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -35,7 +35,7 @@ #include "intel_context.h" #include "brw_structs.h" -#include "imports.h" +#include "main/imports.h" /* Glossary: @@ -557,6 +557,11 @@ struct brw_context GLfloat *last_buf; GLuint last_bufsz; + /** + * Whether we should create a new bo instead of reusing the old one + * (if we just dispatch the batch pointing at the old one. + */ + GLboolean need_new_bo; } curbe; struct { diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 0a3600193b..7cddd3a7de 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -31,10 +31,10 @@ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/prog_parameter.h" #include "shader/prog_statevars.h" #include "intel_batchbuffer.h" @@ -282,7 +282,8 @@ static void prepare_constant_buffer(struct brw_context *brw) brw->curbe.last_bufsz = bufsz; if (brw->curbe.curbe_bo != NULL && - brw->curbe.curbe_next_offset + bufsz > brw->curbe.curbe_bo->size) + (brw->curbe.need_new_bo || + brw->curbe.curbe_next_offset + bufsz > brw->curbe.curbe_bo->size)) { dri_bo_unreference(brw->curbe.curbe_bo); brw->curbe.curbe_bo = NULL; diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 95d798238d..9a353fc7b6 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -27,11 +27,11 @@ #include <stdlib.h> -#include "glheader.h" -#include "context.h" -#include "state.h" -#include "api_validate.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/state.h" +#include "main/api_validate.h" +#include "main/enums.h" #include "brw_draw.h" #include "brw_defines.h" @@ -156,11 +156,13 @@ static void brw_emit_prim( struct brw_context *brw, static void brw_merge_inputs( struct brw_context *brw, const struct gl_client_array *arrays[]) { - struct brw_vertex_element *inputs = brw->vb.inputs; struct brw_vertex_info old = brw->vb.info; GLuint i; - memset(inputs, 0, sizeof(*inputs)); + for (i = 0; i < VERT_ATTRIB_MAX; i++) + dri_bo_unreference(brw->vb.inputs[i].bo); + + memset(&brw->vb.inputs, 0, sizeof(brw->vb.inputs)); memset(&brw->vb.info, 0, sizeof(brw->vb.info)); for (i = 0; i < VERT_ATTRIB_MAX; i++) { @@ -171,7 +173,8 @@ static void brw_merge_inputs( struct brw_context *brw, if (arrays[i]->StrideB != 0) brw->vb.info.varying |= 1 << i; - brw->vb.info.sizes[i/16] |= (inputs[i].glarray->Size - 1) << ((i%16) * 2); + brw->vb.info.sizes[i/16] |= (brw->vb.inputs[i].glarray->Size - 1) << + ((i%16) * 2); } } diff --git a/src/mesa/drivers/dri/i965/brw_draw.h b/src/mesa/drivers/dri/i965/brw_draw.h index e0bba589d5..9aebbdb1b8 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.h +++ b/src/mesa/drivers/dri/i965/brw_draw.h @@ -28,7 +28,7 @@ #ifndef BRW_DRAW_H #define BRW_DRAW_H -#include "mtypes.h" /* for GLcontext... */ +#include "main/mtypes.h" /* for GLcontext... */ #include "vbo/vbo.h" struct brw_context; diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 465239f195..303eaac5cf 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -27,11 +27,11 @@ #include <stdlib.h> -#include "glheader.h" -#include "context.h" -#include "state.h" -#include "api_validate.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/state.h" +#include "main/api_validate.h" +#include "main/enums.h" #include "brw_draw.h" #include "brw_defines.h" @@ -455,12 +455,6 @@ static void brw_emit_vertices(struct brw_context *brw) input->offset); OUT_BATCH(brw->vb.max_index); OUT_BATCH(0); /* Instance data step rate */ - - /* Unreference the buffer so it can get freed, now that we won't - * touch it any more. - */ - dri_bo_unreference(input->bo); - input->bo = NULL; } ADVANCE_BATCH(); diff --git a/src/mesa/drivers/dri/i965/brw_eu_debug.c b/src/mesa/drivers/dri/i965/brw_eu_debug.c index 2dff1ad224..91dbbd5af6 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_debug.c +++ b/src/mesa/drivers/dri/i965/brw_eu_debug.c @@ -30,9 +30,9 @@ */ -#include "mtypes.h" +#include "main/mtypes.h" +#include "main/imports.h" #include "brw_eu.h" -#include "imports.h" void brw_print_reg( struct brw_reg hwreg ) { diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index 693f68f32a..2f6b7febbd 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -25,19 +25,20 @@ * **************************************************************************/ +#include "main/glheader.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/mtypes.h" + #include "swrast_setup/swrast_setup.h" #include "swrast/swrast.h" #include "tnl/tnl.h" -#include "context.h" #include "brw_context.h" #include "brw_fallback.h" -#include "glheader.h" -#include "enums.h" -#include "glapi.h" -#include "imports.h" -#include "macros.h" -#include "mtypes.h" +#include "glapi/glapi.h" #define FILE_DEBUG_FLAG DEBUG_FALLBACKS diff --git a/src/mesa/drivers/dri/i965/brw_fallback.h b/src/mesa/drivers/dri/i965/brw_fallback.h index 684a46cd17..50dcdacd17 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.h +++ b/src/mesa/drivers/dri/i965/brw_fallback.h @@ -28,7 +28,7 @@ #ifndef BRW_FALLBACK_H #define BRW_FALLBACK_H -#include "mtypes.h" /* for GLcontext... */ +#include "main/mtypes.h" /* for GLcontext... */ struct brw_context; struct vbo_prim; diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 2daef0093b..a8b74a0afe 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -29,9 +29,9 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "intel_batchbuffer.h" diff --git a/src/mesa/drivers/dri/i965/brw_gs_emit.c b/src/mesa/drivers/dri/i965/brw_gs_emit.c index 9abb94d82e..22e0d25c2e 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_gs_emit.c @@ -30,9 +30,9 @@ */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/program.h" #include "intel_batchbuffer.h" diff --git a/src/mesa/drivers/dri/i965/brw_gs_state.c b/src/mesa/drivers/dri/i965/brw_gs_state.c index 633e17cc9d..27023cf034 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_state.c +++ b/src/mesa/drivers/dri/i965/brw_gs_state.c @@ -34,7 +34,7 @@ #include "brw_context.h" #include "brw_state.h" #include "brw_defines.h" -#include "macros.h" +#include "main/macros.h" struct brw_gs_unit_key { unsigned int total_grf; diff --git a/src/mesa/drivers/dri/i965/brw_metaops.c b/src/mesa/drivers/dri/i965/brw_metaops.c index 252a8996e2..41bfa2e256 100644 --- a/src/mesa/drivers/dri/i965/brw_metaops.c +++ b/src/mesa/drivers/dri/i965/brw_metaops.c @@ -32,9 +32,9 @@ -#include "glheader.h" -#include "context.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" #include "shader/arbprogparse.h" diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 5bb9e11310..9dce6cd8e6 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -30,9 +30,9 @@ */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "intel_batchbuffer.h" diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c index 6fba8c8908..ffdb0ae6df 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_emit.c +++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c @@ -30,9 +30,9 @@ */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "intel_batchbuffer.h" diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index 07d0b4c798..4f925d1810 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -34,7 +34,7 @@ #include "brw_context.h" #include "brw_state.h" #include "brw_defines.h" -#include "macros.h" +#include "main/macros.h" #include "intel_fbo.h" static void upload_sf_vp(struct brw_context *brw) diff --git a/src/mesa/drivers/dri/i965/brw_state_batch.c b/src/mesa/drivers/dri/i965/brw_state_batch.c index 77e2736d11..94ef924868 100644 --- a/src/mesa/drivers/dri/i965/brw_state_batch.c +++ b/src/mesa/drivers/dri/i965/brw_state_batch.c @@ -33,7 +33,7 @@ #include "brw_state.h" #include "intel_batchbuffer.h" -#include "imports.h" +#include "main/imports.h" diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index fc0c3bd9ff..1318dea594 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -58,7 +58,7 @@ #include "brw_state.h" #include "intel_batchbuffer.h" -#include "imports.h" +#include "main/imports.h" /* XXX: Fixme - have to include these to get the sizes of the prog_key * structs: diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c index 3a93f9f732..b28c57c2bc 100644 --- a/src/mesa/drivers/dri/i965/brw_state_dump.c +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c @@ -25,7 +25,7 @@ * */ -#include "mtypes.h" +#include "main/mtypes.h" #include "brw_context.h" #include "brw_state.h" diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c index ab6393420a..0bb6f176a0 100644 --- a/src/mesa/drivers/dri/i965/brw_tex.c +++ b/src/mesa/drivers/dri/i965/brw_tex.c @@ -30,15 +30,16 @@ */ -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "simple_list.h" -#include "enums.h" -#include "image.h" -#include "teximage.h" -#include "texstore.h" -#include "texformat.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/teximage.h" +#include "main/texstore.h" +#include "main/texformat.h" + #include "texmem.h" #include "intel_context.h" diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index e437c411dd..51a617fcb4 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -36,7 +36,7 @@ #include "intel_mipmap_tree.h" #include "intel_tex_layout.h" #include "intel_context.h" -#include "macros.h" +#include "main/macros.h" #define FILE_DEBUG_FLAG DEBUG_MIPTREE diff --git a/src/mesa/drivers/dri/i965/brw_util.c b/src/mesa/drivers/dri/i965/brw_util.c index d8d35c574e..ce21aa4869 100644 --- a/src/mesa/drivers/dri/i965/brw_util.c +++ b/src/mesa/drivers/dri/i965/brw_util.c @@ -30,7 +30,7 @@ */ -#include "mtypes.h" +#include "main/mtypes.h" #include "shader/prog_parameter.h" #include "brw_util.h" #include "brw_defines.h" diff --git a/src/mesa/drivers/dri/i965/brw_util.h b/src/mesa/drivers/dri/i965/brw_util.h index bd6cc0a268..33e7cd87e4 100644 --- a/src/mesa/drivers/dri/i965/brw_util.h +++ b/src/mesa/drivers/dri/i965/brw_util.h @@ -33,7 +33,7 @@ #ifndef BRW_UTIL_H #define BRW_UTIL_H -#include "mtypes.h" +#include "main/mtypes.h" extern GLuint brw_count_bits( GLuint val ); extern GLuint brw_parameter_list_state_flags(struct gl_program_parameter_list *paramList); diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c index 734a926e96..6fbac02de6 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_constval.c +++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c @@ -30,7 +30,7 @@ */ -#include "macros.h" +#include "main/macros.h" #include "brw_context.h" #include "brw_vs.h" diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 8759826e83..9de05408ba 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1024,6 +1024,9 @@ void brw_vs_emit(struct brw_vs_compile *c ) case OPCODE_ADD: brw_ADD(p, dst, args[0], args[1]); break; + case OPCODE_COS: + emit_math1(c, BRW_MATH_FUNCTION_COS, dst, args[0], BRW_MATH_PRECISION_FULL); + break; case OPCODE_DP3: brw_DP3(p, dst, args[0], args[1]); break; @@ -1089,6 +1092,9 @@ void brw_vs_emit(struct brw_vs_compile *c ) case OPCODE_SEQ: emit_seq(p, dst, args[0], args[1]); break; + case OPCODE_SIN: + emit_math1(c, BRW_MATH_FUNCTION_SIN, dst, args[0], BRW_MATH_PRECISION_FULL); + break; case OPCODE_SNE: emit_sne(p, dst, args[0], args[1]); break; @@ -1155,7 +1161,10 @@ void brw_vs_emit(struct brw_vs_compile *c ) case OPCODE_ENDSUB: break; default: - _mesa_printf("Unsupport opcode %d in vertex shader\n", inst->Opcode); + _mesa_printf("Unsupported opcode %i (%s) in vertex shader\n", + inst->Opcode, inst->Opcode < MAX_OPCODE ? + _mesa_opcode_string(inst->Opcode) : + "unknown"); break; } diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c index 24bf5567bd..6e66f54524 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_state.c @@ -34,7 +34,7 @@ #include "brw_context.h" #include "brw_state.h" #include "brw_defines.h" -#include "macros.h" +#include "main/macros.h" struct brw_vs_unit_key { unsigned int total_grf; diff --git a/src/mesa/drivers/dri/i965/brw_vs_tnl.c b/src/mesa/drivers/dri/i965/brw_vs_tnl.c index 2caa020e61..9b04f19112 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_tnl.c +++ b/src/mesa/drivers/dri/i965/brw_vs_tnl.c @@ -30,11 +30,12 @@ */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/prog_parameter.h" #include "shader/prog_print.h" +#include "shader/prog_statevars.h" #include "brw_vs.h" #include "brw_state.h" @@ -853,7 +854,7 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p, */ if (!p->state->unit[i].light_spotcutoff_is_180) { struct ureg spot_dir_norm = register_param3(p, STATE_INTERNAL, - STATE_SPOT_DIR_NORMALIZED, i); + STATE_LIGHT_SPOT_DIR_NORMALIZED, i); struct ureg spot = get_temp(p); struct ureg slt = get_temp(p); @@ -988,7 +989,7 @@ static void build_lighting( struct tnl_program *p ) * Attenuation never applies to infinite lights. */ VPpli = register_param3(p, STATE_LIGHT, i, - STATE_POSITION_NORMALIZED); + STATE_LIGHT_POSITION_NORMALIZED); if (p->state->light_local_viewer) { struct ureg eye_hat = get_eye_position_normalized(p); half = get_temp(p); diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 31e96a250a..2a03fc59f3 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -32,11 +32,11 @@ -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/colormac.h" #include "intel_batchbuffer.h" #include "intel_regions.h" @@ -97,8 +97,7 @@ static void brw_new_batch( struct intel_context *intel ) /* Check that we didn't just wrap our batchbuffer at a bad time. */ assert(!brw->no_batch_wrap); - dri_bo_unreference(brw->curbe.curbe_bo); - brw->curbe.curbe_bo = NULL; + brw->curbe.need_new_bo = GL_TRUE; /* Mark all context state as needing to be re-emitted. * This is probably not as severe as on 915, since almost all of our state diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 9b919b9cfe..58c78c4b2c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -30,7 +30,7 @@ */ -#include "macros.h" +#include "main/macros.h" #include "brw_context.h" #include "brw_wm.h" @@ -1302,8 +1302,10 @@ void brw_wm_emit( struct brw_wm_compile *c ) break; default: - _mesa_printf("unsupport opcode %d in fragment program\n", - inst->opcode); + _mesa_printf("Unsupported opcode %i (%s) in fragment shader\n", + inst->opcode, inst->opcode < MAX_OPCODE ? + _mesa_opcode_string(inst->opcode) : + "unknown"); } for (i = 0; i < 4; i++) diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index bc933fe7e4..d3e926c328 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -30,9 +30,9 @@ */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "brw_context.h" #include "brw_wm.h" #include "brw_util.h" diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 8dce40f25b..4d5e11f4b6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1,4 +1,4 @@ -#include "macros.h" +#include "main/macros.h" #include "shader/prog_parameter.h" #include "brw_context.h" #include "brw_eu.h" diff --git a/src/mesa/drivers/dri/i965/brw_wm_iz.c b/src/mesa/drivers/dri/i965/brw_wm_iz.c index ec2b976faa..0bb5d5ba83 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_iz.c +++ b/src/mesa/drivers/dri/i965/brw_wm_iz.c @@ -30,7 +30,7 @@ */ -#include "mtypes.h" +#include "main/mtypes.h" #include "brw_wm.h" diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index e47dbe8b10..e1db31ec08 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -34,7 +34,7 @@ #include "brw_state.h" #include "brw_defines.h" -#include "macros.h" +#include "main/macros.h" diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 8fcd50924f..47127c0421 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -30,9 +30,9 @@ */ -#include "mtypes.h" -#include "texformat.h" -#include "texstore.h" +#include "main/mtypes.h" +#include "main/texformat.h" +#include "main/texstore.h" #include "intel_mipmap_tree.h" #include "intel_batchbuffer.h" diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index bc3dd30b7e..f2db48272b 100644..120000 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -1,701 +1 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * 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 TUNGSTEN GRAPHICS 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. - * - **************************************************************************/ - -#include "glheader.h" -#include "context.h" -#include "framebuffer.h" -#include "matrix.h" -#include "renderbuffer.h" -#include "simple_list.h" -#include "utils.h" -#include "vblank.h" -#include "xmlpool.h" - - -#include "intel_screen.h" - -#include "intel_context.h" -#include "intel_tex.h" -#include "intel_span.h" -#include "intel_ioctl.h" - -#include "i830_dri.h" - -PUBLIC const char __driConfigOptions[] = -DRI_CONF_BEGIN - DRI_CONF_SECTION_PERFORMANCE - DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) - DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) - DRI_CONF_SECTION_END - DRI_CONF_SECTION_QUALITY - DRI_CONF_FORCE_S3TC_ENABLE(false) - DRI_CONF_ALLOW_LARGE_TEXTURES(1) - DRI_CONF_SECTION_END -DRI_CONF_END; -const GLuint __driNConfigOptions = 4; - -#ifdef USE_NEW_INTERFACE -static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; -#endif /*USE_NEW_INTERFACE*/ - -/** - * Map all the memory regions described by the screen. - * \return GL_TRUE if success, GL_FALSE if error. - */ -GLboolean -intelMapScreenRegions(__DRIscreenPrivate *sPriv) -{ - intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private; - - if (intelScreen->front.handle) { - if (drmMap(sPriv->fd, - intelScreen->front.handle, - intelScreen->front.size, - (drmAddress *)&intelScreen->front.map) != 0) { - _mesa_problem(NULL, "drmMap(frontbuffer) failed!"); - return GL_FALSE; - } - } else { - /* Use the old static allocation method if the server isn't setting up - * a movable handle for us. Add in the front buffer offset from - * framebuffer start, as our span routines (unlike other drivers) expect - * the renderbuffer address to point to the beginning of the - * renderbuffer. - */ - intelScreen->front.map = (char *)sPriv->pFB; - if (intelScreen->front.map == NULL) { - fprintf(stderr, "Failed to find framebuffer mapping\n"); - return GL_FALSE; - } - } - - if (drmMap(sPriv->fd, - intelScreen->back.handle, - intelScreen->back.size, - (drmAddress *)&intelScreen->back.map) != 0) { - intelUnmapScreenRegions(intelScreen); - return GL_FALSE; - } - - if (drmMap(sPriv->fd, - intelScreen->depth.handle, - intelScreen->depth.size, - (drmAddress *)&intelScreen->depth.map) != 0) { - intelUnmapScreenRegions(intelScreen); - return GL_FALSE; - } - - if (drmMap(sPriv->fd, - intelScreen->tex.handle, - intelScreen->tex.size, - (drmAddress *)&intelScreen->tex.map) != 0) { - intelUnmapScreenRegions(intelScreen); - return GL_FALSE; - } - - if (0) - printf("Mappings: front: %p back: %p depth: %p tex: %p\n", - intelScreen->front.map, - intelScreen->back.map, - intelScreen->depth.map, - intelScreen->tex.map); - return GL_TRUE; -} - - -void -intelUnmapScreenRegions(intelScreenPrivate *intelScreen) -{ -#define REALLY_UNMAP 1 - /* If front.handle is present, we're doing the dynamic front buffer mapping, - * but if we've fallen back to static allocation then we shouldn't try to - * unmap here. - */ - if (intelScreen->front.handle) { -#if REALLY_UNMAP - if (drmUnmap(intelScreen->front.map, intelScreen->front.size) != 0) - printf("drmUnmap front failed!\n"); -#endif - intelScreen->front.map = NULL; - } - if (intelScreen->back.map) { -#if REALLY_UNMAP - if (drmUnmap(intelScreen->back.map, intelScreen->back.size) != 0) - printf("drmUnmap back failed!\n"); -#endif - intelScreen->back.map = NULL; - } - if (intelScreen->depth.map) { -#if REALLY_UNMAP - drmUnmap(intelScreen->depth.map, intelScreen->depth.size); - intelScreen->depth.map = NULL; -#endif - } - if (intelScreen->tex.map) { -#if REALLY_UNMAP - drmUnmap(intelScreen->tex.map, intelScreen->tex.size); - intelScreen->tex.map = NULL; -#endif - } -} - - -static void -intelPrintDRIInfo(intelScreenPrivate *intelScreen, - __DRIscreenPrivate *sPriv, - I830DRIPtr gDRIPriv) -{ - fprintf(stderr, "*** Front size: 0x%x offset: 0x%x pitch: %d\n", - intelScreen->front.size, intelScreen->front.offset, - intelScreen->front.pitch); - fprintf(stderr, "*** Back size: 0x%x offset: 0x%x pitch: %d\n", - intelScreen->back.size, intelScreen->back.offset, - intelScreen->back.pitch); - fprintf(stderr, "*** Depth size: 0x%x offset: 0x%x pitch: %d\n", - intelScreen->depth.size, intelScreen->depth.offset, - intelScreen->depth.pitch); - fprintf(stderr, "*** Rotated size: 0x%x offset: 0x%x pitch: %d\n", - intelScreen->rotated.size, intelScreen->rotated.offset, - intelScreen->rotated.pitch); - fprintf(stderr, "*** Texture size: 0x%x offset: 0x%x\n", - intelScreen->tex.size, intelScreen->tex.offset); - fprintf(stderr, "*** Memory : 0x%x\n", gDRIPriv->mem); -} - - -static void -intelPrintSAREA(volatile drmI830Sarea *sarea) -{ - fprintf(stderr, "SAREA: sarea width %d height %d\n", sarea->width, sarea->height); - fprintf(stderr, "SAREA: pitch: %d\n", sarea->pitch); - fprintf(stderr, - "SAREA: front offset: 0x%08x size: 0x%x handle: 0x%x\n", - sarea->front_offset, sarea->front_size, - (unsigned) sarea->front_handle); - fprintf(stderr, - "SAREA: back offset: 0x%08x size: 0x%x handle: 0x%x\n", - sarea->back_offset, sarea->back_size, - (unsigned) sarea->back_handle); - fprintf(stderr, "SAREA: depth offset: 0x%08x size: 0x%x handle: 0x%x\n", - sarea->depth_offset, sarea->depth_size, - (unsigned) sarea->depth_handle); - fprintf(stderr, "SAREA: tex offset: 0x%08x size: 0x%x handle: 0x%x\n", - sarea->tex_offset, sarea->tex_size, - (unsigned) sarea->tex_handle); - fprintf(stderr, "SAREA: rotation: %d\n", sarea->rotation); - fprintf(stderr, - "SAREA: rotated offset: 0x%08x size: 0x%x\n", - sarea->rotated_offset, sarea->rotated_size); - fprintf(stderr, "SAREA: rotated pitch: %d\n", sarea->rotated_pitch); -} - - -/** - * A number of the screen parameters are obtained/computed from - * information in the SAREA. This function updates those parameters. - */ -void -intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, - volatile drmI830Sarea *sarea) -{ - intelScreen->width = sarea->width; - intelScreen->height = sarea->height; - - intelScreen->front.offset = sarea->front_offset; - intelScreen->front.pitch = sarea->pitch * intelScreen->cpp; - intelScreen->front.handle = sarea->front_handle; - intelScreen->front.size = sarea->front_size; - intelScreen->front.tiled = sarea->front_tiled; - - intelScreen->back.offset = sarea->back_offset; - intelScreen->back.pitch = sarea->pitch * intelScreen->cpp; - intelScreen->back.handle = sarea->back_handle; - intelScreen->back.size = sarea->back_size; - intelScreen->back.tiled = sarea->back_tiled; - - intelScreen->depth.offset = sarea->depth_offset; - intelScreen->depth.pitch = sarea->pitch * intelScreen->cpp; - intelScreen->depth.handle = sarea->depth_handle; - intelScreen->depth.size = sarea->depth_size; - intelScreen->depth.tiled = sarea->depth_tiled; - - intelScreen->tex.offset = sarea->tex_offset; - intelScreen->logTextureGranularity = sarea->log_tex_granularity; - intelScreen->tex.handle = sarea->tex_handle; - intelScreen->tex.size = sarea->tex_size; - - intelScreen->rotated.offset = sarea->rotated_offset; - intelScreen->rotated.pitch = sarea->rotated_pitch * intelScreen->cpp; - intelScreen->rotated.size = sarea->rotated_size; - intelScreen->rotated.tiled = sarea->rotated_tiled; - intelScreen->current_rotation = sarea->rotation; -#if 0 - matrix23Rotate(&intelScreen->rotMatrix, - sarea->width, sarea->height, sarea->rotation); -#endif - intelScreen->rotatedWidth = sarea->virtualX; - intelScreen->rotatedHeight = sarea->virtualY; - - if (0) - intelPrintSAREA(sarea); -} - - -static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) -{ - intelScreenPrivate *intelScreen; - I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; - volatile drmI830Sarea *sarea; - - if (sPriv->devPrivSize != sizeof(I830DRIRec)) { - fprintf(stderr,"\nERROR! sizeof(I830DRIRec) (%ld) does not match passed size from device driver (%d)\n", (unsigned long)sizeof(I830DRIRec), sPriv->devPrivSize); - return GL_FALSE; - } - - /* Allocate the private area */ - intelScreen = (intelScreenPrivate *)CALLOC(sizeof(intelScreenPrivate)); - if (!intelScreen) { - fprintf(stderr,"\nERROR! Allocating private area failed\n"); - return GL_FALSE; - } - /* parse information in __driConfigOptions */ - driParseOptionInfo (&intelScreen->optionCache, - __driConfigOptions, __driNConfigOptions); - - intelScreen->driScrnPriv = sPriv; - sPriv->private = (void *)intelScreen; - intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset; - sarea = (volatile drmI830Sarea *) - (((GLubyte *)sPriv->pSAREA)+intelScreen->sarea_priv_offset); - - intelScreen->deviceID = gDRIPriv->deviceID; - intelScreen->mem = gDRIPriv->mem; - intelScreen->cpp = gDRIPriv->cpp; - - switch (gDRIPriv->bitsPerPixel) { - case 15: intelScreen->fbFormat = DV_PF_555; break; - case 16: intelScreen->fbFormat = DV_PF_565; break; - case 32: intelScreen->fbFormat = DV_PF_8888; break; - } - - intelUpdateScreenFromSAREA(intelScreen, sarea); - - if (0) - intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv); - - if (!intelMapScreenRegions(sPriv)) { - fprintf(stderr,"\nERROR! mapping regions\n"); - _mesa_free(intelScreen); - sPriv->private = NULL; - return GL_FALSE; - } - - intelScreen->drmMinor = sPriv->drmMinor; - - /* Determine if IRQs are active? */ - { - int ret; - drmI830GetParam gp; - - gp.param = I830_PARAM_IRQ_ACTIVE; - gp.value = &intelScreen->irq_active; - - ret = drmCommandWriteRead( sPriv->fd, DRM_I830_GETPARAM, - &gp, sizeof(gp)); - if (ret) { - fprintf(stderr, "drmI830GetParam: %d\n", ret); - return GL_FALSE; - } - } - - /* Determine if batchbuffers are allowed */ - { - int ret; - drmI830GetParam gp; - - gp.param = I830_PARAM_ALLOW_BATCHBUFFER; - gp.value = &intelScreen->allow_batchbuffer; - - ret = drmCommandWriteRead( sPriv->fd, DRM_I830_GETPARAM, - &gp, sizeof(gp)); - if (ret) { - fprintf(stderr, "drmI830GetParam: (%d) %d\n", gp.param, ret); - return GL_FALSE; - } - } - - if (glx_enable_extension != NULL) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); - (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" ); - } - - return GL_TRUE; -} - - -static void intelDestroyScreen(__DRIscreenPrivate *sPriv) -{ - intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private; - - intelUnmapScreenRegions(intelScreen); - FREE(intelScreen); - sPriv->private = NULL; -} - -static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv, - __DRIdrawablePrivate *driDrawPriv, - const __GLcontextModes *mesaVis, - GLboolean isPixmap ) -{ - intelScreenPrivate *screen = (intelScreenPrivate *) driScrnPriv->private; - - if (isPixmap) { - return GL_FALSE; /* not implemented */ - } else { - GLboolean swStencil = (mesaVis->stencilBits > 0 && - mesaVis->depthBits != 24); - - struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); - - { - driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, - screen->front.map, - screen->cpp, - screen->front.offset, screen->front.pitch, - driDrawPriv); - intelSetSpanFunctions(frontRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); - } - - if (mesaVis->doubleBufferMode) { - driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, - screen->back.map, - screen->cpp, - screen->back.offset, screen->back.pitch, - driDrawPriv); - intelSetSpanFunctions(backRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); - } - - if (mesaVis->depthBits == 16) { - driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, - screen->depth.map, - screen->cpp, - screen->depth.offset, screen->depth.pitch, - driDrawPriv); - intelSetSpanFunctions(depthRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - else if (mesaVis->depthBits == 24) { - driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, - screen->depth.map, - screen->cpp, - screen->depth.offset, screen->depth.pitch, - driDrawPriv); - intelSetSpanFunctions(depthRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - - if (mesaVis->stencilBits > 0 && !swStencil) { - driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, - screen->depth.map, - screen->cpp, - screen->depth.offset, screen->depth.pitch, - driDrawPriv); - intelSetSpanFunctions(stencilRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); - } - - _mesa_add_soft_renderbuffers(fb, - GL_FALSE, /* color */ - GL_FALSE, /* depth */ - swStencil, - mesaVis->accumRedBits > 0, - GL_FALSE, /* alpha */ - GL_FALSE /* aux */); - driDrawPriv->driverPrivate = (void *) fb; - - return (driDrawPriv->driverPrivate != NULL); - } -} - -static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) -{ - _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); -} - - -/** - * Get information about previous buffer swaps. - */ -static int -intelGetSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ) -{ - struct intel_context *intel; - - if ( (dPriv == NULL) || (dPriv->driContextPriv == NULL) - || (dPriv->driContextPriv->driverPrivate == NULL) - || (sInfo == NULL) ) { - return -1; - } - - intel = dPriv->driContextPriv->driverPrivate; - sInfo->swap_count = intel->swap_count; - sInfo->swap_ust = intel->swap_ust; - sInfo->swap_missed_count = intel->swap_missed_count; - - sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0) - ? driCalculateSwapUsage( dPriv, 0, intel->swap_missed_ust ) - : 0.0; - - return 0; -} - - -/* There are probably better ways to do this, such as an - * init-designated function to register chipids and createcontext - * functions. - */ -extern GLboolean i830CreateContext( const __GLcontextModes *mesaVis, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate); - -extern GLboolean i915CreateContext( const __GLcontextModes *mesaVis, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate); - -extern GLboolean brwCreateContext( const __GLcontextModes *mesaVis, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate); - - - - -static GLboolean intelCreateContext( const __GLcontextModes *mesaVis, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate) -{ -#if 0 - __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private; - switch (intelScreen->deviceID) { - case PCI_CHIP_845_G: - case PCI_CHIP_I830_M: - case PCI_CHIP_I855_GM: - case PCI_CHIP_I865_G: - return i830CreateContext( mesaVis, driContextPriv, - sharedContextPrivate ); - - case PCI_CHIP_I915_G: - case PCI_CHIP_I915_GM: - case PCI_CHIP_I945_G: - case PCI_CHIP_I945_GM: - return i915CreateContext( mesaVis, driContextPriv, - sharedContextPrivate ); - - default: - fprintf(stderr, "Unrecognized deviceID %x\n", intelScreen->deviceID); - return GL_FALSE; - } -#else - return brwCreateContext( mesaVis, driContextPriv, - sharedContextPrivate ); -#endif -} - - -static const struct __DriverAPIRec intelAPI = { - .InitDriver = intelInitDriver, - .DestroyScreen = intelDestroyScreen, - .CreateContext = intelCreateContext, - .DestroyContext = intelDestroyContext, - .CreateBuffer = intelCreateBuffer, - .DestroyBuffer = intelDestroyBuffer, - .SwapBuffers = intelSwapBuffers, - .MakeCurrent = intelMakeCurrent, - .UnbindContext = intelUnbindContext, - .GetSwapInfo = intelGetSwapInfo, - .GetMSC = driGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL, - .CopySubBuffer = intelCopySubBuffer -}; - - -static __GLcontextModes * -intelFillInModes( unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer ) -{ - __GLcontextModes * modes; - __GLcontextModes * m; - unsigned num_modes; - unsigned depth_buffer_factor; - unsigned back_buffer_factor; - GLenum fb_format; - GLenum fb_type; - - /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't - * support pageflipping at all. - */ - static const GLenum back_buffer_modes[] = { - GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML - }; - - uint8_t depth_bits_array[3]; - uint8_t stencil_bits_array[3]; - - - depth_bits_array[0] = 0; - depth_bits_array[1] = depth_bits; - depth_bits_array[2] = depth_bits; - - /* Just like with the accumulation buffer, always provide some modes - * with a stencil buffer. It will be a sw fallback, but some apps won't - * care about that. - */ - stencil_bits_array[0] = 0; - stencil_bits_array[1] = 0; - stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits; - - depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1; - back_buffer_factor = (have_back_buffer) ? 3 : 1; - - num_modes = depth_buffer_factor * back_buffer_factor * 4; - - if ( pixel_bits == 16 ) { - fb_format = GL_RGB; - fb_type = GL_UNSIGNED_SHORT_5_6_5; - } - else { - fb_format = GL_BGRA; - fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; - } - - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); - m = modes; - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_TRUE_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - GLX_DIRECT_COLOR ) ) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - - /* Mark the visual as slow if there are "fake" stencil bits. - */ - for ( m = modes ; m != NULL ; m = m->next ) { - if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) { - m->visualRating = GLX_SLOW_CONFIG; - } - } - - return modes; -} - - -/** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. - * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. - */ -PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) - -{ - __DRIscreenPrivate *psp; - static const __DRIversion ddx_expected = { 1, 6, 0 }; - static const __DRIversion dri_expected = { 4, 0, 0 }; - static const __DRIversion drm_expected = { 1, 3, 0 }; - - dri_interface = interface; - - if ( ! driCheckDriDdxDrmVersions2( "i915", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { - return NULL; - } - - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &intelAPI); - if ( psp != NULL ) { - I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - *driver_modes = intelFillInModes( dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - GL_TRUE ); - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - intelInitExtensions(NULL, GL_FALSE); - } - - return (void *) psp; -} +../intel/intel_screen.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/i965/intel_state.c b/src/mesa/drivers/dri/i965/intel_state.c index 0fba5a771c..67ef5f78c1 100644 --- a/src/mesa/drivers/dri/i965/intel_state.c +++ b/src/mesa/drivers/dri/i965/intel_state.c @@ -26,12 +26,12 @@ **************************************************************************/ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "enums.h" -#include "colormac.h" -#include "dd.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/enums.h" +#include "main/colormac.h" +#include "main/dd.h" #include "intel_screen.h" #include "intel_context.h" diff --git a/src/mesa/drivers/dri/i965/server/i830_common.h b/src/mesa/drivers/dri/i965/server/i830_common.h deleted file mode 100644 index 49eb145f8b..0000000000 --- a/src/mesa/drivers/dri/i965/server/i830_common.h +++ /dev/null @@ -1,221 +0,0 @@ -/************************************************************************** - -Copyright 2001 VA Linux Systems Inc., Fremont, California. -Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. - -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 -on 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 -ATI, VA LINUX SYSTEMS AND/OR THEIR 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 _I830_COMMON_H_ -#define _I830_COMMON_H_ - - -#define I830_NR_TEX_REGIONS 255 /* maximum due to use of chars for next/prev */ -#define I830_LOG_MIN_TEX_REGION_SIZE 14 - - -/* Driver specific DRM command indices - * NOTE: these are not OS specific, but they are driver specific - */ -#define DRM_I830_INIT 0x00 -#define DRM_I830_FLUSH 0x01 -#define DRM_I830_FLIP 0x02 -#define DRM_I830_BATCHBUFFER 0x03 -#define DRM_I830_IRQ_EMIT 0x04 -#define DRM_I830_IRQ_WAIT 0x05 -#define DRM_I830_GETPARAM 0x06 -#define DRM_I830_SETPARAM 0x07 -#define DRM_I830_ALLOC 0x08 -#define DRM_I830_FREE 0x09 -#define DRM_I830_INIT_HEAP 0x0a -#define DRM_I830_CMDBUFFER 0x0b -#define DRM_I830_DESTROY_HEAP 0x0c -#define DRM_I830_MMIO 0x10 - -typedef struct { - enum { - I830_INIT_DMA = 0x01, - I830_CLEANUP_DMA = 0x02, - I830_RESUME_DMA = 0x03 - } func; - unsigned int mmio_offset; - int sarea_priv_offset; - unsigned int ring_start; - unsigned int ring_end; - unsigned int ring_size; - unsigned int front_offset; - unsigned int back_offset; - unsigned int depth_offset; - unsigned int w; - unsigned int h; - unsigned int pitch; - unsigned int pitch_bits; - unsigned int back_pitch; - unsigned int depth_pitch; - unsigned int cpp; - unsigned int chipset; -} drmI830Init; - -typedef struct { - drmTextureRegion texList[I830_NR_TEX_REGIONS+1]; - int last_upload; /* last time texture was uploaded */ - int last_enqueue; /* last time a buffer was enqueued */ - volatile int last_dispatch; /* age of the most recently dispatched buffer */ - int ctxOwner; /* last context to upload state */ - int texAge; - int pf_enabled; /* is pageflipping allowed? */ - int pf_active; - int pf_current_page; /* which buffer is being displayed? */ - int perf_boxes; /* performance boxes to be displayed */ - int width, height; /* screen size in pixels */ - - drm_handle_t front_handle; - int front_offset; - int front_size; - - drm_handle_t back_handle; - int back_offset; - int back_size; - - drm_handle_t depth_handle; - int depth_offset; - int depth_size; - - drm_handle_t tex_handle; - int tex_offset; - int tex_size; - int log_tex_granularity; - int pitch; - int rotation; /* 0, 90, 180 or 270 */ - int rotated_offset; - int rotated_size; - int rotated_pitch; - int virtualX, virtualY; - - unsigned int front_tiled; - unsigned int back_tiled; - unsigned int depth_tiled; - unsigned int rotated_tiled; - unsigned int rotated2_tiled; -} drmI830Sarea; - -/* Flags for perf_boxes - */ -#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */ -#define I830_BOX_FLIP 0x2 /* populated by kernel */ -#define I830_BOX_WAIT 0x4 /* populated by kernel & client */ -#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */ -#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */ - - -typedef struct { - int start; /* agp offset */ - int used; /* nr bytes in use */ - int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ - int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/ - int num_cliprects; /* mulitpass with multiple cliprects? */ - drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */ -} drmI830BatchBuffer; - -typedef struct { - char *buf; /* agp offset */ - int sz; /* nr bytes in use */ - int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ - int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/ - int num_cliprects; /* mulitpass with multiple cliprects? */ - drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */ -} drmI830CmdBuffer; - -typedef struct { - int *irq_seq; -} drmI830IrqEmit; - -typedef struct { - int irq_seq; -} drmI830IrqWait; - -typedef struct { - int param; - int *value; -} drmI830GetParam; - -#define I830_PARAM_IRQ_ACTIVE 1 -#define I830_PARAM_ALLOW_BATCHBUFFER 2 - -typedef struct { - int param; - int value; -} drmI830SetParam; - -#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1 -#define I830_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 -#define I830_SETPARAM_ALLOW_BATCHBUFFER 3 - - -/* A memory manager for regions of shared memory: - */ -#define I830_MEM_REGION_AGP 1 - -typedef struct { - int region; - int alignment; - int size; - int *region_offset; /* offset from start of fb or agp */ -} drmI830MemAlloc; - -typedef struct { - int region; - int region_offset; -} drmI830MemFree; - -typedef struct { - int region; - int size; - int start; -} drmI830MemInitHeap; - -typedef struct { - int region; -} drmI830MemDestroyHeap; - -#define MMIO_READ 0 -#define MMIO_WRITE 1 - -#define MMIO_REGS_IA_PRIMATIVES_COUNT 0 -#define MMIO_REGS_IA_VERTICES_COUNT 1 -#define MMIO_REGS_VS_INVOCATION_COUNT 2 -#define MMIO_REGS_GS_PRIMITIVES_COUNT 3 -#define MMIO_REGS_GS_INVOCATION_COUNT 4 -#define MMIO_REGS_CL_PRIMITIVES_COUNT 5 -#define MMIO_REGS_CL_INVOCATION_COUNT 6 -#define MMIO_REGS_PS_INVOCATION_COUNT 7 -#define MMIO_REGS_PS_DEPTH_COUNT 8 - -typedef struct { - unsigned int read_write:1; - unsigned int reg:31; - void __user *data; -} drmI830MMIO; - -#endif /* _I830_DRM_H_ */ diff --git a/src/mesa/drivers/dri/i965/server/i830_dri.h b/src/mesa/drivers/dri/i965/server/i830_dri.h deleted file mode 100644 index 68213f69f5..0000000000 --- a/src/mesa/drivers/dri/i965/server/i830_dri.h +++ /dev/null @@ -1,62 +0,0 @@ - -#ifndef _I830_DRI_H -#define _I830_DRI_H - -#include "xf86drm.h" -#include "i830_common.h" - -#define I830_MAX_DRAWABLES 256 - -#define I830_MAJOR_VERSION 1 -#define I830_MINOR_VERSION 3 -#define I830_PATCHLEVEL 0 - -#define I830_REG_SIZE 0x80000 - -typedef struct _I830DRIRec { - drm_handle_t regs; - drmSize regsSize; - - drmSize unused1; /* backbufferSize */ - drm_handle_t unused2; /* backbuffer */ - - drmSize unused3; /* depthbufferSize */ - drm_handle_t unused4; /* depthbuffer */ - - drmSize unused5; /* rotatedSize /*/ - drm_handle_t unused6; /* rotatedbuffer */ - - drm_handle_t unused7; /* textures */ - int unused8; /* textureSize */ - - drm_handle_t unused9; /* agp_buffers */ - drmSize unused10; /* agp_buf_size */ - - int deviceID; - int width; - int height; - int mem; - int cpp; - int bitsPerPixel; - - int unused11[8]; /* was front/back/depth/rotated offset/pitch */ - - int unused12; /* logTextureGranularity */ - int unused13; /* textureOffset */ - - int irq; - int sarea_priv_offset; -} I830DRIRec, *I830DRIPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} I830ConfigPrivRec, *I830ConfigPrivPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} I830DRIContextRec, *I830DRIContextPtr; - - -#endif diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index cf7d4a0633..1f8096b32e 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h @@ -1,7 +1,7 @@ #ifndef INTEL_BATCHBUFFER_H #define INTEL_BATCHBUFFER_H -#include "mtypes.h" +#include "main/mtypes.h" #include "intel_context.h" #include "intel_bufmgr.h" diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 653f485dd0..2917401e02 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -29,9 +29,9 @@ #include <stdio.h> #include <errno.h> -#include "mtypes.h" -#include "context.h" -#include "enums.h" +#include "main/mtypes.h" +#include "main/context.h" +#include "main/enums.h" #include "intel_blit.h" #include "intel_buffers.h" diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 88484a07af..60d7bb3770 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -26,9 +26,9 @@ **************************************************************************/ -#include "imports.h" -#include "mtypes.h" -#include "bufferobj.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/bufferobj.h" #include "intel_context.h" #include "intel_buffer_objects.h" diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.h b/src/mesa/drivers/dri/intel/intel_buffer_objects.h index 7cecc3232d..bf6dbd58f2 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.h +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.h @@ -28,7 +28,7 @@ #ifndef INTEL_BUFFEROBJ_H #define INTEL_BUFFEROBJ_H -#include "mtypes.h" +#include "main/mtypes.h" struct intel_context; struct intel_region; diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 3fe67462d5..defa5b173d 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -35,11 +35,11 @@ #include "intel_regions.h" #include "intel_batchbuffer.h" #include "intel_reg.h" -#include "context.h" +#include "main/context.h" +#include "main/framebuffer.h" +#include "swrast/swrast.h" #include "utils.h" #include "drirenderbuffer.h" -#include "framebuffer.h" -#include "swrast/swrast.h" #include "vblank.h" #include "i915_drm.h" diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h index 15b9ef4312..170efd060a 100644 --- a/src/mesa/drivers/dri/intel/intel_chipset.h +++ b/src/mesa/drivers/dri/intel/intel_chipset.h @@ -58,6 +58,7 @@ #define PCI_CHIP_IGD_E_G 0x2E02 #define PCI_CHIP_Q45_G 0x2E12 #define PCI_CHIP_G45_G 0x2E22 +#define PCI_CHIP_G41_G 0x2E32 #define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \ devid == PCI_CHIP_I915_GM || \ @@ -70,7 +71,8 @@ #define IS_GM45_GM(devid) (devid == PCI_CHIP_GM45_GM) #define IS_G4X(devid) (devid == PCI_CHIP_IGD_E_G || \ devid == PCI_CHIP_Q45_G || \ - devid == PCI_CHIP_G45_G) + devid == PCI_CHIP_G45_G || \ + devid == PCI_CHIP_G41_G) #define IS_915(devid) (devid == PCI_CHIP_I915_G || \ devid == PCI_CHIP_E7221_G || \ diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 4d1a742698..57e574447a 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -26,14 +26,14 @@ **************************************************************************/ -#include "glheader.h" -#include "context.h" -#include "matrix.h" -#include "simple_list.h" -#include "extensions.h" -#include "framebuffer.h" -#include "imports.h" -#include "points.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/matrix.h" +#include "main/simple_list.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/imports.h" +#include "main/points.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -179,6 +179,9 @@ intelGetString(GLcontext * ctx, GLenum name) case PCI_CHIP_Q45_G: chipset = "Intel(R) Q45/Q43"; break; + case PCI_CHIP_G41_G: + chipset = "Intel(R) G41"; + break; default: chipset = "Unknown Intel Chipset"; break; @@ -230,6 +233,9 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) &count, drawable->loaderPrivate); + if (buffers == NULL) + return; + drawable->x = 0; drawable->y = 0; drawable->backX = 0; @@ -295,8 +301,9 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) } else region = intel_region_alloc_for_handle(intel, buffers[i].cpp, - buffers[i].pitch / buffers[i].cpp, + drawable->w, drawable->h, + buffers[i].pitch / buffers[i].cpp, buffers[i].name, region_name); @@ -543,7 +550,7 @@ intelFinish(GLcontext * ctx) #ifdef I915_MMIO_READ static void -intelBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q) +intelBeginQuery(GLcontext *ctx, struct gl_query_object *q) { struct intel_context *intel = intel_context( ctx ); struct drm_i915_mmio io = { @@ -557,7 +564,7 @@ intelBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q) } static void -intelEndQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q) +intelEndQuery(GLcontext *ctx, struct gl_query_object *q) { struct intel_context *intel = intel_context( ctx ); GLuint64EXT tmp; @@ -815,8 +822,6 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) /* free the Mesa context */ _mesa_free_context_data(&intel->ctx); - - dri_bufmgr_destroy(intel->bufmgr); } } diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 8bd75753ea..4af4cb9c96 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -30,10 +30,10 @@ -#include "mtypes.h" -#include "drm.h" -#include "mm.h" +#include "main/mtypes.h" +#include "main/mm.h" #include "texmem.h" +#include "drm.h" #include "intel_bufmgr.h" #include "intel_screen.h" diff --git a/src/mesa/drivers/dri/intel/intel_depthstencil.c b/src/mesa/drivers/dri/intel/intel_depthstencil.c index 70ba68e9e3..c2b4d7728b 100644 --- a/src/mesa/drivers/dri/intel/intel_depthstencil.c +++ b/src/mesa/drivers/dri/intel/intel_depthstencil.c @@ -25,15 +25,15 @@ * **************************************************************************/ -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "depthstencil.h" -#include "fbobject.h" -#include "framebuffer.h" -#include "hash.h" -#include "mtypes.h" -#include "renderbuffer.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/depthstencil.h" +#include "main/fbobject.h" +#include "main/framebuffer.h" +#include "main/hash.h" +#include "main/mtypes.h" +#include "main/renderbuffer.h" #include "intel_context.h" #include "intel_fbo.h" diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 5bd2ebfdcf..fce5e36b9d 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -26,14 +26,14 @@ **************************************************************************/ -#include "imports.h" -#include "mtypes.h" -#include "fbobject.h" -#include "framebuffer.h" -#include "renderbuffer.h" -#include "context.h" -#include "texformat.h" -#include "texrender.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/fbobject.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" +#include "main/context.h" +#include "main/texformat.h" +#include "main/texrender.h" #include "intel_context.h" #include "intel_buffers.h" @@ -296,7 +296,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width, height, pitch); - irb->region = intel_region_alloc(intel, cpp, pitch, height); + irb->region = intel_region_alloc(intel, cpp, width, height, pitch); if (!irb->region) return GL_FALSE; /* out of memory? */ @@ -540,7 +540,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, irb->Base._ActualFormat = GL_DEPTH_COMPONENT16; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; DBG("Render to DEPTH16 texture OK\n"); - } else if (texImage->TexFormat == &_mesa_texformat_z24_s8) { + } else if (texImage->TexFormat == &_mesa_texformat_s8_z24) { irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT; DBG("Render to DEPTH_STENCIL texture OK\n"); diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 9be7e02eff..b96ba72853 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -29,7 +29,7 @@ #include "intel_mipmap_tree.h" #include "intel_regions.h" #include "intel_chipset.h" -#include "enums.h" +#include "main/enums.h" #define FILE_DEBUG_FLAG DEBUG_MIPTREE @@ -117,7 +117,10 @@ intel_miptree_create(struct intel_context *intel, return NULL; mt->region = intel_region_alloc(intel, - mt->cpp, mt->pitch, mt->total_height); + mt->cpp, + mt->pitch, + mt->total_height, + mt->pitch); if (!mt->region) { free(mt); @@ -141,7 +144,7 @@ intel_miptree_create_for_region(struct intel_context *intel, mt = intel_miptree_create_internal(intel, target, internal_format, first_level, last_level, - region->pitch, region->height, depth0, + region->width, region->height, 1, region->cpp, compress_byte); if (!mt) return mt; diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index 6417866b20..f39fac13cf 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -25,8 +25,8 @@ * **************************************************************************/ -#include "enums.h" -#include "state.h" +#include "main/enums.h" +#include "main/state.h" #include "swrast/swrast.h" #include "intel_context.h" diff --git a/src/mesa/drivers/dri/intel/intel_pixel.h b/src/mesa/drivers/dri/intel/intel_pixel.h index 9c899b954c..6fa6effe83 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.h +++ b/src/mesa/drivers/dri/intel/intel_pixel.h @@ -28,7 +28,7 @@ #ifndef INTEL_PIXEL_H #define INTEL_PIXEL_H -#include "mtypes.h" +#include "main/mtypes.h" void intelInitPixelFuncs(struct dd_function_table *functions); diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index daa6d4be17..8963519893 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -25,13 +25,13 @@ * **************************************************************************/ -#include "glheader.h" -#include "enums.h" -#include "image.h" -#include "colormac.h" -#include "mtypes.h" -#include "macros.h" -#include "bufferobj.h" +#include "main/glheader.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/colormac.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/bufferobj.h" #include "swrast/swrast.h" #include "intel_screen.h" diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index 1c72d6179d..1b3cb5adcb 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -25,12 +25,12 @@ * **************************************************************************/ -#include "glheader.h" -#include "enums.h" -#include "image.h" -#include "state.h" -#include "mtypes.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/state.h" +#include "main/mtypes.h" +#include "main/macros.h" #include "swrast/swrast.h" #include "intel_screen.h" @@ -135,10 +135,20 @@ do_texture_copypixels(GLcontext * ctx, srcbox.x2 = srcx + width; srcbox.y2 = srcy + height; - dstbox.x1 = dstx; - dstbox.y1 = dsty; - dstbox.x2 = dstx + width * ctx->Pixel.ZoomX; - dstbox.y2 = dsty + height * ctx->Pixel.ZoomY; + if (ctx->Pixel.ZoomX > 0) { + dstbox.x1 = dstx; + dstbox.x2 = dstx + width * ctx->Pixel.ZoomX; + } else { + dstbox.x1 = dstx + width * ctx->Pixel.ZoomX; + dstbox.x2 = dstx; + } + if (ctx->Pixel.ZoomY > 0) { + dstbox.y1 = dsty; + dstbox.y2 = dsty + height * ctx->Pixel.ZoomY; + } else { + dstbox.y1 = dsty + height * ctx->Pixel.ZoomY; + dstbox.y2 = dsty; + } DBG("src %d,%d %d,%d\n", srcbox.x1, srcbox.y1, srcbox.x2, srcbox.y2); DBG("dst %d,%d %d,%d (%dx%d) (%f,%f)\n", dstbox.x1, dstbox.y1, dstbox.x2, dstbox.y2, diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index 47460da9aa..be213e7b96 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -25,12 +25,22 @@ * **************************************************************************/ -#include "glheader.h" -#include "enums.h" -#include "image.h" -#include "mtypes.h" -#include "macros.h" -#include "bufferobj.h" +#include "main/glheader.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/bufferobj.h" +#include "main/teximage.h" +#include "main/texenv.h" +#include "main/texobj.h" +#include "main/texstate.h" +#include "main/texparam.h" +#include "main/matrix.h" +#include "main/varray.h" +#include "main/attrib.h" +#include "main/enable.h" +#include "glapi/dispatch.h" #include "swrast/swrast.h" #include "intel_screen.h" @@ -44,294 +54,123 @@ #include "intel_tris.h" - static GLboolean -do_texture_drawpixels(GLcontext * ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid * pixels) +intel_texture_drawpixels(GLcontext * ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, + GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels) { - struct intel_context *intel = intel_context(ctx); - struct intel_region *dst = intel_drawbuf_region(intel); - struct intel_buffer_object *src = intel_buffer_object(unpack->BufferObj); - GLuint rowLength = unpack->RowLength ? unpack->RowLength : width; - GLuint src_offset; - - if (INTEL_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s\n", __FUNCTION__); - - intelFlush(&intel->ctx); - - if (!dst) - return GL_FALSE; - - intel->vtbl.render_start(intel); - intel->vtbl.emit_state(intel); - - if (src) { - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels"); - return GL_TRUE; - } - } - else { - /* PBO only for now: - */ - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - not PBO\n", __FUNCTION__); - return GL_FALSE; - } + GLuint texname; + GLfloat vertices[4][4]; + GLfloat texcoords[4][2]; - /* There are a couple of things we can't do yet, one of which is - * set the correct state for pixel operations when GL texturing is - * enabled. That's a pretty rare state and probably not worth the - * effort. A completely device-independent version of this may do - * more. - * - * Similarly, we make no attempt to merge metaops processing with - * an enabled fragment program, though it would certainly be - * possible. + /* We're going to mess with texturing with no regard to existing texture + * state, so if there is some set up we have to bail. */ - if (!intel_check_meta_tex_fragment_ops(ctx)) { - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - bad GL fragment state for metaops texture\n", - __FUNCTION__); + if (ctx->Texture._EnabledUnits != 0) return GL_FALSE; - } - intel->vtbl.install_meta_state(intel); - - - /* Is this true? Also will need to turn depth testing on according - * to state: + /* Can't do textured DrawPixels with a fragment program, unless we were + * to generate a new program that sampled our texture and put the results + * in the fragment color before the user's program started. */ - intel->vtbl.meta_no_stencil_write(intel); - intel->vtbl.meta_no_depth_write(intel); - - /* Set the 3d engine to draw into the destination region: - */ - intel->vtbl.meta_draw_region(intel, dst, intel->depth_region); - - intel->vtbl.meta_import_pixel_state(intel); - - src_offset = (GLuint) _mesa_image_address(2, unpack, pixels, width, height, - format, type, 0, 0, 0); - - - /* Setup the pbo up as a rectangular texture, if possible. - * - * TODO: This is almost always possible if the i915 fragment - * program is adjusted to correctly swizzle the sampled colors. - * The major exception is any 24bit texture, like RGB888, for which - * there is no hardware support. - */ - if (!intel->vtbl.meta_tex_rect_source(intel, src->buffer, src_offset, - rowLength, height, format, type)) { - intel->vtbl.leave_meta_state(intel); - return GL_FALSE; - } - - intel->vtbl.meta_texture_blend_replace(intel); - - - LOCK_HARDWARE(intel); - - if (intel->driDrawable->numClipRects) { - __DRIdrawablePrivate *dPriv = intel->driDrawable; - GLint srcx, srcy; - GLint dstx, dsty; - - dstx = x; - dsty = dPriv->h - (y + height); - - srcx = 0; /* skiprows/pixels already done */ - srcy = 0; - - if (0) { - const GLint orig_x = dstx; - const GLint orig_y = dsty; - - if (!_mesa_clip_to_region(0, 0, dst->pitch, dst->height, - &dstx, &dsty, &width, &height)) - goto out; - - srcx += dstx - orig_x; - srcy += dsty - orig_y; - } - - - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("draw %d,%d %dx%d\n", dstx, dsty, width, height); - - /* Must use the regular cliprect mechanism in order to get the - * drawing origin set correctly. Otherwise scissor state is in - * incorrect coordinate space. Does this even need to hold the - * lock??? - */ - intel->vtbl.meta_draw_quad(intel, - dstx, dstx + width * ctx->Pixel.ZoomX, - dPriv->h - (y + height * ctx->Pixel.ZoomY), - dPriv->h - (y), - -ctx->Current.RasterPos[2] * .5, - 0x00ff00ff, - srcx, srcx + width, srcy + height, srcy); - out: - intel->vtbl.leave_meta_state(intel); - intel_batchbuffer_emit_mi_flush(intel->batch); - } - UNLOCK_HARDWARE(intel); - return GL_TRUE; -} - - - - - -/* Pros: - * - no waiting for idle before updating framebuffer. - * - * Cons: - * - if upload is by memcpy, this may actually be slower than fallback path. - * - uploads the whole image even if destination is clipped - * - * Need to benchmark. - * - * Given the questions about performance, implement for pbo's only. - * This path is definitely a win if the pbo is already in agp. If it - * turns out otherwise, we can add the code necessary to upload client - * data to agp space before performing the blit. (Though it may turn - * out to be better/simpler just to use the texture engine). - */ -static GLboolean -do_blit_drawpixels(GLcontext * ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid * pixels) -{ - struct intel_context *intel = intel_context(ctx); - struct intel_region *dest = intel_drawbuf_region(intel); - struct intel_buffer_object *src = intel_buffer_object(unpack->BufferObj); - GLuint src_offset; - GLuint rowLength; - - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s\n", __FUNCTION__); - - - if (!dest) { - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - no dest\n", __FUNCTION__); - return GL_FALSE; - } - - if (src) { - /* This validation should be done by core mesa: - */ - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels"); - return GL_TRUE; - } - } - else { - /* PBO only for now: - */ - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - not PBO\n", __FUNCTION__); + if (ctx->FragmentProgram.Enabled) return GL_FALSE; - } - if (!intel_check_blit_format(dest, format, type)) { - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - bad format for blit\n", __FUNCTION__); + /* Don't even want to think about it */ + if (format == GL_COLOR_INDEX) return GL_FALSE; - } - if (!intel_check_blit_fragment_ops(ctx, GL_FALSE)) { - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - bad GL fragment state for blitter\n", - __FUNCTION__); + /* We don't have a way to generate fragments with stencil values which * + * will set the resulting stencil value. + */ + if (format == GL_STENCIL_INDEX) return GL_FALSE; - } - if (ctx->Pixel.ZoomX != 1.0F) { - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - bad PixelZoomX for blit\n", __FUNCTION__); - return GL_FALSE; - } - - - if (unpack->RowLength > 0) - rowLength = unpack->RowLength; - else - rowLength = width; - - if (ctx->Pixel.ZoomY == -1.0F) { - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__); - return GL_FALSE; /* later */ - y -= height; - } - else if (ctx->Pixel.ZoomY == 1.0F) { - rowLength = -rowLength; - } - else { - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__); + /* To do DEPTH_COMPONENT, we would need to change our setup to not draw to + * the color buffer, and sample the texture values into the fragment depth + * in a program. + */ + if (format == GL_DEPTH_COMPONENT) return GL_FALSE; - } - - src_offset = (GLuint) _mesa_image_address(2, unpack, pixels, width, height, - format, type, 0, 0, 0); - - intelFlush(&intel->ctx); - LOCK_HARDWARE(intel); - - if (intel->driDrawable->numClipRects) { - __DRIdrawablePrivate *dPriv = intel->driDrawable; - int nbox = dPriv->numClipRects; - drm_clip_rect_t *box = dPriv->pClipRects; - drm_clip_rect_t rect; - drm_clip_rect_t dest_rect; - dri_bo *src_buffer = intel_bufferobj_buffer(intel, src, INTEL_READ); - int i; - dest_rect.x1 = dPriv->x + x; - dest_rect.y1 = dPriv->y + dPriv->h - (y + height); - dest_rect.x2 = dest_rect.x1 + width; - dest_rect.y2 = dest_rect.y1 + height; - - for (i = 0; i < nbox; i++) { - if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i])) - continue; - - intelEmitCopyBlit(intel, - dest->cpp, - rowLength, src_buffer, src_offset, GL_FALSE, - dest->pitch, dest->buffer, 0, dest->tiling, - rect.x1 - dest_rect.x1, - rect.y2 - dest_rect.y2, - rect.x1, - rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1, - ctx->Color.ColorLogicOpEnabled ? - ctx->Color.LogicOp : GL_COPY); - } - } - UNLOCK_HARDWARE(intel); - - if (INTEL_DEBUG & DEBUG_PIXEL) - _mesa_printf("%s - DONE\n", __FUNCTION__); + _mesa_PushAttrib(GL_ENABLE_BIT | GL_TRANSFORM_BIT | GL_TEXTURE_BIT | + GL_CURRENT_BIT); + _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); + + /* XXX: pixel store stuff */ + _mesa_Disable(GL_POLYGON_STIPPLE); + + _mesa_ActiveTextureARB(GL_TEXTURE0_ARB); + _mesa_Enable(GL_TEXTURE_2D); + _mesa_GenTextures(1, &texname); + _mesa_BindTexture(GL_TEXTURE_2D, texname); + _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + _mesa_TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + /* + _mesa_TexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); + _mesa_TexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); + */ + _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, format, + type, pixels); + + _mesa_MatrixMode(GL_PROJECTION); + _mesa_PushMatrix(); + _mesa_LoadIdentity(); + _mesa_Ortho(0, ctx->DrawBuffer->Width, 0, ctx->DrawBuffer->Height, 1, -1); + + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_PushMatrix(); + _mesa_LoadIdentity(); + + vertices[0][0] = x; + vertices[0][1] = y; + vertices[0][2] = ctx->Current.RasterPos[2]; + vertices[0][3] = ctx->Current.RasterPos[3]; + vertices[1][0] = x + width * ctx->Pixel.ZoomX; + vertices[1][1] = y; + vertices[1][2] = ctx->Current.RasterPos[2]; + vertices[1][3] = ctx->Current.RasterPos[3]; + vertices[2][0] = x + width * ctx->Pixel.ZoomX; + vertices[2][1] = y + height * ctx->Pixel.ZoomY; + vertices[2][2] = ctx->Current.RasterPos[2]; + vertices[2][3] = ctx->Current.RasterPos[3]; + vertices[3][0] = x; + vertices[3][1] = y + height * ctx->Pixel.ZoomY; + vertices[3][2] = ctx->Current.RasterPos[2]; + vertices[3][3] = ctx->Current.RasterPos[3]; + + texcoords[0][0] = 0.0; + texcoords[0][1] = 0.0; + texcoords[1][0] = 1.0; + texcoords[1][1] = 0.0; + texcoords[2][0] = 1.0; + texcoords[2][1] = 1.0; + texcoords[3][0] = 0.0; + texcoords[3][1] = 1.0; + + _mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices); + _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords); + _mesa_Enable(GL_VERTEX_ARRAY); + _mesa_Enable(GL_TEXTURE_COORD_ARRAY); + CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); + + _mesa_MatrixMode(GL_PROJECTION); + _mesa_PopMatrix(); + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_PopMatrix(); + _mesa_PopClientAttrib(); + _mesa_PopAttrib(); + + _mesa_DeleteTextures(1, &texname); return GL_TRUE; } - - void intelDrawPixels(GLcontext * ctx, GLint x, GLint y, @@ -341,15 +180,10 @@ intelDrawPixels(GLcontext * ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid * pixels) { - if (do_blit_drawpixels(ctx, x, y, width, height, format, type, - unpack, pixels)) + if (intel_texture_drawpixels(ctx, x, y, width, height, format, type, + unpack, pixels)) return; - if (do_texture_drawpixels(ctx, x, y, width, height, format, type, - unpack, pixels)) - return; - - if (INTEL_DEBUG & DEBUG_PIXEL) _mesa_printf("%s: fallback to swrast\n", __FUNCTION__); diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 1cfc8ddd64..cb0f4ba083 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -105,7 +105,8 @@ intel_set_region_tiling_gem(struct intel_context *intel, static struct intel_region * intel_region_alloc_internal(struct intel_context *intel, - GLuint cpp, GLuint pitch, GLuint height, + GLuint cpp, + GLuint width, GLuint height, GLuint pitch, dri_bo *buffer) { struct intel_region *region; @@ -117,8 +118,9 @@ intel_region_alloc_internal(struct intel_context *intel, region = calloc(sizeof(*region), 1); region->cpp = cpp; + region->width = width; + region->height = height; region->pitch = pitch; - region->height = height; /* needed? */ region->refcount = 1; region->buffer = buffer; @@ -131,19 +133,20 @@ intel_region_alloc_internal(struct intel_context *intel, struct intel_region * intel_region_alloc(struct intel_context *intel, - GLuint cpp, GLuint pitch, GLuint height) + GLuint cpp, GLuint width, GLuint height, GLuint pitch) { dri_bo *buffer; buffer = dri_bo_alloc(intel->bufmgr, "region", pitch * cpp * height, 64); - return intel_region_alloc_internal(intel, cpp, pitch, height, buffer); + return intel_region_alloc_internal(intel, cpp, width, height, pitch, buffer); } struct intel_region * intel_region_alloc_for_handle(struct intel_context *intel, - GLuint cpp, GLuint pitch, GLuint height, + GLuint cpp, + GLuint width, GLuint height, GLuint pitch, GLuint handle, const char *name) { struct intel_region *region; @@ -151,7 +154,8 @@ intel_region_alloc_for_handle(struct intel_context *intel, buffer = intel_bo_gem_create_from_name(intel->bufmgr, name, handle); - region = intel_region_alloc_internal(intel, cpp, pitch, height, buffer); + region = intel_region_alloc_internal(intel, cpp, + width, height, pitch, buffer); if (region == NULL) return region; diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index a561de485e..4b120ba4ce 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -36,7 +36,7 @@ #include <xf86drm.h> -#include "mtypes.h" +#include "main/mtypes.h" #include "intel_bufmgr.h" struct intel_context; @@ -55,8 +55,9 @@ struct intel_region dri_bo *buffer; /**< buffer manager's buffer */ GLuint refcount; /**< Reference count for region */ GLuint cpp; /**< bytes per pixel */ - GLuint pitch; /**< in pixels */ + GLuint width; /**< in pixels */ GLuint height; /**< in pixels */ + GLuint pitch; /**< in pixels */ GLubyte *map; /**< only non-NULL when region is actually mapped */ GLuint map_refcount; /**< Reference count for mapping */ @@ -72,12 +73,13 @@ struct intel_region * copied by calling intel_reference_region(). */ struct intel_region *intel_region_alloc(struct intel_context *intel, - GLuint cpp, - GLuint pitch, GLuint height); + GLuint cpp, GLuint width, + GLuint height, GLuint pitch); struct intel_region * intel_region_alloc_for_handle(struct intel_context *intel, - GLuint cpp, GLuint pitch, GLuint height, + GLuint cpp, + GLuint width, GLuint height, GLuint pitch, unsigned int handle, const char *name); void intel_region_reference(struct intel_region **dst, diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 1de1ac49ea..cf09fad745 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -25,12 +25,12 @@ * **************************************************************************/ -#include "glheader.h" -#include "context.h" -#include "framebuffer.h" -#include "matrix.h" -#include "renderbuffer.h" -#include "simple_list.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/framebuffer.h" +#include "main/matrix.h" +#include "main/renderbuffer.h" +#include "main/simple_list.h" #include "utils.h" #include "vblank.h" #include "xmlpool.h" @@ -298,11 +298,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) &intelScreen->irq_active)) return GL_FALSE; - /* Determine if batchbuffers are allowed */ - if (!intel_get_param(sPriv, I915_PARAM_ALLOW_BATCHBUFFER, - &intelScreen->allow_batchbuffer)) - return GL_FALSE; - sPriv->extensions = intelScreenExtensions; return GL_TRUE; @@ -314,6 +309,7 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv) { intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private; + dri_bufmgr_destroy(intelScreen->bufmgr); intelUnmapScreenRegions(intelScreen); FREE(intelScreen); @@ -496,8 +492,8 @@ intelFillInModes(__DRIscreenPrivate *psp, GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML }; - u_int8_t depth_bits_array[3]; - u_int8_t stencil_bits_array[3]; + uint8_t depth_bits_array[3]; + uint8_t stencil_bits_array[3]; depth_bits_array[0] = 0; depth_bits_array[1] = depth_bits; diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h index daf2ab4c58..fc913da5bf 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.h +++ b/src/mesa/drivers/dri/intel/intel_screen.h @@ -74,7 +74,6 @@ typedef struct int drmMinor; int irq_active; - int allow_batchbuffer; GLboolean no_hw; diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 0ea8576a02..8e2b4456f8 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -25,10 +25,10 @@ * **************************************************************************/ -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/colormac.h" #include "intel_fbo.h" #include "intel_screen.h" diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 4fa18e2d54..23455a4c74 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -1,7 +1,7 @@ #include "swrast/swrast.h" -#include "texobj.h" -#include "teximage.h" -#include "mipmap.h" +#include "main/texobj.h" +#include "main/teximage.h" +#include "main/mipmap.h" #include "intel_context.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index fe7a8badf8..6219c1c953 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -28,7 +28,7 @@ #ifndef INTELTEX_INC #define INTELTEX_INC -#include "mtypes.h" +#include "main/mtypes.h" #include "intel_context.h" #include "texmem.h" diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index d0ab464a1c..a7b88b39c0 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -25,11 +25,11 @@ * **************************************************************************/ -#include "mtypes.h" -#include "enums.h" -#include "image.h" -#include "teximage.h" -#include "mipmap.h" +#include "main/mtypes.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/teximage.h" +#include "main/mipmap.h" #include "swrast/swrast.h" #include "intel_screen.h" diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index 8ae80e1601..2be060dd3e 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -1,7 +1,7 @@ #include "intel_context.h" #include "intel_tex.h" -#include "texformat.h" -#include "enums.h" +#include "main/texformat.h" +#include "main/enums.h" /* It works out that this function is fine for all the supported * hardware. However, there is still a need to map the formats onto diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index d1f540b0f1..2ac7dceb0f 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -2,19 +2,19 @@ #include <stdlib.h> #include <stdio.h> -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "enums.h" -#include "colortab.h" -#include "convolve.h" -#include "context.h" -#include "simple_list.h" -#include "texcompress.h" -#include "texformat.h" -#include "texobj.h" -#include "texstore.h" -#include "teximage.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/enums.h" +#include "main/colortab.h" +#include "main/convolve.h" +#include "main/context.h" +#include "main/simple_list.h" +#include "main/texcompress.h" +#include "main/texformat.h" +#include "main/texobj.h" +#include "main/texstore.h" +#include "main/teximage.h" #include "intel_context.h" #include "intel_mipmap_tree.h" @@ -733,6 +733,12 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) intel_update_renderbuffers(pDRICtx, dPriv); rb = intel_fb->color_rb[0]; + /* If the region isn't set, then intel_update_renderbuffers was unable + * to get the buffers for the drawable. + */ + if (rb->region == NULL) + return; + type = GL_BGRA; format = GL_UNSIGNED_BYTE; internalFormat = (rb->region->cpp == 3 ? 3 : 4); @@ -751,7 +757,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) intelObj->mt = mt; texImage = _mesa_get_tex_image(&intel->ctx, texObj, target, level); _mesa_init_teximage_fields(&intel->ctx, target, texImage, - rb->region->pitch, rb->region->height, 1, + rb->region->width, rb->region->height, 1, 0, internalFormat); intelImage = intel_texture_image(texImage); diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c b/src/mesa/drivers/dri/intel/intel_tex_layout.c index edc3a2eaa4..e6f9a41779 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.c +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c @@ -33,7 +33,7 @@ #include "intel_mipmap_tree.h" #include "intel_tex_layout.h" #include "intel_context.h" -#include "macros.h" +#include "main/macros.h" GLuint intel_compressed_alignment(GLenum internalFormat) { diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.h b/src/mesa/drivers/dri/intel/intel_tex_layout.h index 193699d3f7..dbc90e6f9b 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.h +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.h @@ -30,7 +30,7 @@ * Michel Dänzer <michel@tungstengraphics.com> */ -#include "macros.h" +#include "main/macros.h" static GLuint minify( GLuint d ) diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index 5428a1d068..b752361886 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -26,11 +26,11 @@ * **************************************************************************/ -#include "mtypes.h" -#include "texobj.h" -#include "texstore.h" -#include "texcompress.h" -#include "enums.h" +#include "main/mtypes.h" +#include "main/texobj.h" +#include "main/texstore.h" +#include "main/texcompress.h" +#include "main/enums.h" #include "intel_context.h" #include "intel_tex.h" diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 5763f4ae1f..3dae738ac2 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -1,5 +1,5 @@ -#include "mtypes.h" -#include "macros.h" +#include "main/mtypes.h" +#include "main/macros.h" #include "intel_context.h" #include "intel_batchbuffer.h" diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index 29fd654c3f..99abd209b6 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -29,12 +29,12 @@ * Jos�Fonseca <j_r_fonseca@yahoo.co.uk> */ -#include "glheader.h" -#include "context.h" -#include "simple_list.h" -#include "imports.h" -#include "matrix.h" -#include "extensions.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/matrix.h" +#include "main/extensions.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/mach64/mach64_context.h b/src/mesa/drivers/dri/mach64/mach64_context.h index fa6e2bbd3f..55e0618ff8 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.h +++ b/src/mesa/drivers/dri/mach64/mach64_context.h @@ -36,7 +36,7 @@ #include "drm.h" #include "mach64_drm.h" -#include "mtypes.h" +#include "main/mtypes.h" #include "mach64_reg.h" diff --git a/src/mesa/drivers/dri/mach64/mach64_dd.c b/src/mesa/drivers/dri/mach64/mach64_dd.c index 7d225ebc88..e400e9a918 100644 --- a/src/mesa/drivers/dri/mach64/mach64_dd.c +++ b/src/mesa/drivers/dri/mach64/mach64_dd.c @@ -35,9 +35,10 @@ #include "mach64_vb.h" #include "mach64_dd.h" -#include "context.h" +#include "main/context.h" +#include "main/framebuffer.h" + #include "utils.h" -#include "framebuffer.h" #define DRIVER_DATE "20051019" diff --git a/src/mesa/drivers/dri/mach64/mach64_ioctl.c b/src/mesa/drivers/dri/mach64/mach64_ioctl.c index 0a2df32c07..ef5c0625c3 100644 --- a/src/mesa/drivers/dri/mach64/mach64_ioctl.c +++ b/src/mesa/drivers/dri/mach64/mach64_ioctl.c @@ -35,8 +35,8 @@ #include "mach64_ioctl.h" #include "mach64_tex.h" -#include "imports.h" -#include "macros.h" +#include "main/imports.h" +#include "main/macros.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 4dfffef145..6bfb4c32b1 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -35,10 +35,10 @@ #include "mach64_vb.h" #include "mach64_span.h" -#include "context.h" -#include "imports.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/context.h" +#include "main/imports.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "utils.h" #include "vblank.h" @@ -91,8 +91,8 @@ mach64FillInModes( __DRIscreenPrivate *psp, GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */ }; - u_int8_t depth_bits_array[2]; - u_int8_t stencil_bits_array[2]; + uint8_t depth_bits_array[2]; + uint8_t stencil_bits_array[2]; depth_bits_array[0] = depth_bits; depth_bits_array[1] = depth_bits; diff --git a/src/mesa/drivers/dri/mach64/mach64_state.c b/src/mesa/drivers/dri/mach64/mach64_state.c index d32d7ed9f6..3a023187ce 100644 --- a/src/mesa/drivers/dri/mach64/mach64_state.c +++ b/src/mesa/drivers/dri/mach64/mach64_state.c @@ -36,9 +36,9 @@ #include "mach64_vb.h" #include "mach64_tex.h" -#include "context.h" -#include "enums.h" -#include "colormac.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/colormac.h" #include "swrast/swrast.h" #include "vbo/vbo.h" #include "tnl/tnl.h" diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index c42588e064..1f9d3c57eb 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -36,15 +36,15 @@ #include "mach64_tris.h" #include "mach64_tex.h" -#include "context.h" -#include "macros.h" -#include "simple_list.h" -#include "enums.h" -#include "texstore.h" -#include "texformat.h" -#include "teximage.h" -#include "texobj.h" -#include "imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/texstore.h" +#include "main/texformat.h" +#include "main/teximage.h" +#include "main/texobj.h" +#include "main/imports.h" static void mach64SetTexWrap( mach64TexObjPtr t, diff --git a/src/mesa/drivers/dri/mach64/mach64_texmem.c b/src/mesa/drivers/dri/mach64/mach64_texmem.c index d65b2cda6a..734e547952 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texmem.c +++ b/src/mesa/drivers/dri/mach64/mach64_texmem.c @@ -38,11 +38,11 @@ #include "mach64_tris.h" #include "mach64_tex.h" -#include "context.h" -#include "macros.h" -#include "simple_list.h" -#include "texformat.h" -#include "imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/simple_list.h" +#include "main/texformat.h" +#include "main/imports.h" /* Destroy hardware state associated with texture `t'. diff --git a/src/mesa/drivers/dri/mach64/mach64_texstate.c b/src/mesa/drivers/dri/mach64/mach64_texstate.c index 80c84d6774..fd2369dd88 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texstate.c +++ b/src/mesa/drivers/dri/mach64/mach64_texstate.c @@ -29,11 +29,11 @@ * José Fonseca <j_r_fonseca@yahoo.co.uk> */ -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "macros.h" -#include "texformat.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/texformat.h" #include "mach64_context.h" #include "mach64_ioctl.h" diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c index 6fb4c5bd65..f2e8e2e3ae 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.c +++ b/src/mesa/drivers/dri/mach64/mach64_tris.c @@ -29,10 +29,10 @@ * José Fonseca <j_r_fonseca@yahoo.co.uk> */ -#include "glheader.h" -#include "mtypes.h" -#include "colormac.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/macros.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.h b/src/mesa/drivers/dri/mach64/mach64_tris.h index 4780765a18..042df42f5b 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.h +++ b/src/mesa/drivers/dri/mach64/mach64_tris.h @@ -31,7 +31,7 @@ #ifndef __MACH64_TRIS_H__ #define __MACH64_TRIS_H__ -#include "mtypes.h" +#include "main/mtypes.h" extern void mach64InitTriFuncs( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/mach64/mach64_vb.c b/src/mesa/drivers/dri/mach64/mach64_vb.c index 8aab72a3f3..e58812e902 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vb.c +++ b/src/mesa/drivers/dri/mach64/mach64_vb.c @@ -29,11 +29,11 @@ * José Fonseca <j_r_fonseca@yahoo.co.uk> */ -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/colormac.h" #include "swrast_setup/swrast_setup.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/dri/mach64/mach64_vb.h b/src/mesa/drivers/dri/mach64/mach64_vb.h index 0d923abce0..e0b366916b 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vb.h +++ b/src/mesa/drivers/dri/mach64/mach64_vb.h @@ -32,7 +32,7 @@ #ifndef __MACH64_VB_H__ #define __MACH64_VB_H__ -#include "mtypes.h" +#include "main/mtypes.h" #include "swrast/swrast.h" #include "mach64_context.h" diff --git a/src/mesa/drivers/dri/mga/mga_texcombine.c b/src/mesa/drivers/dri/mga/mga_texcombine.c index bbfa29be5f..24083d9651 100644 --- a/src/mesa/drivers/dri/mga/mga_texcombine.c +++ b/src/mesa/drivers/dri/mga/mga_texcombine.c @@ -23,7 +23,7 @@ * Ville Syrjala <syrjala@sci.fi> */ -#include "glheader.h" +#include "main/glheader.h" #include "mgacontext.h" #include "mgatex.h" diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index c14ddc95c9..d4c5b6fd97 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -28,20 +28,20 @@ */ #include <stdlib.h> -#include "mm.h" +#include "main/mm.h" #include "mgacontext.h" #include "mgatex.h" #include "mgaregs.h" #include "mgatris.h" #include "mgaioctl.h" -#include "context.h" -#include "enums.h" -#include "macros.h" -#include "imports.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/imports.h" -#include "simple_list.h" -#include "texformat.h" +#include "main/simple_list.h" +#include "main/texformat.h" #define MGA_USE_TABLE_FOR_FORMAT #ifdef MGA_USE_TABLE_FOR_FORMAT diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index e7a1b3b01e..86da3a2cac 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -34,12 +34,12 @@ #include "drm.h" #include "mga_drm.h" #include "mga_xmesa.h" -#include "context.h" -#include "matrix.h" -#include "simple_list.h" -#include "imports.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/context.h" +#include "main/matrix.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -64,7 +64,7 @@ #include "utils.h" #include "vblank.h" -#include "extensions.h" +#include "main/extensions.h" #include "drirenderbuffer.h" #include "GL/internal/dri_interface.h" diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.h b/src/mesa/drivers/dri/mga/mga_xmesa.h index 7de7bb06e8..07c22bd596 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.h +++ b/src/mesa/drivers/dri/mga/mga_xmesa.h @@ -31,7 +31,7 @@ #include <sys/time.h> #include "dri_util.h" #include "mga_drm.h" -#include "mtypes.h" +#include "main/mtypes.h" #include "mgaregs.h" #include "xmlconfig.h" diff --git a/src/mesa/drivers/dri/mga/mgacontext.h b/src/mesa/drivers/dri/mga/mgacontext.h index 68bba94fd3..30640a29b3 100644 --- a/src/mesa/drivers/dri/mga/mgacontext.h +++ b/src/mesa/drivers/dri/mga/mgacontext.h @@ -32,12 +32,12 @@ #include "drm.h" #include "mga_drm.h" #include "dri_util.h" -#include "mtypes.h" #include "xf86drm.h" -#include "mm.h" -#include "colormac.h" +#include "main/mtypes.h" +#include "main/mm.h" +#include "main/colormac.h" +#include "main/macros.h" #include "texmem.h" -#include "macros.h" #include "xmlconfig.h" #define MGA_SET_FIELD(reg,mask,val) reg = ((reg) & (mask)) | ((val) & ~(mask)) diff --git a/src/mesa/drivers/dri/mga/mgadd.c b/src/mesa/drivers/dri/mga/mgadd.c index ac7bf9f877..3b1ea22b60 100644 --- a/src/mesa/drivers/dri/mga/mgadd.c +++ b/src/mesa/drivers/dri/mga/mgadd.c @@ -26,10 +26,10 @@ */ -#include "mtypes.h" -#include "framebuffer.h" +#include "main/mtypes.h" +#include "main/framebuffer.h" +#include "main/mm.h" -#include "mm.h" #include "mgacontext.h" #include "mgadd.h" #include "mgastate.h" diff --git a/src/mesa/drivers/dri/mga/mgadd.h b/src/mesa/drivers/dri/mga/mgadd.h index 6830ca67ad..f92591df45 100644 --- a/src/mesa/drivers/dri/mga/mgadd.h +++ b/src/mesa/drivers/dri/mga/mgadd.h @@ -28,7 +28,7 @@ #ifndef MGADD_INC #define MGADD_INC -#include "context.h" +#include "main/context.h" extern void mgaInitDriverFuncs( struct dd_function_table *functions ); diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c index dee9399556..4438bad920 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.c +++ b/src/mesa/drivers/dri/mga/mgaioctl.c @@ -31,12 +31,12 @@ */ #include <errno.h> -#include "mtypes.h" -#include "macros.h" -#include "dd.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/dd.h" #include "swrast/swrast.h" -#include "mm.h" +#include "main/mm.h" #include "drm.h" #include "mga_drm.h" #include "mgacontext.h" diff --git a/src/mesa/drivers/dri/mga/mgapixel.c b/src/mesa/drivers/dri/mga/mgapixel.c index f309aabbc8..9f90047ba5 100644 --- a/src/mesa/drivers/dri/mga/mgapixel.c +++ b/src/mesa/drivers/dri/mga/mgapixel.c @@ -35,8 +35,8 @@ * \author Gareth Hughes <gareth@valinux.com> */ -#include "mtypes.h" -#include "macros.h" +#include "main/mtypes.h" +#include "main/macros.h" #include "mgadd.h" #include "mgacontext.h" #include "mgaioctl.h" @@ -44,7 +44,7 @@ #include "mgastate.h" #include "swrast/swrast.h" -#include "imports.h" +#include "main/imports.h" #if 0 #define IS_AGP_MEM( mmesa, p ) \ diff --git a/src/mesa/drivers/dri/mga/mgapixel.h b/src/mesa/drivers/dri/mga/mgapixel.h index b52c8670f3..f5f300db56 100644 --- a/src/mesa/drivers/dri/mga/mgapixel.h +++ b/src/mesa/drivers/dri/mga/mgapixel.h @@ -28,7 +28,7 @@ #ifndef MGA_PIXELS_H #define MGA_PIXELS_H -#include "mtypes.h" +#include "main/mtypes.h" extern void mgaDDInitPixelFuncs( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/mga/mgarender.c b/src/mesa/drivers/dri/mga/mgarender.c index 51cddf16ed..517c3b8f82 100644 --- a/src/mesa/drivers/dri/mga/mgarender.c +++ b/src/mesa/drivers/dri/mga/mgarender.c @@ -38,11 +38,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * dma buffers. Use strip/fan hardware primitives where possible. * Simulate missing primitives with indexed vertices. */ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c index 7ac59661ac..5b6d323ca9 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.c +++ b/src/mesa/drivers/dri/mga/mgaspan.c @@ -25,7 +25,7 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "mtypes.h" +#include "main/mtypes.h" #include "mgadd.h" #include "mgacontext.h" #include "mgaspan.h" diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c index 1d413d3473..7c830ec097 100644 --- a/src/mesa/drivers/dri/mga/mgastate.c +++ b/src/mesa/drivers/dri/mga/mgastate.c @@ -26,11 +26,11 @@ */ -#include "mtypes.h" -#include "colormac.h" -#include "dd.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/dd.h" +#include "main/mm.h" -#include "mm.h" #include "mgacontext.h" #include "mgadd.h" #include "mgastate.h" diff --git a/src/mesa/drivers/dri/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c index 31ea5046df..2392622b90 100644 --- a/src/mesa/drivers/dri/mga/mgatex.c +++ b/src/mesa/drivers/dri/mga/mgatex.c @@ -25,24 +25,24 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "mm.h" +#include "main/glheader.h" +#include "main/mm.h" #include "mgacontext.h" #include "mgatex.h" #include "mgaregs.h" #include "mgatris.h" #include "mgaioctl.h" -#include "colormac.h" -#include "context.h" -#include "enums.h" -#include "simple_list.h" -#include "imports.h" -#include "macros.h" -#include "texformat.h" -#include "texstore.h" -#include "teximage.h" -#include "texobj.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/texformat.h" +#include "main/texstore.h" +#include "main/teximage.h" +#include "main/texobj.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/mga/mgatexmem.c b/src/mesa/drivers/dri/mga/mgatexmem.c index 559813f5de..9a2d62b53b 100644 --- a/src/mesa/drivers/dri/mga/mgatexmem.c +++ b/src/mesa/drivers/dri/mga/mgatexmem.c @@ -25,17 +25,17 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" +#include "main/glheader.h" -#include "mm.h" +#include "main/mm.h" #include "mgacontext.h" #include "mgatex.h" #include "mgaregs.h" #include "mgaioctl.h" #include "mga_xmesa.h" -#include "imports.h" -#include "simple_list.h" +#include "main/imports.h" +#include "main/simple_list.h" /** * Destroy any device-dependent state associated with the texture. This may diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c index d2a8a693d7..b93a21c3ac 100644 --- a/src/mesa/drivers/dri/mga/mgatris.c +++ b/src/mesa/drivers/dri/mga/mgatris.c @@ -25,15 +25,15 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "mtypes.h" -#include "macros.h" -#include "colormac.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/colormac.h" +#include "main/mm.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" -#include "mm.h" #include "mgacontext.h" #include "mgaioctl.h" #include "mgatris.h" diff --git a/src/mesa/drivers/dri/mga/mgatris.h b/src/mesa/drivers/dri/mga/mgatris.h index a40fef8307..43612b80a1 100644 --- a/src/mesa/drivers/dri/mga/mgatris.h +++ b/src/mesa/drivers/dri/mga/mgatris.h @@ -28,7 +28,7 @@ #ifndef MGATRIS_INC #define MGATRIS_INC -#include "mtypes.h" +#include "main/mtypes.h" extern void mgaDDInitTriFuncs( GLcontext *ctx ); extern void mgaChooseRenderState( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/mga/mgavb.c b/src/mesa/drivers/dri/mga/mgavb.c index 954fd53ae3..1c635b23a6 100644 --- a/src/mesa/drivers/dri/mga/mgavb.c +++ b/src/mesa/drivers/dri/mga/mgavb.c @@ -32,11 +32,11 @@ #include "mgaioctl.h" #include "mga_xmesa.h" -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/colormac.h" #include "tnl/t_context.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/mga/mgavb.h b/src/mesa/drivers/dri/mga/mgavb.h index f6580e0db9..8d24ab7b5f 100644 --- a/src/mesa/drivers/dri/mga/mgavb.h +++ b/src/mesa/drivers/dri/mga/mgavb.h @@ -28,7 +28,7 @@ #ifndef MGAVB_INC #define MGAVB_INC -#include "mtypes.h" +#include "main/mtypes.h" #include "mgacontext.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h deleted file mode 100644 index db4d4cb6b7..0000000000 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************** - -Copyright 2006 Stephane Marchesin -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 -on 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 -ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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 __NOUVEAU_CONTEXT_H__ -#define __NOUVEAU_CONTEXT_H__ - -#include "dri_util.h" -#include "drm.h" -#include "nouveau_drm.h" - -#include "mtypes.h" -#include "tnl/t_vertex.h" - -#include "nouveau_screen.h" -#include "nouveau_state_cache.h" -#include "nouveau_buffers.h" -#include "nouveau_shader.h" -#include "nouveau_sync.h" - -#include "xmlconfig.h" - -typedef struct nouveau_fifo_t{ - int channel; - uint32_t* buffer; - uint32_t* mmio; - uint32_t put_base; - uint32_t current; - uint32_t put; - uint32_t free; - uint32_t max; -} -nouveau_fifo; - -#define TAG(x) nouveau##x -#include "tnl_dd/t_dd_vertex.h" -#undef TAG - -/* Subpixel offsets for window coordinates (triangles): */ -#define SUBPIXEL_X (0.0F) -#define SUBPIXEL_Y (0.125F) - -struct nouveau_context; - -typedef void (*nouveau_tri_func)( struct nouveau_context*, - nouveauVertex *, - nouveauVertex *, - nouveauVertex * ); - -typedef void (*nouveau_line_func)( struct nouveau_context*, - nouveauVertex *, - nouveauVertex * ); - -typedef void (*nouveau_point_func)( struct nouveau_context*, - nouveauVertex * ); - -typedef struct nouveau_hw_func_t { - /* Initialise any card-specific non-GL related state */ - GLboolean (*InitCard)(struct nouveau_context *); - /* Update buffer offset/pitch/format */ - GLboolean (*BindBuffers)(struct nouveau_context *, int num_color, - nouveau_renderbuffer **color, - nouveau_renderbuffer *depth); - /* Update anything that depends on the window position/size */ - void (*WindowMoved)(struct nouveau_context *); -} nouveau_hw_func; - -typedef struct nouveau_context { - /* Mesa context */ - GLcontext *glCtx; - - /* The per-context fifo */ - nouveau_fifo fifo; - - /* The read-only regs */ - volatile unsigned char* mmio; - - /* The per-channel notifier block */ - volatile void *notifier_block; - - /* Physical addresses of AGP/VRAM apertures */ - uint64_t vram_phys; - uint64_t vram_size; - uint64_t gart_phys; - uint64_t gart_size; - - /* Channel synchronisation */ - struct drm_nouveau_notifier_alloc *syncNotifier; - - /* ARB_occlusion_query / EXT_timer_query */ - GLuint query_object_max; - GLboolean * query_alloc; - struct drm_nouveau_notifier_alloc *queryNotifier; - - /* Additional hw-specific functions */ - nouveau_hw_func hw_func; - - /* FIXME : do we want to put all state into a separate struct ? */ - /* State for tris */ - GLuint color_offset; - GLuint specular_offset; - - /* Vertex state */ - GLuint vertex_size; - GLubyte *verts; - struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX]; - GLuint vertex_attr_count; - - /* Color buffer clear value */ - uint32_t clear_color_value; - - /* Depth/stencil clear value */ - uint32_t clear_value; - - /* Light state */ - GLboolean lighting_enabled; - uint32_t enabled_lights; - - /* Cached state */ - nouveau_state_cache state_cache; - - /* The drawing fallbacks */ - GLuint Fallback; - nouveau_tri_func draw_tri; - nouveau_line_func draw_line; - nouveau_point_func draw_point; - - /* Cliprects information */ - GLuint numClipRects; - drm_clip_rect_t *pClipRects; - drm_clip_rect_t osClipRect; - GLuint drawX, drawY, drawW, drawH; - - /* The rendering context information */ - GLenum current_primitive; /* the current primitive enum */ - DECLARE_RENDERINPUTS(render_inputs_bitset); /* the current render inputs */ - - /* Shader state */ - nvsFunc VPfunc; - nvsFunc FPfunc; - nouveauShader *current_fragprog; - nouveauShader *current_vertprog; - nouveauShader *passthrough_vp; - nouveauShader *passthrough_fp; - - nouveauScreenRec *screen; - struct drm_nouveau_sarea *sarea; - - __DRIcontextPrivate *driContext; /* DRI context */ - __DRIscreenPrivate *driScreen; /* DRI screen */ - __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */ - GLint lastStamp; - - drm_context_t hHWContext; - drm_hw_lock_t *driHwLock; - int driFd; - - /* Configuration cache */ - driOptionCache optionCache; - - /* vblank stuff */ - uint32_t vblank_flags; - uint32_t vblank_seq; - - GLuint new_state; - GLuint new_render_state; - GLuint render_index; - GLmatrix viewport; - GLfloat depth_scale; - -}nouveauContextRec, *nouveauContextPtr; - - -#define NOUVEAU_CONTEXT(ctx) ((nouveauContextPtr)(ctx->DriverCtx)) - -/* Flags for software fallback cases: */ -#define NOUVEAU_FALLBACK_TEXTURE 0x0001 -#define NOUVEAU_FALLBACK_DRAW_BUFFER 0x0002 -#define NOUVEAU_FALLBACK_READ_BUFFER 0x0004 -#define NOUVEAU_FALLBACK_STENCIL 0x0008 -#define NOUVEAU_FALLBACK_RENDER_MODE 0x0010 -#define NOUVEAU_FALLBACK_LOGICOP 0x0020 -#define NOUVEAU_FALLBACK_SEP_SPECULAR 0x0040 -#define NOUVEAU_FALLBACK_BLEND_EQ 0x0080 -#define NOUVEAU_FALLBACK_BLEND_FUNC 0x0100 -#define NOUVEAU_FALLBACK_PROJTEX 0x0200 -#define NOUVEAU_FALLBACK_DISABLE 0x0400 - - -extern GLboolean nouveauCreateContext( const __GLcontextModes *glVisual, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate ); - -extern void nouveauDestroyContext( __DRIcontextPrivate * ); - -extern GLboolean nouveauMakeCurrent( __DRIcontextPrivate *driContextPriv, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv ); - -extern GLboolean nouveauUnbindContext( __DRIcontextPrivate *driContextPriv ); - -extern void nouveauSwapBuffers(__DRIdrawablePrivate *dPriv); - -extern void nouveauCopySubBuffer(__DRIdrawablePrivate *dPriv, - int x, int y, int w, int h); - -/* Debugging utils: */ -extern int NOUVEAU_DEBUG; - -#define DEBUG_SHADERS 0x00000001 -#define DEBUG_MEM 0x00000002 -#define DEBUG_BUFFEROBJ 0x00000004 - -#endif /* __NOUVEAU_CONTEXT_H__ */ - diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fifo.c b/src/mesa/drivers/dri/nouveau/nouveau_fifo.c deleted file mode 100644 index 5eb53aa46c..0000000000 --- a/src/mesa/drivers/dri/nouveau/nouveau_fifo.c +++ /dev/null @@ -1,152 +0,0 @@ -/************************************************************************** - -Copyright 2006 Stephane Marchesin -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 -on 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 -ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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. - -**************************************************************************/ - - -#include "vblank.h" -#include <errno.h> -#include "mtypes.h" -#include "macros.h" -#include "dd.h" -#include "swrast/swrast.h" -#include "nouveau_context.h" -#include "nouveau_msg.h" -#include "nouveau_fifo.h" -#include "nouveau_lock.h" -#include "nouveau_object.h" -#include "nouveau_sync.h" - -#ifdef NOUVEAU_RING_DEBUG -int nouveau_fifo_remaining=0; -#endif - - -#define RING_SKIPS 8 - -void WAIT_RING(nouveauContextPtr nmesa,uint32_t size) -{ -#ifdef NOUVEAU_RING_DEBUG - return; -#endif - uint32_t fifo_get; - while(nmesa->fifo.free < size+1) { - fifo_get = NV_FIFO_READ_GET(); - - if(nmesa->fifo.put >= fifo_get) { - nmesa->fifo.free = nmesa->fifo.max - nmesa->fifo.current; - if(nmesa->fifo.free < size+1) { - OUT_RING(NV03_FIFO_CMD_JUMP | nmesa->fifo.put_base); - if(fifo_get <= RING_SKIPS) { - if(nmesa->fifo.put <= RING_SKIPS) /* corner case - will be idle */ - NV_FIFO_WRITE_PUT(RING_SKIPS + 1); - do { fifo_get = NV_FIFO_READ_GET(); } - while(fifo_get <= RING_SKIPS); - } - NV_FIFO_WRITE_PUT(RING_SKIPS); - nmesa->fifo.current = nmesa->fifo.put = RING_SKIPS; - nmesa->fifo.free = fifo_get - (RING_SKIPS + 1); - } - } else - nmesa->fifo.free = fifo_get - nmesa->fifo.current - 1; - } -} - -/* - * Wait for the channel to be idle - */ -void nouveauWaitForIdleLocked(nouveauContextPtr nmesa) -{ - /* Wait for FIFO idle */ - FIRE_RING(); - while(RING_AHEAD()>0); - - /* Wait on notifier to indicate all commands in the channel have - * been completed. - */ - nouveau_notifier_wait_nop(nmesa->glCtx, nmesa->syncNotifier, NvSub3D); -} - -void nouveauWaitForIdle(nouveauContextPtr nmesa) -{ - LOCK_HARDWARE(nmesa); - nouveauWaitForIdleLocked(nmesa); - UNLOCK_HARDWARE(nmesa); -} - -// here we call the fifo initialization ioctl and fill in stuff accordingly -GLboolean nouveauFifoInit(nouveauContextPtr nmesa) -{ - struct drm_nouveau_fifo_alloc fifo_init; - int i, ret; - -#ifdef NOUVEAU_RING_DEBUG - return GL_TRUE; -#endif - - fifo_init.fb_ctxdma_handle = NvDmaFB; - fifo_init.tt_ctxdma_handle = NvDmaTT; - ret=drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_FIFO_ALLOC, &fifo_init, sizeof(fifo_init)); - if (ret) { - FATAL("Fifo initialization ioctl failed (returned %d)\n",ret); - return GL_FALSE; - } - - ret = drmMap(nmesa->driFd, fifo_init.cmdbuf, fifo_init.cmdbuf_size, &nmesa->fifo.buffer); - if (ret) { - FATAL("Unable to map the fifo (returned %d)\n",ret); - return GL_FALSE; - } - - ret = drmMap(nmesa->driFd, fifo_init.ctrl, fifo_init.ctrl_size, &nmesa->fifo.mmio); - if (ret) { - FATAL("Unable to map the control regs (returned %d)\n",ret); - return GL_FALSE; - } - - ret = drmMap(nmesa->driFd, fifo_init.notifier, - fifo_init.notifier_size, - &nmesa->notifier_block); - if (ret) { - FATAL("Unable to map the notifier block (returned %d)\n",ret); - return GL_FALSE; - } - - /* Setup our initial FIFO tracking params */ - nmesa->fifo.channel = fifo_init.channel; - nmesa->fifo.put_base = fifo_init.put_base; - nmesa->fifo.current = 0; - nmesa->fifo.put = 0; - nmesa->fifo.max = (fifo_init.cmdbuf_size >> 2) - 1; - nmesa->fifo.free = nmesa->fifo.max - nmesa->fifo.current; - - for (i=0; i<RING_SKIPS; i++) - OUT_RING(0); - nmesa->fifo.free -= RING_SKIPS; - - MESSAGE("Fifo init ok. Using context %d\n", fifo_init.channel); - return GL_TRUE; -} - - diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fifo.h b/src/mesa/drivers/dri/nouveau/nouveau_fifo.h deleted file mode 100644 index 67f9cd4fc8..0000000000 --- a/src/mesa/drivers/dri/nouveau/nouveau_fifo.h +++ /dev/null @@ -1,195 +0,0 @@ -/************************************************************************** - -Copyright 2006 Stephane Marchesin -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 -on 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 -ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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 __NOUVEAU_FIFO_H__ -#define __NOUVEAU_FIFO_H__ - -#include "nouveau_context.h" -#include "nouveau_ctrlreg.h" -#include "nouveau_state_cache.h" - -//#define NOUVEAU_RING_TRACE -//#define NOUVEAU_RING_DEBUG -//#define NOUVEAU_STATE_CACHE_DISABLE - -#ifndef NOUVEAU_RING_TRACE -#define NOUVEAU_RING_TRACE 0 -#else -#undef NOUVEAU_RING_TRACE -#define NOUVEAU_RING_TRACE 1 -#endif - -#define NV_READ(reg) *(volatile uint32_t *)(nmesa->mmio + (reg)) - -#define NV_FIFO_READ(reg) *(volatile uint32_t *)(nmesa->fifo.mmio + (reg/4)) -#define NV_FIFO_WRITE(reg,value) *(volatile uint32_t *)(nmesa->fifo.mmio + (reg/4)) = value; -#define NV_FIFO_READ_GET() ((NV_FIFO_READ(NV03_FIFO_REGS_DMAGET) - nmesa->fifo.put_base) >> 2) -#define NV_FIFO_WRITE_PUT(val) do { \ - if (NOUVEAU_RING_TRACE) {\ - printf("FIRE_RING : 0x%08x\n", nmesa->fifo.current << 2); \ - fflush(stdout); \ - sleep(1); \ - } \ - NV_FIFO_WRITE(NV03_FIFO_REGS_DMAPUT, ((val)<<2) + nmesa->fifo.put_base); \ -} while(0) - -/* - * Ring/fifo interface - * - * - Begin a ring section with BEGIN_RING_SIZE (if you know the full size in advance) - * - Output stuff to the ring with either OUT_RINGp (outputs a raw mem chunk), OUT_RING (1 uint32_t) or OUT_RINGf (1 float) - * - RING_AVAILABLE returns the available fifo (in uint32_ts) - * - RING_AHEAD returns how much ahead of the last submission point we are - * - FIRE_RING fires whatever we have that wasn't fired before - * - WAIT_RING waits for size (in uint32_ts) to be available in the fifo - */ - -/* Enable for ring debugging. Prints out writes to the ring buffer - * but does not actually write to it. - */ -#ifdef NOUVEAU_RING_DEBUG - -extern int nouveau_fifo_remaining; - -#define OUT_RINGp(ptr,sz) do { \ -uint32_t* p=(uint32_t*)(ptr); \ -int i; printf("OUT_RINGp: (size 0x%x dwords)\n",sz); for(i=0;i<sz;i++) printf(" 0x%08x %f\n", *(p+i), *((float*)(p+i))); \ -nouveau_fifo_remaining-=sz; \ -}while(0) - -#define OUT_RING(n) do { \ - printf("OUT_RINGn: 0x%08x (%s)\n", n, __func__); \ - nouveau_fifo_remaining--; \ -}while(0) - -#define OUT_RINGf(n) do { \ - printf("OUT_RINGf: %.04f (%s)\n", n, __func__); \ - nouveau_fifo_remaining--; \ -}while(0) - -#define BEGIN_RING_SIZE(subchannel,tag,size) do { \ - if (nouveau_fifo_remaining!=0) \ - printf("RING ERROR : remaining %d\n",nouveau_fifo_remaining); \ - nouveau_state_cache_flush(nmesa); \ - if (nmesa->fifo.free <= (size)) \ - WAIT_RING(nmesa,(size)); \ - OUT_RING( ((size)<<18) | ((subchannel) << 13) | (tag)); \ - nmesa->fifo.free -= ((size) + 1); \ - nouveau_fifo_remaining=size; \ -}while(0) - -#else - -#define OUT_RINGp(ptr,sz) do{ \ - if (NOUVEAU_RING_TRACE) { \ - uint32_t* p=(uint32_t*)(ptr); \ - int i; printf("OUT_RINGp: (size 0x%x dwords) (%s)\n",sz, __func__); for(i=0;i<sz;i++) printf(" [0x%08x] 0x%08x %f\n", (nmesa->fifo.current+i) << 2, *(p+i), *((float*)(p+i))); \ - } \ - memcpy(nmesa->fifo.buffer+nmesa->fifo.current,ptr,(sz)*4); \ - nmesa->fifo.current+=(sz); \ -}while(0) - -#define OUT_RING(n) do { \ -if (NOUVEAU_RING_TRACE) \ - printf("OUT_RINGn: [0x%08x] 0x%08x (%s)\n", nmesa->fifo.current << 2, n, __func__); \ -nmesa->fifo.buffer[nmesa->fifo.current++]=(n); \ -}while(0) - -#define OUT_RINGf(n) do { \ -if (NOUVEAU_RING_TRACE) \ - printf("OUT_RINGf: [0x%08x] %.04f (%s)\n", nmesa->fifo.current << 2, n, __func__); \ -*((float*)(nmesa->fifo.buffer+nmesa->fifo.current++))=(n); \ -}while(0) - -#define BEGIN_RING_SIZE(subchannel,tag,size) do { \ - nouveau_state_cache_flush(nmesa); \ - if (nmesa->fifo.free <= (size)) \ - WAIT_RING(nmesa,(size)); \ - OUT_RING( ((size)<<18) | ((subchannel) << 13) | (tag)); \ - nmesa->fifo.free -= ((size) + 1); \ -}while(0) - -#endif - -extern void WAIT_RING(nouveauContextPtr nmesa,uint32_t size); -extern void nouveau_state_cache_flush(nouveauContextPtr nmesa); -extern void nouveau_state_cache_init(nouveauContextPtr nmesa); - -#ifdef NOUVEAU_STATE_CACHE_DISABLE -#define BEGIN_RING_CACHE(subc,tag,size) BEGIN_RING_SIZE((subc), (tag), (size)) -#define OUT_RING_CACHE(n) OUT_RING((n)) -#define OUT_RING_CACHEf(n) OUT_RINGf((n)) -#define OUT_RING_CACHEp(ptr, sz) OUT_RINGp((ptr), (sz)) -#else -#define BEGIN_RING_CACHE(subchannel,tag,size) do { \ - nmesa->state_cache.dirty=1; \ - nmesa->state_cache.current_pos=((tag)/4); \ -}while(0) - -#define OUT_RING_CACHE(n) do { \ - if (nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value!=(n)) { \ - nmesa->state_cache.atoms[nmesa->state_cache.current_pos].dirty=1; \ - nmesa->state_cache.hdirty[nmesa->state_cache.current_pos/NOUVEAU_STATE_CACHE_HIER_SIZE]=1; \ - nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value=(n); \ - } \ - nmesa->state_cache.current_pos++; \ -}while(0) - -#define OUT_RING_CACHEf(n) do { \ - if ((*(float*)(&nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value))!=(n)){ \ - nmesa->state_cache.atoms[nmesa->state_cache.current_pos].dirty=1; \ - nmesa->state_cache.hdirty[nmesa->state_cache.current_pos/NOUVEAU_STATE_CACHE_HIER_SIZE]=1; \ - (*(float*)(&nmesa->state_cache.atoms[nmesa->state_cache.current_pos].value))=(n);\ - } \ - nmesa->state_cache.current_pos++; \ -}while(0) - -#define OUT_RING_CACHEp(ptr,sz) do { \ -uint32_t* p=(uint32_t*)(ptr); \ -int i; for(i=0;i<sz;i++) OUT_RING_CACHE(*(p+i)); \ -}while(0) -#endif - -#define RING_AVAILABLE() (nmesa->fifo.free-1) - -#define RING_AHEAD() ((nmesa->fifo.put<=nmesa->fifo.current)?(nmesa->fifo.current-nmesa->fifo.put):nmesa->fifo.max-nmesa->fifo.put+nmesa->fifo.current) - -#define FIRE_RING() do { \ - if (nmesa->fifo.current!=nmesa->fifo.put) { \ - nmesa->fifo.put=nmesa->fifo.current; \ - NV_FIFO_WRITE_PUT(nmesa->fifo.put); \ - } \ -}while(0) - -extern void nouveauWaitForIdle(nouveauContextPtr nmesa); -extern void nouveauWaitForIdleLocked(nouveauContextPtr nmesa); -extern GLboolean nouveauFifoInit(nouveauContextPtr nmesa); - -#endif /* __NOUVEAU_FIFO_H__ */ - - diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c deleted file mode 100644 index 2cf6f979e4..0000000000 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ /dev/null @@ -1,382 +0,0 @@ -/************************************************************************** - -Copyright 2006 Stephane Marchesin -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 -on 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 -ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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. - -**************************************************************************/ - -#include "glheader.h" -#include "imports.h" -#include "mtypes.h" -#include "framebuffer.h" -#include "renderbuffer.h" - -#include "nouveau_context.h" -#include "nouveau_screen.h" -#include "nouveau_object.h" -#include "nouveau_span.h" - -#include "utils.h" -#include "context.h" -#include "vblank.h" -#include "drirenderbuffer.h" - -#include "GL/internal/dri_interface.h" - -#include "xmlpool.h" - -PUBLIC const char __driConfigOptions[] = -DRI_CONF_BEGIN - DRI_CONF_SECTION_DEBUG - DRI_CONF_NO_RAST(false) - DRI_CONF_SECTION_END -DRI_CONF_END; -static const GLuint __driNConfigOptions = 1; - -extern const struct dri_extension common_extensions[]; -extern const struct dri_extension nv10_extensions[]; -extern const struct dri_extension nv20_extensions[]; -extern const struct dri_extension nv30_extensions[]; -extern const struct dri_extension nv40_extensions[]; -extern const struct dri_extension nv50_extensions[]; - -static nouveauScreenPtr nouveauCreateScreen(__DRIscreenPrivate *sPriv) -{ - nouveauScreenPtr screen; - NOUVEAUDRIPtr dri_priv=(NOUVEAUDRIPtr)sPriv->pDevPriv; - - /* allocate screen */ - screen = (nouveauScreenPtr) CALLOC( sizeof(*screen) ); - if ( !screen ) { - __driUtilMessage("%s: Could not allocate memory for screen structure",__FUNCTION__); - return NULL; - } - - screen->card=nouveau_card_lookup(dri_priv->device_id); - if (!screen->card) { - __driUtilMessage("%s: Unknown card type 0x%04x:0x%04x\n", - __func__, dri_priv->device_id >> 16, dri_priv->device_id & 0xFFFF); - FREE(screen); - return NULL; - } - - /* parse information in __driConfigOptions */ - driParseOptionInfo (&screen->optionCache,__driConfigOptions, __driNConfigOptions); - - screen->fbFormat = dri_priv->bpp / 8; - screen->frontOffset = dri_priv->front_offset; - screen->frontPitch = dri_priv->front_pitch; - screen->backOffset = dri_priv->back_offset; - screen->backPitch = dri_priv->back_pitch; - screen->depthOffset = dri_priv->depth_offset; - screen->depthPitch = dri_priv->depth_pitch; - - screen->driScreen = sPriv; - return screen; -} - -static void -nouveauDestroyScreen(__DRIscreenPrivate *sPriv) -{ - nouveauScreenPtr screen = (nouveauScreenPtr)sPriv->private; - - if (!screen) return; - - /* free all option information */ - driDestroyOptionInfo (&screen->optionCache); - - FREE(screen); - sPriv->private = NULL; -} - -static GLboolean nouveauInitDriver(__DRIscreenPrivate *sPriv) -{ - sPriv->private = (void *) nouveauCreateScreen( sPriv ); - if ( !sPriv->private ) { - nouveauDestroyScreen( sPriv ); - return GL_FALSE; - } - - return GL_TRUE; -} - -/** - * Create the Mesa framebuffer and renderbuffers for a given window/drawable. - * - * \todo This function (and its interface) will need to be updated to support - * pbuffers. - */ -static GLboolean -nouveauCreateBuffer(__DRIscreenPrivate *driScrnPriv, - __DRIdrawablePrivate *driDrawPriv, - const __GLcontextModes *mesaVis, - GLboolean isPixmap) -{ - nouveauScreenPtr screen = (nouveauScreenPtr) driScrnPriv->private; - nouveau_renderbuffer *nrb; - struct gl_framebuffer *fb; - const GLboolean swAccum = mesaVis->accumRedBits > 0; - const GLboolean swStencil = mesaVis->stencilBits > 0 && mesaVis->depthBits != 24; - GLenum color_format = screen->fbFormat == 4 ? GL_RGBA8 : GL_RGB5; - - if (isPixmap) - return GL_FALSE; /* not implemented */ - - fb = _mesa_create_framebuffer(mesaVis); - if (!fb) - return GL_FALSE; - - /* Front buffer */ - nrb = nouveau_renderbuffer_new(color_format, - driScrnPriv->pFB + screen->frontOffset, - screen->frontOffset, - screen->frontPitch * screen->fbFormat, - driDrawPriv); - nouveauSpanSetFunctions(nrb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &nrb->mesa); - - if (0 /* unified buffers if we choose to support them.. */) { - } else { - if (mesaVis->doubleBufferMode) { - nrb = nouveau_renderbuffer_new(color_format, NULL, - 0, 0, - NULL); - nouveauSpanSetFunctions(nrb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &nrb->mesa); - } - - if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) { - nrb = nouveau_renderbuffer_new(GL_DEPTH24_STENCIL8_EXT, NULL, - 0, 0, - NULL); - nouveauSpanSetFunctions(nrb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &nrb->mesa); - _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &nrb->mesa); - } else if (mesaVis->depthBits == 24) { - nrb = nouveau_renderbuffer_new(GL_DEPTH_COMPONENT24, NULL, - 0, 0, - NULL); - nouveauSpanSetFunctions(nrb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &nrb->mesa); - } else if (mesaVis->depthBits == 16) { - nrb = nouveau_renderbuffer_new(GL_DEPTH_COMPONENT16, NULL, - 0, 0, - NULL); - nouveauSpanSetFunctions(nrb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &nrb->mesa); - } - } - - _mesa_add_soft_renderbuffers(fb, - GL_FALSE, /* color */ - GL_FALSE, /* depth */ - swStencil, - swAccum, - GL_FALSE, /* alpha */ - GL_FALSE /* aux */); - - driDrawPriv->driverPrivate = (void *) fb; - return (driDrawPriv->driverPrivate != NULL); -} - - -static void -nouveauDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) -{ - _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); -} - -static int -nouveauGetSwapInfo(__DRIdrawablePrivate *dpriv, __DRIswapInfo *sInfo) -{ - return -1; -} - -static const struct __DriverAPIRec nouveauAPI = { - .InitDriver = nouveauInitDriver, - .DestroyScreen = nouveauDestroyScreen, - .CreateContext = nouveauCreateContext, - .DestroyContext = nouveauDestroyContext, - .CreateBuffer = nouveauCreateBuffer, - .DestroyBuffer = nouveauDestroyBuffer, - .SwapBuffers = nouveauSwapBuffers, - .MakeCurrent = nouveauMakeCurrent, - .UnbindContext = nouveauUnbindContext, - .GetSwapInfo = nouveauGetSwapInfo, - .GetMSC = driGetMSC32, - .WaitForMSC = driWaitForMSC32, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL, - .CopySubBuffer = nouveauCopySubBuffer -}; - - -static __GLcontextModes * -nouveauFillInModes( unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer ) -{ - __GLcontextModes * modes; - __GLcontextModes * m; - unsigned num_modes; - unsigned depth_buffer_factor; - unsigned back_buffer_factor; - int i; - - static const struct { - GLenum format; - GLenum type; - } fb_format_array[] = { - { GL_RGB , GL_UNSIGNED_SHORT_5_6_5 }, - { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV }, - { GL_BGR , GL_UNSIGNED_INT_8_8_8_8_REV }, - }; - - /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't - * support pageflipping at all. - */ - static const GLenum back_buffer_modes[] = { - GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML - }; - - uint8_t depth_bits_array[4] = { 0, 16, 24, 24 }; - uint8_t stencil_bits_array[4] = { 0, 0, 0, 8 }; - - depth_buffer_factor = 4; - back_buffer_factor = (have_back_buffer) ? 3 : 1; - - num_modes = ((pixel_bits==16) ? 1 : 2) * - depth_buffer_factor * back_buffer_factor * 4; - modes = (*dri_interface->createContextModes)(num_modes, - sizeof(__GLcontextModes)); - m = modes; - - for (i=((pixel_bits==16)?0:1);i<((pixel_bits==16)?1:3);i++) { - if (!driFillInModes(&m, fb_format_array[i].format, - fb_format_array[i].type, - depth_bits_array, - stencil_bits_array, - depth_buffer_factor, - back_buffer_modes, - back_buffer_factor, - GLX_TRUE_COLOR)) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - - if (!driFillInModes(&m, fb_format_array[i].format, - fb_format_array[i].type, - depth_bits_array, - stencil_bits_array, - depth_buffer_factor, - back_buffer_modes, - back_buffer_factor, - GLX_DIRECT_COLOR)) { - fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__ ); - return NULL; - } - } - - return modes; -} - - -/** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. - * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. - */ -PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - -{ - __DRIscreenPrivate *psp; - static const __DRIversion ddx_expected = { 1, 2, 0 }; - static const __DRIversion dri_expected = { 4, 0, 0 }; - static const __DRIversion drm_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL }; -#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 9 -#error nouveau_drm.h version doesn't match expected version -#endif - dri_interface = interface; - - if (!driCheckDriDdxDrmVersions2("nouveau", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected)) { - return NULL; - } - - // temporary lock step versioning - if (drm_expected.patch!=drm_version->patch) { - __driUtilMessage("%s: wrong DRM version, expected %d, got %d\n", - __func__, - drm_expected.patch, drm_version->patch); - return NULL; - } - - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &nouveauAPI); - if ( psp != NULL ) { - NOUVEAUDRIPtr dri_priv = (NOUVEAUDRIPtr)psp->pDevPriv; - - *driver_modes = nouveauFillInModes(dri_priv->bpp, - (dri_priv->bpp == 16) ? 16 : 24, - (dri_priv->bpp == 16) ? 0 : 8, - 1 - ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, common_extensions, GL_FALSE ); - driInitExtensions( NULL, nv10_extensions, GL_FALSE ); - driInitExtensions( NULL, nv10_extensions, GL_FALSE ); - driInitExtensions( NULL, nv30_extensions, GL_FALSE ); - driInitExtensions( NULL, nv40_extensions, GL_FALSE ); - driInitExtensions( NULL, nv50_extensions, GL_FALSE ); - } - - return (void *) psp; -} - diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.h b/src/mesa/drivers/dri/nouveau/nouveau_screen.h deleted file mode 100644 index bbe5810128..0000000000 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.h +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************** - -Copyright 2006 Stephane Marchesin -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 -on 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 -ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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 __NOUVEAU_SCREEN_H__ -#define __NOUVEAU_SCREEN_H__ - -#include "xmlconfig.h" - -#include "nouveau_dri.h" -#include "nouveau_card.h" - -typedef struct { - nouveau_card* card; - uint32_t bus_type; - uint32_t agp_mode; - - GLint fbFormat; - - GLuint frontOffset; - GLuint frontPitch; - GLuint backOffset; - GLuint backPitch; - - GLuint depthOffset; - GLuint depthPitch; - GLuint spanOffset; - - __DRIscreenPrivate *driScreen; - unsigned int sarea_priv_offset; - - /* Configuration cache with default values for all contexts */ - driOptionCache optionCache; - -} nouveauScreenRec, *nouveauScreenPtr; - - -#endif /* __NOUVEAU_SCREEN_H__ */ diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index 5e7cadc331..535a98cc01 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -32,12 +32,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#include "glheader.h" -#include "context.h" -#include "simple_list.h" -#include "imports.h" -#include "matrix.h" -#include "extensions.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/matrix.h" +#include "main/extensions.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h index 7bf853da39..0e10209a6a 100644 --- a/src/mesa/drivers/dri/r128/r128_context.h +++ b/src/mesa/drivers/dri/r128/r128_context.h @@ -39,7 +39,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "drm.h" #include "r128_drm.h" -#include "mtypes.h" +#include "main/mtypes.h" #include "tnl/t_vertex.h" #include "r128_reg.h" diff --git a/src/mesa/drivers/dri/r128/r128_dd.c b/src/mesa/drivers/dri/r128/r128_dd.c index d8e1c70ab7..dfe47f2dd6 100644 --- a/src/mesa/drivers/dri/r128/r128_dd.c +++ b/src/mesa/drivers/dri/r128/r128_dd.c @@ -38,8 +38,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_dd.h" #include "swrast/swrast.h" -#include "context.h" -#include "framebuffer.h" +#include "main/context.h" +#include "main/framebuffer.h" #include "utils.h" diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c index a3d4b2ba0c..84ac3d9f79 100644 --- a/src/mesa/drivers/dri/r128/r128_ioctl.c +++ b/src/mesa/drivers/dri/r128/r128_ioctl.c @@ -36,8 +36,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_context.h" #include "r128_state.h" #include "r128_ioctl.h" -#include "imports.h" -#include "macros.h" +#include "main/imports.h" +#include "main/macros.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/r128/r128_lock.c b/src/mesa/drivers/dri/r128/r128_lock.c index 3478e12ad0..81488a2742 100644 --- a/src/mesa/drivers/dri/r128/r128_lock.c +++ b/src/mesa/drivers/dri/r128/r128_lock.c @@ -58,7 +58,7 @@ r128UpdatePageFlipping( r128ContextPtr rmesa ) rmesa->new_state |= R128_NEW_WINDOW; } -/* Update the hardware state. This is called if another context has +/* Update the hardware state. This is called if another main/context.has * grabbed the hardware lock, which includes the X server. This * function also updates the driver's window state after the X server * moves, resizes or restacks a window -- the change will be reflected diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 448c857380..cb3a147dba 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -39,10 +39,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_span.h" #include "r128_tris.h" -#include "context.h" -#include "imports.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/context.h" +#include "main/imports.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "utils.h" #include "vblank.h" diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index 52a4d2e3f1..451dcd1b55 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -39,9 +39,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_tris.h" #include "r128_tex.h" -#include "context.h" -#include "enums.h" -#include "colormac.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/colormac.h" #include "swrast/swrast.h" #include "vbo/vbo.h" #include "tnl/tnl.h" diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index 5712351b03..3fc9c06cfa 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -39,17 +39,17 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_tex.h" #include "r128_texobj.h" -#include "context.h" -#include "macros.h" -#include "simple_list.h" -#include "enums.h" -#include "texstore.h" -#include "texformat.h" -#include "teximage.h" -#include "texobj.h" -#include "imports.h" -#include "colormac.h" -#include "texobj.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/texstore.h" +#include "main/texformat.h" +#include "main/teximage.h" +#include "main/texobj.h" +#include "main/imports.h" +#include "main/colormac.h" +#include "main/texobj.h" #include "xmlpool.h" diff --git a/src/mesa/drivers/dri/r128/r128_tex.h b/src/mesa/drivers/dri/r128/r128_tex.h index 77f0201a55..7df8decf76 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.h +++ b/src/mesa/drivers/dri/r128/r128_tex.h @@ -68,8 +68,8 @@ extern void r128InitTextureFuncs( struct dd_function_table *functions ); ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) static INLINE uint32_t r128PackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) { switch ( cpp ) { case 2: diff --git a/src/mesa/drivers/dri/r128/r128_texmem.c b/src/mesa/drivers/dri/r128/r128_texmem.c index af510a38c9..111fe1fd74 100644 --- a/src/mesa/drivers/dri/r128/r128_texmem.c +++ b/src/mesa/drivers/dri/r128/r128_texmem.c @@ -38,11 +38,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_tris.h" #include "r128_tex.h" -#include "context.h" -#include "macros.h" -#include "simple_list.h" -#include "texformat.h" -#include "imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/simple_list.h" +#include "main/texformat.h" +#include "main/imports.h" #define TEX_0 1 #define TEX_1 2 diff --git a/src/mesa/drivers/dri/r128/r128_texobj.h b/src/mesa/drivers/dri/r128/r128_texobj.h index 8a0596eea8..efbbb2df78 100644 --- a/src/mesa/drivers/dri/r128/r128_texobj.h +++ b/src/mesa/drivers/dri/r128/r128_texobj.h @@ -35,7 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _R128_TEXOBJ_H_ #define _R128_TEXOBJ_H_ -#include "mm.h" +#include "main/mm.h" /* Individual texture image information. */ diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index 211b9ea2a9..a9c9568003 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -32,11 +32,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Brian Paul <brianp@valinux.com> */ -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "macros.h" -#include "texformat.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/texformat.h" #include "r128_context.h" #include "r128_state.h" diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c index f2f124360c..bcc9ffa651 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.c +++ b/src/mesa/drivers/dri/r128/r128_tris.c @@ -33,10 +33,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#include "glheader.h" -#include "mtypes.h" -#include "colormac.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/macros.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/r128/r128_tris.h b/src/mesa/drivers/dri/r128/r128_tris.h index c8f0a4809b..d90ca31534 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.h +++ b/src/mesa/drivers/dri/r128/r128_tris.h @@ -35,7 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __R128_TRIS_H__ #define __R128_TRIS_H__ -#include "mtypes.h" +#include "main/mtypes.h" extern void r128InitTriFuncs( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index c1d51e8700..e1633772a1 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -31,12 +31,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "macros.h" -#include "context.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/context.h" #include "swrast/swrast.h" -#include "simple_list.h" +#include "main/simple_list.h" #include "r200_context.h" #include "r200_state.h" diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index c567349335..5531e0a739 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -32,15 +32,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "api_arrayelt.h" -#include "context.h" -#include "simple_list.h" -#include "imports.h" -#include "matrix.h" -#include "extensions.h" -#include "framebuffer.h" -#include "state.h" +#include "main/glheader.h" +#include "main/api_arrayelt.h" +#include "main/context.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/matrix.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/state.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index ee478e7d3c..14a1dda46a 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -41,9 +41,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dri_util.h" #include "texmem.h" -#include "macros.h" -#include "mtypes.h" -#include "colormac.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/colormac.h" #include "r200_reg.h" #include "r200_vertprog.h" @@ -63,7 +63,7 @@ typedef union { GLfloat f; uint32_t ui32; } float_ui32_type; #include "r200_lock.h" #include "radeon_screen.h" -#include "mm.h" +#include "main/mm.h" /* Flags for software fallback cases */ /* See correponding strings in r200_swtcl.c */ diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 90c695fec9..0741e57af7 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -35,10 +35,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <sched.h> #include <errno.h> -#include "glheader.h" -#include "imports.h" -#include "macros.h" -#include "context.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/context.h" #include "swrast/swrast.h" #include "r200_context.h" diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index 31431b7b03..f7458e4a0e 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -35,7 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __R200_IOCTL_H__ #define __R200_IOCTL_H__ -#include "simple_list.h" +#include "main/simple_list.h" #include "radeon_dri.h" #include "r200_lock.h" diff --git a/src/mesa/drivers/dri/r200/r200_lock.c b/src/mesa/drivers/dri/r200/r200_lock.c index f89b526a31..99661a4bfb 100644 --- a/src/mesa/drivers/dri/r200/r200_lock.c +++ b/src/mesa/drivers/dri/r200/r200_lock.c @@ -60,7 +60,7 @@ r200UpdatePageFlipping( r200ContextPtr rmesa ) -/* Update the hardware state. This is called if another context has +/* Update the hardware state. This is called if another main/context.has * grabbed the hardware lock, which includes the X server. This * function also updates the driver's window state after the X server * moves, resizes or restacks a window -- the change will be reflected diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index 7bc05e2f0b..8512b9af47 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -32,11 +32,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "mtypes.h" -#include "colormac.h" -#include "imports.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/imports.h" +#include "main/macros.h" #include "swrast_setup/swrast_setup.h" #include "math/m_translate.h" diff --git a/src/mesa/drivers/dri/r200/r200_pixel.c b/src/mesa/drivers/dri/r200/r200_pixel.c index 46d230767a..be68821dc1 100644 --- a/src/mesa/drivers/dri/r200/r200_pixel.c +++ b/src/mesa/drivers/dri/r200/r200_pixel.c @@ -31,10 +31,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "enums.h" -#include "mtypes.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/enums.h" +#include "main/mtypes.h" +#include "main/macros.h" #include "swrast/swrast.h" #include "r200_context.h" diff --git a/src/mesa/drivers/dri/r200/r200_sanity.c b/src/mesa/drivers/dri/r200/r200_sanity.c index 00d2f65c99..36530c224e 100644 --- a/src/mesa/drivers/dri/r200/r200_sanity.c +++ b/src/mesa/drivers/dri/r200/r200_sanity.c @@ -34,8 +34,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include <errno.h> -#include "glheader.h" -#include "imports.h" +#include "main/glheader.h" +#include "main/imports.h" #include "r200_context.h" #include "r200_ioctl.h" diff --git a/src/mesa/drivers/dri/r200/r200_span.c b/src/mesa/drivers/dri/r200/r200_span.c index 3d7a000218..9783678028 100644 --- a/src/mesa/drivers/dri/r200/r200_span.c +++ b/src/mesa/drivers/dri/r200/r200_span.c @@ -32,10 +32,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/colormac.h" #include "swrast/swrast.h" -#include "colormac.h" #include "r200_context.h" #include "r200_ioctl.h" diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index ade26c2d21..0eaaaf69ac 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -33,13 +33,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "api_arrayelt.h" -#include "enums.h" -#include "colormac.h" -#include "light.h" -#include "framebuffer.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/api_arrayelt.h" +#include "main/enums.h" +#include "main/colormac.h" +#include "main/light.h" +#include "main/framebuffer.h" #include "swrast/swrast.h" #include "vbo/vbo.h" diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 0c36cefc16..9e4677eda4 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -31,11 +31,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "enums.h" -#include "colormac.h" -#include "api_arrayelt.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/enums.h" +#include "main/colormac.h" +#include "main/api_arrayelt.h" #include "swrast/swrast.h" #include "vbo/vbo.h" diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index a1ea0198be..b25f028244 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -32,13 +32,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "mtypes.h" -#include "colormac.h" -#include "enums.h" -#include "image.h" -#include "imports.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/imports.h" +#include "main/macros.h" #include "swrast/s_context.h" #include "swrast/s_fog.h" diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.h b/src/mesa/drivers/dri/r200/r200_swtcl.h index 7458c54928..8c29fd0c99 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.h +++ b/src/mesa/drivers/dri/r200/r200_swtcl.h @@ -34,7 +34,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __R200_SWTCL_H__ #define __R200_SWTCL_H__ -#include "mtypes.h" +#include "main/mtypes.h" #include "swrast/swrast.h" #include "r200_context.h" diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index 78347d3cc2..99aecfe1e9 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -32,12 +32,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "mtypes.h" -#include "enums.h" -#include "colormac.h" -#include "light.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/enums.h" +#include "main/colormac.h" +#include "main/light.h" #include "vbo/vbo.h" #include "tnl/tnl.h" diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 24b9b3b696..5a4db33f44 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -31,18 +31,19 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "colormac.h" -#include "context.h" -#include "enums.h" -#include "image.h" -#include "simple_list.h" -#include "texformat.h" -#include "texstore.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/simple_list.h" +#include "main/texformat.h" +#include "main/texstore.h" +#include "main/teximage.h" +#include "main/texobj.h" + #include "texmem.h" -#include "teximage.h" -#include "texobj.h" #include "r200_context.h" #include "r200_state.h" diff --git a/src/mesa/drivers/dri/r200/r200_texmem.c b/src/mesa/drivers/dri/r200/r200_texmem.c index 183c4ca424..3b81ac0c80 100644 --- a/src/mesa/drivers/dri/r200/r200_texmem.c +++ b/src/mesa/drivers/dri/r200/r200_texmem.c @@ -37,11 +37,11 @@ SOFTWARE. #include <errno.h> -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "colormac.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/colormac.h" +#include "main/macros.h" #include "r200_context.h" #include "r200_ioctl.h" #include "r200_tex.h" diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 4edf304438..3f9a2f4ac1 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -32,13 +32,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "macros.h" -#include "texformat.h" -#include "texobj.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/texformat.h" +#include "main/texobj.h" +#include "main/enums.h" #include "r200_context.h" #include "r200_state.h" diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index c069660eea..c9e1dfe977 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -33,13 +33,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \author Nicolai Haehnle <prefect_@gmx.net> */ -#include "glheader.h" -#include "state.h" -#include "imports.h" -#include "macros.h" -#include "context.h" +#include "main/glheader.h" +#include "main/state.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/context.h" +#include "main/simple_list.h" #include "swrast/swrast.h" -#include "simple_list.h" #include "drm.h" #include "radeon_drm.h" diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index fcf571d206..ee4a69dce3 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -35,15 +35,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \author Nicolai Haehnle <prefect_@gmx.net> */ -#include "glheader.h" -#include "api_arrayelt.h" -#include "context.h" -#include "simple_list.h" -#include "imports.h" -#include "matrix.h" -#include "extensions.h" -#include "state.h" -#include "bufferobj.h" +#include "main/glheader.h" +#include "main/api_arrayelt.h" +#include "main/context.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/matrix.h" +#include "main/extensions.h" +#include "main/state.h" +#include "main/bufferobj.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -355,7 +355,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, ctx->Const.FragmentProgram.MaxNativeTexIndirections = PFS_MAX_TEX_INDIRECT; ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */ - _tnl_ProgramCacheInit(ctx); + ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; driInitExtensions(ctx, card_extensions, GL_TRUE); @@ -501,7 +501,6 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv) release_texture_heaps = (r300->radeon.glCtx->Shared->RefCount == 1); _swsetup_DestroyContext(r300->radeon.glCtx); - _tnl_ProgramCacheDestroy(r300->radeon.glCtx); _tnl_DestroyContext(r300->radeon.glCtx); _vbo_DestroyContext(r300->radeon.glCtx); _swrast_DestroyContext(r300->radeon.glCtx); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index d2017f8afe..c15e9fa300 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -43,9 +43,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dri_util.h" #include "texmem.h" -#include "macros.h" -#include "mtypes.h" -#include "colormac.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/colormac.h" #define USER_BUFFERS @@ -54,7 +54,7 @@ typedef struct r300_context r300ContextRec; typedef struct r300_context *r300ContextPtr; #include "radeon_lock.h" -#include "mm.h" +#include "main/mm.h" /* From http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html . I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index 2ea17ad0a7..80bd3389ae 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -33,12 +33,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \author Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "mtypes.h" -#include "colormac.h" -#include "imports.h" -#include "macros.h" -#include "image.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/image.h" #include "swrast_setup/swrast_setup.h" #include "math/m_translate.h" diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index 5950539cba..89d738339f 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -39,7 +39,7 @@ #ifndef __R300_EMIT_H__ #define __R300_EMIT_H__ -#include "glheader.h" +#include "main/glheader.h" #include "r300_context.h" #include "r300_cmdbuf.h" #include "radeon_reg.h" diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 453dda7431..4ef7f2bd78 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -36,9 +36,9 @@ * \author Jerome Glisse <j.glisse@gmail.com> */ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/prog_instruction.h" #include "shader/prog_parameter.h" #include "shader/prog_print.h" diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index b3a3cd2e04..94fb554fb3 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -33,9 +33,9 @@ #ifndef __R300_FRAGPROG_H_ #define __R300_FRAGPROG_H_ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/program.h" #include "shader/prog_instruction.h" diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.h b/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.h index 3da99a9dbe..231bf4eef5 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.h @@ -28,7 +28,7 @@ #ifndef __R300_FRAGPROG_SWIZZLE_H_ #define __R300_FRAGPROG_SWIZZLE_H_ -#include "glheader.h" +#include "main/glheader.h" #include "shader/prog_instruction.h" struct nqssadce_state; diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index bd7f060435..ee85e229f0 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -40,10 +40,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <sched.h> #include <errno.h> -#include "glheader.h" -#include "imports.h" -#include "macros.h" -#include "context.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/context.h" #include "swrast/swrast.h" #include "r300_context.h" diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 0a199e6faa..292f87a2b1 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -50,15 +50,15 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * no bugs... */ -#include "glheader.h" -#include "state.h" -#include "imports.h" -#include "enums.h" -#include "macros.h" -#include "context.h" -#include "dd.h" -#include "simple_list.h" -#include "api_arrayelt.h" +#include "main/glheader.h" +#include "main/state.h" +#include "main/imports.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/context.h" +#include "main/dd.h" +#include "main/simple_list.h" +#include "main/api_arrayelt.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "vbo/vbo.h" diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 15cd053161..6a5c3633a2 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -35,23 +35,23 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \author Nicolai Haehnle <prefect_@gmx.net> */ -#include "glheader.h" -#include "state.h" -#include "imports.h" -#include "enums.h" -#include "macros.h" -#include "context.h" -#include "dd.h" -#include "simple_list.h" - -#include "api_arrayelt.h" +#include "main/glheader.h" +#include "main/state.h" +#include "main/imports.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/context.h" +#include "main/dd.h" +#include "main/simple_list.h" +#include "main/api_arrayelt.h" +#include "main/texformat.h" + #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "shader/prog_parameter.h" #include "shader/prog_statevars.h" #include "vbo/vbo.h" #include "tnl/tnl.h" -#include "texformat.h" #include "radeon_ioctl.h" #include "radeon_state.h" diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 8aebd9be3e..b6e7ce1a1a 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -34,14 +34,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "glheader.h" -#include "mtypes.h" -#include "colormac.h" -#include "enums.h" -#include "image.h" -#include "imports.h" -#include "light.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/imports.h" +#include "main/light.h" +#include "main/macros.h" #include "swrast/s_context.h" #include "swrast/s_fog.h" diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.h b/src/mesa/drivers/dri/r300/r300_swtcl.h index 2ea6ceded7..55df53c1ad 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.h +++ b/src/mesa/drivers/dri/r300/r300_swtcl.h @@ -35,7 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __R300_SWTCL_H__ #define __R300_SWTCL_H__ -#include "mtypes.h" +#include "main/mtypes.h" #include "swrast/swrast.h" #include "r300_context.h" diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index f7f49729bc..8ab382c83c 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -32,18 +32,19 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \author Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "colormac.h" -#include "context.h" -#include "enums.h" -#include "image.h" -#include "simple_list.h" -#include "texformat.h" -#include "texstore.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/simple_list.h" +#include "main/texformat.h" +#include "main/texstore.h" +#include "main/teximage.h" +#include "main/texobj.h" + #include "texmem.h" -#include "teximage.h" -#include "texobj.h" #include "r300_context.h" #include "r300_state.h" diff --git a/src/mesa/drivers/dri/r300/r300_texmem.c b/src/mesa/drivers/dri/r300/r300_texmem.c index 69847a4022..b03eefaa7c 100644 --- a/src/mesa/drivers/dri/r300/r300_texmem.c +++ b/src/mesa/drivers/dri/r300/r300_texmem.c @@ -38,12 +38,12 @@ SOFTWARE. #include <errno.h> -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "colormac.h" -#include "macros.h" -#include "simple_list.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/simple_list.h" #include "radeon_reg.h" /* gets definition for usleep */ #include "r300_context.h" #include "r300_state.h" diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index d19832f861..e2329f04ec 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -35,14 +35,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \todo Enable R300 texture tiling code? */ -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "macros.h" -#include "texformat.h" -#include "teximage.h" -#include "texobj.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/texformat.h" +#include "main/teximage.h" +#include "main/texobj.h" +#include "main/enums.h" #include "r300_context.h" #include "r300_state.h" diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.h b/src/mesa/drivers/dri/r300/r500_fragprog.h index 8641ceeb8f..1e45538f80 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/r500_fragprog.h @@ -33,9 +33,9 @@ #ifndef __R500_FRAGPROG_H_ #define __R500_FRAGPROG_H_ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/prog_parameter.h" #include "shader/prog_print.h" #include "shader/program.h" diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index 3fc724a553..5267fe9a77 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -36,12 +36,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <dlfcn.h> -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "state.h" -#include "matrix.h" -#include "framebuffer.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/state.h" +#include "main/matrix.h" +#include "main/framebuffer.h" #include "drivers/common/driverfuncs.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h index 7458d63723..47cbc22a72 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.h +++ b/src/mesa/drivers/dri/r300/radeon_context.h @@ -43,11 +43,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __RADEON_CONTEXT_H__ #define __RADEON_CONTEXT_H__ -#include "mtypes.h" +#include "main/mtypes.h" +#include "main/colormac.h" #include "radeon_screen.h" #include "drm.h" #include "dri_util.h" -#include "colormac.h" struct radeon_context; typedef struct radeon_context radeonContextRec; diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.c b/src/mesa/drivers/dri/r300/radeon_ioctl.c index 0c1a19507b..36502eb42d 100644 --- a/src/mesa/drivers/dri/r300/radeon_ioctl.c +++ b/src/mesa/drivers/dri/r300/radeon_ioctl.c @@ -35,10 +35,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <sched.h> #include <errno.h> -#include "glheader.h" -#include "imports.h" -#include "macros.h" -#include "context.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/context.h" #include "swrast/swrast.h" #include "r300_context.h" #include "radeon_ioctl.h" diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.h b/src/mesa/drivers/dri/r300/radeon_ioctl.h index 210001e8e0..3add775b82 100644 --- a/src/mesa/drivers/dri/r300/radeon_ioctl.h +++ b/src/mesa/drivers/dri/r300/radeon_ioctl.h @@ -35,14 +35,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __RADEON_IOCTL_H__ #define __RADEON_IOCTL_H__ -#include "simple_list.h" +#include "main/simple_list.h" #include "radeon_dri.h" #include "radeon_lock.h" #include "xf86drm.h" #include "drm.h" #if 0 -#include "r200_context.h" +#include "r200context.h" #endif #include "radeon_drm.h" diff --git a/src/mesa/drivers/dri/r300/radeon_lock.c b/src/mesa/drivers/dri/r300/radeon_lock.c index d54a821c63..4f47afd5dc 100644 --- a/src/mesa/drivers/dri/r300/radeon_lock.c +++ b/src/mesa/drivers/dri/r300/radeon_lock.c @@ -45,7 +45,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_context.h" #include "r300_state.h" -#include "framebuffer.h" +#include "main/framebuffer.h" #include "drirenderbuffer.h" diff --git a/src/mesa/drivers/dri/r300/radeon_program.h b/src/mesa/drivers/dri/r300/radeon_program.h index 2e01dd496b..b411f69bc8 100644 --- a/src/mesa/drivers/dri/r300/radeon_program.h +++ b/src/mesa/drivers/dri/r300/radeon_program.h @@ -28,9 +28,9 @@ #ifndef __RADEON_PROGRAM_H_ #define __RADEON_PROGRAM_H_ -#include "glheader.h" -#include "macros.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/enums.h" #include "shader/program.h" #include "shader/prog_instruction.h" diff --git a/src/mesa/drivers/dri/r300/radeon_span.c b/src/mesa/drivers/dri/r300/radeon_span.c index 3616d8b14d..16f9fb99e6 100644 --- a/src/mesa/drivers/dri/r300/radeon_span.c +++ b/src/mesa/drivers/dri/r300/radeon_span.c @@ -40,7 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#include "glheader.h" +#include "main/glheader.h" #include "swrast/swrast.h" #include "r300_state.h" diff --git a/src/mesa/drivers/dri/r300/radeon_state.c b/src/mesa/drivers/dri/r300/radeon_state.c index d81318ce20..c401da6c54 100644 --- a/src/mesa/drivers/dri/r300/radeon_state.c +++ b/src/mesa/drivers/dri/r300/radeon_state.c @@ -33,12 +33,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "api_arrayelt.h" -#include "enums.h" -#include "colormac.h" -#include "light.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/api_arrayelt.h" +#include "main/enums.h" +#include "main/framebuffer.h" +#include "main/colormac.h" +#include "main/light.h" #include "swrast/swrast.h" #include "vbo/vbo.h" @@ -49,7 +50,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_ioctl.h" #include "radeon_state.h" #include "r300_ioctl.h" -#include "framebuffer.h" + /* ============================================================= * Scissoring diff --git a/src/mesa/drivers/dri/radeon/radeon_compat.c b/src/mesa/drivers/dri/radeon/radeon_compat.c index bd467fb15b..46b490d61f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_compat.c +++ b/src/mesa/drivers/dri/radeon/radeon_compat.c @@ -32,8 +32,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#include "glheader.h" -#include "imports.h" +#include "main/glheader.h" +#include "main/imports.h" #include "radeon_context.h" #include "radeon_state.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index bc43fc5960..53df766f8c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -49,9 +49,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_drm.h" #include "texmem.h" -#include "macros.h" -#include "mtypes.h" -#include "colormac.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/colormac.h" struct radeon_context; typedef struct radeon_context radeonContextRec; @@ -66,7 +66,7 @@ typedef union { #include "radeon_lock.h" #include "radeon_screen.h" -#include "mm.h" +#include "main/mm.h" #include "math/m_vector.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index e681ca0889..09acf6b4f8 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -37,9 +37,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <sched.h> #include <errno.h> -#include "glheader.h" -#include "imports.h" -#include "simple_list.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/simple_list.h" #include "swrast/swrast.h" #include "radeon_context.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.h b/src/mesa/drivers/dri/radeon/radeon_ioctl.h index f8c96af3f7..4e3a44df07 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.h +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.h @@ -36,7 +36,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __RADEON_IOCTL_H__ #define __RADEON_IOCTL_H__ -#include "simple_list.h" +#include "main/simple_list.h" #include "radeon_lock.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_lighting.c b/src/mesa/drivers/dri/radeon/radeon_lighting.c index 5e9b9c3051..6d9ccfa24d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lighting.c +++ b/src/mesa/drivers/dri/radeon/radeon_lighting.c @@ -27,11 +27,11 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" +#include "main/glheader.h" +#include "main/imports.h" #include "api_arrayelt.h" /* #include "mmath.h" */ -#include "enums.h" +#include "main/enums.h" #include "colormac.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.c b/src/mesa/drivers/dri/radeon/radeon_lock.c index 30a0c3863c..64bb3ca103 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lock.c +++ b/src/mesa/drivers/dri/radeon/radeon_lock.c @@ -39,8 +39,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Kevin E. Martin <martin@valinux.com> */ -#include "glheader.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/mtypes.h" #include "radeon_context.h" #include "radeon_lock.h" #include "radeon_tex.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index b61f5e0f3e..de3c3a15a7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -32,15 +32,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "mtypes.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/macros.h" #include "swrast_setup/swrast_setup.h" #include "math/m_translate.h" #include "tnl/tnl.h" -#include "tnl/t_context.h" +#include "tnl/tcontext.h" #include "radeon_context.h" #include "radeon_ioctl.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index d5ceedfa24..126d0727c6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -32,9 +32,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "vbo/vbo.h" #include "math/m_translate.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_sanity.c b/src/mesa/drivers/dri/radeon/radeon_sanity.c index bdfb7240d7..6613757fce 100644 --- a/src/mesa/drivers/dri/radeon/radeon_sanity.c +++ b/src/mesa/drivers/dri/radeon/radeon_sanity.c @@ -33,7 +33,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <errno.h> -#include "glheader.h" +#include "main/glheader.h" #include "radeon_context.h" #include "radeon_ioctl.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index edf804c60a..05107dd2ad 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -35,11 +35,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \author Gareth Hughes <gareth@valinux.com> */ -#include "glheader.h" -#include "imports.h" -#include "mtypes.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #define STANDALONE_MMIO #include "radeon_chipset.h" @@ -62,7 +62,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif #include "utils.h" -#include "context.h" #include "vblank.h" #include "drirenderbuffer.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index e7ab3677b3..12051ff1c8 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -40,7 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#include "glheader.h" +#include "main/glheader.h" #include "swrast/swrast.h" #include "radeon_context.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 3437de16bb..32bcff3360 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -32,14 +32,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "api_arrayelt.h" -#include "enums.h" -#include "light.h" -#include "state.h" -#include "context.h" -#include "framebuffer.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/api_arrayelt.h" +#include "main/enums.h" +#include "main/light.h" +#include "main/state.h" +#include "main/context.h" +#include "main/framebuffer.h" #include "vbo/vbo.h" #include "tnl/tnl.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index c876a596e6..57dc380050 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -27,9 +27,9 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "api_arrayelt.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/api_arrayelt.h" #include "swrast/swrast.h" #include "vbo/vbo.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index 2b3ae14ff7..ebea1fecdc 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -32,12 +32,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "mtypes.h" -#include "colormac.h" -#include "enums.h" -#include "imports.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/enums.h" +#include "main/imports.h" +#include "main/macros.h" #include "swrast_setup/swrast_setup.h" #include "math/m_translate.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.h b/src/mesa/drivers/dri/radeon/radeon_swtcl.h index 1feedf185d..e485052ad7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.h +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.h @@ -35,7 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __RADEON_TRIS_H__ #define __RADEON_TRIS_H__ -#include "mtypes.h" +#include "main/mtypes.h" #include "swrast/swrast.h" #include "radeon_context.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.c b/src/mesa/drivers/dri/radeon/radeon_tcl.c index 4c11ff7ab4..779e9ae5df 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c @@ -32,11 +32,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "imports.h" -#include "light.h" -#include "mtypes.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/light.h" +#include "main/mtypes.h" +#include "main/enums.h" #include "vbo/vbo.h" #include "tnl/tnl.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index f3eb9d8eef..b0aec21670 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -31,18 +31,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Brian Paul <brianp@valinux.com> */ -#include "glheader.h" -#include "imports.h" -#include "colormac.h" -#include "context.h" -#include "enums.h" -#include "image.h" -#include "simple_list.h" -#include "texformat.h" -#include "texstore.h" -#include "teximage.h" -#include "texobj.h" - +#include "main/glheader.h" +#include "main/imports.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/simple_list.h" +#include "main/texformat.h" +#include "main/texstore.h" +#include "main/teximage.h" +#include "main/texobj.h" #include "radeon_context.h" #include "radeon_state.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_texmem.c b/src/mesa/drivers/dri/radeon/radeon_texmem.c index 523c597271..5f7bbe6a4c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texmem.c +++ b/src/mesa/drivers/dri/radeon/radeon_texmem.c @@ -36,10 +36,10 @@ SOFTWARE. */ #include <errno.h> -#include "glheader.h" -#include "imports.h" -#include "context.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/macros.h" #include "radeon_context.h" #include "radeon_ioctl.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 90c6379eae..1e2f654add 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -33,14 +33,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Gareth Hughes <gareth@valinux.com> */ -#include "glheader.h" -#include "imports.h" -#include "colormac.h" -#include "context.h" -#include "macros.h" -#include "texformat.h" -#include "texobj.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/texformat.h" +#include "main/texobj.h" +#include "main/enums.h" #include "radeon_context.h" #include "radeon_state.h" diff --git a/src/mesa/drivers/dri/s3v/s3v_context.c b/src/mesa/drivers/dri/s3v/s3v_context.c index 2d2f704ad7..14502f95ae 100644 --- a/src/mesa/drivers/dri/s3v/s3v_context.c +++ b/src/mesa/drivers/dri/s3v/s3v_context.c @@ -11,15 +11,15 @@ #include "tnl/tnl.h" #include "tnl/t_pipeline.h" -#include "context.h" -#include "simple_list.h" -#include "matrix.h" -#include "extensions.h" +#include "main/context.h" +#include "main/simple_list.h" +#include "main/matrix.h" +#include "main/extensions.h" #if defined(USE_X86_ASM) #include "x86/common_x86_asm.h" #endif -#include "simple_list.h" -#include "mm.h" +#include "main/simple_list.h" +#include "main/mm.h" #include "drivers/common/driverfuncs.h" #include "s3v_vb.h" diff --git a/src/mesa/drivers/dri/s3v/s3v_context.h b/src/mesa/drivers/dri/s3v/s3v_context.h index ed698103ff..671ba90d78 100644 --- a/src/mesa/drivers/dri/s3v/s3v_context.h +++ b/src/mesa/drivers/dri/s3v/s3v_context.h @@ -11,11 +11,11 @@ #include "s3v_regs.h" #include "s3v_macros.h" #include "s3v_screen.h" -#include "colormac.h" -#include "macros.h" -#include "mtypes.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/mtypes.h" #include "drm.h" -#include "mm.h" +#include "main/mm.h" #include "drirenderbuffer.h" /* Flags for context */ diff --git a/src/mesa/drivers/dri/s3v/s3v_dd.c b/src/mesa/drivers/dri/s3v/s3v_dd.c index 1cbe890319..e340116f5e 100644 --- a/src/mesa/drivers/dri/s3v/s3v_dd.c +++ b/src/mesa/drivers/dri/s3v/s3v_dd.c @@ -9,8 +9,8 @@ #include "x86/common_x86_asm.h" #endif -#include "context.h" -#include "framebuffer.h" +#include "main/context.h" +#include "main/framebuffer.h" #include "swrast/swrast.h" #define S3V_DATE "20020207" diff --git a/src/mesa/drivers/dri/s3v/s3v_render.c b/src/mesa/drivers/dri/s3v/s3v_render.c index fa3f85e52b..5023f3c464 100644 --- a/src/mesa/drivers/dri/s3v/s3v_render.c +++ b/src/mesa/drivers/dri/s3v/s3v_render.c @@ -2,10 +2,10 @@ * Author: Max Lingua <sunmax@libero.it> */ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/mtypes.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/dri/s3v/s3v_screen.h b/src/mesa/drivers/dri/s3v/s3v_screen.h index 0c4f69efac..c49bc8587d 100644 --- a/src/mesa/drivers/dri/s3v/s3v_screen.h +++ b/src/mesa/drivers/dri/s3v/s3v_screen.h @@ -2,7 +2,7 @@ * Author: Max Lingua <sunmax@libero.it> */ -#include "mtypes.h" +#include "main/mtypes.h" typedef struct _s3vRegion { drm_handle_t handle; diff --git a/src/mesa/drivers/dri/s3v/s3v_state.c b/src/mesa/drivers/dri/s3v/s3v_state.c index b86b618c11..c71c89a3e1 100644 --- a/src/mesa/drivers/dri/s3v/s3v_state.c +++ b/src/mesa/drivers/dri/s3v/s3v_state.c @@ -5,9 +5,9 @@ #include <X11/Xlibint.h> #include "s3v_context.h" #include "s3v_macros.h" -#include "macros.h" #include "s3v_dri.h" -#include "colormac.h" +#include "main/macros.h" +#include "main/colormac.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "vbo/vbo.h" diff --git a/src/mesa/drivers/dri/s3v/s3v_tex.c b/src/mesa/drivers/dri/s3v/s3v_tex.c index 5bee051b09..8bf2ea9878 100644 --- a/src/mesa/drivers/dri/s3v/s3v_tex.c +++ b/src/mesa/drivers/dri/s3v/s3v_tex.c @@ -5,16 +5,16 @@ #include <stdlib.h> #include <stdio.h> -#include "glheader.h" -#include "mtypes.h" -#include "simple_list.h" -#include "enums.h" -#include "texstore.h" -#include "texformat.h" -#include "teximage.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/simple_list.h" +#include "main/enums.h" +#include "main/mm.h" +#include "main/texstore.h" +#include "main/texformat.h" +#include "main/teximage.h" #include "swrast/swrast.h" -#include "mm.h" #include "s3v_context.h" #include "s3v_tex.h" diff --git a/src/mesa/drivers/dri/s3v/s3v_texmem.c b/src/mesa/drivers/dri/s3v/s3v_texmem.c index 5b44340d19..705d105f55 100644 --- a/src/mesa/drivers/dri/s3v/s3v_texmem.c +++ b/src/mesa/drivers/dri/s3v/s3v_texmem.c @@ -5,13 +5,13 @@ #include <stdlib.h> #include <stdio.h> -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "simple_list.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/simple_list.h" +#include "main/enums.h" -#include "mm.h" +#include "main/mm.h" #include "s3v_context.h" #include "s3v_lock.h" #include "s3v_tex.h" diff --git a/src/mesa/drivers/dri/s3v/s3v_texstate.c b/src/mesa/drivers/dri/s3v/s3v_texstate.c index 2719de3663..455bae6301 100644 --- a/src/mesa/drivers/dri/s3v/s3v_texstate.c +++ b/src/mesa/drivers/dri/s3v/s3v_texstate.c @@ -5,13 +5,13 @@ #include <stdlib.h> #include <stdio.h> -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "simple_list.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/simple_list.h" +#include "main/enums.h" -#include "mm.h" +#include "main/mm.h" #include "s3v_context.h" #include "s3v_tex.h" diff --git a/src/mesa/drivers/dri/s3v/s3v_tris.c b/src/mesa/drivers/dri/s3v/s3v_tris.c index d6cceddd45..fafd38480c 100644 --- a/src/mesa/drivers/dri/s3v/s3v_tris.c +++ b/src/mesa/drivers/dri/s3v/s3v_tris.c @@ -11,10 +11,10 @@ #include "s3v_vb.h" #include "s3v_tris.h" -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/colormac.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/s3v/s3v_vb.c b/src/mesa/drivers/dri/s3v/s3v_vb.c index dadf2b4891..00e375c6c4 100644 --- a/src/mesa/drivers/dri/s3v/s3v_vb.c +++ b/src/mesa/drivers/dri/s3v/s3v_vb.c @@ -2,10 +2,10 @@ * Author: Max Lingua <sunmax@libero.it> */ -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/colormac.h" #include "swrast_setup/swrast_setup.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/dri/s3v/s3v_vb.h b/src/mesa/drivers/dri/s3v/s3v_vb.h index b35d804e62..0fd5437380 100644 --- a/src/mesa/drivers/dri/s3v/s3v_vb.h +++ b/src/mesa/drivers/dri/s3v/s3v_vb.h @@ -5,7 +5,7 @@ #ifndef S3VVB_INC #define S3VVB_INC -#include "mtypes.h" +#include "main/mtypes.h" #include "swrast/swrast.h" #define _S3V_NEW_VERTEX (_NEW_TEXTURE | \ diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c index 663dabdb91..b18c8763c3 100644 --- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c +++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c @@ -4,11 +4,11 @@ #include "s3v_context.h" #include "s3v_vb.h" -#include "context.h" -#include "matrix.h" +#include "main/context.h" +#include "main/matrix.h" #include "s3v_dri.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/savage/savage_init.h b/src/mesa/drivers/dri/savage/savage_init.h index 43fb969c69..abb8440fc4 100644 --- a/src/mesa/drivers/dri/savage/savage_init.h +++ b/src/mesa/drivers/dri/savage/savage_init.h @@ -28,7 +28,7 @@ #include <sys/time.h> #include "dri_util.h" -#include "mtypes.h" +#include "main/mtypes.h" #include "xmlconfig.h" diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 04c1bd6a34..a344aab71b 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -26,16 +26,16 @@ #include <X11/Xlibint.h> #include <stdio.h> -#include "savagecontext.h" -#include "context.h" -#include "matrix.h" -#include "framebuffer.h" -#include "renderbuffer.h" -#include "simple_list.h" +#include "main/context.h" +#include "main/context.h" +#include "main/matrix.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" +#include "main/simple_list.h" #include "utils.h" -#include "extensions.h" +#include "main/extensions.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/savage/savagecontext.h b/src/mesa/drivers/dri/savage/savagecontext.h index 3fe3d71d4e..fd6399d6a6 100644 --- a/src/mesa/drivers/dri/savage/savagecontext.h +++ b/src/mesa/drivers/dri/savage/savagecontext.h @@ -33,13 +33,13 @@ typedef struct savage_texture_object_t *savageTextureObjectPtr; #include <X11/Xlibint.h> #include "dri_util.h" -#include "mtypes.h" +#include "main/mtypes.h" #include "xf86drm.h" #include "drm.h" #include "savage_drm.h" #include "savage_init.h" #include "savage_3d_reg.h" -#include "mm.h" +#include "main/mm.h" #include "tnl/t_vertex.h" #include "texmem.h" diff --git a/src/mesa/drivers/dri/savage/savagedd.c b/src/mesa/drivers/dri/savage/savagedd.c index a5c5310e28..32ca86de8a 100644 --- a/src/mesa/drivers/dri/savage/savagedd.c +++ b/src/mesa/drivers/dri/savage/savagedd.c @@ -23,12 +23,12 @@ */ -#include "mtypes.h" -#include "framebuffer.h" +#include "main/mtypes.h" +#include "main/framebuffer.h" #include <stdio.h> -#include "mm.h" +#include "main/mm.h" #include "swrast/swrast.h" #include "savagedd.h" @@ -37,7 +37,7 @@ #include "savagetex.h" #include "savagetris.h" #include "savagecontext.h" -#include "extensions.h" +#include "main/extensions.h" #include "utils.h" diff --git a/src/mesa/drivers/dri/savage/savagedd.h b/src/mesa/drivers/dri/savage/savagedd.h index ae167be700..698a8d5de9 100644 --- a/src/mesa/drivers/dri/savage/savagedd.h +++ b/src/mesa/drivers/dri/savage/savagedd.h @@ -26,7 +26,7 @@ #ifndef SAVAGEDD_INC #define SAVAGEDD_INC -#include "context.h" +#include "main/context.h" void savageDDInitDriverFuncs( GLcontext *ctx ); #endif diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c index bea9a3ea53..948ed18419 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.c +++ b/src/mesa/drivers/dri/savage/savageioctl.c @@ -27,14 +27,14 @@ #include <unistd.h> #include <sys/mman.h> -#include "mtypes.h" -#include "macros.h" -#include "dd.h" -#include "context.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/dd.h" +#include "main/context.h" +#include "main/colormac.h" +#include "main/mm.h" #include "swrast/swrast.h" -#include "colormac.h" -#include "mm.h" #include "savagecontext.h" #include "savageioctl.h" #include "savage_bci.h" diff --git a/src/mesa/drivers/dri/savage/savagerender.c b/src/mesa/drivers/dri/savage/savagerender.c index f2f19984b1..32c74f9467 100644 --- a/src/mesa/drivers/dri/savage/savagerender.c +++ b/src/mesa/drivers/dri/savage/savagerender.c @@ -27,11 +27,11 @@ * dma buffers. Use strip/fan hardware primitives where possible. * Simulate missing primitives with indexed vertices. */ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c index 00fd1259fd..9615e34013 100644 --- a/src/mesa/drivers/dri/savage/savagespan.c +++ b/src/mesa/drivers/dri/savage/savagespan.c @@ -22,7 +22,7 @@ * DEALINGS IN THE SOFTWARE. */ -#include "mtypes.h" +#include "main/mtypes.h" #include "savagedd.h" #include "savagespan.h" #include "savageioctl.h" diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index ceef34c03e..73d85ed57b 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -25,12 +25,12 @@ #include <stdio.h> -#include "mtypes.h" -#include "enums.h" -#include "macros.h" -#include "dd.h" +#include "main/mtypes.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/dd.h" -#include "mm.h" +#include "main/mm.h" #include "savagedd.h" #include "savagecontext.h" diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 1d4bfa53ca..a3bebfa8cf 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -28,22 +28,21 @@ #include <GL/gl.h> -#include "mm.h" +#include "main/mm.h" #include "savagecontext.h" #include "savagetex.h" #include "savagetris.h" #include "savageioctl.h" -#include "simple_list.h" -#include "enums.h" +#include "main/simple_list.h" +#include "main/enums.h" #include "savage_bci.h" -#include "macros.h" -#include "texformat.h" -#include "texstore.h" -#include "texobj.h" - -#include "convolve.h" -#include "colormac.h" +#include "main/macros.h" +#include "main/texformat.h" +#include "main/texstore.h" +#include "main/texobj.h" +#include "main/convolve.h" +#include "main/colormac.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/savage/savagetex.h b/src/mesa/drivers/dri/savage/savagetex.h index f1ee722414..e5f8a80f85 100644 --- a/src/mesa/drivers/dri/savage/savagetex.h +++ b/src/mesa/drivers/dri/savage/savagetex.h @@ -26,7 +26,7 @@ #ifndef SAVAGETEX_INC #define SAVAGETEX_INC -#include "mtypes.h" +#include "main/mtypes.h" #include "savagecontext.h" #include "texmem.h" diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c index 39b74285f1..c04763b40e 100644 --- a/src/mesa/drivers/dri/savage/savagetris.c +++ b/src/mesa/drivers/dri/savage/savagetris.c @@ -37,10 +37,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include <stdio.h> #include <math.h> -#include "glheader.h" -#include "mtypes.h" -#include "colormac.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/macros.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/savage/savagetris.h b/src/mesa/drivers/dri/savage/savagetris.h index b2b3d951c6..a2a9375ed5 100644 --- a/src/mesa/drivers/dri/savage/savagetris.h +++ b/src/mesa/drivers/dri/savage/savagetris.h @@ -36,7 +36,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __R128_TRIS_H__ #define __R128_TRIS_H__ -#include "mtypes.h" +#include "main/mtypes.h" extern void savageInitTriFuncs( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/sis/sis6326_clear.c b/src/mesa/drivers/dri/sis/sis6326_clear.c index 48db19566c..d46ecc9cd2 100644 --- a/src/mesa/drivers/dri/sis/sis6326_clear.c +++ b/src/mesa/drivers/dri/sis/sis6326_clear.c @@ -32,7 +32,7 @@ #include "sis_reg.h" #include "swrast/swrast.h" -#include "macros.h" +#include "main/macros.h" static void sis_clear_front_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height); diff --git a/src/mesa/drivers/dri/sis/sis6326_state.c b/src/mesa/drivers/dri/sis/sis6326_state.c index e47e663c35..65d4c06466 100644 --- a/src/mesa/drivers/dri/sis/sis6326_state.c +++ b/src/mesa/drivers/dri/sis/sis6326_state.c @@ -33,9 +33,9 @@ #include "sis_tex.h" #include "sis_reg.h" -#include "context.h" -#include "enums.h" -#include "colormac.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/colormac.h" #include "swrast/swrast.h" #include "vbo/vbo.h" #include "tnl/tnl.h" diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c index 174f3c0768..323383da62 100644 --- a/src/mesa/drivers/dri/sis/sis_clear.c +++ b/src/mesa/drivers/dri/sis/sis_clear.c @@ -36,7 +36,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_lock.h" #include "swrast/swrast.h" -#include "macros.h" +#include "main/macros.h" static GLbitfield sis_3D_Clear( GLcontext * ctx, GLbitfield mask, GLint x, GLint y, GLint width, diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index 04c7464c5e..00d17da3ba 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -42,11 +42,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_tris.h" #include "sis_alloc.h" -#include "imports.h" -#include "matrix.h" -#include "extensions.h" +#include "main/imports.h" +#include "main/matrix.h" +#include "main/extensions.h" #include "utils.h" -#include "framebuffer.h" +#include "main/framebuffer.h" #include "drivers/common/driverfuncs.h" diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h index 895e4ab08d..bc53cb5efa 100644 --- a/src/mesa/drivers/dri/sis/sis_context.h +++ b/src/mesa/drivers/dri/sis/sis_context.h @@ -34,7 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _sis_ctx_h_ #define _sis_ctx_h_ -#include "context.h" +#include "main/context.h" #include "dri_util.h" #include "drm.h" #include "drm_sarea.h" diff --git a/src/mesa/drivers/dri/sis/sis_dd.c b/src/mesa/drivers/dri/sis/sis_dd.c index 989c159a80..bddc4a9285 100644 --- a/src/mesa/drivers/dri/sis/sis_dd.c +++ b/src/mesa/drivers/dri/sis/sis_dd.c @@ -41,8 +41,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_tris.h" #include "swrast/swrast.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "utils.h" diff --git a/src/mesa/drivers/dri/sis/sis_fog.c b/src/mesa/drivers/dri/sis/sis_fog.c index ba5ac90851..517d5722e6 100644 --- a/src/mesa/drivers/dri/sis/sis_fog.c +++ b/src/mesa/drivers/dri/sis/sis_fog.c @@ -35,7 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_state.h" #include "swrast/swrast.h" -#include "macros.h" +#include "main/macros.h" static GLint convertFtToFogFt( GLfloat dwInValue ); static GLint doFPtoFixedNoRound( GLfloat dwInValue, int nFraction ); diff --git a/src/mesa/drivers/dri/sis/sis_lock.c b/src/mesa/drivers/dri/sis/sis_lock.c index 0ea64e3498..806110cad4 100644 --- a/src/mesa/drivers/dri/sis/sis_lock.c +++ b/src/mesa/drivers/dri/sis/sis_lock.c @@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Eric Anholt <anholt@FreeBSD.org> */ -#include "context.h" +#include "main/context.h" #include "sis_context.h" #include "sis_lock.h" #include "sis_dd.h" diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 5888996af9..b1a5d15236 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -30,11 +30,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dri_util.h" -#include "context.h" +#include "main/context.h" #include "utils.h" -#include "imports.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/imports.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "sis_context.h" #include "sis_dri.h" diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c index cb672c2c7c..98e8d02fab 100644 --- a/src/mesa/drivers/dri/sis/sis_state.c +++ b/src/mesa/drivers/dri/sis/sis_state.c @@ -37,9 +37,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_lock.h" #include "sis_tex.h" -#include "context.h" -#include "enums.h" -#include "colormac.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/colormac.h" #include "swrast/swrast.h" #include "vbo/vbo.h" #include "tnl/tnl.h" diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index a98dfa3ec3..28ced6cfd5 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -33,11 +33,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_tex.h" #include "swrast/swrast.h" -#include "imports.h" -#include "texformat.h" -#include "texstore.h" -#include "teximage.h" -#include "texobj.h" +#include "main/imports.h" +#include "main/texformat.h" +#include "main/texstore.h" +#include "main/teximage.h" +#include "main/texobj.h" #include "xmlpool.h" diff --git a/src/mesa/drivers/dri/sis/sis_texstate.c b/src/mesa/drivers/dri/sis/sis_texstate.c index 4f813bb81c..63f23fc014 100644 --- a/src/mesa/drivers/dri/sis/sis_texstate.c +++ b/src/mesa/drivers/dri/sis/sis_texstate.c @@ -31,12 +31,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Eric Anholt <anholt@FreeBSD.org> */ -#include "glheader.h" -#include "imports.h" -#include "colormac.h" -#include "context.h" -#include "macros.h" -#include "texformat.h" +#include "main/glheader.h" +#include "main/imports.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/texformat.h" #include "sis_context.h" #include "sis_state.h" diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c index adbbb8ae13..095941aea2 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.c +++ b/src/mesa/drivers/dri/sis/sis_tris.c @@ -32,10 +32,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Eric Anholt <anholt@FreeBSD.org> */ -#include "glheader.h" -#include "mtypes.h" -#include "colormac.h" -#include "macros.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/macros.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/sis/sis_tris.h b/src/mesa/drivers/dri/sis/sis_tris.h index 7ee276c66e..b34fe8c7c9 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.h +++ b/src/mesa/drivers/dri/sis/sis_tris.h @@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define __SIS_TRIS_H__ #include "sis_lock.h" -#include "mtypes.h" +#include "main/mtypes.h" extern void sisInitTriFuncs( GLcontext *ctx ); extern void sisFlushPrims( sisContextPtr smesa ); diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 304d07729e..49f1b8b9ee 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -31,11 +31,11 @@ * The back-buffer is allocated by the driver and is private. */ -#include "context.h" -#include "extensions.h" -#include "framebuffer.h" -#include "imports.h" -#include "renderbuffer.h" +#include "main/context.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/imports.h" +#include "main/renderbuffer.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" @@ -143,8 +143,8 @@ swrastFillInModes(__DRIscreen *psp, GLX_NONE, GLX_SWAP_UNDEFINED_OML }; - u_int8_t depth_bits_array[4]; - u_int8_t stencil_bits_array[4]; + uint8_t depth_bits_array[4]; + uint8_t stencil_bits_array[4]; depth_bits_array[0] = 0; depth_bits_array[1] = 0; diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h index a614823aa0..a707ffc40a 100644 --- a/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -33,7 +33,7 @@ #include <GL/gl.h> #include <GL/internal/dri_interface.h> -#include "mtypes.h" +#include "main/mtypes.h" /** diff --git a/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/src/mesa/drivers/dri/swrast/swrast_spantemp.h index 187a240ea2..e0cb241429 100644 --- a/src/mesa/drivers/dri/swrast/swrast_spantemp.h +++ b/src/mesa/drivers/dri/swrast/swrast_spantemp.h @@ -110,7 +110,7 @@ GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) * ignored otherwise. */ -#include "macros.h" +#include "main/macros.h" #ifdef CI_MODE diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index b4eea2566f..ef688d103d 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -43,9 +43,9 @@ #include "tdfx_render.h" #include "tdfx_span.h" #include "tdfx_texman.h" -#include "extensions.h" -#include "hash.h" -#include "texobj.h" +#include "main/extensions.h" +#include "main/hash.h" +#include "main/texobj.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.h b/src/mesa/drivers/dri/tdfx/tdfx_context.h index c88a3ef96f..3bcb545119 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.h @@ -44,7 +44,7 @@ #ifdef XFree86Server #include "GL/xf86glx.h" #else -#include "glheader.h" +#include "main/glheader.h" #endif #if defined(__linux__) #include <signal.h> @@ -55,12 +55,12 @@ #include "tdfx_glide.h" #include "xmlconfig.h" -#include "clip.h" -#include "context.h" -#include "macros.h" -#include "matrix.h" -#include "imports.h" -#include "mtypes.h" +#include "main/clip.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/matrix.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "tdfx_screen.h" diff --git a/src/mesa/drivers/dri/tdfx/tdfx_dd.c b/src/mesa/drivers/dri/tdfx/tdfx_dd.c index adbe0c0f33..2cef079515 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_dd.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_dd.c @@ -39,9 +39,9 @@ #include "tdfx_pixels.h" #include "utils.h" -#include "context.h" -#include "enums.h" -#include "framebuffer.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/framebuffer.h" #include "swrast/swrast.h" #if defined(USE_X86_ASM) #include "x86/common_x86_asm.h" diff --git a/src/mesa/drivers/dri/tdfx/tdfx_dd.h b/src/mesa/drivers/dri/tdfx/tdfx_dd.h index bd61e10605..f419c8426a 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_dd.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_dd.h @@ -36,7 +36,7 @@ #ifndef __TDFX_DD_H__ #define __TDFX_DD_H__ -#include "context.h" +#include "main/context.h" extern void tdfxDDInitDriverFuncs( const __GLcontextModes *visual, struct dd_function_table *functions ); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c index b5c01f6ef2..9ab9c05f2b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c @@ -44,7 +44,7 @@ #include "swrast/swrast.h" -#include "image.h" +#include "main/image.h" #define FX_grLfbWriteRegion(fxMesa,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ diff --git a/src/mesa/drivers/dri/tdfx/tdfx_pixels.h b/src/mesa/drivers/dri/tdfx/tdfx_pixels.h index 55f7eedef8..f5e5427653 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_pixels.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_pixels.h @@ -38,7 +38,7 @@ #ifndef __TDFX_PIXELS_H__ #define __TDFX_PIXELS_H__ -#include "context.h" +#include "main/context.h" extern void tdfx_bitmap_R5G6B5( GLcontext *ctx, GLint px, GLint py, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 4e67b5d203..cd22b84951 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -40,8 +40,8 @@ #include "tdfx_span.h" #include "tdfx_tris.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "xmlpool.h" #include "utils.h" @@ -64,6 +64,7 @@ DRI_CONF_END; static const __DRIextension *tdfxExtensions[] = { &driReadDrawableExtension, + NULL }; static const GLuint __driNConfigOptions = 1; @@ -349,12 +350,7 @@ tdfxFillInModes(__DRIscreenPrivate *psp, unsigned stencil_bits, GLboolean have_back_buffer) { - __DRIconfig **configs, **c; - __GLcontextModes *m; - unsigned num_modes; - unsigned vis[2] = { GLX_TRUE_COLOR, GLX_DIRECT_COLOR }; unsigned deep = (depth_bits > 17); - unsigned i, db, depth, accum, stencil; /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy * enough to add support. Basically, if a context is created with an @@ -362,55 +358,32 @@ tdfxFillInModes(__DRIscreenPrivate *psp, * will never be used. */ - num_modes = (depth_bits == 16) ? 32 : 16; - - configs = _mesa_malloc(num_modes * sizeof *configs); - c = configs; - - for (i = 0; i <= 1; i++) { - for (db = 0; db <= 1; db++) { - for (depth = 0; depth <= 1; depth++) { - for (accum = 0; accum <= 1; accum++) { - for (stencil = 0; stencil <= !deep; stencil++) { - *c = _mesa_malloc(sizeof **c); - m = &(*c++)->modes; - if (deep) stencil = depth; - m->redBits = deep ? 8 : 5; - m->greenBits = deep ? 8 : 6; - m->blueBits = deep ? 8 : 5; - m->alphaBits = deep ? 8 : 0; - m->redMask = deep ?0xFF000000 :0x0000F800; - m->greenMask = deep ?0x00FF0000 :0x000007E0; - m->blueMask = deep ?0x0000FF00 :0x0000001F; - m->alphaMask = deep ? 0x000000FF : 0; - m->rgbBits = m->redBits + m->greenBits + - m->blueBits + m->alphaBits; - m->accumRedBits = accum ? 16 : 0; - m->accumGreenBits = accum ? 16 : 0; - m->accumBlueBits = accum ? 16 : 0; - m->accumAlphaBits = (accum && deep) ? 16 : 0; - m->stencilBits = stencil ? 8 : 0; - m->depthBits = deep - ? (depth ? 24 : 0) - : (depth ? 0 : depth_bits); - m->visualType = vis[i]; - m->renderType = GLX_RGBA_BIT; - m->drawableType = GLX_WINDOW_BIT; - m->rgbMode = GL_TRUE; - m->doubleBufferMode = db ? GL_TRUE : GL_FALSE; - if (db) - m->swapMethod = GLX_SWAP_UNDEFINED_OML; - m->visualRating = ((stencil && !deep) || accum) - ? GLX_SLOW_CONFIG - : GLX_NONE; - if (deep) stencil = 0; - } - } - } - } + static const GLenum db_modes[2] = { GLX_NONE, GLX_SWAP_UNDEFINED_OML }; + uint8_t depth_bits_array[4]; + uint8_t stencil_bits_array[4]; + if(deep) { + depth_bits_array[0] = 0; + depth_bits_array[1] = 24; + stencil_bits_array[0] = 0; + stencil_bits_array[1] = 8; + } else { + depth_bits_array[0] = depth_bits; + depth_bits_array[1] = 0; + depth_bits_array[2] = depth_bits; + depth_bits_array[3] = 0; + stencil_bits_array[0] = 0; + stencil_bits_array[1] = 0; + stencil_bits_array[2] = 8; + stencil_bits_array[3] = 8; } - return (const __DRIconfig **) configs; + return driCreateConfigs( + deep ? GL_RGBA : GL_RGB, + deep ? GL_UNSIGNED_INT_8_8_8_8 : GL_UNSIGNED_SHORT_5_6_5, + depth_bits_array, + stencil_bits_array, + deep ? 2 : 4, + db_modes, 2); } /** diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.h b/src/mesa/drivers/dri/tdfx/tdfx_span.h index 5af9f9b301..6973f8d140 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_span.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_span.h @@ -37,7 +37,7 @@ #ifndef __TDFX_SPAN_H__ #define __TDFX_SPAN_H__ -#include "context.h" +#include "main/context.h" #include "drirenderbuffer.h" extern void tdfxDDInitSpanFuncs( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c index 781964e3c6..a2d7bcd97d 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c @@ -38,11 +38,11 @@ * */ -#include "mtypes.h" -#include "colormac.h" -#include "texformat.h" -#include "texstore.h" -#include "teximage.h" +#include "main/mtypes.h" +#include "main/colormac.h" +#include "main/texformat.h" +#include "main/texstore.h" +#include "main/teximage.h" #include "swrast/swrast.h" #include "vbo/vbo.h" diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.h b/src/mesa/drivers/dri/tdfx/tdfx_state.h index 591ea5b083..4880b990fc 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.h @@ -37,7 +37,7 @@ #ifndef __TDFX_STATE_H__ #define __TDFX_STATE_H__ -#include "context.h" +#include "main/context.h" #include "tdfx_context.h" extern void tdfxDDInitStateFuncs( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 70ef726437..1f7257eaea 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -38,14 +38,14 @@ */ -#include "enums.h" -#include "image.h" -#include "mipmap.h" -#include "texcompress.h" -#include "texformat.h" -#include "teximage.h" -#include "texstore.h" -#include "texobj.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/mipmap.h" +#include "main/texcompress.h" +#include "main/texformat.h" +#include "main/teximage.h" +#include "main/texstore.h" +#include "main/texobj.h" #include "tdfx_context.h" #include "tdfx_tex.h" #include "tdfx_texman.h" diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texman.c b/src/mesa/drivers/dri/tdfx/tdfx_texman.c index f9b2726da2..35636ee5ef 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texman.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_texman.c @@ -37,8 +37,8 @@ #include "tdfx_context.h" #include "tdfx_tex.h" #include "tdfx_texman.h" -#include "texobj.h" -#include "hash.h" +#include "main/texobj.h" +#include "main/hash.h" #define BAD_ADDRESS ((FxU32) -1) diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/src/mesa/drivers/dri/tdfx/tdfx_tris.c index 59ff35a7fa..8824988895 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tris.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.c @@ -31,10 +31,10 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/colormac.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.h b/src/mesa/drivers/dri/tdfx/tdfx_tris.h index a591decf1d..ec48a48692 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tris.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.h @@ -33,7 +33,7 @@ #ifndef TDFX_TRIS_INC #define TDFX_TRIS_INC -#include "mtypes.h" +#include "main/mtypes.h" extern void tdfxDDInitTriFuncs( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.c b/src/mesa/drivers/dri/tdfx/tdfx_vb.c index 62885daaa5..4928802232 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vb.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.c @@ -23,11 +23,11 @@ * */ -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/colormac.h" #include "math/m_translate.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.h b/src/mesa/drivers/dri/tdfx/tdfx_vb.h index 6389ec95b1..1e190e85f6 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vb.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.h @@ -26,7 +26,7 @@ #ifndef TDFXVB_INC #define TDFXVB_INC -#include "mtypes.h" +#include "main/mtypes.h" #include "tnl/tnl.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index 2b6d19c4a5..e134cfcf8e 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -35,17 +35,17 @@ #include "tnl/tnl.h" #include "tnl/t_pipeline.h" -#include "context.h" -#include "simple_list.h" -#include "matrix.h" -#include "extensions.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/context.h" +#include "main/simple_list.h" +#include "main/matrix.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #if defined(USE_X86_ASM) #include "x86/common_x86_asm.h" #endif -#include "simple_list.h" -#include "mm.h" +#include "main/simple_list.h" +#include "main/mm.h" #include "drirenderbuffer.h" #include "drivers/common/driverfuncs.h" diff --git a/src/mesa/drivers/dri/trident/trident_context.h b/src/mesa/drivers/dri/trident/trident_context.h index 82b53df884..fbbb4a96e7 100644 --- a/src/mesa/drivers/dri/trident/trident_context.h +++ b/src/mesa/drivers/dri/trident/trident_context.h @@ -28,10 +28,10 @@ #define _TRIDENT_CONTEXT_H_ #include "dri_util.h" -#include "macros.h" -#include "mtypes.h" +#include "main/macros.h" +#include "main/mtypes.h" #include "drm.h" -#include "mm.h" +#include "main/mm.h" #define SUBPIXEL_X (0.0F) #define SUBPIXEL_Y (0.125F) diff --git a/src/mesa/drivers/dri/trident/trident_dd.c b/src/mesa/drivers/dri/trident/trident_dd.c index 4639b3a15e..faa40c36a2 100644 --- a/src/mesa/drivers/dri/trident/trident_dd.c +++ b/src/mesa/drivers/dri/trident/trident_dd.c @@ -31,8 +31,8 @@ #endif #include "swrast/swrast.h" -#include "context.h" -#include "framebuffer.h" +#include "main/context.h" +#include "main/framebuffer.h" #define TRIDENT_DATE "20041223" diff --git a/src/mesa/drivers/dri/trident/trident_state.c b/src/mesa/drivers/dri/trident/trident_state.c index cc2e52ab27..e68d3a73c6 100644 --- a/src/mesa/drivers/dri/trident/trident_state.c +++ b/src/mesa/drivers/dri/trident/trident_state.c @@ -30,7 +30,7 @@ #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" -#include "framebuffer.h" +#include "main/framebuffer.h" #define TRIDENTPACKCOLOR332(r, g, b) \ (((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6)) diff --git a/src/mesa/drivers/dri/trident/trident_vb.c b/src/mesa/drivers/dri/trident/trident_vb.c index 77e4d9b76e..b231f5ef15 100644 --- a/src/mesa/drivers/dri/trident/trident_vb.c +++ b/src/mesa/drivers/dri/trident/trident_vb.c @@ -24,10 +24,10 @@ * Trident CyberBladeXP driver. * */ -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/colormac.h" #include "swrast_setup/swrast_setup.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index ed7001d48d..f5bdb65eb0 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -30,14 +30,14 @@ * \author Others at S3 Graphics? */ -#include "glheader.h" -#include "context.h" -#include "matrix.h" -#include "state.h" -#include "simple_list.h" -#include "extensions.h" -#include "framebuffer.h" -#include "renderbuffer.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/matrix.h" +#include "main/state.h" +#include "main/simple_list.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -59,7 +59,7 @@ #include "via_fb.h" #include <stdio.h> -#include "macros.h" +#include "main/macros.h" #include "drirenderbuffer.h" #define need_GL_ARB_multisample diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index acd6f2e2b1..4cc9e475c2 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -28,9 +28,10 @@ #include "dri_util.h" -#include "mtypes.h" #include "drm.h" -#include "mm.h" + +#include "main/mtypes.h" +#include "main/mm.h" #include "tnl/t_vertex.h" #include "via_screen.h" diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c index 48c7ed4caa..e4fb29f6c6 100644 --- a/src/mesa/drivers/dri/unichrome/via_fb.c +++ b/src/mesa/drivers/dri/unichrome/via_fb.c @@ -28,8 +28,8 @@ #include "via_ioctl.h" #include "via_fb.h" #include "xf86drm.h" -#include "imports.h" -#include "simple_list.h" +#include "main/imports.h" +#include "main/simple_list.h" #include <sys/ioctl.h> GLboolean diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 482a1a63d7..6746f552ae 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -24,13 +24,13 @@ #include <stdio.h> #include <unistd.h> -#include "glheader.h" -#include "mtypes.h" -#include "macros.h" -#include "dd.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/dd.h" #include "swrast/swrast.h" -#include "mm.h" +#include "main/mm.h" #include "via_context.h" #include "via_tris.h" #include "via_ioctl.h" diff --git a/src/mesa/drivers/dri/unichrome/via_render.c b/src/mesa/drivers/dri/unichrome/via_render.c index d7e373d7dd..f676cc13c8 100644 --- a/src/mesa/drivers/dri/unichrome/via_render.c +++ b/src/mesa/drivers/dri/unichrome/via_render.c @@ -28,10 +28,10 @@ * dma buffers. Use strip/fan hardware acceleration where possible. * */ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "mtypes.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/mtypes.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 9c8eb908f1..988f9935ac 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -26,12 +26,12 @@ #include "dri_util.h" #include "utils.h" -#include "glheader.h" -#include "context.h" -#include "framebuffer.h" -#include "renderbuffer.h" -#include "matrix.h" -#include "simple_list.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" +#include "main/matrix.h" +#include "main/simple_list.h" #include "vblank.h" #include "via_state.h" diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c index 15e29c52cd..b908f0fb23 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.c +++ b/src/mesa/drivers/dri/unichrome/via_span.c @@ -22,10 +22,10 @@ * DEALINGS IN THE SOFTWARE. */ -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/colormac.h" #include "via_context.h" #include "via_span.h" #include "via_ioctl.h" diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index 7957003bcb..1cef01ab03 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -24,14 +24,14 @@ #include <stdio.h> -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "colormac.h" -#include "enums.h" -#include "dd.h" - -#include "mm.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/colormac.h" +#include "main/enums.h" +#include "main/dd.h" +#include "main/mm.h" + #include "via_context.h" #include "via_state.h" #include "via_tex.h" diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 15f15a89a6..d2010f0907 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -26,21 +26,21 @@ #include <stdlib.h> #include <stdio.h> -#include "glheader.h" -#include "macros.h" -#include "mtypes.h" -#include "enums.h" -#include "colortab.h" -#include "convolve.h" -#include "context.h" -#include "mipmap.h" -#include "simple_list.h" -#include "texcompress.h" -#include "texformat.h" -#include "texobj.h" -#include "texstore.h" - -#include "mm.h" +#include "main/glheader.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/enums.h" +#include "main/colortab.h" +#include "main/convolve.h" +#include "main/context.h" +#include "main/mipmap.h" +#include "main/simple_list.h" +#include "main/texcompress.h" +#include "main/texformat.h" +#include "main/texobj.h" +#include "main/texstore.h" + +#include "main/mm.h" #include "via_context.h" #include "via_fb.h" #include "via_tex.h" diff --git a/src/mesa/drivers/dri/unichrome/via_tex.h b/src/mesa/drivers/dri/unichrome/via_tex.h index 73cfa91add..25eeee32f3 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.h +++ b/src/mesa/drivers/dri/unichrome/via_tex.h @@ -26,7 +26,7 @@ #ifndef _VIATEX_H #define _VIATEX_H -#include "mtypes.h" +#include "main/mtypes.h" struct via_context; diff --git a/src/mesa/drivers/dri/unichrome/via_texcombine.c b/src/mesa/drivers/dri/unichrome/via_texcombine.c index d604457bfd..b646897848 100644 --- a/src/mesa/drivers/dri/unichrome/via_texcombine.c +++ b/src/mesa/drivers/dri/unichrome/via_texcombine.c @@ -31,11 +31,11 @@ #include <stdio.h> -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "colormac.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/colormac.h" +#include "main/enums.h" #include "via_context.h" #include "via_state.h" diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c index b97dacde24..79e67620c9 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.c +++ b/src/mesa/drivers/dri/unichrome/via_tris.c @@ -25,12 +25,12 @@ #include <stdio.h> #include <math.h> -#include "glheader.h" -#include "context.h" -#include "mtypes.h" -#include "macros.h" -#include "colormac.h" -#include "enums.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/colormac.h" +#include "main/enums.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/unichrome/via_tris.h b/src/mesa/drivers/dri/unichrome/via_tris.h index b4f0880a7a..bc6ef4e4eb 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.h +++ b/src/mesa/drivers/dri/unichrome/via_tris.h @@ -25,7 +25,7 @@ #ifndef _VIATRIS_H #define _VIATRIS_H -#include "mtypes.h" +#include "main/mtypes.h" extern void viaPrintRenderState(const char *msg, GLuint state); extern void viaInitTriFuncs(GLcontext *ctx); diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c index f3da4a5ba2..3c874ba57a 100644 --- a/src/mesa/drivers/fbdev/glfbdev.c +++ b/src/mesa/drivers/fbdev/glfbdev.c @@ -41,19 +41,19 @@ #ifdef USE_GLFBDEV_DRIVER -#include "glheader.h" #include <linux/fb.h> #include "GL/glfbdev.h" -#include "buffers.h" -#include "context.h" -#include "extensions.h" -#include "fbobject.h" -#include "framebuffer.h" -#include "imports.h" -#include "renderbuffer.h" -#include "texformat.h" -#include "teximage.h" -#include "texstore.h" +#include "main/glheader.h" +#include "main/buffers.h" +#include "main/context.h" +#include "main/extensions.h" +#include "main/fbobject.h" +#include "main/framebuffer.h" +#include "main/imports.h" +#include "main/renderbuffer.h" +#include "main/texformat.h" +#include "main/teximage.h" +#include "main/texstore.h" #include "vbo/vbo.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c index 85592d98da..bc08144d66 100644 --- a/src/mesa/drivers/ggi/ggimesa.c +++ b/src/mesa/drivers/ggi/ggimesa.c @@ -29,20 +29,20 @@ #include <ggi/mesa/ggimesa_int.h> #include <ggi/mesa/debug.h> -#include "extensions.h" -#include "buffers.h" -#include "colormac.h" -#include "imports.h" -#include "matrix.h" +#include "main/extensions.h" +#include "main/buffers.h" +#include "main/colormac.h" +#include "main/imports.h" +#include "main/matrix.h" +#include "main/teximage.h" +#include "main/texformat.h" +#include "main/texstore.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "vbo/vbo.h" -#include "teximage.h" -#include "texformat.h" -#include "texstore.h" /* We use LibGG to manage config files */ #include <ggi/gg.h> diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c index 00b9d29fac..b7708fd636 100644 --- a/src/mesa/drivers/glide/fxapi.c +++ b/src/mesa/drivers/glide/fxapi.c @@ -43,7 +43,7 @@ #include "fxdrv.h" #include "drivers/common/driverfuncs.h" -#include "framebuffer.h" +#include "main/framebuffer.h" #ifndef TDFX_DEBUG int TDFX_DEBUG = (0 diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index c082fd827f..213ef2382f 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -40,15 +40,15 @@ #if defined(FX) -#include "image.h" -#include "mtypes.h" +#include "main/image.h" +#include "main/mtypes.h" #include "fxdrv.h" -#include "buffers.h" -#include "enums.h" -#include "extensions.h" -#include "macros.h" -#include "texstore.h" -#include "teximage.h" +#include "main/buffers.h" +#include "main/enums.h" +#include "main/extensions.h" +#include "main/macros.h" +#include "main/texstore.h" +#include "main/teximage.h" #include "swrast/swrast.h" #include "swrast/s_context.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index cb2c8554b1..f3cd908181 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -39,13 +39,13 @@ #if defined(FX) #include "fxdrv.h" -#include "enums.h" -#include "image.h" -#include "teximage.h" -#include "texformat.h" -#include "texcompress.h" -#include "texobj.h" -#include "texstore.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/teximage.h" +#include "main/texformat.h" +#include "main/texcompress.h" +#include "main/texobj.h" +#include "main/texstore.h" /* no borders! can't halve 1x1! (stride > width * comp) not allowed */ diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h index dc19a912da..bee10de2f4 100644 --- a/src/mesa/drivers/glide/fxdrv.h +++ b/src/mesa/drivers/glide/fxdrv.h @@ -48,11 +48,11 @@ #include <signal.h> #endif -#include "context.h" -#include "imports.h" -#include "macros.h" -#include "matrix.h" -#include "mtypes.h" +#include "main/context.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/matrix.h" +#include "main/mtypes.h" #include "GL/fxmesa.h" #include "fxglidew.h" diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index 240e5e0b59..d48726a62a 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -41,11 +41,11 @@ #if defined(FX) #include "fxdrv.h" -#include "enums.h" -#include "tnl.h" +#include "main/enums.h" +#include "main/texstore.h" +#include "tnl/tnl.h" #include "tnl/t_context.h" -#include "swrast.h" -#include "texstore.h" +#include "swrast/swrast.h" static void diff --git a/src/mesa/drivers/glide/fxtris.c b/src/mesa/drivers/glide/fxtris.c index 0b9b3be582..aff91fe7d4 100644 --- a/src/mesa/drivers/glide/fxtris.c +++ b/src/mesa/drivers/glide/fxtris.c @@ -31,10 +31,10 @@ #ifdef FX -#include "imports.h" -#include "mtypes.h" -#include "macros.h" -#include "colormac.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/colormac.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/t_context.h" diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c index 34ada61f4e..1dc5f9891a 100644 --- a/src/mesa/drivers/glide/fxvb.c +++ b/src/mesa/drivers/glide/fxvb.c @@ -34,11 +34,11 @@ #ifdef FX -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/colormac.h" #include "math/m_translate.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/glslcompiler/glslcompiler.c b/src/mesa/drivers/glslcompiler/glslcompiler.c index 016b53d57a..62a366858c 100644 --- a/src/mesa/drivers/glslcompiler/glslcompiler.c +++ b/src/mesa/drivers/glslcompiler/glslcompiler.c @@ -45,11 +45,11 @@ */ -#include "imports.h" -#include "context.h" -#include "extensions.h" -#include "framebuffer.h" -#include "shaders.h" +#include "main/imports.h" +#include "main/context.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/shaders.h" #include "shader/shader_api.h" #include "shader/prog_print.h" #include "drivers/common/driverfuncs.h" diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c index 1e4e185d65..5afa8e188b 100644 --- a/src/mesa/drivers/svga/svgamesa.c +++ b/src/mesa/drivers/svga/svgamesa.c @@ -38,12 +38,12 @@ #include <string.h> #include <vga.h> #include "GL/svgamesa.h" -#include "buffers.h" -#include "context.h" -#include "extensions.h" -#include "imports.h" -#include "matrix.h" -#include "mtypes.h" +#include "main/buffers.h" +#include "main/context.h" +#include "main/extensions.h" +#include "main/imports.h" +#include "main/matrix.h" +#include "main/mtypes.h" #include "swrast/swrast.h" #include "svgapix.h" #include "svgamesa8.h" diff --git a/src/mesa/drivers/svga/svgapix.h b/src/mesa/drivers/svga/svgapix.h index 19cb74487d..c8cee37ca6 100644 --- a/src/mesa/drivers/svga/svgapix.h +++ b/src/mesa/drivers/svga/svgapix.h @@ -32,8 +32,8 @@ #include "GL/gl.h" #include "GL/svgamesa.h" -#include "context.h" -#include "colormac.h" +#include "main/context.h" +#include "main/colormac.h" #include "vga.h" struct svgamesa_context { diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index e5cd8f0b80..827d39f995 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -43,12 +43,12 @@ #include "glxheader.h" #include "glxapi.h" #include "GL/xmesa.h" -#include "context.h" -#include "config.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" -#include "version.h" +#include "main/context.h" +#include "main/config.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/version.h" #include "xfonts.h" #include "xmesaP.h" diff --git a/src/mesa/drivers/x11/glxheader.h b/src/mesa/drivers/x11/glxheader.h index 15e8390583..d88afba20e 100644 --- a/src/mesa/drivers/x11/glxheader.h +++ b/src/mesa/drivers/x11/glxheader.h @@ -30,7 +30,7 @@ #include <GL/vms_x_fix.h> #endif -#include "glheader.h" +#include "main/glheader.h" #ifdef XFree86Server diff --git a/src/mesa/drivers/x11/xfonts.c b/src/mesa/drivers/x11/xfonts.c index d72c600bd1..f732c94586 100644 --- a/src/mesa/drivers/x11/xfonts.c +++ b/src/mesa/drivers/x11/xfonts.c @@ -33,8 +33,8 @@ #endif #include "glxheader.h" -#include "context.h" -#include "imports.h" +#include "main/context.h" +#include "main/imports.h" #include "xfonts.h" diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 2eb88c1557..c9009bad03 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -68,26 +68,19 @@ #include "main/context.h" #include "main/extensions.h" #include "main/framebuffer.h" -#include "glapi/glthread.h" #include "main/imports.h" #include "main/macros.h" #include "main/renderbuffer.h" #include "main/teximage.h" +#include "glapi/glthread.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "vbo/vbo.h" -#if 0 #include "tnl/tnl.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" -#endif #include "drivers/common/driverfuncs.h" -#include "state_tracker/st_public.h" -#include "state_tracker/st_context.h" -#include "softpipe/sp_context.h" -#include "pipe/p_defines.h" - /** * Global X driver lock */ @@ -388,7 +381,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, /* * Front renderbuffer */ - b->frontxrb = xmesa_create_renderbuffer(NULL, 0, &vis->mesa_visual, GL_FALSE); + b->frontxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_FALSE); if (!b->frontxrb) { _mesa_free(b); return NULL; @@ -397,13 +390,13 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, b->frontxrb->drawable = d; b->frontxrb->pixmap = (XMesaPixmap) d; _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_FRONT_LEFT, - &b->frontxrb->St.Base); + &b->frontxrb->Base); /* * Back renderbuffer */ if (vis->mesa_visual.doubleBufferMode) { - b->backxrb = xmesa_create_renderbuffer(NULL, 0, &vis->mesa_visual, GL_TRUE); + b->backxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_TRUE); if (!b->backxrb) { /* XXX free front xrb too */ _mesa_free(b); @@ -414,7 +407,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, b->db_mode = vis->ximage_flag ? BACK_XIMAGE : BACK_PIXMAP; _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_BACK_LEFT, - &b->backxrb->St.Base); + &b->backxrb->Base); } /* @@ -432,43 +425,14 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, b->swAlpha = GL_FALSE; } - if (vis->mesa_visual.depthBits > 0 && - vis->mesa_visual.stencilBits > 0) { - /* combined depth/stencil */ - struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(GL_DEPTH24_STENCIL8_EXT); - _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_DEPTH, rb); - _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_STENCIL, rb); - } - else { - if (vis->mesa_visual.depthBits > 0) { - struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(GL_DEPTH_COMPONENT32); - _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_DEPTH, rb); - } - - if (vis->mesa_visual.stencilBits > 0) { - struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(GL_STENCIL_INDEX8_EXT); - _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_STENCIL, rb); - } - } - - if (vis->mesa_visual.accumRedBits > 0) { - struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(GL_RGBA16); - _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_ACCUM, rb); - } - - /* * Other renderbuffer (depth, stencil, etc) */ _mesa_add_soft_renderbuffers(&b->mesa_buffer, - GL_FALSE, /* color */ - GL_FALSE, /*vis->mesa_visual.haveDepthBuffer,*/ - GL_FALSE, /* stencil */ - GL_FALSE, /* accum */ + GL_FALSE, /* color */ + vis->mesa_visual.haveDepthBuffer, + vis->mesa_visual.haveStencilBuffer, + vis->mesa_visual.haveAccumBuffer, b->swAlpha, vis->mesa_visual.numAuxBuffers > 0 ); @@ -1599,9 +1563,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) XMesaContext c; GLcontext *mesaCtx; struct dd_function_table functions; -#if 0 TNLcontext *tnl; -#endif if (firstTime) { _glthread_INIT_MUTEX(_xmesa_lock); @@ -1618,15 +1580,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) /* initialize with default driver functions, then plug in XMesa funcs */ _mesa_init_driver_functions(&functions); xmesa_init_driver_functions(v, &functions); - st_init_driver_functions(&functions); - - /* override st's function */ - functions.UpdateState = xmesa_update_state; - - /* - functions.NewRenderbuffer = xmesa_new_renderbuffer; - */ - if (!_mesa_initialize_context(mesaCtx, &v->mesa_visual, share_list ? &(share_list->mesa) : (GLcontext *) NULL, &functions, (void *) c)) { @@ -1667,49 +1620,22 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) /* Initialize the software rasterizer and helper modules. */ - if (!_swrast_CreateContext( mesaCtx ) -#if 0 - || !_vbo_CreateContext( mesaCtx ) || + if (!_swrast_CreateContext( mesaCtx ) || + !_vbo_CreateContext( mesaCtx ) || !_tnl_CreateContext( mesaCtx ) || - !_swsetup_CreateContext( mesaCtx ) -#endif - ) { + !_swsetup_CreateContext( mesaCtx )) { _mesa_free_context_data(&c->mesa); _mesa_free(c); return NULL; } -#if 0 /* tnl setup */ tnl = TNL_CONTEXT(mesaCtx); tnl->Driver.RunPipeline = _tnl_run_pipeline; -#endif - /* swrast setup */ xmesa_register_swrast_functions( mesaCtx ); - - - st_create_context( mesaCtx, - xmesa_create_softpipe( c ) ); - - _swsetup_CreateContext( mesaCtx ); _swsetup_Wakeup(mesaCtx); - /* override these functions, as if the xlib driver were derived from - * the softpipe driver. - */ -#if 0 - mesaCtx->st->pipe->surface_alloc = xmesa_surface_alloc; -#endif - mesaCtx->st->pipe->is_format_supported = xmesa_is_format_supported; - mesaCtx->st->pipe->get_tile_rgba = xmesa_get_tile_rgba; - mesaCtx->st->pipe->put_tile_rgba = xmesa_put_tile_rgba; - - mesaCtx->st->haveFramebufferRegions = GL_FALSE; - - /* special pipe->clear function */ - mesaCtx->st->pipe->clear = xmesa_clear; - return c; } @@ -1726,10 +1652,8 @@ void XMesaDestroyContext( XMesaContext c ) _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); -#if 0 _tnl_DestroyContext( mesaCtx ); _vbo_DestroyContext( mesaCtx ); -#endif _mesa_free_context_data( mesaCtx ); _mesa_free( c ); } diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 09356c7329..f104d44d05 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -32,13 +32,9 @@ #include "glxheader.h" #include "GL/xmesa.h" #include "xmesaP.h" -#include "imports.h" -#include "framebuffer.h" -#include "renderbuffer.h" -#include "pipe/p_state.h" -#include "pipe/p_defines.h" -#include "pipe/p_winsys.h" -#include "state_tracker/st_context.h" +#include "main/imports.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #if defined(USE_XSHM) && !defined(XFree86Server) @@ -249,18 +245,6 @@ xmesa_delete_renderbuffer(struct gl_renderbuffer *rb) } -static void -finish_surface_init(GLcontext *ctx, struct xmesa_renderbuffer *xrb) -{ - struct pipe_context *pipe = ctx->st->pipe; - if (!xrb->St.surface->region) { - int w = 1, h = 1; - xrb->St.surface->region = pipe->winsys->region_alloc(pipe->winsys, - 1, w, h, 0x0); - } -} - - /** * Reallocate renderbuffer storage for front color buffer. * Called via gl_renderbuffer::AllocStorage() @@ -284,12 +268,6 @@ xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->Height = height; rb->InternalFormat = internalFormat; - if (!xrb->St.surface || !xrb->St.surface->region) - finish_surface_init(ctx, xrb); - - xrb->St.surface->width = width; - xrb->St.surface->height = height; - return GL_TRUE; } @@ -339,103 +317,46 @@ xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, xrb->origin4 = NULL; } - if (!xrb->St.surface || !xrb->St.surface->region) - finish_surface_init(ctx, xrb); - - xrb->St.surface->width = width; - xrb->St.surface->height = height; - return GL_TRUE; } -/** - * Called to create the front/back color renderbuffers, not user-created - * renderbuffers. - */ struct xmesa_renderbuffer * -xmesa_create_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, - GLboolean backBuffer) +xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, + GLboolean backBuffer) { struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer); - struct pipe_context *pipe = NULL;/*ctx->st->pipe;*/ if (xrb) { GLuint name = 0; - GLuint pipeFormat = 0; - struct xmesa_surface *xms; - - _mesa_init_renderbuffer(&xrb->St.Base, name); + _mesa_init_renderbuffer(&xrb->Base, name); - xrb->St.Base.Delete = xmesa_delete_renderbuffer; + xrb->Base.Delete = xmesa_delete_renderbuffer; if (backBuffer) - xrb->St.Base.AllocStorage = xmesa_alloc_back_storage; + xrb->Base.AllocStorage = xmesa_alloc_back_storage; else - xrb->St.Base.AllocStorage = xmesa_alloc_front_storage; + xrb->Base.AllocStorage = xmesa_alloc_front_storage; if (visual->rgbMode) { - xrb->St.Base.InternalFormat = GL_RGBA; - xrb->St.Base._BaseFormat = GL_RGBA; - xrb->St.Base.DataType = GL_UNSIGNED_BYTE; - xrb->St.Base.RedBits = visual->redBits; - xrb->St.Base.GreenBits = visual->greenBits; - xrb->St.Base.BlueBits = visual->blueBits; - xrb->St.Base.AlphaBits = visual->alphaBits; - pipeFormat = PIPE_FORMAT_U_A8_R8_G8_B8; + xrb->Base.InternalFormat = GL_RGBA; + xrb->Base._BaseFormat = GL_RGBA; + xrb->Base.DataType = GL_UNSIGNED_BYTE; + xrb->Base.RedBits = visual->redBits; + xrb->Base.GreenBits = visual->greenBits; + xrb->Base.BlueBits = visual->blueBits; + xrb->Base.AlphaBits = visual->alphaBits; } else { - xrb->St.Base.InternalFormat = GL_COLOR_INDEX; - xrb->St.Base._BaseFormat = GL_COLOR_INDEX; - xrb->St.Base.DataType = GL_UNSIGNED_INT; - xrb->St.Base.IndexBits = visual->indexBits; + xrb->Base.InternalFormat = GL_COLOR_INDEX; + xrb->Base._BaseFormat = GL_COLOR_INDEX; + xrb->Base.DataType = GL_UNSIGNED_INT; + xrb->Base.IndexBits = visual->indexBits; } /* only need to set Red/Green/EtcBits fields for user-created RBs */ - - xrb->St.surface = xmesa_new_color_surface(pipe, pipeFormat); - xms = (struct xmesa_surface *) xrb->St.surface; - xms->xrb = xrb; } return xrb; } -#if 0 -struct gl_renderbuffer * -xmesa_new_renderbuffer(GLcontext *ctx, struct gl_renderbuffer *rb, - GLenum internalFormat, GLuint width, GLuint height) -{ - struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer); - if (xrb) { - GLuint name = 0; - _mesa_init_renderbuffer(&xrb->St.Base, name); - - xrb->St.Base.Delete = xmesa_delete_renderbuffer; - if (backBuffer) - xrb->St.Base.AllocStorage = xmesa_alloc_back_storage; - else - xrb->St.Base.AllocStorage = xmesa_alloc_front_storage; - - if (visual->rgbMode) { - xrb->St.Base.InternalFormat = GL_RGBA; - xrb->St.Base._BaseFormat = GL_RGBA; - xrb->St.Base.DataType = GL_UNSIGNED_BYTE; - xrb->St.Base.RedBits = visual->redBits; - xrb->St.Base.GreenBits = visual->greenBits; - xrb->St.Base.BlueBits = visual->blueBits; - xrb->St.Base.AlphaBits = visual->alphaBits; - } - else { - xrb->St.Base.InternalFormat = GL_COLOR_INDEX; - xrb->St.Base._BaseFormat = GL_COLOR_INDEX; - xrb->St.Base.DataType = GL_UNSIGNED_INT; - xrb->St.Base.IndexBits = visual->indexBits; - } - /* only need to set Red/Green/EtcBits fields for user-created RBs */ - } - return xrb; -} -#endif - - /** * Called via gl_framebuffer::Delete() method when this buffer * is _really_ being deleted. diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index ec094b6021..305df548fa 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -29,34 +29,30 @@ */ #include "glxheader.h" -#include "bufferobj.h" -#include "buffers.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "drawpix.h" -#include "extensions.h" -#include "framebuffer.h" -#include "macros.h" -#include "image.h" -#include "imports.h" -#include "mtypes.h" -#include "state.h" -#include "texobj.h" -#include "teximage.h" -#include "texstore.h" -#include "texformat.h" -#include "xmesaP.h" +#include "main/bufferobj.h" +#include "main/buffers.h" +#include "main/context.h" +#include "main/colormac.h" +#include "main/depth.h" +#include "main/drawpix.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/macros.h" +#include "main/image.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/state.h" +#include "main/texobj.h" +#include "main/teximage.h" +#include "main/texstore.h" +#include "main/texformat.h" #include "swrast/swrast.h" #include "swrast/s_context.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" #include "tnl/t_context.h" +#include "xmesaP.h" -#include "softpipe/sp_context.h" -#include "state_tracker/st_public.h" -#include "state_tracker/st_context.h" -#include "state_tracker/st_draw.h" /* @@ -222,7 +218,7 @@ clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb, assert(xmbuf->cleargc); XMesaFillRectangle( xmesa->display, xrb->pixmap, xmbuf->cleargc, - x, xrb->St.Base.Height - y - height, + x, xrb->Base.Height - y - height, width, height ); } @@ -333,9 +329,9 @@ clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, | ((pixel << 24) & 0xff000000); } - if (width == xrb->St.Base.Width && height == xrb->St.Base.Height) { + if (width == xrb->Base.Width && height == xrb->Base.Height) { /* clearing whole buffer */ - const GLuint n = xrb->St.Base.Width * xrb->St.Base.Height; + const GLuint n = xrb->Base.Width * xrb->Base.Height; GLuint *ptr4 = (GLuint *) xrb->ximage->data; if (pixel == 0) { /* common case */ @@ -379,8 +375,8 @@ clear_nbit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, -void -xmesa_clear_buffers(GLcontext *ctx, GLbitfield buffers) +static void +clear_buffers(GLcontext *ctx, GLbitfield buffers) { if (ctx->DrawBuffer->Name == 0) { /* this is a window system framebuffer */ @@ -783,7 +779,7 @@ get_string( GLcontext *ctx, GLenum name ) #ifdef XFree86Server return (const GLubyte *) "Mesa GLX Indirect"; #else - return (const GLubyte *) "Mesa X11 (softpipe)"; + return (const GLubyte *) "Mesa X11"; #endif case GL_VENDOR: #ifdef XFree86Server @@ -910,9 +906,6 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) _vbo_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); - st_invalidate_state( ctx, new_state ); - - if (ctx->DrawBuffer->Name != 0) return; @@ -920,7 +913,7 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) * GL_DITHER, GL_READ/DRAW_BUFFER, buffer binding state, etc. effect * renderbuffer span/clear funcs. */ - if (new_state & (_NEW_COLOR | _NEW_BUFFERS)) { + if (new_state & (_NEW_COLOR | _NEW_PIXEL | _NEW_BUFFERS)) { XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); struct xmesa_renderbuffer *front_xrb, *back_xrb; @@ -1153,7 +1146,7 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, driver->IndexMask = index_mask; driver->ColorMask = color_mask; driver->Enable = enable; - driver->Clear = xmesa_clear_buffers; + driver->Clear = clear_buffers; driver->Viewport = xmesa_viewport; #ifndef XFree86Server driver->CopyPixels = xmesa_CopyPixels; @@ -1178,7 +1171,6 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, driver->BeginQuery = xmesa_begin_query; driver->EndQuery = xmesa_end_query; #endif - } diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index 9833b4c9f0..f643b6d3a7 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -31,9 +31,9 @@ #include "glxheader.h" -#include "depth.h" -#include "macros.h" -#include "mtypes.h" +#include "main/depth.h" +#include "main/macros.h" +#include "main/mtypes.h" #include "xmesaP.h" /* Internal swrast includes: diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index ce54a18a27..57b5749448 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -23,15 +23,15 @@ */ #include "glxheader.h" -#include "colormac.h" -#include "context.h" -#include "depth.h" -#include "drawpix.h" -#include "extensions.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" -#include "state.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/depth.h" +#include "main/drawpix.h" +#include "main/extensions.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/state.h" #include "xmesaP.h" #include "swrast/swrast.h" @@ -1303,17 +1303,6 @@ static void put_row_rgb_TRUEDITHER_ximage( RGB_SPAN_ARGS ) } - -static void *get_pointer_4_ximage( GLcontext *ctx, - struct gl_renderbuffer *rb, - GLint x, GLint y ) -{ - GET_XRB(xrb); - return PIXEL_ADDR4(xrb, x, y); -} - - - /* * Write a span of PF_8A8B8G8R-format pixels to an ximage. */ @@ -4539,260 +4528,257 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, enum pixel_format pixelformat, GLint depth) { const GLboolean pixmap = xrb->pixmap ? GL_TRUE : GL_FALSE; - struct gl_renderbuffer *rb = &xrb->St.Base; switch (pixelformat) { case PF_Index: - ASSERT(rb->DataType == GL_UNSIGNED_INT); + ASSERT(xrb->Base.DataType == GL_UNSIGNED_INT); if (pixmap) { - rb->PutRow = put_row_ci_pixmap; - rb->PutRowRGB = NULL; - rb->PutMonoRow = put_mono_row_ci_pixmap; - rb->PutValues = put_values_ci_pixmap; - rb->PutMonoValues = put_mono_values_ci_pixmap; + xrb->Base.PutRow = put_row_ci_pixmap; + xrb->Base.PutRowRGB = NULL; + xrb->Base.PutMonoRow = put_mono_row_ci_pixmap; + xrb->Base.PutValues = put_values_ci_pixmap; + xrb->Base.PutMonoValues = put_mono_values_ci_pixmap; } else { - rb->PutRow = put_row_ci_ximage; - rb->PutRowRGB = NULL; - rb->PutMonoRow = put_mono_row_ci_ximage; - rb->PutValues = put_values_ci_ximage; - rb->PutMonoValues = put_mono_values_ci_ximage; + xrb->Base.PutRow = put_row_ci_ximage; + xrb->Base.PutRowRGB = NULL; + xrb->Base.PutMonoRow = put_mono_row_ci_ximage; + xrb->Base.PutValues = put_values_ci_ximage; + xrb->Base.PutMonoValues = put_mono_values_ci_ximage; } break; case PF_Truecolor: if (pixmap) { - rb->PutRow = put_row_TRUECOLOR_pixmap; - rb->PutRowRGB = put_row_rgb_TRUECOLOR_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_TRUECOLOR_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_TRUECOLOR_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_TRUECOLOR_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_TRUECOLOR_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_TRUECOLOR_ximage; - rb->PutRowRGB = put_row_rgb_TRUECOLOR_ximage; - rb->PutMonoRow = put_mono_row_ximage; - rb->PutValues = put_values_TRUECOLOR_ximage; - rb->PutMonoValues = put_mono_values_ximage; + xrb->Base.PutRow = put_row_TRUECOLOR_ximage; + xrb->Base.PutRowRGB = put_row_rgb_TRUECOLOR_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_TRUECOLOR_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; } break; case PF_Dither_True: if (pixmap) { - rb->PutRow = put_row_TRUEDITHER_pixmap; - rb->PutRowRGB = put_row_rgb_TRUEDITHER_pixmap; - rb->PutMonoRow = put_mono_row_TRUEDITHER_pixmap; - rb->PutValues = put_values_TRUEDITHER_pixmap; - rb->PutMonoValues = put_mono_values_TRUEDITHER_pixmap; + xrb->Base.PutRow = put_row_TRUEDITHER_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_TRUEDITHER_pixmap; + xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_pixmap; + xrb->Base.PutValues = put_values_TRUEDITHER_pixmap; + xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_pixmap; } else { - rb->PutRow = put_row_TRUEDITHER_ximage; - rb->PutRowRGB = put_row_rgb_TRUEDITHER_ximage; - rb->PutMonoRow = put_mono_row_TRUEDITHER_ximage; - rb->PutValues = put_values_TRUEDITHER_ximage; - rb->PutMonoValues = put_mono_values_TRUEDITHER_ximage; + xrb->Base.PutRow = put_row_TRUEDITHER_ximage; + xrb->Base.PutRowRGB = put_row_rgb_TRUEDITHER_ximage; + xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_ximage; + xrb->Base.PutValues = put_values_TRUEDITHER_ximage; + xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_ximage; } break; case PF_8A8B8G8R: if (pixmap) { - rb->PutRow = put_row_8A8B8G8R_pixmap; - rb->PutRowRGB = put_row_rgb_8A8B8G8R_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_8A8B8G8R_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_8A8B8G8R_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8A8B8G8R_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8A8B8G8R_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_8A8B8G8R_ximage; - rb->PutRowRGB = put_row_rgb_8A8B8G8R_ximage; - rb->PutMonoRow = put_mono_row_8A8B8G8R_ximage; - rb->PutValues = put_values_8A8B8G8R_ximage; - rb->PutMonoValues = put_mono_values_8A8B8G8R_ximage; - rb->GetPointer = get_pointer_4_ximage; + xrb->Base.PutRow = put_row_8A8B8G8R_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8A8B8G8R_ximage; + xrb->Base.PutMonoRow = put_mono_row_8A8B8G8R_ximage; + xrb->Base.PutValues = put_values_8A8B8G8R_ximage; + xrb->Base.PutMonoValues = put_mono_values_8A8B8G8R_ximage; } break; case PF_8A8R8G8B: if (pixmap) { - rb->PutRow = put_row_8A8R8G8B_pixmap; - rb->PutRowRGB = put_row_rgb_8A8R8G8B_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_8A8R8G8B_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_8A8R8G8B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8A8R8G8B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8A8R8G8B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_8A8R8G8B_ximage; - rb->PutRowRGB = put_row_rgb_8A8R8G8B_ximage; - rb->PutMonoRow = put_mono_row_8A8R8G8B_ximage; - rb->PutValues = put_values_8A8R8G8B_ximage; - rb->PutMonoValues = put_mono_values_8A8R8G8B_ximage; - rb->GetPointer = get_pointer_4_ximage; + xrb->Base.PutRow = put_row_8A8R8G8B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8A8R8G8B_ximage; + xrb->Base.PutMonoRow = put_mono_row_8A8R8G8B_ximage; + xrb->Base.PutValues = put_values_8A8R8G8B_ximage; + xrb->Base.PutMonoValues = put_mono_values_8A8R8G8B_ximage; } break; case PF_8R8G8B: if (pixmap) { - rb->PutRow = put_row_8R8G8B_pixmap; - rb->PutRowRGB = put_row_rgb_8R8G8B_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_8R8G8B_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_8R8G8B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8R8G8B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_8R8G8B_ximage; - rb->PutRowRGB = put_row_rgb_8R8G8B_ximage; - rb->PutMonoRow = put_mono_row_8R8G8B_ximage; - rb->PutValues = put_values_8R8G8B_ximage; - rb->PutMonoValues = put_mono_values_8R8G8B_ximage; + xrb->Base.PutRow = put_row_8R8G8B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B_ximage; + xrb->Base.PutMonoRow = put_mono_row_8R8G8B_ximage; + xrb->Base.PutValues = put_values_8R8G8B_ximage; + xrb->Base.PutMonoValues = put_mono_values_8R8G8B_ximage; } break; case PF_8R8G8B24: if (pixmap) { - rb->PutRow = put_row_8R8G8B24_pixmap; - rb->PutRowRGB = put_row_rgb_8R8G8B24_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_8R8G8B24_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_8R8G8B24_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B24_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8R8G8B24_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_8R8G8B24_ximage; - rb->PutRowRGB = put_row_rgb_8R8G8B24_ximage; - rb->PutMonoRow = put_mono_row_8R8G8B24_ximage; - rb->PutValues = put_values_8R8G8B24_ximage; - rb->PutMonoValues = put_mono_values_8R8G8B24_ximage; + xrb->Base.PutRow = put_row_8R8G8B24_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B24_ximage; + xrb->Base.PutMonoRow = put_mono_row_8R8G8B24_ximage; + xrb->Base.PutValues = put_values_8R8G8B24_ximage; + xrb->Base.PutMonoValues = put_mono_values_8R8G8B24_ximage; } break; case PF_5R6G5B: if (pixmap) { - rb->PutRow = put_row_5R6G5B_pixmap; - rb->PutRowRGB = put_row_rgb_5R6G5B_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_5R6G5B_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_5R6G5B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_5R6G5B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_5R6G5B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_5R6G5B_ximage; - rb->PutRowRGB = put_row_rgb_5R6G5B_ximage; - rb->PutMonoRow = put_mono_row_ximage; - rb->PutValues = put_values_5R6G5B_ximage; - rb->PutMonoValues = put_mono_values_ximage; + xrb->Base.PutRow = put_row_5R6G5B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_5R6G5B_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_5R6G5B_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; } break; case PF_Dither_5R6G5B: if (pixmap) { - rb->PutRow = put_row_DITHER_5R6G5B_pixmap; - rb->PutRowRGB = put_row_rgb_DITHER_5R6G5B_pixmap; - rb->PutMonoRow = put_mono_row_TRUEDITHER_pixmap; - rb->PutValues = put_values_DITHER_5R6G5B_pixmap; - rb->PutMonoValues = put_mono_values_TRUEDITHER_pixmap; + xrb->Base.PutRow = put_row_DITHER_5R6G5B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_5R6G5B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_pixmap; + xrb->Base.PutValues = put_values_DITHER_5R6G5B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_pixmap; } else { - rb->PutRow = put_row_DITHER_5R6G5B_ximage; - rb->PutRowRGB = put_row_rgb_DITHER_5R6G5B_ximage; - rb->PutMonoRow = put_mono_row_DITHER_5R6G5B_ximage; - rb->PutValues = put_values_DITHER_5R6G5B_ximage; - rb->PutMonoValues = put_mono_values_DITHER_5R6G5B_ximage; + xrb->Base.PutRow = put_row_DITHER_5R6G5B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_5R6G5B_ximage; + xrb->Base.PutMonoRow = put_mono_row_DITHER_5R6G5B_ximage; + xrb->Base.PutValues = put_values_DITHER_5R6G5B_ximage; + xrb->Base.PutMonoValues = put_mono_values_DITHER_5R6G5B_ximage; } break; case PF_Dither: if (pixmap) { - rb->PutRow = put_row_DITHER_pixmap; - rb->PutRowRGB = put_row_rgb_DITHER_pixmap; - rb->PutMonoRow = put_mono_row_DITHER_pixmap; - rb->PutValues = put_values_DITHER_pixmap; - rb->PutMonoValues = put_mono_values_DITHER_pixmap; + xrb->Base.PutRow = put_row_DITHER_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_pixmap; + xrb->Base.PutMonoRow = put_mono_row_DITHER_pixmap; + xrb->Base.PutValues = put_values_DITHER_pixmap; + xrb->Base.PutMonoValues = put_mono_values_DITHER_pixmap; } else { if (depth == 8) { - rb->PutRow = put_row_DITHER8_ximage; - rb->PutRowRGB = put_row_rgb_DITHER8_ximage; - rb->PutMonoRow = put_mono_row_DITHER8_ximage; - rb->PutValues = put_values_DITHER8_ximage; - rb->PutMonoValues = put_mono_values_DITHER8_ximage; + xrb->Base.PutRow = put_row_DITHER8_ximage; + xrb->Base.PutRowRGB = put_row_rgb_DITHER8_ximage; + xrb->Base.PutMonoRow = put_mono_row_DITHER8_ximage; + xrb->Base.PutValues = put_values_DITHER8_ximage; + xrb->Base.PutMonoValues = put_mono_values_DITHER8_ximage; } else { - rb->PutRow = put_row_DITHER_ximage; - rb->PutRowRGB = put_row_rgb_DITHER_ximage; - rb->PutMonoRow = put_mono_row_DITHER_ximage; - rb->PutValues = put_values_DITHER_ximage; - rb->PutMonoValues = put_mono_values_DITHER_ximage; + xrb->Base.PutRow = put_row_DITHER_ximage; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_ximage; + xrb->Base.PutMonoRow = put_mono_row_DITHER_ximage; + xrb->Base.PutValues = put_values_DITHER_ximage; + xrb->Base.PutMonoValues = put_mono_values_DITHER_ximage; } } break; case PF_1Bit: if (pixmap) { - rb->PutRow = put_row_1BIT_pixmap; - rb->PutRowRGB = put_row_rgb_1BIT_pixmap; - rb->PutMonoRow = put_mono_row_1BIT_pixmap; - rb->PutValues = put_values_1BIT_pixmap; - rb->PutMonoValues = put_mono_values_1BIT_pixmap; + xrb->Base.PutRow = put_row_1BIT_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_1BIT_pixmap; + xrb->Base.PutMonoRow = put_mono_row_1BIT_pixmap; + xrb->Base.PutValues = put_values_1BIT_pixmap; + xrb->Base.PutMonoValues = put_mono_values_1BIT_pixmap; } else { - rb->PutRow = put_row_1BIT_ximage; - rb->PutRowRGB = put_row_rgb_1BIT_ximage; - rb->PutMonoRow = put_mono_row_1BIT_ximage; - rb->PutValues = put_values_1BIT_ximage; - rb->PutMonoValues = put_mono_values_1BIT_ximage; + xrb->Base.PutRow = put_row_1BIT_ximage; + xrb->Base.PutRowRGB = put_row_rgb_1BIT_ximage; + xrb->Base.PutMonoRow = put_mono_row_1BIT_ximage; + xrb->Base.PutValues = put_values_1BIT_ximage; + xrb->Base.PutMonoValues = put_mono_values_1BIT_ximage; } break; case PF_HPCR: if (pixmap) { - rb->PutRow = put_row_HPCR_pixmap; - rb->PutRowRGB = put_row_rgb_HPCR_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_HPCR_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_HPCR_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_HPCR_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_HPCR_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_HPCR_ximage; - rb->PutRowRGB = put_row_rgb_HPCR_ximage; - rb->PutMonoRow = put_mono_row_HPCR_ximage; - rb->PutValues = put_values_HPCR_ximage; - rb->PutMonoValues = put_mono_values_HPCR_ximage; + xrb->Base.PutRow = put_row_HPCR_ximage; + xrb->Base.PutRowRGB = put_row_rgb_HPCR_ximage; + xrb->Base.PutMonoRow = put_mono_row_HPCR_ximage; + xrb->Base.PutValues = put_values_HPCR_ximage; + xrb->Base.PutMonoValues = put_mono_values_HPCR_ximage; } break; case PF_Lookup: if (pixmap) { - rb->PutRow = put_row_LOOKUP_pixmap; - rb->PutRowRGB = put_row_rgb_LOOKUP_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_LOOKUP_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_LOOKUP_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_LOOKUP_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_LOOKUP_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { if (depth==8) { - rb->PutRow = put_row_LOOKUP8_ximage; - rb->PutRowRGB = put_row_rgb_LOOKUP8_ximage; - rb->PutMonoRow = put_mono_row_LOOKUP8_ximage; - rb->PutValues = put_values_LOOKUP8_ximage; - rb->PutMonoValues = put_mono_values_LOOKUP8_ximage; + xrb->Base.PutRow = put_row_LOOKUP8_ximage; + xrb->Base.PutRowRGB = put_row_rgb_LOOKUP8_ximage; + xrb->Base.PutMonoRow = put_mono_row_LOOKUP8_ximage; + xrb->Base.PutValues = put_values_LOOKUP8_ximage; + xrb->Base.PutMonoValues = put_mono_values_LOOKUP8_ximage; } else { - rb->PutRow = put_row_LOOKUP_ximage; - rb->PutRowRGB = put_row_rgb_LOOKUP_ximage; - rb->PutMonoRow = put_mono_row_ximage; - rb->PutValues = put_values_LOOKUP_ximage; - rb->PutMonoValues = put_mono_values_ximage; + xrb->Base.PutRow = put_row_LOOKUP_ximage; + xrb->Base.PutRowRGB = put_row_rgb_LOOKUP_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_LOOKUP_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; } } break; case PF_Grayscale: if (pixmap) { - rb->PutRow = put_row_GRAYSCALE_pixmap; - rb->PutRowRGB = put_row_rgb_GRAYSCALE_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_GRAYSCALE_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_GRAYSCALE_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_GRAYSCALE_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { if (depth == 8) { - rb->PutRow = put_row_GRAYSCALE8_ximage; - rb->PutRowRGB = put_row_rgb_GRAYSCALE8_ximage; - rb->PutMonoRow = put_mono_row_GRAYSCALE8_ximage; - rb->PutValues = put_values_GRAYSCALE8_ximage; - rb->PutMonoValues = put_mono_values_GRAYSCALE8_ximage; + xrb->Base.PutRow = put_row_GRAYSCALE8_ximage; + xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE8_ximage; + xrb->Base.PutMonoRow = put_mono_row_GRAYSCALE8_ximage; + xrb->Base.PutValues = put_values_GRAYSCALE8_ximage; + xrb->Base.PutMonoValues = put_mono_values_GRAYSCALE8_ximage; } else { - rb->PutRow = put_row_GRAYSCALE_ximage; - rb->PutRowRGB = put_row_rgb_GRAYSCALE_ximage; - rb->PutMonoRow = put_mono_row_ximage; - rb->PutValues = put_values_GRAYSCALE_ximage; - rb->PutMonoValues = put_mono_values_ximage; + xrb->Base.PutRow = put_row_GRAYSCALE_ximage; + xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_GRAYSCALE_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; } } break; @@ -4804,12 +4790,12 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, /* Get functions */ if (pixelformat == PF_Index) { - rb->GetRow = get_row_ci; - rb->GetValues = get_values_ci; + xrb->Base.GetRow = get_row_ci; + xrb->Base.GetValues = get_values_ci; } else { - rb->GetRow = get_row_rgba; - rb->GetValues = get_values_rgba; + xrb->Base.GetRow = get_row_rgba; + xrb->Base.GetValues = get_values_rgba; } } diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c deleted file mode 100644 index a3f2fe7d68..0000000000 --- a/src/mesa/drivers/x11/xm_surface.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 Brian Paul 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL 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. - */ - - -/** - * \file xm_surface.c - * Code to allow the softpipe code to write to X windows/buffers. - * This is a bit of a hack for now. We've basically got two different - * abstractions for color buffers: gl_renderbuffer and pipe_surface. - * They'll need to get merged someday... - * For now, they're separate things that point to each other. - */ - - -#include "glxheader.h" -#include "GL/xmesa.h" -#include "xmesaP.h" -#include "context.h" -#include "imports.h" -#include "macros.h" -#include "framebuffer.h" -#include "renderbuffer.h" - -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "pipe/p_winsys.h" -#include "softpipe/sp_context.h" -#include "softpipe/sp_clear.h" -#include "softpipe/sp_tile_cache.h" -#include "softpipe/sp_surface.h" -#include "state_tracker/st_context.h" - - -#define CLIP_TILE \ - do { \ - if (x + w > ps->width) \ - w = ps->width - x; \ - if (y + h > ps->height) \ - h = ps->height -y; \ - } while(0) - - -static INLINE struct xmesa_surface * -xmesa_surface(struct pipe_surface *ps) -{ - return (struct xmesa_surface *) ps; -} - - -static INLINE struct xmesa_renderbuffer * -xmesa_rb(struct pipe_surface *ps) -{ - struct xmesa_surface *xms = xmesa_surface(ps); - return xms->xrb; -} - - -#define FLIP(Y) Y = xrb->St.Base.Height - (Y) - 1; - - -void -xmesa_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps, - uint x, uint y, uint w, uint h, float *p) -{ - struct xmesa_surface *xms = xmesa_surface(ps); - struct xmesa_renderbuffer *xrb = xms->xrb; - - if (xrb) { - /* this is a front/back color buffer */ - GLubyte tmp[MAX_WIDTH * 4]; - GLuint i, j; - uint w0 = w; - GET_CURRENT_CONTEXT(ctx); - - CLIP_TILE; - - FLIP(y); - for (i = 0; i < h; i++) { - xrb->St.Base.GetRow(ctx, &xrb->St.Base, w, x, y - i, tmp); - for (j = 0; j < w * 4; j++) { - p[j] = UBYTE_TO_FLOAT(tmp[j]); - } - p += w0 * 4; - } - } - else { - /* other softpipe surface */ - softpipe_get_tile_rgba(ps, x, y, w, h, p); - } -} - - -void -xmesa_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps, - uint x, uint y, uint w, uint h, const float *p) -{ - struct xmesa_surface *xms = xmesa_surface(ps); - struct xmesa_renderbuffer *xrb = xms->xrb; - - if (xrb) { - /* this is a front/back color buffer */ - GLubyte tmp[MAX_WIDTH * 4]; - GLuint i, j; - uint w0 = w; - GET_CURRENT_CONTEXT(ctx); - CLIP_TILE; - FLIP(y); - for (i = 0; i < h; i++) { - for (j = 0; j < w * 4; j++) { - UNCLAMPED_FLOAT_TO_UBYTE(tmp[j], p[j]); - } - xrb->St.Base.PutRow(ctx, &xrb->St.Base, w, x, y - i, tmp, NULL); - p += w0 * 4; - } -#if 0 /* debug: flush */ - { - XMesaContext xm = XMESA_CONTEXT(ctx); - XSync(xm->display, 0); - } -#endif - } - else { - /* other softpipe surface */ - softpipe_put_tile_rgba(ps, x, y, w, h, p); - } -} - - - -/** - * Called to create a pipe_surface for each X renderbuffer. - * Note: this is being used instead of pipe->surface_alloc() since we - * have special/unique quad read/write functions for X. - */ -struct pipe_surface * -xmesa_new_color_surface(struct pipe_context *pipe, GLuint pipeFormat) -{ - struct xmesa_surface *xms = CALLOC_STRUCT(xmesa_surface); - - assert(pipeFormat); - - xms->surface.format = pipeFormat; - xms->surface.refcount = 1; - - /* Note, the region we allocate doesn't actually have any storage - * since we're drawing into an XImage or Pixmap. - * The region's size will get set in the xmesa_alloc_front/back_storage() - * functions. - */ - if (pipe) - xms->surface.region = pipe->winsys->region_alloc(pipe->winsys, - 1, 0, 0, 0x0); - - return &xms->surface; -} - - -/** - * Called via pipe->surface_alloc() to create new surfaces (textures, - * renderbuffers, etc. - */ -struct pipe_surface * -xmesa_surface_alloc(struct pipe_context *pipe, GLuint pipeFormat) -{ - struct xmesa_surface *xms = CALLOC_STRUCT(xmesa_surface); - - assert(pipe); - assert(pipeFormat); - - xms->surface.format = pipeFormat; - xms->surface.refcount = 1; - - return &xms->surface; -} - - -boolean -xmesa_is_format_supported(struct pipe_context *pipe, uint format) -{ - switch( format ) { - case PIPE_FORMAT_U_A8_R8_G8_B8: - case PIPE_FORMAT_S_R16_G16_B16_A16: - case PIPE_FORMAT_S8_Z24: - return TRUE; - }; - return FALSE; -} - - -/** - * Called via pipe->clear() - */ -void -xmesa_clear(struct pipe_context *pipe, struct pipe_surface *ps, GLuint value) -{ - struct xmesa_renderbuffer *xrb = xmesa_rb(ps); - - /* XXX actually, we should just discard any cached tiles from this - * surface since we don't want to accidentally re-use them after clearing. - */ - pipe->flush(pipe, 0); - - { - struct softpipe_context *sp = softpipe_context(pipe); - if (ps == sp_tile_cache_get_surface(sp->cbuf_cache[0])) { - float clear[4]; - clear[0] = 0.2; /* XXX hack */ - clear[1] = 0.2; - clear[2] = 0.2; - clear[3] = 0.2; - sp_tile_cache_clear(sp->cbuf_cache[0], clear); - } - } - - if (xrb && xrb->ximage) { - /* clearing back color buffer */ - GET_CURRENT_CONTEXT(ctx); - xmesa_clear_buffers(ctx, BUFFER_BIT_BACK_LEFT); - } - else if (xrb && xrb->pixmap) { - /* clearing front color buffer */ - GET_CURRENT_CONTEXT(ctx); - xmesa_clear_buffers(ctx, BUFFER_BIT_FRONT_LEFT); - } - else { - /* clearing other buffer */ - softpipe_clear(pipe, ps, value); - } -} - diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 158f284a5e..3a0cf80139 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -30,11 +30,11 @@ */ +#include "main/depth.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "glxheader.h" -#include "depth.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" #include "xmesaP.h" /* Internal swrast includes: @@ -1443,46 +1443,6 @@ do { \ #endif -#if 0 -GLboolean xmesa_get_cbuf_details( GLcontext *ctx, - void **ptr, - GLuint *cpp, - GLint *stride, - GLuint *format ) -{ - XMesaContext xmesa = XMESA_CONTEXT(ctx); - struct gl_framebuffer *fb = ctx->DrawBuffer; - struct gl_renderbuffer *crb = fb->_ColorDrawBuffers[0][0]; - struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(crb->Wrapped); - - *ptr = crb->GetPointer(ctx, crb, 0, 0); - *stride = ((GLubyte *)crb->GetPointer(ctx, crb, 0, 1) - - (GLubyte *)crb->GetPointer(ctx, crb, 0, 0)); - - if (!ptr) - goto bad; - - switch (xmesa->pixelformat) { - case PF_8A8B8G8R: - case PF_8A8R8G8B: - *format = 1; /* whatever */ - *cpp = 4; - break; - default: - goto bad; - } - - return GL_TRUE; - - bad: - *ptr = NULL; - *stride = 0; - *format = 0; - return GL_FALSE; -} -#endif - - /** * Return pointer to line drawing function, or NULL if we should use a * swrast fallback. diff --git a/src/mesa/drivers/x11/xm_winsys.c b/src/mesa/drivers/x11/xm_winsys.c deleted file mode 100644 index eab9fd3852..0000000000 --- a/src/mesa/drivers/x11/xm_winsys.c +++ /dev/null @@ -1,362 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA - * 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 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 - * THE COPYRIGHT HOLDERS, AUTHORS 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. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * - **************************************************************************/ - -/* - * Authors: - * Keith Whitwell - * Brian Paul - */ - - -#include "glxheader.h" -#include "xmesaP.h" -#include "main/macros.h" - -#include "pipe/p_winsys.h" -#include "softpipe/sp_winsys.h" - - -/** - * XMesa winsys, derived from softpipe winsys. - * NOTE: there's nothing really X-specific in this winsys layer so - * we could probably lift it up somewhere. - */ -struct xm_winsys -{ - struct softpipe_winsys sws; - int foo; /* placeholder */ -}; - - -/** - * Low-level OS/window system memory buffer - */ -struct xm_buffer -{ - boolean userBuffer; /** Is this a user-space buffer? */ - int refcount; - unsigned size; - void *data; - void *mapped; -}; - - - -/* Turn the softpipe opaque buffer pointer into a dri_bufmgr opaque - * buffer pointer... - */ -static inline struct xm_buffer * -xm_bo( struct pipe_buffer *bo ) -{ - return (struct xm_buffer *) bo; -} - -static inline struct pipe_buffer * -pipe_bo( struct xm_buffer *bo ) -{ - return (struct pipe_buffer *) bo; -} - -/* Turn a softpipe winsys into an xm/softpipe winsys: - */ -static inline struct xm_winsys * -xm_winsys(struct softpipe_winsys *sws) -{ - return (struct xm_winsys *) sws; -} - - -/* Most callbacks map direcly onto dri_bufmgr operations: - */ -static void * -xm_buffer_map(struct pipe_winsys *pws, struct pipe_buffer *buf, - unsigned flags) -{ - struct xm_buffer *xm_buf = xm_bo(buf); - xm_buf->mapped = xm_buf->data; - return xm_buf->mapped; -} - -static void -xm_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf) -{ - struct xm_buffer *xm_buf = xm_bo(buf); - xm_buf->mapped = NULL; -} - -static void -xm_buffer_reference(struct pipe_winsys *pws, - struct pipe_buffer **ptr, - struct pipe_buffer *buf) -{ - if (*ptr) { - struct xm_buffer *oldBuf = xm_bo(*ptr); - oldBuf->refcount--; - assert(oldBuf->refcount >= 0); - if (oldBuf->refcount == 0) { - if (oldBuf->data) { - if (!oldBuf->userBuffer) - free(oldBuf->data); - oldBuf->data = NULL; - } - free(oldBuf); - } - *ptr = NULL; - } - - assert(!(*ptr)); - - if (buf) { - struct xm_buffer *newBuf = xm_bo(buf); - newBuf->refcount++; - *ptr = buf; - } -} - -static void -xm_buffer_data(struct pipe_winsys *pws, struct pipe_buffer *buf, - unsigned size, const void *data, unsigned usage) -{ - struct xm_buffer *xm_buf = xm_bo(buf); - assert(!xm_buf->userBuffer); - if (xm_buf->size != size) { - if (xm_buf->data) - free(xm_buf->data); - xm_buf->data = malloc(size); - xm_buf->size = size; - } - if (data) - memcpy(xm_buf->data, data, size); -} - -static void -xm_buffer_subdata(struct pipe_winsys *pws, struct pipe_buffer *buf, - unsigned long offset, unsigned long size, const void *data) -{ - struct xm_buffer *xm_buf = xm_bo(buf); - GLubyte *b = (GLubyte *) xm_buf->data; - assert(!xm_buf->userBuffer); - assert(b); - memcpy(b + offset, data, size); -} - -static void -xm_buffer_get_subdata(struct pipe_winsys *pws, struct pipe_buffer *buf, - unsigned long offset, unsigned long size, void *data) -{ - const struct xm_buffer *xm_buf = xm_bo(buf); - const GLubyte *b = (GLubyte *) xm_buf->data; - assert(!xm_buf->userBuffer); - assert(b); - memcpy(data, b + offset, size); -} - -static void -xm_flush_frontbuffer(struct pipe_winsys *pws) -{ - /* - struct intel_context *intel = intel_pipe_winsys(sws)->intel; - __DRIdrawablePrivate *dPriv = intel->driDrawable; - - intelCopyBuffer(dPriv, NULL); - */ -} - -static void -xm_wait_idle(struct pipe_winsys *pws) -{ - /* no-op */ -} - -static const char * -xm_get_name(struct pipe_winsys *pws) -{ - return "Xlib"; -} - - -static struct pipe_buffer * -xm_buffer_create(struct pipe_winsys *pws, - unsigned alignment, - unsigned flags, - unsigned hint) -{ - struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer); - buffer->refcount = 1; - return pipe_bo(buffer); -} - - -/** - * Create buffer which wraps user-space data. - */ -static struct pipe_buffer * -xm_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes) -{ - struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer); - buffer->userBuffer = TRUE; - buffer->refcount = 1; - buffer->data = ptr; - buffer->size = bytes; - return pipe_bo(buffer); -} - - - -/** - * Round n up to next multiple. - */ -static INLINE unsigned -round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - - -static struct pipe_region * -xm_region_alloc(struct pipe_winsys *winsys, - unsigned cpp, unsigned width, unsigned height, unsigned flags) -{ - struct pipe_region *region = CALLOC_STRUCT(pipe_region); - const unsigned alignment = 64; - - region->cpp = cpp; - region->pitch = round_up(width, alignment / cpp); - region->height = height; - region->refcount = 1; - - assert(region->pitch > 0); - - region->buffer = winsys->buffer_create( winsys, alignment, 0, 0 ) -; - - /* NULL data --> just allocate the space */ - winsys->buffer_data( winsys, - region->buffer, - region->pitch * cpp * height, - NULL, - PIPE_BUFFER_USAGE_PIXEL ); - return region; -} - - -static void -xm_region_release(struct pipe_winsys *winsys, struct pipe_region **region) -{ - if (!*region) - return; - - assert((*region)->refcount > 0); - (*region)->refcount--; - - if ((*region)->refcount == 0) { - assert((*region)->map_refcount == 0); - - winsys->buffer_reference( winsys, &((*region)->buffer), NULL ); - free(*region); - } - *region = NULL; -} - - -/** - * Called via pipe->surface_alloc() to create new surfaces (textures, - * renderbuffers, etc. - */ -static struct pipe_surface * -xm_surface_alloc(struct pipe_winsys *ws, GLuint pipeFormat) -{ - struct xmesa_surface *xms = CALLOC_STRUCT(xmesa_surface); - - assert(ws); - assert(pipeFormat); - - xms->surface.format = pipeFormat; - xms->surface.refcount = 1; -#if 0 - /* - * This is really just a softpipe surface, not an XImage/Pixmap surface. - */ - softpipe_init_surface_funcs(&xms->surface); -#endif - return &xms->surface; -} - - - - -struct xmesa_pipe_winsys -{ - struct pipe_winsys winsys; - XMesaContext xmesa; -}; - -static struct pipe_winsys * -xmesa_create_pipe_winsys( XMesaContext xmesa ) -{ - struct xmesa_pipe_winsys *xws = CALLOC_STRUCT(xmesa_pipe_winsys); - - /* Fill in this struct with callbacks that pipe will need to - * communicate with the window system, buffer manager, etc. - * - * Pipe would be happy with a malloc based memory manager, but - * the SwapBuffers implementation in this winsys driver requires - * that rendering be done to an appropriate _DriBufferObject. - */ - xws->winsys.buffer_create = xm_buffer_create; - xws->winsys.user_buffer_create = xm_user_buffer_create; - xws->winsys.buffer_map = xm_buffer_map; - xws->winsys.buffer_unmap = xm_buffer_unmap; - xws->winsys.buffer_reference = xm_buffer_reference; - xws->winsys.buffer_data = xm_buffer_data; - xws->winsys.buffer_subdata = xm_buffer_subdata; - xws->winsys.buffer_get_subdata = xm_buffer_get_subdata; - - xws->winsys.region_alloc = xm_region_alloc; - xws->winsys.region_release = xm_region_release; - - xws->winsys.surface_alloc = xm_surface_alloc; - - xws->winsys.flush_frontbuffer = xm_flush_frontbuffer; - xws->winsys.wait_idle = xm_wait_idle; - xws->winsys.get_name = xm_get_name; - xws->xmesa = xmesa; - - return &xws->winsys; -} - - -struct pipe_context * -xmesa_create_softpipe(XMesaContext xmesa) -{ - struct xm_winsys *xm_ws = CALLOC_STRUCT( xm_winsys ); - - /* Create the softpipe context: - */ - return softpipe_create( xmesa_create_pipe_winsys(xmesa), &xm_ws->sws ); -} diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index e0e69274d4..98867ac710 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -28,7 +28,7 @@ #include "GL/xmesa.h" -#include "mtypes.h" +#include "main/mtypes.h" #if defined(FX) #include "GL/fxmesa.h" #include "xm_glide.h" @@ -36,9 +36,6 @@ #ifdef XFree86Server #include "xm_image.h" #endif -#include "state_tracker/st_cb_fbo.h" -#include "softpipe/sp_context.h" -#include "softpipe/sp_surface.h" extern _glthread_Mutex _xmesa_lock; @@ -180,11 +177,7 @@ typedef enum { */ struct xmesa_renderbuffer { -#if 0 struct gl_renderbuffer Base; /* Base class */ -#else - struct st_renderbuffer St; /**< Base class */ -#endif XMesaBuffer Parent; /**< The XMesaBuffer this renderbuffer belongs to */ XMesaDrawable drawable; /* Usually the X window ID */ @@ -203,8 +196,6 @@ struct xmesa_renderbuffer GLint bottom; /* used for FLIP macro, equals height - 1 */ ClearFunc clearFunc; - - void *pSurface; /** pipe surface */ }; @@ -500,8 +491,8 @@ extern const int xmesa_kernel1[16]; */ extern struct xmesa_renderbuffer * -xmesa_create_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, - GLboolean backBuffer); +xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, + GLboolean backBuffer); extern void xmesa_delete_framebuffer(struct gl_framebuffer *fb); @@ -590,41 +581,4 @@ extern void xmesa_register_swrast_functions( GLcontext *ctx ); #define ENABLE_EXT_timer_query 0 /* may not have 64-bit GLuint64EXT */ #endif - -struct pipe_surface; -struct pipe_context; - -struct xmesa_surface -{ - struct pipe_surface surface; - struct xmesa_renderbuffer *xrb; -}; - - -extern void -xmesa_clear(struct pipe_context *pipe, struct pipe_surface *ps, GLuint value); - -extern void -xmesa_clear_buffers(GLcontext *ctx, GLbitfield buffers); - -extern struct pipe_context * -xmesa_create_softpipe(XMesaContext xm); - -extern struct pipe_surface * -xmesa_surface_alloc(struct pipe_context *pipe, GLuint format); - -extern struct pipe_surface * -xmesa_new_color_surface(struct pipe_context *pipe, GLuint format); - -extern boolean -xmesa_is_format_supported(struct pipe_context *pipe, uint format); - -extern void -xmesa_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps, - uint x, uint y, uint w, uint h, float *p); - -extern void -xmesa_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps, - uint x, uint y, uint w, uint h, const float *p); - #endif diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 53efd7eef4..4b23b42223 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -50,7 +50,23 @@ +#ifdef HAVE_DIX_CONFIG_H + +#include <dix-config.h> +#define PUBLIC + +#else + #include "main/glheader.h" + +#endif + +#include <stdlib.h> +#include <string.h> +#ifdef DEBUG +#include <assert.h> +#endif + #include "glapi.h" #include "glapioffsets.h" #include "glapitable.h" diff --git a/src/mesa/glapi/glthread.c b/src/mesa/glapi/glthread.c index 09cc8cfcde..56ddf7c25a 100644 --- a/src/mesa/glapi/glthread.c +++ b/src/mesa/glapi/glthread.c @@ -28,6 +28,9 @@ * truly reusable outside of Mesa. First, the glheader.h include must go. */ +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif #include "main/glheader.h" #include "glthread.h" diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 32d86ce149..dc85da2518 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1110,9 +1110,9 @@ _mesa_PopAttrib(void) _mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite); if (ctx->Extensions.NV_point_sprite) _mesa_PointParameteri(GL_POINT_SPRITE_R_MODE_NV, - ctx->Point.SpriteRMode); + ctx->Point.SpriteRMode); _mesa_PointParameterf(GL_POINT_SPRITE_COORD_ORIGIN, - (GLfloat)ctx->Point.SpriteOrigin); + (GLfloat)ctx->Point.SpriteOrigin); } } break; diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 11e1fd6b2b..190e6ab564 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -38,6 +38,13 @@ #include "bufferobj.h" +#ifdef FEATURE_OES_mapbuffer +#define DEFAULT_ACCESS GL_WRITE_ONLY; +#else +#define DEFAULT_ACCESS GL_READ_WRITE; +#endif + + /** * Get the buffer object bound to the specified target in a GL context. * @@ -205,11 +212,14 @@ _mesa_reference_buffer_object(GLcontext *ctx, if (deleteFlag) { /* some sanity checking: don't delete a buffer still in use */ +#if 0 + /* unfortunately, these tests are invalid during context tear-down */ ASSERT(ctx->Array.ArrayBufferObj != bufObj); ASSERT(ctx->Array.ElementArrayBufferObj != bufObj); ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj); - ASSERT(ctx->Driver.DeleteBuffer); +#endif + ASSERT(ctx->Driver.DeleteBuffer); ctx->Driver.DeleteBuffer(ctx, oldObj); } @@ -252,7 +262,7 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, obj->RefCount = 1; obj->Name = name; obj->Usage = GL_STATIC_DRAW_ARB; - obj->Access = GL_READ_WRITE_ARB; + obj->Access = DEFAULT_ACCESS; } @@ -1062,7 +1072,7 @@ _mesa_UnmapBufferARB(GLenum target) status = ctx->Driver.UnmapBuffer( ctx, target, bufObj ); } - bufObj->Access = GL_READ_WRITE_ARB; /* initial value, OK? */ + bufObj->Access = DEFAULT_ACCESS; bufObj->Pointer = NULL; return status; diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index a6257f9b98..63388f42ee 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -114,6 +114,8 @@ _mesa_Clear( GLbitfield mask ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glClear 0x%x\n", mask); diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 882e2f224a..3b340c476c 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -176,13 +176,11 @@ /** For GL_ARB_fragment_program */ /*@{*/ #define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 0 -#define MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS 48 -#define MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS 24 -#define MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS 4 /*@}*/ /** For any program target/extension */ /*@{*/ +#define MAX_PROGRAM_INSTRUCTIONS (16 * 1024) #define MAX_PROGRAM_LOCAL_PARAMS 128 /* KW: power of two */ #define MAX_PROGRAM_ENV_PARAMS 128 #define MAX_PROGRAM_MATRICES 8 diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 96a8c30106..c6ff8c13c6 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -819,11 +819,33 @@ _mesa_init_current(GLcontext *ctx) /** - * Init vertex/fragment program native limits from logical limits. + * Init vertex/fragment program limits. + * Important: drivers should override these with actual limits. */ static void -init_natives(struct gl_program_constants *prog) +init_program_limits(GLenum type, struct gl_program_constants *prog) { + prog->MaxInstructions = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxAluInstructions = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxTexInstructions = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxTexIndirections = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxTemps = MAX_PROGRAM_TEMPS; + prog->MaxEnvParams = MAX_PROGRAM_ENV_PARAMS; + prog->MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; + prog->MaxUniformComponents = 4 * MAX_UNIFORMS; + + if (type == GL_VERTEX_PROGRAM_ARB) { + prog->MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS; + prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; + prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; + } + else { + prog->MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS; + prog->MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; + prog->MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; + } + + /* copy the above limits to init native limits */ prog->MaxNativeInstructions = prog->MaxInstructions; prog->MaxNativeAluInstructions = prog->MaxAluInstructions; prog->MaxNativeTexInstructions = prog->MaxTexInstructions; @@ -885,33 +907,10 @@ _mesa_init_constants(GLcontext *ctx) ctx->Const.MaxViewportWidth = MAX_WIDTH; ctx->Const.MaxViewportHeight = MAX_HEIGHT; #if FEATURE_ARB_vertex_program - ctx->Const.VertexProgram.MaxInstructions = MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS; - ctx->Const.VertexProgram.MaxAluInstructions = 0; - ctx->Const.VertexProgram.MaxTexInstructions = 0; - ctx->Const.VertexProgram.MaxTexIndirections = 0; - ctx->Const.VertexProgram.MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; - ctx->Const.VertexProgram.MaxTemps = MAX_PROGRAM_TEMPS; - ctx->Const.VertexProgram.MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS; - ctx->Const.VertexProgram.MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; - ctx->Const.VertexProgram.MaxEnvParams = MAX_PROGRAM_ENV_PARAMS; - ctx->Const.VertexProgram.MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; - ctx->Const.VertexProgram.MaxUniformComponents = 4 * MAX_UNIFORMS; - init_natives(&ctx->Const.VertexProgram); + init_program_limits(GL_VERTEX_PROGRAM_ARB, &ctx->Const.VertexProgram); #endif - #if FEATURE_ARB_fragment_program - ctx->Const.FragmentProgram.MaxInstructions = MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS; - ctx->Const.FragmentProgram.MaxAluInstructions = MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS; - ctx->Const.FragmentProgram.MaxTexInstructions = MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS; - ctx->Const.FragmentProgram.MaxTexIndirections = MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS; - ctx->Const.FragmentProgram.MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; - ctx->Const.FragmentProgram.MaxTemps = MAX_PROGRAM_TEMPS; - ctx->Const.FragmentProgram.MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS; - ctx->Const.FragmentProgram.MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; - ctx->Const.FragmentProgram.MaxEnvParams = MAX_PROGRAM_ENV_PARAMS; - ctx->Const.FragmentProgram.MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; - ctx->Const.FragmentProgram.MaxUniformComponents = 4 * MAX_UNIFORMS; - init_natives(&ctx->Const.FragmentProgram); + init_program_limits(GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.FragmentProgram); #endif ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; @@ -1316,7 +1315,9 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); +#if FEATURE_attrib_stack _mesa_free_attrib_data(ctx); +#endif _mesa_free_lighting_data( ctx ); #if FEATURE_evaluators _mesa_free_eval_data( ctx ); diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index c12f55a7a1..34127cb248 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -39,7 +39,7 @@ #ifndef GLX_USE_APPLEGL -#include "glheader.h" +#include "main/glheader.h" #include "glapi/glapi.h" #include "glapi/glapitable.h" #include "glapi/glthread.h" diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index cafe8072ee..f7660930a9 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -6796,6 +6796,11 @@ _mesa_EndList(void) _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList"); return; } + + /* Call before emitting END_OF_LIST, in case the driver wants to + * emit opcodes itself. + */ + ctx->Driver.EndList(ctx); (void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0); @@ -6809,8 +6814,6 @@ _mesa_EndList(void) if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) mesa_print_display_list(ctx->ListState.CurrentListNum); - ctx->Driver.EndList(ctx); - ctx->ListState.CurrentList = NULL; ctx->ListState.CurrentListNum = 0; ctx->ListState.CurrentListPtr = NULL; diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index ae6afef17d..f72aa6a288 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1092,7 +1092,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); ASSERT(n <= 100); for (i = 0; i < n; i++) - params[i] = ENUM_TO_INT(formats[i]); + params[i] = ENUM_TO_BOOLEAN(formats[i]); } break; case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: @@ -2940,7 +2940,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); ASSERT(n <= 100); for (i = 0; i < n; i++) - params[i] = ENUM_TO_INT(formats[i]); + params[i] = ENUM_TO_FLOAT(formats[i]); } break; case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: @@ -3985,7 +3985,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = ctx->DrawBuffer->Visual.depthBits; break; case GL_DEPTH_CLEAR_VALUE: - params[0] = IROUND(ctx->Depth.Clear); + params[0] = FLOAT_TO_INT(ctx->Depth.Clear); break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_INT(ctx->Depth.Func); diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index decc9dd52a..152e378b4f 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -50,7 +50,8 @@ TypeStrings = { # - the GL state name, such as GL_CURRENT_COLOR # - the state datatype, one of GLint, GLfloat, GLboolean or GLenum # - list of code fragments to get the state, such as ["ctx->Foo.Bar"] -# - optional extra code or empty string +# - optional extra code or empty string. If present, "CONVERSION" will be +# replaced by ENUM_TO_FLOAT, INT_TO_FLOAT, etc. # - optional extensions to check, or None # StateVars = [ @@ -179,7 +180,7 @@ StateVars = [ ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", None ), ( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"], "", None ), - ( "GL_DEPTH_CLEAR_VALUE", GLfloat, ["ctx->Depth.Clear"], "", None ), + ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["ctx->Depth.Clear"], "", None ), ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ), ( "GL_DEPTH_RANGE", GLfloatN, [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ), @@ -532,7 +533,7 @@ StateVars = [ GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); ASSERT(n <= 100); for (i = 0; i < n; i++) - params[i] = ENUM_TO_INT(formats[i]);""", + params[i] = CONVERSION(formats[i]);""", ["ARB_texture_compression"] ), # GL_EXT_compiled_vertex_array @@ -1083,10 +1084,11 @@ def EmitGetFunction(stateVars, returnType): assert len(extensions) == 4 print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' % (extensions[0], extensions[1], extensions[2], extensions[3], function)) + conversion = ConversionFunc(varType, returnType) if optionalCode: + optionalCode = string.replace(optionalCode, "CONVERSION", conversion); print " {" print " " + optionalCode - conversion = ConversionFunc(varType, returnType) n = len(state) for i in range(n): if conversion: diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 3d413659ec..d69c7bbb21 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -93,15 +93,6 @@ # include <stdint.h> #endif -/* For platforms that have the C99 standard uint*_t, - but not the commonly used u_int*_t */ -#if defined(__sun) -# define u_int8_t uint8_t -# define u_int16_t uint16_t -# define u_int32_t uint32_t -# define u_int64_t uint64_t -# define u_intptr_t uintptr_t -#endif /* Sun compilers define __i386 instead of the gcc-style __i386__ */ #ifdef __SUNPRO_C diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index b08c017ec8..ed78f57edf 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -44,7 +44,6 @@ #define FEATURE_dlist _HAVE_FULL_GL #define FEATURE_draw_read_buffer _HAVE_FULL_GL #define FEATURE_drawpix _HAVE_FULL_GL -#define FEATURE_es2_glsl 0 #define FEATURE_evaluators _HAVE_FULL_GL #define FEATURE_feedback _HAVE_FULL_GL #define FEATURE_fixedpt 0 @@ -56,6 +55,8 @@ #define FEATURE_texture_s3tc _HAVE_FULL_GL #define FEATURE_userclip _HAVE_FULL_GL #define FEATURE_vertex_array_byte 0 +#define FEATURE_windowpos _HAVE_FULL_GL +#define FEATURE_es2_glsl 0 #define FEATURE_ARB_occlusion_query _HAVE_FULL_GL #define FEATURE_ARB_fragment_program _HAVE_FULL_GL diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index d35fa6734c..13d90e78fe 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -446,30 +446,23 @@ make_1d_mipmap(GLenum datatype, GLuint comps, GLint border, } -/** - * Strides are in bytes. If zero, it'll be computed as width * bpp. - */ static void make_2d_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, - GLint srcRowBytes, const GLubyte *srcPtr, + const GLubyte *srcPtr, GLint srcRowStride, GLint dstWidth, GLint dstHeight, - GLint dstRowBytes, GLubyte *dstPtr) + GLubyte *dstPtr, GLint dstRowStride) { const GLint bpt = bytes_per_pixel(datatype, comps); const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; + const GLint srcRowBytes = bpt * srcRowStride; + const GLint dstRowBytes = bpt * dstRowStride; const GLubyte *srcA, *srcB; GLubyte *dst; GLint row; - if (!srcRowBytes) - srcRowBytes = bpt * srcWidth; - - if (!dstRowBytes) - dstRowBytes = bpt * dstWidth; - /* Compute src and dst pointers, skipping any border */ srcA = srcPtr + border * ((srcWidth + 1) * bpt); if (srcHeight > 1) @@ -541,11 +534,9 @@ make_2d_mipmap(GLenum datatype, GLuint comps, GLint border, static void make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, GLint srcDepth, - GLint srcRowBytes, - const GLubyte *srcPtr, + const GLubyte *srcPtr, GLint srcRowStride, GLint dstWidth, GLint dstHeight, GLint dstDepth, - GLint dstRowBytes, - GLubyte *dstPtr) + GLubyte *dstPtr, GLint dstRowStride) { const GLint bpt = bytes_per_pixel(datatype, comps); const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ @@ -556,6 +547,7 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, GLvoid *tmpRowA, *tmpRowB; GLint img, row; GLint bytesPerSrcImage, bytesPerDstImage; + GLint bytesPerSrcRow, bytesPerDstRow; GLint srcImageOffset, srcRowOffset; (void) srcDepthNB; /* silence warnings */ @@ -573,10 +565,8 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, bytesPerSrcImage = srcWidth * srcHeight * bpt; bytesPerDstImage = dstWidth * dstHeight * bpt; - if (!srcRowBytes) - srcRowBytes = srcWidth * bpt; - if (!dstRowBytes) - dstRowBytes = dstWidth * bpt; + bytesPerSrcRow = srcWidth * bpt; + bytesPerDstRow = dstWidth * bpt; /* Offset between adjacent src images to be averaged together */ srcImageOffset = (srcDepth == dstDepth) ? 0 : bytesPerSrcImage; @@ -600,13 +590,13 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, for (img = 0; img < dstDepthNB; img++) { /* first source image pointer, skipping border */ const GLubyte *imgSrcA = srcPtr - + (bytesPerSrcImage + srcRowBytes + border) * bpt * border + + (bytesPerSrcImage + bytesPerSrcRow + border) * bpt * border + img * (bytesPerSrcImage + srcImageOffset); /* second source image pointer, skipping border */ const GLubyte *imgSrcB = imgSrcA + srcImageOffset; /* address of the dest image, skipping border */ GLubyte *imgDst = dstPtr - + (bytesPerDstImage + dstRowBytes + border) * bpt * border + + (bytesPerDstImage + bytesPerDstRow + border) * bpt * border + img * bytesPerDstImage; /* setup the four source row pointers and the dest row pointer */ @@ -627,11 +617,11 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, do_row(datatype, comps, srcWidthNB, tmpRowA, tmpRowB, dstWidthNB, dstImgRow); /* advance to next rows */ - srcImgARowA += srcRowBytes + srcRowOffset; - srcImgARowB += srcRowBytes + srcRowOffset; - srcImgBRowA += srcRowBytes + srcRowOffset; - srcImgBRowB += srcRowBytes + srcRowOffset; - dstImgRow += dstRowBytes; + srcImgARowA += bytesPerSrcRow + srcRowOffset; + srcImgARowB += bytesPerSrcRow + srcRowOffset; + srcImgBRowA += bytesPerSrcRow + srcRowOffset; + srcImgBRowB += bytesPerSrcRow + srcRowOffset; + dstImgRow += bytesPerDstRow; } } @@ -641,15 +631,13 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, /* Luckily we can leverage the make_2d_mipmap() function here! */ if (border > 0) { /* do front border image */ - make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, 0, srcPtr, - dstWidth, dstHeight, 0, dstPtr); + make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, srcPtr, srcRowStride, + dstWidth, dstHeight, dstPtr, dstRowStride); /* do back border image */ make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, - 0, - srcPtr + bytesPerSrcImage * (srcDepth - 1), + srcPtr + bytesPerSrcImage * (srcDepth - 1), srcRowStride, dstWidth, dstHeight, - 0, - dstPtr + bytesPerDstImage * (dstDepth - 1)); + dstPtr + bytesPerDstImage * (dstDepth - 1), dstRowStride); /* do four remaining border edges that span the image slices */ if (srcDepth == dstDepth) { /* just copy border pixels from src to dst */ @@ -664,9 +652,9 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, /* do border along [img][row=dstHeight-1][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (srcHeight - 1) * srcRowBytes; + + (srcHeight - 1) * bytesPerSrcRow; dst = dstPtr + (img + 1) * bytesPerDstImage - + (dstHeight - 1) * dstRowBytes; + + (dstHeight - 1) * bytesPerDstRow; MEMCPY(dst, src, bpt); /* do border along [img][row=0][col=dstWidth-1] */ @@ -698,9 +686,9 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, /* do border along [img][row=dstHeight-1][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (srcHeight - 1) * srcRowBytes; + + (srcHeight - 1) * bytesPerSrcRow; dst = dstPtr + (img + 1) * bytesPerDstImage - + (dstHeight - 1) * dstRowBytes; + + (dstHeight - 1) * bytesPerDstRow; do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst); /* do border along [img][row=0][col=dstWidth-1] */ @@ -724,15 +712,16 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, static void make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, - GLint srcWidth, const GLubyte *srcPtr, - GLint dstWidth, GLint dstHeight, GLubyte *dstPtr) + GLint srcWidth, const GLubyte *srcPtr, GLuint srcRowStride, + GLint dstWidth, GLint dstHeight, + GLubyte *dstPtr, GLuint dstRowStride ) { const GLint bpt = bytes_per_pixel(datatype, comps); const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; - const GLint srcRowBytes = bpt * srcRowBytes; - const GLint dstRowBytes = bpt * dstRowBytes; + const GLint srcRowBytes = bpt * srcRowStride; + const GLint dstRowBytes = bpt * dstRowStride; const GLubyte *src; GLubyte *dst; GLint row; @@ -767,28 +756,22 @@ make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, static void make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, - GLint srcRowBytes, - const GLubyte *srcPtr, + const GLubyte *srcPtr, GLint srcRowStride, GLint dstWidth, GLint dstHeight, GLint dstDepth, - GLint dstRowBytes, - GLubyte *dstPtr) + GLubyte *dstPtr, GLint dstRowStride) { const GLint bpt = bytes_per_pixel(datatype, comps); const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; const GLint dstDepthNB = dstDepth - 2 * border; + const GLint srcRowBytes = bpt * srcRowStride; + const GLint dstRowBytes = bpt * dstRowStride; const GLubyte *srcA, *srcB; GLubyte *dst; GLint layer; GLint row; - if (!srcRowBytes) - srcRowBytes = bpt * srcWidth; - - if (!dstRowBytes) - dstRowBytes = bpt * dstWidth; - /* Compute src and dst pointers, skipping any border */ srcA = srcPtr + border * ((srcWidth + 1) * bpt); if (srcHeight > 1) @@ -867,12 +850,15 @@ _mesa_generate_mipmap_level(GLenum target, GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, GLint srcDepth, - GLint srcRowBytes, const GLubyte *srcData, + GLint srcRowStride, GLint dstWidth, GLint dstHeight, GLint dstDepth, - GLint dstRowBytes, - GLubyte *dstData) + GLubyte *dstData, + GLint dstRowStride) { + /* + * We use simple 2x2 averaging to compute the next mipmap level. + */ switch (target) { case GL_TEXTURE_1D: make_1d_mipmap(datatype, comps, border, @@ -887,29 +873,35 @@ _mesa_generate_mipmap_level(GLenum target, case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: make_2d_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcRowBytes, srcData, - dstWidth, dstHeight, dstRowBytes, dstData); + srcWidth, srcHeight, srcData, srcRowStride, + dstWidth, dstHeight, dstData, dstRowStride); break; case GL_TEXTURE_3D: make_3d_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcDepth, srcRowBytes, srcData, - dstWidth, dstHeight, dstDepth, dstRowBytes, dstData); + srcWidth, srcHeight, srcDepth, + srcData, srcRowStride, + dstWidth, dstHeight, dstDepth, + dstData, dstRowStride); break; case GL_TEXTURE_1D_ARRAY_EXT: make_1d_stack_mipmap(datatype, comps, border, - srcWidth, srcData, - dstWidth, dstHeight, dstData); + srcWidth, srcData, srcRowStride, + dstWidth, dstHeight, + dstData, dstRowStride); break; case GL_TEXTURE_2D_ARRAY_EXT: make_2d_stack_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcRowBytes, srcData, - dstWidth, dstHeight, dstDepth, dstRowBytes, dstData); + srcWidth, srcHeight, + srcData, srcRowStride, + dstWidth, dstHeight, + dstDepth, dstData, dstRowStride); break; case GL_TEXTURE_RECTANGLE_NV: /* no mipmaps, do nothing */ break; default: - _mesa_problem(NULL, "bad target in _mesa_generate_mipmap_level"); + _mesa_problem(NULL, "bad dimensions in _mesa_generate_mipmaps"); + return; } } @@ -1131,23 +1123,25 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstData = (GLubyte *) dstImage->Data; } - /* Note, 0 indicates default row strides */ _mesa_generate_mipmap_level(target, datatype, comps, border, - srcWidth, srcHeight, srcDepth, 0, srcData, - dstWidth, dstHeight, dstDepth, 0, dstData); + srcWidth, srcHeight, srcDepth, + srcData, srcImage->RowStride, + dstWidth, dstHeight, dstDepth, + dstData, dstImage->RowStride); + if (dstImage->IsCompressed) { GLubyte *temp; /* compress image from dstData into dstImage->Data */ const GLenum srcFormat = convertFormat->BaseFormat; - GLint dstRowBytes + GLint dstRowStride = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth); ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); dstImage->TexFormat->StoreImage(ctx, 2, dstImage->_BaseFormat, dstImage->TexFormat, dstImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowBytes, 0, /* strides */ + dstRowStride, 0, /* strides */ dstWidth, dstHeight, 1, /* size */ srcFormat, CHAN_TYPE, dstData, /* src data, actually */ @@ -1172,7 +1166,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, void _mesa_rescale_teximage2d(GLuint bytesPerPixel, GLuint srcStrideInPixels, - GLuint dstRowBytes, + GLuint dstRowStride, GLint srcWidth, GLint srcHeight, GLint dstWidth, GLint dstHeight, const GLvoid *srcImage, GLvoid *dstImage) @@ -1186,7 +1180,7 @@ _mesa_rescale_teximage2d(GLuint bytesPerPixel, GLint srcCol = col WOP wScale; \ dst[col] = src[srcRow * srcStrideInPixels + srcCol]; \ } \ - dst = (TYPE *) ((GLubyte *) dst + dstRowBytes); \ + dst = (TYPE *) ((GLubyte *) dst + dstRowStride); \ } \ #define RESCALE_IMAGE( TYPE ) \ @@ -1244,7 +1238,7 @@ do { \ void _mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight, GLsizei outWidth, GLsizei outHeight, - GLint comps, const GLchan *src, GLint srcRowBytes, + GLint comps, const GLchan *src, GLint srcRowStride, GLchan *dest ) { GLint i, j, k; @@ -1263,7 +1257,7 @@ _mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight, const GLint jj = j % inWidth; for (k = 0; k < comps; k++) { dest[(i * outWidth + j) * comps + k] - = src[ii * srcRowBytes + jj * comps + k]; + = src[ii * srcRowStride + jj * comps + k]; } } } diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h index 44ecdddb27..22094c3437 100644 --- a/src/mesa/main/mipmap.h +++ b/src/mesa/main/mipmap.h @@ -34,11 +34,11 @@ _mesa_generate_mipmap_level(GLenum target, GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, GLint srcDepth, - GLint srcRowStride, const GLubyte *srcData, + GLint srcRowStride, GLint dstWidth, GLint dstHeight, GLint dstDepth, - GLint dstRowStride, - GLubyte *dstData); + GLubyte *dstData, + GLint dstRowStride); extern void diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c index 6f381b02a7..d430bcdb84 100644 --- a/src/mesa/main/mm.c +++ b/src/mesa/main/mm.c @@ -167,7 +167,7 @@ mmAllocMem(struct mem_block *heap, unsigned size, unsigned align2, unsigned star unsigned startofs = 0; unsigned endofs; - if (!heap || !align2 || !size) + if (!heap || !size) return NULL; for (p = heap->next_free; p != heap; p = p->next_free) { diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 300010c373..8e4f6a2e66 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1933,7 +1933,10 @@ struct gl_fragment_program { struct gl_program Base; /**< base class */ GLenum FogOption; - GLboolean UsesKill; + GLboolean UsesKill; /**< shader uses KIL instruction */ + GLboolean UsesPointCoord; /**< shader uses gl_PointCoord */ + GLboolean UsesFrontFacing; /**< shader used gl_FrontFacing */ + GLboolean UsesFogFragCoord; /**< shader used gl_FogFragCoord */ }; @@ -2123,12 +2126,14 @@ struct gl_shader_program GLuint NumShaders; /**< number of attached shaders */ struct gl_shader **Shaders; /**< List of attached the shaders */ + /** User-defined attribute bindings (glBindAttribLocation) */ + struct gl_program_parameter_list *Attributes; + /* post-link info: */ struct gl_vertex_program *VertexProgram; /**< Linked vertex program */ struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */ struct gl_uniform_list *Uniforms; struct gl_program_parameter_list *Varying; - struct gl_program_parameter_list *Attributes; /**< Vertex attributes */ GLboolean LinkStatus; /**< GL_LINK_STATUS */ GLboolean Validated; GLchar *InfoLog; diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index dc22808e5b..dfdd297b6e 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -105,8 +105,7 @@ _mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type, } break; case GL_DEPTH_COMPONENT: - if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) || - (!drawing && !_mesa_source_buffer_exists(ctx, format))) { + if ((drawing && !_mesa_dest_buffer_exists(ctx, format))) { _mesa_error(ctx, GL_INVALID_OPERATION, "gl%sPixels(no depth buffer)", readDraw); return GL_TRUE; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index e340cd6686..5913019bc1 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -51,8 +51,6 @@ #include "texstate.h" - - static void update_separate_specular(GLcontext *ctx) { @@ -317,10 +315,10 @@ static void update_multisample(GLcontext *ctx) { ctx->Multisample._Enabled = GL_FALSE; - if (ctx->DrawBuffer) { - if (ctx->DrawBuffer->Visual.sampleBuffers) - ctx->Multisample._Enabled = GL_TRUE; - } + if (ctx->Multisample.Enabled && + ctx->DrawBuffer && + ctx->DrawBuffer->Visual.sampleBuffers) + ctx->Multisample._Enabled = GL_TRUE; } diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 25e280bc3f..2bce93eef1 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -48,11 +48,9 @@ struct texenvprog_cache_item /** - * This MAX is probably a bit generous, but that's OK. There can be - * up to four instructions per texture unit (TEX + 3 for combine), - * then there's fog and specular add. + * Up to nine instructions per tex unit, plus fog, specular color. */ -#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 4) + 12) +#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 9) + 12) #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) @@ -388,7 +386,7 @@ static struct ureg get_tex_temp( struct texenv_fragment_program *p ) { int bit; - /* First try to find availble temp not previously used (to avoid + /* First try to find available temp not previously used (to avoid * starting a new texture indirection). According to the spec, the * ~p->temps_output isn't necessary, but will keep it there for * now: @@ -588,14 +586,16 @@ static struct ureg register_const4f( struct texenv_fragment_program *p, { GLfloat values[4]; GLuint idx, swizzle; + struct ureg r; values[0] = s0; values[1] = s1; values[2] = s2; values[3] = s3; idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4, &swizzle ); - ASSERT(swizzle == SWIZZLE_NOOP); - return make_ureg(PROGRAM_CONSTANT, idx); + r = make_ureg(PROGRAM_CONSTANT, idx); + r.swz = swizzle; + return r; } #define register_scalar_const(p, s0) register_const4f(p, s0, s0, s0, s0) diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 63939f4011..7499ba7b36 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1117,6 +1117,7 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage, break;; default: _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8"); + return; } #if CHAN_TYPE == GL_UNSIGNED_BYTE COPY_4UBV(texel, texelUB); diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 3f3b448dbc..664adadfb9 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -324,6 +324,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) break; case GL_GENERATE_MIPMAP_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE; } else { diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 86c54aefc0..f019377041 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -118,20 +118,20 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) /* copy texture object bindings, not contents of texture objects */ _mesa_lock_context_textures(dst); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current1D, - src->Texture.Unit[i].Current1D); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current2D, - src->Texture.Unit[i].Current2D); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current3D, - src->Texture.Unit[i].Current3D); - _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentCubeMap, - src->Texture.Unit[i].CurrentCubeMap); - _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentRect, - src->Texture.Unit[i].CurrentRect); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current1DArray, - src->Texture.Unit[i].Current1DArray); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current2DArray, - src->Texture.Unit[i].Current2DArray); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current1D, + src->Texture.Unit[i].Current1D); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current2D, + src->Texture.Unit[i].Current2D); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current3D, + src->Texture.Unit[i].Current3D); + _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentCubeMap, + src->Texture.Unit[i].CurrentCubeMap); + _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentRect, + src->Texture.Unit[i].CurrentRect); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current1DArray, + src->Texture.Unit[i].Current1DArray); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current2DArray, + src->Texture.Unit[i].Current2DArray); _mesa_unlock_context_textures(dst); } @@ -819,7 +819,6 @@ _mesa_free_texture_data(GLcontext *ctx) for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]); - #if FEATURE_colortable { GLuint i; diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 57419aa2f3..76b785ab0e 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2507,7 +2507,8 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) dstRow += dstRowStride / sizeof(GLuint); } } - } else { + } + else { for (img = 0; img < srcDepth; img++) { GLuint *dstRow = (GLuint *) dstAddr + dstImageOffsets[dstZoffset + img] diff --git a/src/mesa/math/m_vector.h b/src/mesa/math/m_vector.h index b1a65b3356..647388ac7d 100644 --- a/src/mesa/math/m_vector.h +++ b/src/mesa/math/m_vector.h @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 7.3 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), diff --git a/src/mesa/math/m_xform.h b/src/mesa/math/m_xform.h index d1b974f043..24e8ddbd57 100644 --- a/src/mesa/math/m_xform.h +++ b/src/mesa/math/m_xform.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), diff --git a/src/mesa/ppc/common_ppc.c b/src/mesa/ppc/common_ppc.c index 13526df78c..786e1817ac 100644 --- a/src/mesa/ppc/common_ppc.c +++ b/src/mesa/ppc/common_ppc.c @@ -38,6 +38,9 @@ #include <elf.h> #endif +#include "common_ppc_features.h" + + unsigned long _mesa_ppc_cpu_features = 0; /** diff --git a/src/mesa/ppc/common_ppc_features.h b/src/mesa/ppc/common_ppc_features.h index 4d46ca04c9..9cde422d72 100644 --- a/src/mesa/ppc/common_ppc_features.h +++ b/src/mesa/ppc/common_ppc_features.h @@ -48,4 +48,7 @@ extern unsigned long _mesa_ppc_cpu_features; #define cpu_has_fpu ((_mesa_ppc_cpu_features & PPC_FEATURE_HAS_FPU) != 0) #endif /* USE_PPC_ASM */ + +extern void _mesa_init_all_ppc_transform_asm( void ); + #endif /* COMMON_PPC_FEATURES_H */ diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 26ccdc7395..f499499eb3 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -30,17 +30,38 @@ * \author Karl Rasche */ +/** +Notes on program parameters, etc. + +The instructions we emit will use six kinds of source registers: + + PROGRAM_INPUT - input registers + PROGRAM_TEMPORARY - temp registers + PROGRAM_ADDRESS - address/indirect register + PROGRAM_SAMPLER - texture sampler + PROGRAM_CONSTANT - indexes into program->Parameters, a known constant/literal + PROGRAM_STATE_VAR - indexes into program->Parameters, and may actually be: + + a state variable, like "state.fog.color", or + + a pointer to a "program.local[k]" parameter, or + + a pointer to a "program.env[k]" parameter + +Basically, all the program.local[] and program.env[] values will get mapped +into the unified gl_program->Parameters array. This solves the problem of +having three separate program parameter arrays. +*/ + + #include "main/glheader.h" #include "main/imports.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/mtypes.h" #include "shader/grammar/grammar_mesa.h" #include "arbprogparse.h" #include "program.h" #include "programopt.h" #include "prog_parameter.h" #include "prog_statevars.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/mtypes.h" #include "prog_instruction.h" @@ -1871,7 +1892,11 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, const_values, 4); if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; - param_var->param_binding_type = PROGRAM_CONSTANT; + param_var->param_binding_type = PROGRAM_STATE_VAR; + /* Note: when we reference this parameter in an instruction later, + * we'll check if it's really a constant/immediate and set the + * instruction register type appropriately. + */ param_var->param_binding_length++; Program->Base.NumParameters++; break; @@ -2578,6 +2603,18 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, return 1; } + if (*File == PROGRAM_STATE_VAR) { + enum register_file file; + + /* If we're referencing the Program->Parameters[] array, check if the + * parameter is really a constant/literal. If so, set File to CONSTANT. + */ + assert(*Index < Program->Base.Parameters->NumParameters); + file = Program->Base.Parameters->Parameters[*Index].Type; + if (file == PROGRAM_CONSTANT) + *File = PROGRAM_CONSTANT; + } + /* Add attributes to InputsRead only if they are used the program. * This avoids the handling of unused ATTRIB declarations in the drivers. */ if (*File == PROGRAM_INPUT) diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index beb5deea50..760dac2399 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -30,13 +30,13 @@ #include "main/glheader.h" -#include "arbprogram.h" -#include "arbprogparse.h" #include "main/context.h" #include "main/hash.h" #include "main/imports.h" #include "main/macros.h" #include "main/mtypes.h" +#include "arbprogram.h" +#include "arbprogparse.h" #include "program.h" diff --git a/src/mesa/shader/grammar/grammar_crt.c b/src/mesa/shader/grammar/grammar_crt.c index bdf2da9b2e..d2c95d1c8e 100644 --- a/src/mesa/shader/grammar/grammar_crt.c +++ b/src/mesa/shader/grammar/grammar_crt.c @@ -10,17 +10,17 @@ void grammar_alloc_free (void *ptr) free (ptr); } -void *grammar_alloc_malloc (unsigned int size) +void *grammar_alloc_malloc (size_t size) { return malloc (size); } -void *grammar_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size) +void *grammar_alloc_realloc (void *ptr, size_t old_size, size_t size) { return realloc (ptr, size); } -void *grammar_memory_copy (void *dst, const void * src, unsigned int size) +void *grammar_memory_copy (void *dst, const void * src, size_t size) { return memcpy (dst, src, size); } @@ -30,7 +30,7 @@ int grammar_string_compare (const byte *str1, const byte *str2) return strcmp ((const char *) str1, (const char *) str2); } -int grammar_string_compare_n (const byte *str1, const byte *str2, unsigned int n) +int grammar_string_compare_n (const byte *str1, const byte *str2, size_t n) { return strncmp ((const char *) str1, (const char *) str2, n); } @@ -40,7 +40,7 @@ byte *grammar_string_copy (byte *dst, const byte *src) return (byte *) strcpy ((char *) dst, (const char *) src); } -byte *grammar_string_copy_n (byte *dst, const byte *src, unsigned int n) +byte *grammar_string_copy_n (byte *dst, const byte *src, size_t n) { return (byte *) strncpy ((char *) dst, (const char *) src, n); } diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index a2a7a5f3f4..20e4781372 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -41,10 +41,10 @@ #include "main/context.h" #include "main/imports.h" #include "main/macros.h" +#include "program.h" #include "prog_parameter.h" #include "prog_instruction.h" #include "nvfragparse.h" -#include "program.h" #define INPUT_1V 1 diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index d656d4b28b..88272fff3f 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -42,12 +42,12 @@ #include "main/hash.h" #include "main/imports.h" #include "main/macros.h" +#include "program.h" #include "prog_parameter.h" #include "prog_instruction.h" #include "nvfragparse.h" #include "nvvertparse.h" #include "nvprogram.h" -#include "program.h" diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 32b6ff4fd4..23648f3f4c 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -81,11 +81,12 @@ get_register_pointer(const struct prog_src_register *source, { if (source->RelAddr) { const GLint reg = source->Index + machine->AddressReg[0][0]; - if (source->File == PROGRAM_ENV_PARAM) + if (source->File == PROGRAM_ENV_PARAM) { if (reg < 0 || reg >= MAX_PROGRAM_ENV_PARAMS) return ZeroVec; else return machine->EnvParams[reg]; + } else { const struct gl_program_parameter_list *params; ASSERT(source->File == PROGRAM_LOCAL_PARAM || diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 6263fd277f..f120c20bdf 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -517,7 +517,7 @@ _mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count) for (i = 0; i < prog->NumInstructions; i++) { struct prog_instruction *inst = prog->Instructions + i; if (inst->BranchTarget > 0) { - if (inst->BranchTarget >= start) { + if ((GLuint)inst->BranchTarget >= start) { inst->BranchTarget += count; } } diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index d8b210be53..854f8bfdaa 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.2 * * Copyright (C) 2004-2008 Brian Paul All Rights Reserved. * @@ -39,11 +39,11 @@ #include "main/context.h" #include "main/hash.h" #include "main/macros.h" -#include "program.h" -#include "prog_parameter.h" -#include "prog_print.h" -#include "prog_statevars.h" -#include "prog_uniform.h" +#include "shader/program.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" +#include "shader/prog_statevars.h" +#include "shader/prog_uniform.h" #include "shader/shader_api.h" #include "shader/slang/slang_compile.h" #include "shader/slang/slang_link.h" @@ -497,10 +497,14 @@ _mesa_get_attrib_location(GLcontext *ctx, GLuint program, if (!name) return -1; - if (shProg->Attributes) { - GLint i = _mesa_lookup_parameter_index(shProg->Attributes, -1, name); - if (i >= 0) { - return shProg->Attributes->Parameters[i].StateIndexes[0]; + if (shProg->VertexProgram) { + const struct gl_program_parameter_list *attribs = + shProg->VertexProgram->Base.Attributes; + if (attribs) { + GLint i = _mesa_lookup_parameter_index(attribs, -1, name); + if (i >= 0) { + return attribs->Parameters[i].StateIndexes[0]; + } } } return -1; @@ -551,12 +555,10 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, return; } - if (shProg->VertexProgram && oldIndex >= 0 && oldIndex != index) { - /* If the index changed, need to search/replace references to that attribute - * in the vertex program. - */ - _slang_remap_attribute(&shProg->VertexProgram->Base, oldIndex, index); - } + /* + * Note that this attribute binding won't go into effect until + * glLinkProgram is called again. + */ } @@ -798,24 +800,29 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *nameOut) { + const struct gl_program_parameter_list *attribs = NULL; struct gl_shader_program *shProg; shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib"); if (!shProg) return; - if (!shProg->Attributes || index >= shProg->Attributes->NumParameters) { + if (shProg->VertexProgram) + attribs = shProg->VertexProgram->Base.Attributes; + + if (!attribs || index >= attribs->NumParameters) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveAttrib(index)"); return; } - copy_string(nameOut, maxLength, length, - shProg->Attributes->Parameters[index].Name); + copy_string(nameOut, maxLength, length, attribs->Parameters[index].Name); + if (size) - *size = shProg->Attributes->Parameters[index].Size - / sizeof_glsl_type(shProg->Attributes->Parameters[index].DataType); + *size = attribs->Parameters[index].Size + / sizeof_glsl_type(attribs->Parameters[index].DataType); + if (type) - *type = shProg->Attributes->Parameters[index].DataType; + *type = attribs->Parameters[index].DataType; } @@ -937,6 +944,7 @@ static void _mesa_get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params) { + const struct gl_program_parameter_list *attribs; struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); @@ -945,6 +953,11 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program, return; } + if (shProg->VertexProgram) + attribs = shProg->VertexProgram->Base.Attributes; + else + attribs = NULL; + switch (pname) { case GL_DELETE_STATUS: *params = shProg->DeletePending; @@ -962,11 +975,10 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program, *params = shProg->NumShaders; break; case GL_ACTIVE_ATTRIBUTES: - *params = shProg->Attributes ? shProg->Attributes->NumParameters : 0; + *params = attribs ? attribs->NumParameters : 0; break; case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: - *params = _mesa_longest_parameter_name(shProg->Attributes, - PROGRAM_INPUT) + 1; + *params = _mesa_longest_parameter_name(attribs, PROGRAM_INPUT) + 1; break; case GL_ACTIVE_UNIFORMS: *params = shProg->Uniforms ? shProg->Uniforms->NumUniforms : 0; @@ -1108,7 +1120,8 @@ get_matrix_dims(GLenum type, GLint *rows, GLint *cols) /** * Determine the number of rows and columns occupied by a uniform - * according to its datatype. + * according to its datatype. For non-matrix types (such as GL_FLOAT_VEC4), + * the number of rows = 1 and cols = number of elements in the vector. */ static void get_uniform_rows_cols(const struct gl_program_parameter *p, @@ -1117,11 +1130,17 @@ get_uniform_rows_cols(const struct gl_program_parameter *p, get_matrix_dims(p->DataType, rows, cols); if (*rows == 0 && *cols == 0) { /* not a matrix type, probably a float or vector */ - *rows = p->Size / 4 + 1; - if (p->Size % 4 == 0) - *cols = 4; - else - *cols = p->Size % 4; + if (p->Size <= 4) { + *rows = 1; + *cols = p->Size; + } + else { + *rows = p->Size / 4 + 1; + if (p->Size % 4 == 0) + *cols = 4; + else + *cols = p->Size % 4; + } } } diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 7006e86958..72a3c0ef9e 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2439,7 +2439,11 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var) /*assert(!var->declared);*/ var->declared = GL_TRUE; - assert(!is_sampler_type(&var->type)); + if(is_sampler_type(&var->type)) { + slang_info_log_error(A->log, "redeclaration of sampler '%s'", + (char*) var->a_name); + return NULL; + } n = new_node0(IR_VAR_DECL); if (n) { diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 57dbfc2388..d884be2a75 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.2 * - * Copyright (C) 2007 Brian Paul All Rights Reserved. + * Copyright (C) 2008 Brian Paul 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"), @@ -42,6 +42,24 @@ #include "slang_link.h" +/** cast wrapper */ +static struct gl_vertex_program * +vertex_program(struct gl_program *prog) +{ + assert(prog->Target == GL_VERTEX_PROGRAM_ARB); + return (struct gl_vertex_program *) prog; +} + + +/** cast wrapper */ +static struct gl_fragment_program * +fragment_program(struct gl_program *prog) +{ + assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); + return (struct gl_fragment_program *) prog; +} + + /** * Record a linking error. */ @@ -215,74 +233,112 @@ link_uniform_vars(struct gl_shader_program *shProg, * For example, if the vertex shader declared "attribute vec4 foobar" we'll * allocate a generic vertex attribute for "foobar" and plug that value into * the vertex program instructions. + * But if the user called glBindAttributeLocation(), those bindings will + * have priority. */ static GLboolean _slang_resolve_attributes(struct gl_shader_program *shProg, - struct gl_program *prog) + const struct gl_program *origProg, + struct gl_program *linkedProg) { + GLint attribMap[MAX_VERTEX_ATTRIBS]; GLuint i, j; GLbitfield usedAttributes; - assert(prog->Target == GL_VERTEX_PROGRAM_ARB); + assert(origProg != linkedProg); + assert(origProg->Target == GL_VERTEX_PROGRAM_ARB); + assert(linkedProg->Target == GL_VERTEX_PROGRAM_ARB); if (!shProg->Attributes) shProg->Attributes = _mesa_new_parameter_list(); + if (linkedProg->Attributes) { + _mesa_free_parameter_list(linkedProg->Attributes); + } + linkedProg->Attributes = _mesa_new_parameter_list(); + + /* Build a bitmask indicating which attribute indexes have been * explicitly bound by the user with glBindAttributeLocation(). */ usedAttributes = 0x0; for (i = 0; i < shProg->Attributes->NumParameters; i++) { GLint attr = shProg->Attributes->Parameters[i].StateIndexes[0]; - usedAttributes |= attr; + usedAttributes |= (1 << attr); + } + + /* initialize the generic attribute map entries to -1 */ + for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) { + attribMap[i] = -1; } /* * Scan program for generic attribute references */ - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; + for (i = 0; i < linkedProg->NumInstructions; i++) { + struct prog_instruction *inst = linkedProg->Instructions + i; for (j = 0; j < 3; j++) { if (inst->SrcReg[j].File == PROGRAM_INPUT && inst->SrcReg[j].Index >= VERT_ATTRIB_GENERIC0) { - /* this is a generic attrib */ - const GLint k = inst->SrcReg[j].Index - VERT_ATTRIB_GENERIC0; - const char *name = prog->Attributes->Parameters[k].Name; - /* See if this attrib name is in the program's attribute list - * (i.e. was bound by the user). + /* + * OK, we've found a generic vertex attribute reference. */ - GLint index = _mesa_lookup_parameter_index(shProg->Attributes, - -1, name); - GLint attr; - if (index >= 0) { - /* found, user must have specified a binding */ - attr = shProg->Attributes->Parameters[index].StateIndexes[0]; - } - else { - /* Not found, choose our own attribute number. - * Start at 1 since generic attribute 0 always aliases - * glVertex/position. + const GLint k = inst->SrcReg[j].Index - VERT_ATTRIB_GENERIC0; + + GLint attr = attribMap[k]; + + if (attr < 0) { + /* Need to figure out attribute mapping now. + */ + const char *name = origProg->Attributes->Parameters[k].Name; + const GLint size = origProg->Attributes->Parameters[k].Size; + const GLenum type =origProg->Attributes->Parameters[k].DataType; + GLint index; + + /* See if there's a user-defined attribute binding for + * this name. */ - GLint size = prog->Attributes->Parameters[k].Size; - GLenum datatype = prog->Attributes->Parameters[k].DataType; - for (attr = 1; attr < MAX_VERTEX_ATTRIBS; attr++) { - if (((1 << attr) & usedAttributes) == 0) - break; + index = _mesa_lookup_parameter_index(shProg->Attributes, + -1, name); + if (index >= 0) { + /* Found a user-defined binding */ + attr = shProg->Attributes->Parameters[index].StateIndexes[0]; } - if (attr == MAX_VERTEX_ATTRIBS) { - /* too many! XXX record error log */ - return GL_FALSE; + else { + /* No user-defined binding, choose our own attribute number. + * Start at 1 since generic attribute 0 always aliases + * glVertex/position. + */ + for (attr = 1; attr < MAX_VERTEX_ATTRIBS; attr++) { + if (((1 << attr) & usedAttributes) == 0) + break; + } + if (attr == MAX_VERTEX_ATTRIBS) { + link_error(shProg, "Too many vertex attributes"); + return GL_FALSE; + } + + /* mark this attribute as used */ + usedAttributes |= (1 << attr); } - _mesa_add_attribute(shProg->Attributes, name, size, datatype,attr); - /* set the attribute as used */ - usedAttributes |= 1<<attr; + attribMap[k] = attr; + + /* Save the final name->attrib binding so it can be queried + * with glGetAttributeLocation(). + */ + _mesa_add_attribute(linkedProg->Attributes, name, + size, type, attr); } + assert(attr >= 0); + + /* update the instruction's src reg */ inst->SrcReg[j].Index = VERT_ATTRIB_GENERIC0 + attr; } } } + return GL_TRUE; } @@ -325,6 +381,7 @@ static void _slang_update_inputs_outputs(struct gl_program *prog) { GLuint i, j; + GLuint maxAddrReg = 0; prog->InputsRead = 0x0; prog->OutputsWritten = 0x0; @@ -335,60 +392,33 @@ _slang_update_inputs_outputs(struct gl_program *prog) for (j = 0; j < numSrc; j++) { if (inst->SrcReg[j].File == PROGRAM_INPUT) { prog->InputsRead |= 1 << inst->SrcReg[j].Index; + if (prog->Target == GL_FRAGMENT_PROGRAM_ARB && + inst->SrcReg[j].Index == FRAG_ATTRIB_FOGC) { + /* The fragment shader FOGC input is used for fog, + * front-facing and sprite/point coord. + */ + struct gl_fragment_program *fp = fragment_program(prog); + const GLint swz = GET_SWZ(inst->SrcReg[j].Swizzle, 0); + if (swz == SWIZZLE_X) + fp->UsesFogFragCoord = GL_TRUE; + else if (swz == SWIZZLE_Y) + fp->UsesFrontFacing = GL_TRUE; + else if (swz == SWIZZLE_Z || swz == SWIZZLE_W) + fp->UsesPointCoord = GL_TRUE; + } + } + else if (inst->SrcReg[j].File == PROGRAM_ADDRESS) { + maxAddrReg = MAX2(maxAddrReg, inst->SrcReg[j].Index + 1); } } if (inst->DstReg.File == PROGRAM_OUTPUT) { prog->OutputsWritten |= 1 << inst->DstReg.Index; } - } -} - - -/** - * Scan a vertex program looking for instances of - * (PROGRAM_INPUT, VERT_ATTRIB_GENERIC0 + oldAttrib) and replace with - * (PROGRAM_INPUT, VERT_ATTRIB_GENERIC0 + newAttrib). - * This is used when the user calls glBindAttribLocation on an already linked - * shader program. - */ -void -_slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, GLuint newAttrib) -{ - GLuint i, j; - - assert(prog->Target == GL_VERTEX_PROGRAM_ARB); - - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; - for (j = 0; j < 3; j++) { - if (inst->SrcReg[j].File == PROGRAM_INPUT) { - if (inst->SrcReg[j].Index == VERT_ATTRIB_GENERIC0 + oldAttrib) { - inst->SrcReg[j].Index = VERT_ATTRIB_GENERIC0 + newAttrib; - } - } + else if (inst->DstReg.File == PROGRAM_ADDRESS) { + maxAddrReg = MAX2(maxAddrReg, inst->DstReg.Index + 1); } } - - _slang_update_inputs_outputs(prog); -} - - - -/** cast wrapper */ -static struct gl_vertex_program * -vertex_program(struct gl_program *prog) -{ - assert(prog->Target == GL_VERTEX_PROGRAM_ARB); - return (struct gl_vertex_program *) prog; -} - - -/** cast wrapper */ -static struct gl_fragment_program * -fragment_program(struct gl_program *prog) -{ - assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); - return (struct gl_fragment_program *) prog; + prog->NumAddressRegs = maxAddrReg; } @@ -492,9 +522,8 @@ _slang_link(GLcontext *ctx, /*_mesa_print_uniforms(shProg->Uniforms);*/ if (shProg->VertexProgram) { - if (!_slang_resolve_attributes(shProg, &shProg->VertexProgram->Base)) { - /*goto cleanup;*/ - _mesa_problem(ctx, "_slang_resolve_attributes() failed"); + if (!_slang_resolve_attributes(shProg, &vertProg->Base, + &shProg->VertexProgram->Base)) { return; } } diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index 8ef8a6b4b3..2b44d20787 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.2 * - * Copyright (C) 2007 Brian Paul All Rights Reserved. + * Copyright (C) 2008 Brian Paul 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"), @@ -32,10 +32,6 @@ extern void _slang_link(GLcontext *ctx, GLhandleARB h, struct gl_shader_program *shProg); -extern void -_slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, - GLuint newAttrib); - #endif diff --git a/src/mesa/sources b/src/mesa/sources index 2db1843239..9a34d1a989 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -2,6 +2,7 @@ MAIN_SOURCES = \ main/api_arrayelt.c \ + main/api_exec.c \ main/api_loopback.c \ main/api_noop.c \ main/api_validate.c \ @@ -11,6 +12,7 @@ MAIN_SOURCES = \ main/blend.c \ main/bufferobj.c \ main/buffers.c \ + main/clear.c \ main/clip.c \ main/colortab.c \ main/context.c \ @@ -27,6 +29,7 @@ MAIN_SOURCES = \ main/extensions.c \ main/fbobject.c \ main/feedback.c \ + main/ffvertex_prog.c \ main/fog.c \ main/framebuffer.c \ main/get.c \ @@ -41,23 +44,30 @@ MAIN_SOURCES = \ main/matrix.c \ main/mipmap.c \ main/mm.c \ + main/multisample.c \ main/pixel.c \ + main/pixelstore.c \ main/points.c \ main/polygon.c \ main/queryobj.c \ main/rastpos.c \ main/rbadaptors.c \ + main/readpix.c \ main/renderbuffer.c \ + main/scissor.c \ main/shaders.c \ main/state.c \ main/stencil.c \ main/texcompress.c \ main/texcompress_s3tc.c \ main/texcompress_fxt1.c \ + main/texenv.c \ main/texenvprogram.c \ main/texformat.c \ + main/texgen.c \ main/teximage.c \ main/texobj.c \ + main/texparam.c \ main/texrender.c \ main/texstate.c \ main/texstore.c \ @@ -67,6 +77,7 @@ MAIN_SOURCES = \ GLAPI_SOURCES = \ main/dispatch.c \ glapi/glapi.c \ + glapi/glapi_getproc.c \ glapi/glthread.c MATH_SOURCES = \ @@ -118,6 +129,7 @@ TNL_SOURCES = \ tnl/t_context.c \ tnl/t_pipeline.c \ tnl/t_draw.c \ + tnl/t_rasterpos.c \ tnl/t_vb_program.c \ tnl/t_vb_render.c \ tnl/t_vb_texgen.c \ @@ -159,6 +171,7 @@ SHADER_SOURCES = \ shader/nvprogram.c \ shader/nvvertparse.c \ shader/program.c \ + shader/prog_cache.c \ shader/prog_debug.c \ shader/prog_execute.c \ shader/prog_instruction.c \ @@ -260,20 +273,19 @@ MESA_SOURCES = \ ALL_SOURCES = \ $(MESA_SOURCES) \ $(GLAPI_SOURCES) \ - $(ASM_SOURCES) \ + $(MESA_ASM_SOURCES) \ $(COMMON_DRIVER_SOURCES) - ### Object files MESA_OBJECTS = \ $(MESA_SOURCES:.c=.o) \ - $(ASM_SOURCES:.S=.o) + $(MESA_ASM_SOURCES:.S=.o) GLAPI_OBJECTS = \ $(GLAPI_SOURCES:.c=.o) \ - $(ASM_API:.S=.o) + $(GLAPI_ASM_SOURCES:.S=.o) COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_SOURCES:.c=.o) @@ -281,16 +293,10 @@ COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_SOURCES:.c=.o) ### Include directories +### XXX we should be able to trim this down to just -Iinclude/ and -Isrc/mesa/ +### since most #includes have been changed from #include "mtypes.h" to +### #include "main/mtypes.h", etc. INCLUDE_DIRS = \ -I$(TOP)/include \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/main \ - -I$(TOP)/src/mesa/glapi \ - -I$(TOP)/src/mesa/math \ - -I$(TOP)/src/mesa/tnl \ - -I$(TOP)/src/mesa/shader \ - -I$(TOP)/src/mesa/shader/grammar \ - -I$(TOP)/src/mesa/shader/slang \ - -I$(TOP)/src/mesa/swrast \ - -I$(TOP)/src/mesa/swrast_setup + -I$(TOP)/src/mesa diff --git a/src/mesa/state_tracker/acc2.c b/src/mesa/state_tracker/acc2.c deleted file mode 100644 index fa5de2b764..0000000000 --- a/src/mesa/state_tracker/acc2.c +++ /dev/null @@ -1,319 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * 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 TUNGSTEN GRAPHICS 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. - * - **************************************************************************/ - - /* - * Authors: - * Brian Paul - */ - -#include "main/imports.h" -#include "main/image.h" -#include "main/macros.h" - -#include "st_context.h" -#include "st_cb_accum.h" -#include "st_cb_fbo.h" -#include "st_draw.h" -#include "st_format.h" -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "pipe/p_inlines.h" -#include "util/p_tile.h" - - -#define UNCLAMPED_FLOAT_TO_SHORT(us, f) \ - us = ( (short) ( CLAMP((f), -1.0, 1.0) * 32767.0F) ) - - -/** - * For hardware that supports deep color buffers, we could accelerate - * most/all the accum operations with blending/texturing. - * For now, just use the get/put_tile() functions and do things in software. - */ - - -static void -acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps, - uint x, uint y, uint w, uint h, float *p) -{ - const enum pipe_format f = acc_ps->format; - const int cpp = acc_ps->cpp; - - acc_ps->format = PIPE_FORMAT_R16G16B16A16_SNORM; - acc_ps->cpp = 8; - - pipe_get_tile_rgba(pipe, acc_ps, x, y, w, h, p); - - acc_ps->format = f; - acc_ps->cpp = cpp; -} - - -static void -acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps, - uint x, uint y, uint w, uint h, const float *p) -{ - enum pipe_format f = acc_ps->format; - const int cpp = acc_ps->cpp; - - acc_ps->format = PIPE_FORMAT_R16G16B16A16_SNORM; - acc_ps->cpp = 8; - - pipe_put_tile_rgba(pipe, acc_ps, x, y, w, h, p); - - acc_ps->format = f; - acc_ps->cpp = cpp; -} - - - -void -st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) -{ - struct pipe_context *pipe = ctx->st->pipe; - struct st_renderbuffer *acc_strb = st_renderbuffer(rb); - struct pipe_surface *acc_ps = acc_strb->surface; - const GLint xpos = ctx->DrawBuffer->_Xmin; - const GLint ypos = ctx->DrawBuffer->_Ymin; - const GLint width = ctx->DrawBuffer->_Xmax - xpos; - const GLint height = ctx->DrawBuffer->_Ymax - ypos; - const GLfloat r = ctx->Accum.ClearColor[0]; - const GLfloat g = ctx->Accum.ClearColor[1]; - const GLfloat b = ctx->Accum.ClearColor[2]; - const GLfloat a = ctx->Accum.ClearColor[3]; - GLfloat *accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - int i; - -#if 1 - GLvoid *map; - - map = pipe_surface_map(acc_ps); - switch (acc_strb->format) { - case PIPE_FORMAT_R16G16B16A16_SNORM: - { - GLshort r = FLOAT_TO_SHORT(ctx->Accum.ClearColor[0]); - GLshort g = FLOAT_TO_SHORT(ctx->Accum.ClearColor[1]); - GLshort b = FLOAT_TO_SHORT(ctx->Accum.ClearColor[2]); - GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]); - int i, j; - for (i = 0; i < height; i++) { - GLshort *dst = ((GLshort *) map - + ((ypos + i) * acc_ps->pitch + xpos) * 4); - for (j = 0; j < width; j++) { - dst[0] = r; - dst[1] = g; - dst[2] = b; - dst[3] = a; - dst += 4; - } - } - } - break; - default: - _mesa_problem(ctx, "unexpected format in st_clear_accum_buffer()"); - } - - pipe_surface_unmap(acc_ps); - -#else - for (i = 0; i < width * height; i++) { - accBuf[i*4+0] = r; - accBuf[i*4+1] = g; - accBuf[i*4+2] = b; - accBuf[i*4+3] = a; - } - - acc_put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf); -#endif -} - - -/** For ADD/MULT */ -static void -accum_mad(struct pipe_context *pipe, GLfloat scale, GLfloat bias, - GLint xpos, GLint ypos, GLint width, GLint height, - struct pipe_surface *acc_ps) -{ - GLfloat *accBuf; - GLint i; - - accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - - pipe_get_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf); - - for (i = 0; i < 4 * width * height; i++) { - accBuf[i] = accBuf[i] * scale + bias; - } - - pipe_put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf); - - free(accBuf); -} - - -static void -accum_accum(struct pipe_context *pipe, GLfloat value, - GLint xpos, GLint ypos, GLint width, GLint height, - struct pipe_surface *acc_ps, - struct pipe_surface *color_ps) -{ - GLfloat *colorBuf, *accBuf; - GLint i; - - colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - - pipe_get_tile_rgba(pipe, color_ps, xpos, ypos, width, height, colorBuf); - acc_get_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf); - - for (i = 0; i < 4 * width * height; i++) { - accBuf[i] = accBuf[i] + colorBuf[i] * value; - } - - acc_put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf); - - free(colorBuf); - free(accBuf); -} - - -static void -accum_load(struct pipe_context *pipe, GLfloat value, - GLint xpos, GLint ypos, GLint width, GLint height, - struct pipe_surface *acc_ps, - struct pipe_surface *color_ps) -{ - GLfloat *buf; - GLint i; - - buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - - pipe_get_tile_rgba(pipe, color_ps, xpos, ypos, width, height, buf); - - for (i = 0; i < 4 * width * height; i++) { - buf[i] = buf[i] * value; - } - - acc_put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, buf); - - free(buf); -} - - -static void -accum_return(GLcontext *ctx, GLfloat value, - GLint xpos, GLint ypos, GLint width, GLint height, - struct pipe_surface *acc_ps, - struct pipe_surface *color_ps) -{ - struct pipe_context *pipe = ctx->st->pipe; - const GLubyte *colormask = ctx->Color.ColorMask; - GLfloat *abuf, *cbuf = NULL; - GLint i, ch; - - abuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - - acc_get_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, abuf); - - if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) { - cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(pipe, color_ps, xpos, ypos, width, height, cbuf); - } - - for (i = 0; i < width * height; i++) { - for (ch = 0; ch < 4; ch++) { - if (colormask[ch]) { - GLfloat val = abuf[i * 4 + ch] * value; - abuf[i * 4 + ch] = CLAMP(val, 0.0, 1.0); - } - else { - abuf[i * 4 + ch] = cbuf[i * 4 + ch]; - } - } - } - - pipe_put_tile_rgba(pipe, color_ps, xpos, ypos, width, height, abuf); - - free(abuf); - if (cbuf) - free(cbuf); -} - - -static void -st_Accum(GLcontext *ctx, GLenum op, GLfloat value) -{ - struct st_context *st = ctx->st; - struct pipe_context *pipe = st->pipe; - struct st_renderbuffer *acc_strb - = st_renderbuffer(ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer); - struct st_renderbuffer *color_strb - = st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer); - struct pipe_surface *acc_ps = acc_strb->surface; - struct pipe_surface *color_ps = color_strb->surface; - - const GLint xpos = ctx->DrawBuffer->_Xmin; - const GLint ypos = ctx->DrawBuffer->_Ymin; - const GLint width = ctx->DrawBuffer->_Xmax - xpos; - const GLint height = ctx->DrawBuffer->_Ymax - ypos; - - /* make sure color bufs aren't cached */ - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - - switch (op) { - case GL_ADD: - if (value != 0.0F) { - accum_mad(pipe, 1.0, value, xpos, ypos, width, height, acc_ps); - } - break; - case GL_MULT: - if (value != 1.0F) { - accum_mad(pipe, value, 0.0, xpos, ypos, width, height, acc_ps); - } - break; - case GL_ACCUM: - if (value != 0.0F) { - accum_accum(pipe, value, xpos, ypos, width, height, acc_ps, color_ps); - } - break; - case GL_LOAD: - accum_load(pipe, value, xpos, ypos, width, height, acc_ps, color_ps); - break; - case GL_RETURN: - accum_return(ctx, value, xpos, ypos, width, height, acc_ps, color_ps); - break; - default: - assert(0); - } -} - - - -void st_init_accum_functions(struct dd_function_table *functions) -{ - functions->Accum = st_Accum; -} diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index d3886f95cd..b4f42c6f93 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -144,18 +144,13 @@ update_framebuffer_state( struct st_context *st ) cso_set_framebuffer(st->cso_context, framebuffer); -#if 0 - if (fb->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT) { + if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) { if (st->frontbuffer_status == FRONT_STATUS_COPY_OF_BACK) { /* XXX copy back buf to front? */ } /* we're assuming we'll really draw to the front buffer */ st->frontbuffer_status = FRONT_STATUS_DIRTY; } -#else -#warning "fix me" - st->frontbuffer_status = FRONT_STATUS_DIRTY; -#endif } diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index e286dc5116..fc47896c24 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -254,7 +254,7 @@ static void update_raster_state( struct st_context *st ) raster->line_stipple_factor = ctx->Line.StippleFactor - 1; /* _NEW_MULTISAMPLE */ - if (ctx->Multisample._Enabled) + if (ctx->Multisample._Enabled || st->force_msaa) raster->multisample = 1; /* _NEW_SCISSOR */ diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 8406bf247f..00076f61e0 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -170,6 +170,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, 0, 0, 0, surface_usage ); + assert(strb->surface->texture); assert(strb->surface->buffer); assert(strb->surface->format); assert(strb->surface->block.size); diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c index 066124f8f3..09545aa8fb 100644 --- a/src/mesa/state_tracker/st_cb_strings.c +++ b/src/mesa/state_tracker/st_cb_strings.c @@ -40,7 +40,7 @@ #include "st_context.h" #include "st_cb_strings.h" -#define ST_VERSION_STRING "0.1" +#define ST_VERSION_STRING "0.2" static const GLubyte * st_get_string(GLcontext * ctx, GLenum name) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index a3e8fc992d..e545e00eb2 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -455,6 +455,11 @@ st_TexImage(GLcontext * ctx, _mesa_align_free(texImage->Data); } + if (width == 0 || height == 0 || depth == 0) { + /* stop after freeing old image */ + return; + } + /* If this is the only mipmap level in the texture, could call * bmBufferData with NULL data to free the old block and avoid * waiting on any outstanding fences. @@ -476,8 +481,15 @@ st_TexImage(GLcontext * ctx, if (!stObj->pt) { guess_and_alloc_texture(ctx->st, stObj, stImage); if (!stObj->pt) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); - return; + /* Probably out of memory. + * Try flushing any pending rendering, then retry. + */ + st_finish(ctx->st); + guess_and_alloc_texture(ctx->st, stObj, stImage); + if (!stObj->pt) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); + return; + } } } @@ -737,8 +749,8 @@ st_GetTexImage(GLcontext * ctx, GLenum target, GLint level, static void st_GetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, GLvoid *pixels, - const struct gl_texture_object *texObj, - const struct gl_texture_image *texImage) + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) { st_get_tex_image(ctx, target, level, 0, 0, pixels, (struct gl_texture_object *) texObj, @@ -1048,7 +1060,8 @@ st_copy_texsubimage(GLcontext *ctx, GLboolean use_fallback = GL_TRUE; GLboolean matching_base_formats; - st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + /* any rendering in progress must complete before we grab the fb image */ + st_finish(ctx->st); /* determine if copying depth or color data */ if (texBaseFormat == GL_DEPTH_COMPONENT) { diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 08d4db7f7f..cca808d328 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -88,6 +88,19 @@ void st_invalidate_state(GLcontext * ctx, GLuint new_state) } +/** + * Check for multisample env var override. + */ +int +st_get_msaa(void) +{ + const char *msaa = _mesa_getenv("__GL_FSAA_MODE"); + if (msaa) + return atoi(msaa); + return 0; +} + + static struct st_context * st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) { @@ -141,6 +154,8 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) st->pixel_xfer.cache = _mesa_new_program_cache(); + st->force_msaa = st_get_msaa(); + /* GL limits and extensions */ st_init_limits(st); st_init_extensions(st); @@ -188,8 +203,6 @@ static void st_destroy_context_priv( struct st_context *st ) st_destroy_drawtex(st); #endif - _vbo_DestroyContext(st->ctx); - for (i = 0; i < Elements(st->state.sampler_texture); i++) { pipe_texture_reference(&st->state.sampler_texture[i], NULL); } @@ -223,6 +236,8 @@ void st_destroy_context( struct st_context *st ) _mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache); + _vbo_DestroyContext(st->ctx); + _mesa_free_context_data(ctx); st_destroy_context_priv(st); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 4314d9af5c..1d1aca3111 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -181,6 +181,8 @@ struct st_context struct blit_state *blit; struct cso_context *cso_context; + + int force_msaa; }; @@ -238,4 +240,8 @@ st_fb_orientation(const struct gl_framebuffer *fb) } +extern int +st_get_msaa(void); + + #endif diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 0f4a03fa48..1ff7009382 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -51,13 +51,12 @@ st_create_framebuffer( const __GLcontextModes *visual, { struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer); if (stfb) { - int samples = 0; - const char *msaa_override = _mesa_getenv("__GL_FSAA_MODE"); + int samples = st_get_msaa(); + + if (visual->sampleBuffers) + samples = visual->samples; + _mesa_initialize_framebuffer(&stfb->Base, visual); - if (visual->sampleBuffers) samples = visual->samples; - if (msaa_override) { - samples = _mesa_atoi(msaa_override); - } { /* fake frontbuffer */ @@ -154,9 +153,9 @@ void st_resize_framebuffer( struct st_framebuffer *stfb, } -void st_unreference_framebuffer( struct st_framebuffer **stfb ) +void st_unreference_framebuffer( struct st_framebuffer *stfb ) { - _mesa_unreference_framebuffer((struct gl_framebuffer **) stfb); + _mesa_unreference_framebuffer((struct gl_framebuffer **) &stfb); } @@ -302,3 +301,10 @@ void *st_framebuffer_private( struct st_framebuffer *stfb ) return stfb->Private; } +void st_get_framebuffer_dimensions( struct st_framebuffer *stfb, + uint *width, + uint *height) +{ + *width = stfb->Base.Width; + *height = stfb->Base.Height; +} diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index b9d114b1c9..a15faf732c 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -138,11 +138,11 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, _mesa_generate_mipmap_level(target, datatype, comps, 0 /*border*/, pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel], - srcSurf->stride, /* stride in bytes */ srcData, + srcSurf->stride, /* stride in bytes */ pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel], - dstSurf->stride, /* stride in bytes */ - dstData); + dstData, + dstSurf->stride); /* stride in bytes */ pipe_buffer_unmap(pipe->screen, srcSurf->buffer); pipe_buffer_unmap(pipe->screen, dstSurf->buffer); diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 5ec9fddd7f..50e638df46 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -35,10 +35,13 @@ #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_build.h" #include "tgsi/tgsi_util.h" +#include "tgsi/tgsi_dump.h" +#include "tgsi/tgsi_sanity.h" #include "st_mesa_to_tgsi.h" #include "shader/prog_instruction.h" #include "shader/prog_parameter.h" - +#include "shader/prog_print.h" +#include "pipe/p_debug.h" /* * Map mesa register file to TGSI register file. @@ -74,6 +77,7 @@ map_register_file( case PROGRAM_CONSTANT: if (indirectAccess) return TGSI_FILE_CONSTANT; + assert(immediateMapping[index] != ~0); return TGSI_FILE_IMMEDIATE; case PROGRAM_INPUT: return TGSI_FILE_INPUT; @@ -115,6 +119,7 @@ map_register_file_index( case TGSI_FILE_IMMEDIATE: if (indirectAccess) return index; + assert(immediateMapping[index] != ~0); return immediateMapping[index]; default: @@ -239,6 +244,7 @@ compile_instruction( immediateMapping, indirectAccess ); + /* swizzle (ext swizzle also depends on negation) */ { GLuint swz[4]; @@ -707,7 +713,7 @@ find_temporaries(const struct gl_program *program, * \return number of tokens placed in 'tokens' buffer, or zero if error */ GLuint -tgsi_translate_mesa_program( +st_translate_mesa_program( uint procType, const struct gl_program *program, GLuint numInputs, @@ -980,5 +986,17 @@ tgsi_translate_mesa_program( maxTokens - ti ); } +#if DEBUG + if(!tgsi_sanity_check(tokens)) { + debug_printf("Due to sanity check failure(s) above the following shader program is invalid:\n"); + debug_printf("\nOriginal program:\n%s", program->String); + debug_printf("\nMesa program:\n"); + _mesa_print_program(program); + debug_printf("\nTGSI program:\n"); + tgsi_dump(tokens, 0); + assert(0); + } +#endif + return ti; } diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index f17f2eac96..77c74644b8 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -40,7 +40,7 @@ struct tgsi_token; struct gl_program; GLuint -tgsi_translate_mesa_program( +st_translate_mesa_program( uint procType, const struct gl_program *program, GLuint numInputs, diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 936a6e32ea..55b52c3745 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -307,7 +307,7 @@ st_translate_vertex_program(struct st_context *st, /* XXX: fix static allocation of tokens: */ - num_tokens = tgsi_translate_mesa_program( TGSI_PROCESSOR_VERTEX, + num_tokens = st_translate_mesa_program( TGSI_PROCESSOR_VERTEX, &stvp->Base.Base, /* inputs */ vs_num_inputs, @@ -409,7 +409,10 @@ st_translate_fragment_program(struct st_context *st, interpMode[slot] = TGSI_INTERPOLATE_LINEAR; break; case FRAG_ATTRIB_FOGC: - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG; + if (stfp->Base.UsesPointCoord) + stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + else + stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG; stfp->input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; @@ -478,7 +481,7 @@ st_translate_fragment_program(struct st_context *st, /* XXX: fix static allocation of tokens: */ - num_tokens = tgsi_translate_mesa_program( TGSI_PROCESSOR_FRAGMENT, + num_tokens = st_translate_mesa_program( TGSI_PROCESSOR_FRAGMENT, &stfp->Base.Base, /* inputs */ fs_num_inputs, diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h index 5cfb2e41f2..6ef30f4403 100644 --- a/src/mesa/state_tracker/st_public.h +++ b/src/mesa/state_tracker/st_public.h @@ -75,6 +75,9 @@ void st_resize_framebuffer( struct st_framebuffer *stfb, void st_set_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex, struct pipe_surface *surf); +void st_get_framebuffer_dimensions( struct st_framebuffer *stfb, + uint *width, uint *height); + struct pipe_surface *st_get_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex); @@ -83,7 +86,7 @@ struct pipe_texture *st_get_framebuffer_texture(struct st_framebuffer *stfb, void *st_framebuffer_private( struct st_framebuffer *stfb ); -void st_unreference_framebuffer( struct st_framebuffer **stfb ); +void st_unreference_framebuffer( struct st_framebuffer *stfb ); void st_make_current(struct st_context *st, struct st_framebuffer *draw, diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c index ee65a71d7e..9bfa8f2e61 100644 --- a/src/mesa/swrast/s_aaline.c +++ b/src/mesa/swrast/s_aaline.c @@ -26,11 +26,11 @@ #include "main/glheader.h" #include "main/imports.h" #include "main/macros.h" +#include "main/mtypes.h" #include "swrast/s_aaline.h" #include "swrast/s_context.h" #include "swrast/s_span.h" #include "swrast/swrast.h" -#include "main/mtypes.h" #define SUB_PIXEL 4 diff --git a/src/mesa/swrast/s_aaline.h b/src/mesa/swrast/s_aaline.h index 9fb4959f91..f1d708ec80 100644 --- a/src/mesa/swrast/s_aaline.h +++ b/src/mesa/swrast/s_aaline.h @@ -28,7 +28,6 @@ #define S_AALINE_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast/s_aatriangle.h b/src/mesa/swrast/s_aatriangle.h index 734d420b62..4b57fa73a2 100644 --- a/src/mesa/swrast/s_aatriangle.h +++ b/src/mesa/swrast/s_aatriangle.h @@ -28,7 +28,6 @@ #define S_AATRIANGLE_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c index 1d1cdf23d1..ff741777e7 100644 --- a/src/mesa/swrast/s_accum.c +++ b/src/mesa/swrast/s_accum.c @@ -27,7 +27,7 @@ #include "main/context.h" #include "main/macros.h" #include "main/imports.h" -#include "fbobject.h" +#include "main/fbobject.h" #include "s_accum.h" #include "s_context.h" diff --git a/src/mesa/swrast/s_alpha.h b/src/mesa/swrast/s_alpha.h index 92cb01b18a..7a5b72e650 100644 --- a/src/mesa/swrast/s_alpha.h +++ b/src/mesa/swrast/s_alpha.h @@ -28,7 +28,6 @@ #define S_ALPHA_H -#include "main/mtypes.h" #include "s_context.h" diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c index 9fa352c36b..21cbd3cf37 100644 --- a/src/mesa/swrast/s_atifragshader.c +++ b/src/mesa/swrast/s_atifragshader.c @@ -1,5 +1,4 @@ /* - * * Copyright (C) 2004 David Airlie All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 2308acae1c..35b34e654f 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -29,10 +29,10 @@ */ #include "main/glheader.h" -#include "bufferobj.h" -#include "image.h" +#include "main/bufferobj.h" +#include "main/image.h" #include "main/macros.h" -#include "pixel.h" +#include "main/pixel.h" #include "s_context.h" #include "s_span.h" diff --git a/src/mesa/swrast/s_blend.h b/src/mesa/swrast/s_blend.h index c8abecc099..8d5a81635d 100644 --- a/src/mesa/swrast/s_blend.h +++ b/src/mesa/swrast/s_blend.h @@ -27,7 +27,6 @@ #define S_BLEND_H -#include "main/mtypes.h" #include "s_context.h" diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 2dea895399..297940adbd 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -27,14 +27,14 @@ */ #include "main/imports.h" -#include "bufferobj.h" +#include "main/bufferobj.h" #include "main/context.h" #include "main/colormac.h" #include "main/mtypes.h" -#include "teximage.h" -#include "swrast.h" +#include "main/teximage.h" #include "shader/prog_parameter.h" #include "shader/prog_statevars.h" +#include "swrast.h" #include "s_blend.h" #include "s_context.h" #include "s_lines.h" diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index b5ffb6aa1e..fc5990b261 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -26,12 +26,12 @@ #include "main/glheader.h" #include "main/context.h" #include "main/colormac.h" -#include "convolve.h" -#include "histogram.h" -#include "image.h" +#include "main/convolve.h" +#include "main/histogram.h" +#include "main/image.h" #include "main/macros.h" #include "main/imports.h" -#include "pixel.h" +#include "main/pixel.h" #include "s_context.h" #include "s_depth.h" diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index a9d3e9d98e..293eb8628e 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -27,7 +27,7 @@ #include "main/context.h" #include "main/macros.h" #include "main/imports.h" -#include "fbobject.h" +#include "main/fbobject.h" #include "s_depth.h" #include "s_context.h" diff --git a/src/mesa/swrast/s_depth.h b/src/mesa/swrast/s_depth.h index 484cc73f49..3688625683 100644 --- a/src/mesa/swrast/s_depth.h +++ b/src/mesa/swrast/s_depth.h @@ -27,7 +27,6 @@ #define S_DEPTH_H -#include "main/mtypes.h" #include "s_context.h" diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 72398f9ec1..7af3e3dad1 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -24,17 +24,16 @@ #include "main/glheader.h" -#include "bufferobj.h" +#include "main/bufferobj.h" #include "main/context.h" -#include "convolve.h" -#include "image.h" +#include "main/convolve.h" +#include "main/image.h" #include "main/macros.h" #include "main/imports.h" -#include "pixel.h" -#include "state.h" +#include "main/pixel.h" +#include "main/state.h" #include "s_context.h" -#include "s_drawpix.h" #include "s_span.h" #include "s_stencil.h" #include "s_zoom.h" diff --git a/src/mesa/swrast/s_drawpix.h b/src/mesa/swrast/s_drawpix.h deleted file mode 100644 index 7882a79966..0000000000 --- a/src/mesa/swrast/s_drawpix.h +++ /dev/null @@ -1,36 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL 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 S_DRAWPIXELS_H -#define S_DRAWPIXELS_H - - -#include "main/mtypes.h" -#include "swrast.h" - -/* XXX kill this header? */ - -#endif diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index 31cea8e41f..aa79531277 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -26,7 +26,7 @@ #include "main/colormac.h" #include "main/context.h" #include "main/enums.h" -#include "feedback.h" +#include "main/feedback.h" #include "main/macros.h" #include "s_context.h" diff --git a/src/mesa/swrast/s_feedback.h b/src/mesa/swrast/s_feedback.h index 6484f1dc75..9feab75dbb 100644 --- a/src/mesa/swrast/s_feedback.h +++ b/src/mesa/swrast/s_feedback.h @@ -28,7 +28,6 @@ #define S_FEEDBACK_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast/s_fog.h b/src/mesa/swrast/s_fog.h index 2346dd1734..50760d88af 100644 --- a/src/mesa/swrast/s_fog.h +++ b/src/mesa/swrast/s_fog.h @@ -28,7 +28,6 @@ #define S_FOG_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast/s_imaging.c b/src/mesa/swrast/s_imaging.c index 73aaba1ec9..591857c342 100644 --- a/src/mesa/swrast/s_imaging.c +++ b/src/mesa/swrast/s_imaging.c @@ -27,10 +27,11 @@ * extensions into either swrast or a sister module. */ +#include "main/glheader.h" +#include "main/colortab.h" +#include "main/convolve.h" #include "s_context.h" #include "s_span.h" -#include "colortab.h" -#include "convolve.h" void diff --git a/src/mesa/swrast/s_lines.h b/src/mesa/swrast/s_lines.h index 6c629ca2d4..22979a02b6 100644 --- a/src/mesa/swrast/s_lines.h +++ b/src/mesa/swrast/s_lines.h @@ -27,7 +27,7 @@ #ifndef S_LINES_H #define S_LINES_H -#include "main/mtypes.h" +#include "swrast.h" void _swrast_choose_line( GLcontext *ctx ); diff --git a/src/mesa/swrast/s_logic.h b/src/mesa/swrast/s_logic.h index 04ef00bb99..ba20cd7b32 100644 --- a/src/mesa/swrast/s_logic.h +++ b/src/mesa/swrast/s_logic.h @@ -27,7 +27,6 @@ #define S_LOGIC_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast/s_masking.h b/src/mesa/swrast/s_masking.h index 688c07c7ae..3260ca34e3 100644 --- a/src/mesa/swrast/s_masking.h +++ b/src/mesa/swrast/s_masking.h @@ -27,7 +27,6 @@ #define S_MASKING_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c index 22639c58ff..846c485f15 100644 --- a/src/mesa/swrast/s_points.c +++ b/src/mesa/swrast/s_points.c @@ -27,7 +27,7 @@ #include "main/colormac.h" #include "main/context.h" #include "main/macros.h" -#include "texstate.h" +#include "main/texstate.h" #include "s_context.h" #include "s_feedback.h" #include "s_points.h" diff --git a/src/mesa/swrast/s_points.h b/src/mesa/swrast/s_points.h index 3fda115c0d..9e39c601ef 100644 --- a/src/mesa/swrast/s_points.h +++ b/src/mesa/swrast/s_points.h @@ -27,7 +27,7 @@ #ifndef S_POINTS_H #define S_POINTS_H -#include "main/mtypes.h" +#include "swrast.h" extern void _swrast_choose_point( GLcontext *ctx ); diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 8fa95ded18..f263045170 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -24,16 +24,16 @@ #include "main/glheader.h" -#include "bufferobj.h" +#include "main/bufferobj.h" #include "main/colormac.h" -#include "convolve.h" +#include "main/convolve.h" #include "main/context.h" -#include "feedback.h" -#include "image.h" +#include "main/feedback.h" +#include "main/image.h" #include "main/macros.h" #include "main/imports.h" -#include "pixel.h" -#include "state.h" +#include "main/pixel.h" +#include "main/state.h" #include "s_context.h" #include "s_depth.h" diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 01b490f38f..214c2a1b6f 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -35,7 +35,7 @@ #include "main/context.h" #include "main/macros.h" #include "main/imports.h" -#include "image.h" +#include "main/image.h" #include "s_atifragshader.h" #include "s_alpha.h" diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h index 6b814fc8fb..c4b47df58f 100644 --- a/src/mesa/swrast/s_span.h +++ b/src/mesa/swrast/s_span.h @@ -27,7 +27,6 @@ #define S_SPAN_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast/s_stencil.h b/src/mesa/swrast/s_stencil.h index 742f8d4c94..cd6cbc57b0 100644 --- a/src/mesa/swrast/s_stencil.h +++ b/src/mesa/swrast/s_stencil.h @@ -27,7 +27,6 @@ #define S_STENCIL_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index b7724f7b20..4e3d329075 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -28,7 +28,7 @@ #include "main/colormac.h" #include "main/imports.h" #include "main/macros.h" -#include "image.h" +#include "main/pixel.h" #include "s_context.h" #include "s_texcombine.h" diff --git a/src/mesa/swrast/s_texcombine.h b/src/mesa/swrast/s_texcombine.h index 20cd2bd8ad..9ed96efb87 100644 --- a/src/mesa/swrast/s_texcombine.h +++ b/src/mesa/swrast/s_texcombine.h @@ -27,7 +27,6 @@ #define S_TEXCOMBINE_H -#include "main/mtypes.h" #include "swrast.h" extern void diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 1b44fddc41..9e44fba3da 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -27,7 +27,7 @@ #include "main/context.h" #include "main/colormac.h" #include "main/imports.h" -#include "texformat.h" +#include "main/texformat.h" #include "s_context.h" #include "s_texfilter.h" @@ -342,6 +342,7 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c, break; \ default: \ _mesa_problem(ctx, "Bad wrap mode"); \ + return; \ } \ } @@ -462,6 +463,7 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c, break; \ default: \ _mesa_problem(ctx, "Bad wrap mode"); \ + return; \ } \ } diff --git a/src/mesa/swrast/s_texfilter.h b/src/mesa/swrast/s_texfilter.h index 6267ad17eb..2e265d685c 100644 --- a/src/mesa/swrast/s_texfilter.h +++ b/src/mesa/swrast/s_texfilter.h @@ -27,7 +27,6 @@ #define S_TEXFILTER_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast/s_texstore.c b/src/mesa/swrast/s_texstore.c index f3ce590bf3..15d52aa587 100644 --- a/src/mesa/swrast/s_texstore.c +++ b/src/mesa/swrast/s_texstore.c @@ -40,13 +40,13 @@ #include "main/imports.h" #include "main/colormac.h" #include "main/context.h" -#include "convolve.h" -#include "image.h" +#include "main/convolve.h" +#include "main/image.h" #include "main/macros.h" -#include "mipmap.h" -#include "texformat.h" -#include "teximage.h" -#include "texstore.h" +#include "main/mipmap.h" +#include "main/texformat.h" +#include "main/teximage.h" +#include "main/texstore.h" #include "s_context.h" #include "s_depth.h" diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index f584f6e7f5..2033ab5529 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -34,7 +34,7 @@ #include "main/colormac.h" #include "main/imports.h" #include "main/macros.h" -#include "texformat.h" +#include "main/texformat.h" #include "s_aatriangle.h" #include "s_context.h" diff --git a/src/mesa/swrast/s_triangle.h b/src/mesa/swrast/s_triangle.h index c3cadae2d4..b81932c730 100644 --- a/src/mesa/swrast/s_triangle.h +++ b/src/mesa/swrast/s_triangle.h @@ -28,7 +28,6 @@ #define S_TRIANGLES_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast/s_zoom.h b/src/mesa/swrast/s_zoom.h index 7701515476..d2815b41a0 100644 --- a/src/mesa/swrast/s_zoom.h +++ b/src/mesa/swrast/s_zoom.h @@ -25,7 +25,6 @@ #ifndef S_ZOOM_H #define S_ZOOM_H -#include "main/mtypes.h" #include "swrast.h" diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index 4ed868ea60..f4d90c514b 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -28,13 +28,14 @@ #include "main/glheader.h" #include "main/imports.h" #include "main/colormac.h" -#include "ss_context.h" -#include "ss_triangle.h" -#include "swrast_setup.h" #include "tnl/tnl.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "tnl/t_vertex.h" +#include "swrast_setup.h" +#include "ss_context.h" +#include "ss_triangle.h" + /* Need to check lighting state and vertex program state to know * if two-sided lighting is in effect. diff --git a/src/mesa/swrast_setup/ss_triangle.h b/src/mesa/swrast_setup/ss_triangle.h index 863e744607..007fa2e914 100644 --- a/src/mesa/swrast_setup/ss_triangle.h +++ b/src/mesa/swrast_setup/ss_triangle.h @@ -29,7 +29,6 @@ #ifndef SS_TRIANGLE_H #define SS_TRIANGLE_H -#include "main/mtypes.h" #include "ss_context.h" diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index dd59091770..ce37dc0428 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.2 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -136,11 +136,19 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR_INDEX ); } - if (ctx->Fog.Enabled || - ((ctx->FragmentProgram._Active || ctx->FragmentProgram._Current) && - (ctx->FragmentProgram._Current->FogOption != GL_NONE || - (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_FOGC)))) + if (ctx->Fog.Enabled) { + /* fixed-function fog */ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG ); + } + else if (ctx->FragmentProgram._Active || ctx->FragmentProgram._Current) { + struct gl_fragment_program *fp = ctx->FragmentProgram._Current; + if (fp) { + if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) { + /* fragment program needs fog coord */ + RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG ); + } + } + } if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index 173deff09c..fd647c1f4a 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -28,7 +28,7 @@ #include "main/glheader.h" #include "main/context.h" #include "main/imports.h" -#include "state.h" +#include "main/state.h" #include "main/mtypes.h" #include "main/macros.h" #include "main/enums.h" diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index ebd3412d20..f47f99397c 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -26,10 +26,10 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "light.h" +#include "main/light.h" #include "main/macros.h" #include "main/imports.h" -#include "simple_list.h" +#include "main/simple_list.h" #include "main/mtypes.h" #include "math/m_translate.h" diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c index c399423b9e..db70ad4dad 100644 --- a/src/mesa/tnl/t_vertex_generic.c +++ b/src/mesa/tnl/t_vertex_generic.c @@ -29,9 +29,9 @@ #include "main/glheader.h" #include "main/context.h" #include "main/colormac.h" +#include "main/simple_list.h" #include "t_context.h" #include "t_vertex.h" -#include "simple_list.h" diff --git a/src/mesa/tnl/t_vertex_sse.c b/src/mesa/tnl/t_vertex_sse.c index 53a6e55f4b..76043bd1b5 100644 --- a/src/mesa/tnl/t_vertex_sse.c +++ b/src/mesa/tnl/t_vertex_sse.c @@ -28,10 +28,10 @@ #include "main/glheader.h" #include "main/context.h" #include "main/colormac.h" +#include "main/simple_list.h" +#include "main/enums.h" #include "t_context.h" #include "t_vertex.h" -#include "simple_list.h" -#include "main/enums.h" #if defined(USE_SSE_ASM) diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 691bf5b450..bbf745b0c6 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -244,12 +244,14 @@ void _vbo_DestroyContext( GLcontext *ctx ) ctx->aelt_context = NULL; } - vbo_exec_destroy(ctx); + if (vbo_context(ctx)) { + vbo_exec_destroy(ctx); #if FEATURE_dlist - vbo_save_destroy(ctx); + vbo_save_destroy(ctx); #endif - FREE(vbo_context(ctx)); - ctx->swtnl_im = NULL; + FREE(vbo_context(ctx)); + ctx->swtnl_im = NULL; + } } diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index d70b4bb1a1..fdb0c5a9a4 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -700,8 +700,8 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) &exec->vtx.bufferobj, ctx->Array.NullBufferObj); + ASSERT(!exec->vtx.buffer_map); exec->vtx.buffer_map = ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE * sizeof(GLfloat), 64); - vbo_exec_vtxfmt_init( exec ); /* Hook our functions into the dispatch table. @@ -726,13 +726,13 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) { - GLcontext *ctx = exec->ctx; if (exec->vtx.bufferobj->Name) { - ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, exec->vtx.bufferobj); - ctx->Driver.DeleteBuffer(ctx, exec->vtx.bufferobj); - exec->vtx.bufferobj = NULL; + /* using a real VBO for vertex data */ + GLcontext *ctx = exec->ctx; + _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); } else { + /* just using malloc'd space for vertex data */ if (exec->vtx.buffer_map) { ALIGN_FREE(exec->vtx.buffer_map); exec->vtx.buffer_map = NULL; diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 7ec431a237..92356ba977 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -200,7 +200,6 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) /* Ptr into ordinary app memory */ arrays[attr].Ptr = (void *) data; } - arrays[attr].Size = exec->vtx.attrsz[src]; arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat); arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat); @@ -243,8 +242,11 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec ) */ vbo_exec_bind_arrays( ctx ); - ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj); - exec->vtx.buffer_map = NULL; + /* if using a real VBO, unmap it before drawing */ + if (exec->vtx.bufferobj->Name) { + ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj); + exec->vtx.buffer_map = NULL; + } vbo_context(ctx)->draw_prims( ctx, exec->vtx.inputs, @@ -254,11 +256,12 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec ) 0, exec->vtx.vert_count - 1); - /* Get new data: - */ - ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj); - exec->vtx.buffer_map - = ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); + /* If using a real VBO, get new storage */ + if (exec->vtx.bufferobj->Name) { + ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj); + exec->vtx.buffer_map = + ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); + } } } diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 88d573f128..f69a33d817 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1045,6 +1045,32 @@ void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode ) void vbo_save_EndList( GLcontext *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; + + /* EndList called inside a (saved) Begin/End pair? + */ + if (ctx->Driver.CurrentSavePrimitive != PRIM_OUTSIDE_BEGIN_END) { + + if (save->prim_count > 0) { + GLint i = save->prim_count - 1; + ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; + save->prim[i].end = 0; + save->prim[i].count = (save->vert_count - + save->prim[i].start); + } + + /* Make sure this vertex list gets replayed by the "loopback" + * mechanism: + */ + save->dangling_attr_ref = 1; + vbo_save_SaveFlushVertices( ctx ); + + /* Swap out this vertex format while outside begin/end. Any color, + * etc. received between here and the next begin will be compiled + * as opcodes. + */ + _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); + } + unmap_vertex_store( ctx, save->vertex_store ); assert(save->vertex_size == 0); diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index dc80d26fa9..5321547935 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -48,8 +48,8 @@ #include <machine/cpu.h> #endif -#include "common_x86_asm.h" #include "main/imports.h" +#include "common_x86_asm.h" int _mesa_x86_cpu_features = 0; diff --git a/src/mesa/x86/common_x86_asm.S b/src/mesa/x86/common_x86_asm.S index 09c86b05ba..ea4047a0e1 100644 --- a/src/mesa/x86/common_x86_asm.S +++ b/src/mesa/x86/common_x86_asm.S @@ -39,6 +39,7 @@ * in there will break the build on some platforms. */ +#include "matypes.h" #include "assyntax.h" #include "common_x86_features.h" |