Mesa (master): nouveau: remove dri1 code now we' re using the dri state tracker

Ben Skeggs darktama at kemper.freedesktop.org
Thu May 7 23:36:25 UTC 2009


Module: Mesa
Branch: master
Commit: 9e02fa45320c724c69839dae5aaa47034eae5125
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e02fa45320c724c69839dae5aaa47034eae5125

Author: Ben Skeggs <bskeggs at redhat.com>
Date:   Fri May  8 09:11:17 2009 +1000

nouveau: remove dri1 code now we're using the dri state tracker

---

 src/gallium/winsys/drm/nouveau/Makefile            |    2 +-
 src/gallium/winsys/drm/nouveau/dri/Makefile        |   16 +-
 .../winsys/drm/nouveau/dri/nouveau_context.c       |  118 -------
 .../winsys/drm/nouveau/dri/nouveau_context.h       |   53 ----
 src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c  |   73 -----
 .../winsys/drm/nouveau/dri/nouveau_screen.c        |  330 --------------------
 .../winsys/drm/nouveau/dri/nouveau_screen.h        |   16 -
 .../winsys/drm/nouveau/dri/nouveau_swapbuffers.c   |  115 -------
 .../winsys/drm/nouveau/dri/nouveau_swapbuffers.h   |   11 -
 src/gallium/winsys/drm/nouveau/dri2/Makefile       |   26 --
 10 files changed, 5 insertions(+), 755 deletions(-)

diff --git a/src/gallium/winsys/drm/nouveau/Makefile b/src/gallium/winsys/drm/nouveau/Makefile
index be4cad6..e275b2d 100644
--- a/src/gallium/winsys/drm/nouveau/Makefile
+++ b/src/gallium/winsys/drm/nouveau/Makefile
@@ -2,7 +2,7 @@
 TOP = ../../../../..
 include $(TOP)/configs/current
 
-SUBDIRS = drm dri2
+SUBDIRS = drm dri
 
 default install clean:
 	@for dir in $(SUBDIRS) ; do \
diff --git a/src/gallium/winsys/drm/nouveau/dri/Makefile b/src/gallium/winsys/drm/nouveau/dri/Makefile
index f7db620..024ab15 100644
--- a/src/gallium/winsys/drm/nouveau/dri/Makefile
+++ b/src/gallium/winsys/drm/nouveau/dri/Makefile
@@ -3,9 +3,8 @@ include $(TOP)/configs/current
 
 LIBNAME = nouveau_dri.so
 
-MINIGLX_SOURCES =
-
 PIPE_DRIVERS = \
+	$(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
 	$(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
 	$(TOP)/src/gallium/drivers/nv04/libnv04.a \
 	$(TOP)/src/gallium/drivers/nv10/libnv10.a \
@@ -13,22 +12,15 @@ PIPE_DRIVERS = \
 	$(TOP)/src/gallium/drivers/nv30/libnv30.a \
 	$(TOP)/src/gallium/drivers/nv40/libnv40.a \
 	$(TOP)/src/gallium/drivers/nv50/libnv50.a
-	
-DRIVER_SOURCES = \
-	nouveau_context.c \
-	nouveau_screen.c \
-	nouveau_swapbuffers.c \
-	nouveau_lock.c
+
+DRIVER_SOURCES =
 
 C_SOURCES = \
 	$(COMMON_GALLIUM_SOURCES) \
 	$(DRIVER_SOURCES)
 
-ASM_SOURCES = 
+include ../../Makefile.template
 
-DRIVER_DEFINES = $(shell pkg-config libdrm_nouveau --cflags)
 DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs)
 
-include ../../Makefile.template
-
 symlinks:
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_context.c
deleted file mode 100644
index deb6ffc..0000000
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_context.c
+++ /dev/null
@@ -1,118 +0,0 @@
-#include <main/glheader.h>
-#include <glapi/glthread.h>
-#include <GL/internal/glcore.h>
-#include <utils.h>
-
-#include <state_tracker/st_public.h>
-#include <state_tracker/st_context.h>
-#include <state_tracker/drm_api.h>
-#include <pipe/p_defines.h>
-#include <pipe/p_context.h>
-#include <pipe/p_screen.h>
-
-#include "nouveau_context.h"
-#include "nouveau_screen.h"
-
-#include "nouveau_drmif.h"
-
-GLboolean
-nouveau_context_create(const __GLcontextModes *glVis,
-		       __DRIcontextPrivate *driContextPriv,
-		       void *sharedContextPrivate)
-{
-	__DRIscreenPrivate *driScrnPriv = driContextPriv->driScreenPriv;
-	struct nouveau_screen  *nv_screen = driScrnPriv->private;
-	struct nouveau_context *nv;
-	struct pipe_context *pipe;
-	struct st_context *st_share = NULL;
-
-	if (sharedContextPrivate)
-		st_share = ((struct nouveau_context *)sharedContextPrivate)->st;
-
-	nv = CALLOC_STRUCT(nouveau_context);
-	if (!nv)
-		return GL_FALSE;
-
-	{
-		struct nouveau_device_priv *nvdev =
-			nouveau_device(nv_screen->device);
-
-		nvdev->ctx  = driContextPriv->hHWContext;
-		nvdev->lock = (drmLock *)&driScrnPriv->pSAREA->lock;
-	}
-
-	pipe = drm_api_hooks.create_context(nv_screen->pscreen);
-	if (!pipe) {
-		FREE(nv);
-		return GL_FALSE;
-	}
-	pipe->priv = nv;
-
-	driContextPriv->driverPrivate = nv;
-	nv->dri_screen = driScrnPriv;
-
-	driParseConfigFiles(&nv->dri_option_cache, &nv_screen->option_cache,
-			    nv->dri_screen->myNum, "nouveau");
-
-	nv->st = st_create_context(pipe, glVis, st_share);
-	return GL_TRUE;
-}
-
-void
-nouveau_context_destroy(__DRIcontextPrivate *driContextPriv)
-{
-	struct nouveau_context *nv = driContextPriv->driverPrivate;
-
-	assert(nv);
-
-	st_finish(nv->st);
-	st_destroy_context(nv->st);
-
-	FREE(nv);
-}
-
-GLboolean
-nouveau_context_bind(__DRIcontextPrivate *driContextPriv,
-		     __DRIdrawablePrivate *driDrawPriv,
-		     __DRIdrawablePrivate *driReadPriv)
-{
-	struct nouveau_context *nv;
-	struct nouveau_framebuffer *draw, *read;
-
-	if (!driContextPriv) {
-		st_make_current(NULL, NULL, NULL);
-		return GL_TRUE;
-	}
-
-	nv = driContextPriv->driverPrivate;
-	draw = driDrawPriv->driverPrivate;
-	read = driReadPriv->driverPrivate;
-
-	st_make_current(nv->st, draw->stfb, read->stfb);
-
-	if ((nv->dri_drawable != driDrawPriv) ||
-	    (nv->last_stamp != driDrawPriv->lastStamp)) {
-		nv->dri_drawable = driDrawPriv;
-		st_resize_framebuffer(draw->stfb, driDrawPriv->w,
-				      driDrawPriv->h);
-		nv->last_stamp = driDrawPriv->lastStamp;
-	}
-
-	if (driDrawPriv != driReadPriv) {
-		st_resize_framebuffer(read->stfb, driReadPriv->w,
-				      driReadPriv->h);
-	}
-
-	return GL_TRUE;
-}
-
-GLboolean
-nouveau_context_unbind(__DRIcontextPrivate *driContextPriv)
-{
-	struct nouveau_context *nv = driContextPriv->driverPrivate;
-	(void)nv;
-
-	st_flush(nv->st, 0, NULL);
-	return GL_TRUE;
-}
-
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_context.h
deleted file mode 100644
index 2779b09..0000000
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_context.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef __NOUVEAU_CONTEXT_DRI_H__
-#define __NOUVEAU_CONTEXT_DRI_H__
-
-#include <dri_util.h>
-#include <xmlconfig.h>
-
-#include "nouveau/nouveau_winsys.h"
-
-#define NOUVEAU_ERR(fmt, args...) debug_printf("%s: "fmt, __func__, ##args)
-
-struct nouveau_framebuffer {
-	struct st_framebuffer *stfb;
-};
-
-struct nouveau_context {
-	struct st_context *st;
-
-	/* DRI stuff */
-	__DRIscreenPrivate    *dri_screen;
-	__DRIdrawablePrivate  *dri_drawable;
-	unsigned int           last_stamp;
-	driOptionCache         dri_option_cache;
-	drm_context_t          drm_context;
-	drmLock                drm_lock;
-	int                    locked;
-};
-
-extern GLboolean nouveau_context_create(const __GLcontextModes *,
-					__DRIcontextPrivate *, void *);
-extern void nouveau_context_destroy(__DRIcontextPrivate *);
-extern GLboolean nouveau_context_bind(__DRIcontextPrivate *,
-				      __DRIdrawablePrivate *draw,
-				      __DRIdrawablePrivate *read);
-extern GLboolean nouveau_context_unbind(__DRIcontextPrivate *);
-
-extern void nouveau_contended_lock(struct nouveau_context *nv);
-extern void LOCK_HARDWARE(struct nouveau_context *nv);
-extern void UNLOCK_HARDWARE(struct nouveau_context *nv);
-
-#ifdef DEBUG
-extern int __nouveau_debug;
-
-#define DEBUG_BO (1 << 0)
-
-#define DBG(flag, ...) do {                   \
-	if (__nouveau_debug & (DEBUG_##flag)) \
-		NOUVEAU_ERR(__VA_ARGS__);     \
-} while(0)
-#else
-#define DBG(flag, ...)
-#endif
-
-#endif
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c
deleted file mode 100644
index 92f5bd0..0000000
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c
+++ /dev/null
@@ -1,73 +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.
- * 
- **************************************************************************/
-
-#include <pipe/p_thread.h>
-#include "nouveau_context.h"
-#include "nouveau_screen.h"
-#include "nouveau_drmif.h"
-
-pipe_static_mutex(lockMutex);
-
-/* Lock the hardware and validate our state.
- */
-void
-LOCK_HARDWARE(struct nouveau_context *nv)
-{
-	struct nouveau_screen *nv_screen = nv->dri_screen->private;
-	struct nouveau_device *dev = nv_screen->device;
-	struct nouveau_device_priv *nvdev = nouveau_device(dev);
-	char __ret=0;
-
-	assert(!nv->locked);
-	pipe_mutex_lock(lockMutex);
-
-	DRM_CAS(nvdev->lock, nvdev->ctx,
-		(DRM_LOCK_HELD | nvdev->ctx), __ret);
-
-	if (__ret) {
-		drmGetLock(nvdev->fd, nvdev->ctx, 0);
-		nouveau_contended_lock(nv);
-	}
-	nv->locked = 1;
-}
-
-/* Unlock the hardware using the global current context 
- */
-void
-UNLOCK_HARDWARE(struct nouveau_context *nv)
-{
-	struct nouveau_screen *nv_screen = nv->dri_screen->private;
-	struct nouveau_device *dev = nv_screen->device;
-	struct nouveau_device_priv *nvdev = nouveau_device(dev);
-
-	assert(nv->locked);
-	nv->locked = 0;
-
-	DRM_UNLOCK(nvdev->fd, nvdev->lock, nvdev->ctx);
-
-	pipe_mutex_unlock(lockMutex);
-} 
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c
deleted file mode 100644
index 4e9b76a..0000000
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c
+++ /dev/null
@@ -1,330 +0,0 @@
-#include <utils.h>
-#include <vblank.h>
-#include <xmlpool.h>
-
-#include <pipe/p_context.h>
-#include <state_tracker/st_public.h>
-#include <state_tracker/st_cb_fbo.h>
-#include <state_tracker/drm_api.h>
-
-#include "nouveau_context.h"
-#include "nouveau_screen.h"
-#include "nouveau_swapbuffers.h"
-#include "nouveau_dri.h"
-
-#include "nouveau_drm.h"
-#include "nouveau_drmif.h"
-
-#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 12
-#error nouveau_drm.h version does not match expected version
-#endif
-
-/* Extension stuff, enabling of extensions handled by Gallium's GL state
- * tracker.  But, we still need to define the entry points we want.
- */
-#define need_GL_ARB_fragment_program
-#define need_GL_ARB_multisample
-#define need_GL_ARB_occlusion_query
-#define need_GL_ARB_point_parameters
-#define need_GL_ARB_shader_objects
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_vertex_shader
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_EXT_compiled_vertex_array
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_secondary_color
-#define need_GL_EXT_framebuffer_object
-#define need_GL_VERSION_2_0
-#define need_GL_VERSION_2_1
-#include "extension_helper.h"
-
-const struct dri_extension card_extensions[] =
-{
-	{ "GL_ARB_multisample", GL_ARB_multisample_functions },
-	{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions },
-	{ "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
-	{ "GL_ARB_shader_objects", GL_ARB_shader_objects_functions },
-	{ "GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
-	{ "GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
-	{ "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
-	{ "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
-	{ "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions },
-	{ "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions },
-	{ "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions },
-	{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
-	{ "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
-	{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
-	{ NULL, 0 }
-};
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
-DRI_CONF_END;
-static const GLuint __driNConfigOptions = 0;
-
-extern const struct dri_extension common_extensions[];
-extern const struct dri_extension nv40_extensions[];
-
-static GLboolean
-nouveau_create_buffer(__DRIscreenPrivate * driScrnPriv,
-		      __DRIdrawablePrivate * driDrawPriv,
-		      const __GLcontextModes *glVis, GLboolean pixmapBuffer)
-{
-	struct nouveau_framebuffer *nvfb;
-	enum pipe_format colour, depth, stencil;
-
-	if (pixmapBuffer)
-		return GL_FALSE;
-
-	nvfb = CALLOC_STRUCT(nouveau_framebuffer);
-	if (!nvfb)
-		return GL_FALSE;
-
-	if (glVis->redBits == 5)
-		colour = PIPE_FORMAT_R5G6B5_UNORM;
-	else
-		colour = PIPE_FORMAT_A8R8G8B8_UNORM;
-
-	if (glVis->depthBits == 16)
-		depth = PIPE_FORMAT_Z16_UNORM;
-	else if (glVis->depthBits == 24)
-		depth = PIPE_FORMAT_Z24S8_UNORM;
-	else
-		depth = PIPE_FORMAT_NONE;
-
-	if (glVis->stencilBits == 8)
-		stencil = PIPE_FORMAT_Z24S8_UNORM;
-	else
-		stencil = PIPE_FORMAT_NONE;
-
-	nvfb->stfb = st_create_framebuffer(glVis, colour, depth, stencil,
-					   driDrawPriv->w, driDrawPriv->h,
-					   (void*)nvfb);
-	if (!nvfb->stfb) {
-		free(nvfb);
-		return  GL_FALSE;
-	}
-
-	driDrawPriv->driverPrivate = (void *)nvfb;
-	return GL_TRUE;
-}
-
-static void
-nouveau_destroy_buffer(__DRIdrawablePrivate * driDrawPriv)
-{
-	struct nouveau_framebuffer *nvfb;
-	
-	nvfb = (struct nouveau_framebuffer *)driDrawPriv->driverPrivate;
-	st_unreference_framebuffer(nvfb->stfb);
-	free(nvfb);
-}
-
-static __DRIconfig **
-nouveau_fill_in_modes(__DRIscreenPrivate *psp,
-		      unsigned pixel_bits, unsigned depth_bits,
-		      unsigned stencil_bits, GLboolean have_back_buffer)
-{
-	__DRIconfig **configs;
-	unsigned depth_buffer_factor;
-	unsigned back_buffer_factor;
-	GLenum fb_format;
-	GLenum fb_type;
-
-	static const GLenum back_buffer_modes[] = {
-		GLX_NONE, GLX_SWAP_UNDEFINED_OML,
-	};
-
-	uint8_t depth_bits_array[3];
-	uint8_t stencil_bits_array[3];
-	uint8_t msaa_samples_array[1];
-
-	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;
-	if (depth_bits == 24)
-		stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
-	stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits;
-
-	msaa_samples_array[0] = 0;
-
-	depth_buffer_factor =
-		((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
-	back_buffer_factor = (have_back_buffer) ? 3 : 1;
-
-	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;
-	}
-
-	configs = driCreateConfigs(fb_format, fb_type,
-				   depth_bits_array, stencil_bits_array,
-				   depth_buffer_factor, back_buffer_modes,
-				   back_buffer_factor, msaa_samples_array, 1);
-	if (configs == NULL) {
-	 fprintf(stderr, "[%s:%u] Error creating FBConfig!\n",
-			 __func__, __LINE__);
-		return NULL;
-	}
-
-	return configs;
-}
-
-static struct pipe_surface *
-dri_surface_from_handle(struct pipe_screen *screen,
-                        unsigned handle,
-                        enum pipe_format format,
-                        unsigned width,
-                        unsigned height,
-                        unsigned pitch)
-{
-   struct pipe_surface *surface = NULL;
-   struct pipe_texture *texture = NULL;
-   struct pipe_texture templat;
-   struct pipe_buffer *buf = NULL;
-
-   buf = drm_api_hooks.buffer_from_handle(screen, "front buffer", handle);
-   if (!buf)
-      return NULL;
-
-   memset(&templat, 0, sizeof(templat));
-   templat.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY |
-                       NOUVEAU_TEXTURE_USAGE_LINEAR;
-   templat.target = PIPE_TEXTURE_2D;
-   templat.last_level = 0;
-   templat.depth[0] = 1;
-   templat.format = format;
-   templat.width[0] = width;
-   templat.height[0] = height;
-   pf_get_block(templat.format, &templat.block);
-
-   texture = screen->texture_blanket(screen,
-                                     &templat,
-                                     &pitch,
-                                     buf);
-
-   /* we don't need the buffer from this point on */
-   pipe_buffer_reference(&buf, NULL);
-
-   if (!texture)
-      return NULL;
-
-   surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
-                                     PIPE_BUFFER_USAGE_GPU_READ |
-                                     PIPE_BUFFER_USAGE_GPU_WRITE);
-
-   /* we don't need the texture from this point on */
-   pipe_texture_reference(&texture, NULL);
-   return surface;
-}
-
-static const __DRIconfig **
-nouveau_screen_create(__DRIscreenPrivate *psp)
-{
-	struct nouveau_dri *nv_dri = psp->pDevPriv;
-	struct nouveau_screen *nv_screen;
-	static const __DRIversion ddx_expected =
-		{ 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
-	static const __DRIversion dri_expected = { 4, 0, 0 };
-	static const __DRIversion drm_expected =
-		{ 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
-
-	if (!driCheckDriDdxDrmVersions2("nouveau",
-					&psp->dri_version, &dri_expected,
-					&psp->ddx_version, &ddx_expected,
-					&psp->drm_version, &drm_expected)) {
-		return NULL;
-	}
-
-	if (drm_expected.patch != psp->drm_version.patch) {
-		fprintf(stderr, "Incompatible DRM patch level.\n"
-				"Expected: %d\n" "Current : %d\n",
-			drm_expected.patch, psp->drm_version.patch);
-		return NULL;
-	}
-
-	driInitExtensions(NULL, card_extensions, GL_FALSE);
-
-	if (psp->devPrivSize != sizeof(struct nouveau_dri)) {
-		NOUVEAU_ERR("DRI struct mismatch between DDX/DRI\n");
-		return NULL;
-	}
-
-	nv_screen = CALLOC_STRUCT(nouveau_screen);
-	if (!nv_screen)
-		return NULL;
-
-	nouveau_device_open_existing(&nv_screen->device, 0, psp->fd, 0);
-
-	nv_screen->pscreen = drm_api_hooks.create_screen(psp->fd, NULL);
-	if (!nv_screen->pscreen) {
-		FREE(nv_screen);
-		return NULL;
-	}
-	nv_screen->pscreen->flush_frontbuffer = nouveau_flush_frontbuffer;
-
-	{
-		enum pipe_format format;
-
-		if (nv_dri->bpp == 16)
-			format = PIPE_FORMAT_R5G6B5_UNORM;
-		else
-			format = PIPE_FORMAT_A8R8G8B8_UNORM;
-
-		nv_screen->fb = dri_surface_from_handle(nv_screen->pscreen,
-							nv_dri->front_offset,
-							format,
-							nv_dri->width,
-							nv_dri->height,
-							nv_dri->front_pitch *
-							nv_dri->bpp / 8);
-	}
-						
-	driParseOptionInfo(&nv_screen->option_cache,
-			   __driConfigOptions, __driNConfigOptions);
-
-	nv_screen->driScrnPriv = psp;
-	psp->private = (void *)nv_screen;
-
-	return (const __DRIconfig **)
-		nouveau_fill_in_modes(psp, nv_dri->bpp,
-				      (nv_dri->bpp == 16) ? 16 : 24,
-				      (nv_dri->bpp == 16) ? 0 : 8, 1);
-}
-
-static void
-nouveau_screen_destroy(__DRIscreenPrivate *driScrnPriv)
-{
-	struct nouveau_screen *nv_screen = driScrnPriv->private;
-
-	driScrnPriv->private = NULL;
-	FREE(nv_screen);
-}
-
-const struct __DriverAPIRec
-driDriverAPI = {
-	.InitScreen	= nouveau_screen_create,
-	.DestroyScreen	= nouveau_screen_destroy,
-	.CreateContext	= nouveau_context_create,
-	.DestroyContext	= nouveau_context_destroy,
-	.CreateBuffer	= nouveau_create_buffer,
-	.DestroyBuffer	= nouveau_destroy_buffer,
-	.SwapBuffers	= nouveau_swap_buffers,
-	.MakeCurrent	= nouveau_context_bind,
-	.UnbindContext	= nouveau_context_unbind,
-	.CopySubBuffer	= nouveau_copy_sub_buffer,
-
-	.InitScreen2	= NULL, /* one day, I promise! */
-};
-
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h
deleted file mode 100644
index ac078f3..0000000
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef __NOUVEAU_SCREEN_DRI_H__
-#define __NOUVEAU_SCREEN_DRI_H__
-
-#include "xmlconfig.h"
-
-struct nouveau_screen {
-	__DRIscreenPrivate *driScrnPriv;
-	driOptionCache      option_cache;
-
-	struct nouveau_device *device;
-
-	struct pipe_screen *pscreen;
-	struct pipe_surface *fb;
-};
-
-#endif
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c
deleted file mode 100644
index 9c841a0..0000000
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <main/glheader.h>
-#include <glapi/glthread.h>
-#include <GL/internal/glcore.h>
-
-#include <pipe/p_context.h>
-#include <state_tracker/st_public.h>
-#include <state_tracker/st_context.h>
-#include <state_tracker/st_cb_fbo.h>
-
-#include "nouveau_context.h"
-#include "nouveau_screen.h"
-#include "nouveau_swapbuffers.h"
-
-#include "nouveau_pushbuf.h"
-
-void
-nouveau_copy_buffer(__DRIdrawablePrivate *dPriv, struct pipe_surface *surf,
-		    const drm_clip_rect_t *rect)
-{
-	struct nouveau_context *nv = dPriv->driContextPriv->driverPrivate;
-	struct nouveau_screen *nv_screen = nv->dri_screen->private;
-	struct pipe_context *pipe = nv->st->pipe;
-	drm_clip_rect_t *pbox;
-	int nbox, i;
-
-	LOCK_HARDWARE(nv);
-	if (!dPriv->numClipRects) {
-		UNLOCK_HARDWARE(nv);
-		return;
-	}
-	pbox = dPriv->pClipRects;
-	nbox = dPriv->numClipRects;
-
-	for (i = 0; i < nbox; i++, pbox++) {
-		int sx, sy, dx, dy, w, h;
-
-		sx = pbox->x1 - dPriv->x;
-		sy = pbox->y1 - dPriv->y;
-		dx = pbox->x1;
-		dy = pbox->y1;
-		w  = pbox->x2 - pbox->x1;
-		h  = pbox->y2 - pbox->y1;
-
-		pipe->surface_copy(pipe, nv_screen->fb, dx, dy, surf,
-				   sx, sy, w, h);
-	}
-
-	pipe->flush(pipe, 0, NULL);
-	UNLOCK_HARDWARE(nv);
-
-	if (nv->last_stamp != dPriv->lastStamp) {
-		struct nouveau_framebuffer *nvfb = dPriv->driverPrivate;
-		st_resize_framebuffer(nvfb->stfb, dPriv->w, dPriv->h);
-		nv->last_stamp = dPriv->lastStamp;
-	}
-}
-
-void
-nouveau_copy_sub_buffer(__DRIdrawablePrivate *dPriv, int x, int y, int w, int h)
-{
-	struct nouveau_framebuffer *nvfb = dPriv->driverPrivate;
-	struct pipe_surface *surf;
-
-	st_get_framebuffer_surface(nvfb->stfb, ST_SURFACE_BACK_LEFT, &surf);
-	if (surf) {
-		drm_clip_rect_t rect;
-		rect.x1 = x;
-		rect.y1 = y;
-		rect.x2 = x + w;
-		rect.y2 = y + h;
-
-		st_notify_swapbuffers(nvfb->stfb);
-		nouveau_copy_buffer(dPriv, surf, &rect);
-	}
-}
-
-void
-nouveau_swap_buffers(__DRIdrawablePrivate *dPriv)
-{
-	struct nouveau_framebuffer *nvfb = dPriv->driverPrivate;
-	struct pipe_surface *surf;
-
-	st_get_framebuffer_surface(nvfb->stfb, ST_SURFACE_BACK_LEFT, &surf);
-	if (surf) {
-		st_notify_swapbuffers(nvfb->stfb);
-		nouveau_copy_buffer(dPriv, surf, NULL);
-	}
-}
-
-void
-nouveau_flush_frontbuffer(struct pipe_screen *pscreen, struct pipe_surface *ps,
-			  void *context_private)
-{
-	struct nouveau_context *nv = context_private;
-	__DRIdrawablePrivate *dPriv = nv->dri_drawable;
-
-	nouveau_copy_buffer(dPriv, ps, NULL);
-}
-
-void
-nouveau_contended_lock(struct nouveau_context *nv)
-{
-	struct nouveau_context *nv_sub = (struct nouveau_context*)nv;
-	__DRIdrawablePrivate *dPriv = nv_sub->dri_drawable;
-	__DRIscreenPrivate *sPriv = nv_sub->dri_screen;
-
-	/* If the window moved, may need to set a new cliprect now.
-	 *
-	 * NOTE: This releases and regains the hw lock, so all state
-	 * checking must be done *after* this call:
-	 */
-	if (dPriv)
-		DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-}
-
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h
deleted file mode 100644
index 4ca9cc2..0000000
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __NOUVEAU_SWAPBUFFERS_H__
-#define __NOUVEAU_SWAPBUFFERS_H__
-
-void nouveau_copy_buffer(__DRIdrawablePrivate *, struct pipe_surface *,
-			 const drm_clip_rect_t *);
-void nouveau_copy_sub_buffer(__DRIdrawablePrivate *, int x, int y, int w, int h);
-void nouveau_swap_buffers(__DRIdrawablePrivate *);
-void nouveau_flush_frontbuffer(struct pipe_screen *, struct pipe_surface *,
-			       void *context_private);
-
-#endif
diff --git a/src/gallium/winsys/drm/nouveau/dri2/Makefile b/src/gallium/winsys/drm/nouveau/dri2/Makefile
deleted file mode 100644
index 024ab15..0000000
--- a/src/gallium/winsys/drm/nouveau/dri2/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = nouveau_dri.so
-
-PIPE_DRIVERS = \
-	$(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
-	$(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
-	$(TOP)/src/gallium/drivers/nv04/libnv04.a \
-	$(TOP)/src/gallium/drivers/nv10/libnv10.a \
-	$(TOP)/src/gallium/drivers/nv20/libnv20.a \
-	$(TOP)/src/gallium/drivers/nv30/libnv30.a \
-	$(TOP)/src/gallium/drivers/nv40/libnv40.a \
-	$(TOP)/src/gallium/drivers/nv50/libnv50.a
-
-DRIVER_SOURCES =
-
-C_SOURCES = \
-	$(COMMON_GALLIUM_SOURCES) \
-	$(DRIVER_SOURCES)
-
-include ../../Makefile.template
-
-DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs)
-
-symlinks:




More information about the mesa-commit mailing list