summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-05-10 03:27:58 +0200
committerJerome Glisse <jglisse@redhat.com>2010-05-27 23:24:02 +0200
commitb8fb1d75ce95fe5d404b301ab31ca0c323967d14 (patch)
tree78b648b638f7ed1560c569877c2c0c3b8b1dd81e /src/gallium/winsys
parent72128962d640846472c1b0dc22cf4ac6ce875dc9 (diff)
r600g: adapt to latest interfaces changes
- Wrapped the buffer and texture create/destroy/transfer/... functions using u_resource, which is then used to implement the resource functions. - Implemented texture transfers. I left the buffer and texture transfers separate because one day we'll need a special codepath for textures. - Added index_bias to the draw_*elements functions. - Removed nonexistent *REP and *FOR instructions. - Some pipe formats have changed channel ordering, so I've removed/fixed nonexistent ones. - Added stubs for create/set/destroy sampler views. - Added a naive implementation of vertex elements state (new CSO). - Reworked {texture,buffer}_{from,to}_handle. - Reorganized winsys files, removed dri,egl,python directories. - Added a new build target dri-r600.
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/drm/r600/Makefile12
-rw-r--r--src/gallium/winsys/drm/r600/SConscript7
-rw-r--r--src/gallium/winsys/drm/r600/core/r600_drm.c170
-rw-r--r--src/gallium/winsys/drm/r600/dri/Makefile20
-rw-r--r--src/gallium/winsys/drm/r600/dri/SConscript17
-rw-r--r--src/gallium/winsys/drm/r600/egl/Makefile14
-rw-r--r--src/gallium/winsys/drm/r600/egl/dummy.c1
-rw-r--r--src/gallium/winsys/drm/r600/python/README15
-rw-r--r--src/gallium/winsys/drm/r600/python/SConscript33
-rw-r--r--src/gallium/winsys/drm/r600/python/radeon_hardpipe_winsys.c132
-rw-r--r--src/gallium/winsys/drm/r600/python/xf86dri.c605
-rw-r--r--src/gallium/winsys/drm/r600/python/xf86dri.h123
-rw-r--r--src/gallium/winsys/drm/r600/python/xf86dristr.h389
-rw-r--r--src/gallium/winsys/r600/drm/Makefile (renamed from src/gallium/winsys/drm/r600/core/Makefile)7
-rw-r--r--src/gallium/winsys/r600/drm/bof.c (renamed from src/gallium/winsys/drm/r600/core/bof.c)0
-rw-r--r--src/gallium/winsys/r600/drm/bof.h (renamed from src/gallium/winsys/drm/r600/core/bof.h)0
-rw-r--r--src/gallium/winsys/r600/drm/r600_drm.c87
-rw-r--r--src/gallium/winsys/r600/drm/r600_state.c (renamed from src/gallium/winsys/drm/r600/core/r600_state.c)0
-rw-r--r--src/gallium/winsys/r600/drm/r600_states.h (renamed from src/gallium/winsys/drm/r600/core/r600_states.h)0
-rw-r--r--src/gallium/winsys/r600/drm/r600d.h (renamed from src/gallium/winsys/drm/r600/core/r600d.h)0
-rw-r--r--src/gallium/winsys/r600/drm/radeon.c (renamed from src/gallium/winsys/drm/r600/core/radeon.c)0
-rw-r--r--src/gallium/winsys/r600/drm/radeon_bo.c (renamed from src/gallium/winsys/drm/r600/core/radeon_bo.c)0
-rw-r--r--src/gallium/winsys/r600/drm/radeon_ctx.c (renamed from src/gallium/winsys/drm/r600/core/radeon_ctx.c)0
-rw-r--r--src/gallium/winsys/r600/drm/radeon_draw.c (renamed from src/gallium/winsys/drm/r600/core/radeon_draw.c)0
-rw-r--r--src/gallium/winsys/r600/drm/radeon_pciid.c (renamed from src/gallium/winsys/drm/r600/core/radeon_pciid.c)0
-rw-r--r--src/gallium/winsys/r600/drm/radeon_priv.h (renamed from src/gallium/winsys/drm/r600/core/radeon_priv.h)0
-rw-r--r--src/gallium/winsys/r600/drm/radeon_state.c (renamed from src/gallium/winsys/drm/r600/core/radeon_state.c)0
27 files changed, 91 insertions, 1541 deletions
diff --git a/src/gallium/winsys/drm/r600/Makefile b/src/gallium/winsys/drm/r600/Makefile
deleted file mode 100644
index bacdf3de28..0000000000
--- a/src/gallium/winsys/drm/r600/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# src/gallium/winsys/drm/radeon/Makefile
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-SUBDIRS = core $(GALLIUM_STATE_TRACKERS_DIRS)
-
-default install clean:
- @for dir in $(SUBDIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE) $@) || exit 1; \
- fi \
- done
diff --git a/src/gallium/winsys/drm/r600/SConscript b/src/gallium/winsys/drm/r600/SConscript
deleted file mode 100644
index b2dfd504d4..0000000000
--- a/src/gallium/winsys/drm/r600/SConscript
+++ /dev/null
@@ -1,7 +0,0 @@
-Import('*')
-
-SConscript(['core/SConscript',])
-
-if 'mesa' in env['statetrackers']:
-
- SConscript(['dri/SConscript'])
diff --git a/src/gallium/winsys/drm/r600/core/r600_drm.c b/src/gallium/winsys/drm/r600/core/r600_drm.c
deleted file mode 100644
index 028f443944..0000000000
--- a/src/gallium/winsys/drm/r600/core/r600_drm.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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
- * THE AUTHOR(S) 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.
- *
- * Authors:
- * Jerome Glisse
- * Corbin Simpson <MostAwesomeDude@gmail.com>
- * Joakim Sindholt <opensource@zhasha.com>
- */
-#include <sys/ioctl.h>
-#include "trace/tr_drm.h"
-#include "util/u_inlines.h"
-#include "util/u_debug.h"
-#include "state_tracker/drm_api.h"
-#include "radeon_priv.h"
-#include "r600_screen.h"
-#include "r600_texture.h"
-
-static struct pipe_screen *r600_drm_create_screen(struct drm_api* api, int drmfd,
- struct drm_create_screen_arg *arg)
-{
- struct radeon *rw = radeon_new(drmfd, 0);
-
- if (rw == NULL)
- return NULL;
- return radeon_create_screen(rw);
-}
-
-static boolean r600_buffer_from_texture(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- struct pipe_buffer **buffer,
- unsigned *stride)
-{
- return r600_get_texture_buffer(screen, texture, buffer, stride);
-}
-
-static struct pipe_buffer *r600_buffer_from_handle(struct drm_api *api,
- struct pipe_screen *screen,
- const char *name,
- unsigned handle)
-{
- struct radeon *rw = (struct radeon*)screen->winsys;
- struct r600_pipe_buffer *rbuffer;
- struct radeon_bo *bo = NULL;
-
- bo = radeon_bo(rw, handle, 0, 0, NULL);
- if (bo == NULL) {
- return NULL;
- }
-
- rbuffer = calloc(1, sizeof(struct r600_pipe_buffer));
- if (rbuffer == NULL) {
- radeon_bo_decref(rw, bo);
- return NULL;
- }
-
- pipe_reference_init(&rbuffer->base.reference, 1);
- rbuffer->base.screen = screen;
- rbuffer->base.usage = PIPE_BUFFER_USAGE_PIXEL;
- rbuffer->bo = bo;
- return &rbuffer->base;
-}
-
-static struct pipe_texture *r600_texture_from_shared_handle(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *templ,
- const char *name,
- unsigned stride,
- unsigned handle)
-{
- struct pipe_buffer *buffer;
- struct pipe_texture *blanket;
-
-
- buffer = r600_buffer_from_handle(api, screen, name, handle);
- if (buffer == NULL) {
- return NULL;
- }
- blanket = screen->texture_blanket(screen, templ, &stride, buffer);
- pipe_buffer_reference(&buffer, NULL);
- return blanket;
-}
-
-static boolean r600_shared_handle_from_texture(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *stride,
- unsigned *handle)
-{
- struct radeon *rw = (struct radeon*)screen->winsys;
- struct drm_gem_flink flink;
- struct r600_pipe_buffer* rbuffer;
- struct pipe_buffer *buffer = NULL;
- int r;
-
- if (!r600_buffer_from_texture(api, screen, texture, &buffer, stride)) {
- return FALSE;
- }
-
- rbuffer = (struct r600_pipe_buffer*)buffer;
- if (!rbuffer->flink) {
- flink.handle = rbuffer->bo->handle;
- r = ioctl(rw->fd, DRM_IOCTL_GEM_FLINK, &flink);
- if (r) {
- return FALSE;
- }
- rbuffer->flink = flink.name;
- }
- *handle = rbuffer->flink;
- return TRUE;
-}
-
-static boolean r600_local_handle_from_texture(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *stride,
- unsigned *handle)
-{
- struct pipe_buffer *buffer = NULL;
-
- if (!r600_buffer_from_texture(api, screen, texture, &buffer, stride)) {
- return FALSE;
- }
- *handle = ((struct r600_pipe_buffer*)buffer)->bo->handle;
- pipe_buffer_reference(&buffer, NULL);
- return TRUE;
-}
-
-static void r600_drm_api_destroy(struct drm_api *api)
-{
- return;
-}
-
-struct drm_api drm_api_hooks = {
- .name = "r600",
- .driver_name = "r600",
- .create_screen = r600_drm_create_screen,
- .texture_from_shared_handle = r600_texture_from_shared_handle,
- .shared_handle_from_texture = r600_shared_handle_from_texture,
- .local_handle_from_texture = r600_local_handle_from_texture,
- .destroy = r600_drm_api_destroy,
-};
-
-struct drm_api* drm_api_create()
-{
-#ifdef DEBUG
- return trace_drm_create(&drm_api_hooks);
-#else
- return &drm_api_hooks;
-#endif
-}
diff --git a/src/gallium/winsys/drm/r600/dri/Makefile b/src/gallium/winsys/drm/r600/dri/Makefile
deleted file mode 100644
index 01db99399a..0000000000
--- a/src/gallium/winsys/drm/r600/dri/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = r600_dri.so
-
-PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
- $(TOP)/src/gallium/winsys/drm/r600/core/libr600winsys.a \
- $(TOP)/src/gallium/drivers/trace/libtrace.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
- $(TOP)/src/gallium/drivers/r600/libr600.a
-
-C_SOURCES = \
- $(COMMON_GALLIUM_SOURCES) \
- $(DRIVER_SOURCES)
-
-include ../../Makefile.template
-
-symlinks: $(TOP)/$(LIB_DIR)/gallium
- @rm -f $(TOP)/$(LIB_DIR)/gallium/r600_dri.so
diff --git a/src/gallium/winsys/drm/r600/dri/SConscript b/src/gallium/winsys/drm/r600/dri/SConscript
deleted file mode 100644
index c4989d1b59..0000000000
--- a/src/gallium/winsys/drm/r600/dri/SConscript
+++ /dev/null
@@ -1,17 +0,0 @@
-Import('*')
-
-env = drienv.Clone()
-
-env.ParseConfig('pkg-config --cflags --libs libdrm_radeon')
-
-drivers = [
- trace,
- softpipe,
- r300
-]
-
-env.SharedLibrary(
- target ='radeon_dri.so',
- source = COMMON_GALLIUM_SOURCES,
- LIBS = st_dri + radeonwinsys + mesa + drivers + gallium + env['LIBS'],
-)
diff --git a/src/gallium/winsys/drm/r600/egl/Makefile b/src/gallium/winsys/drm/r600/egl/Makefile
deleted file mode 100644
index cd4f9b20f0..0000000000
--- a/src/gallium/winsys/drm/r600/egl/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-EGL_DRIVER_NAME = radeon
-EGL_DRIVER_SOURCES = dummy.c
-EGL_DRIVER_LIBS = -ldrm_radeon
-
-EGL_DRIVER_PIPES = \
- $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
- $(TOP)/src/gallium/drivers/trace/libtrace.a \
- $(TOP)/src/gallium/drivers/r300/libr300.a
-
-include ../../Makefile.egl
diff --git a/src/gallium/winsys/drm/r600/egl/dummy.c b/src/gallium/winsys/drm/r600/egl/dummy.c
deleted file mode 100644
index 4a1bc28b0b..0000000000
--- a/src/gallium/winsys/drm/r600/egl/dummy.c
+++ /dev/null
@@ -1 +0,0 @@
-/* mklib expects at least one object file */
diff --git a/src/gallium/winsys/drm/r600/python/README b/src/gallium/winsys/drm/r600/python/README
deleted file mode 100644
index d9e49bce67..0000000000
--- a/src/gallium/winsys/drm/r600/python/README
+++ /dev/null
@@ -1,15 +0,0 @@
-Python bindings for the radeon gallium driver.
-
-
-See gallium/src/gallium/state_trackers/python/README for more information.
-
-
-Build as:
-
- scons debug=1 statetrackers=python winsys=drm/radeon/python
-
-Run as:
-
- export PYTHONPATH=$PWD/build/linux-x86-debug/gallium/winsys/drm/radeon/python:$PWD/build/linux-x86-debug/gallium/state_trackers/python
-
- python src/gallium/state_trackers/python/samples/tri.py
diff --git a/src/gallium/winsys/drm/r600/python/SConscript b/src/gallium/winsys/drm/r600/python/SConscript
deleted file mode 100644
index 91cae98697..0000000000
--- a/src/gallium/winsys/drm/r600/python/SConscript
+++ /dev/null
@@ -1,33 +0,0 @@
-import os.path
-
-Import('*')
-
-if env['platform'] == 'linux':
-
- env = env.Clone()
-
- env.Tool('python')
-
- env.ParseConfig('pkg-config --cflags --libs libdrm')
-
- env.Prepend(CPPPATH = [
- '#src/gallium/state_trackers/python',
- '../core',
- ])
-
- drivers = [
- softpipe,
- radeon,
- trace,
- ]
-
- sources = [
- 'radeon_hardpipe_winsys.c',
- 'xf86dri.c',
- ]
-
- env.SharedLibrary(
- target ='_gallium',
- source = sources,
- LIBS = [pyst] + drivers + gallium + env['LIBS'],
- )
diff --git a/src/gallium/winsys/drm/r600/python/radeon_hardpipe_winsys.c b/src/gallium/winsys/drm/r600/python/radeon_hardpipe_winsys.c
deleted file mode 100644
index fc63081a4c..0000000000
--- a/src/gallium/winsys/drm/r600/python/radeon_hardpipe_winsys.c
+++ /dev/null
@@ -1,132 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2009 VMware, Inc.
- * 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 VMWARE 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 <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <drm/drm.h>
-
-#include "pipe/p_screen.h"
-#include "pipe/p_context.h"
-
-#include "st_winsys.h"
-
-#include "radeon_winsys.h"
-
-#include "xf86dri.h"
-
-
-/* XXX: Force init_gallium symbol to be linked */
-extern void init_gallium(void);
-void (*force_init_gallium_linkage)(void) = &init_gallium;
-
-
-static struct pipe_screen *
-radeon_hardpipe_screen_create(void)
-{
- Display *dpy;
- Window rootWin;
- XWindowAttributes winAttr;
- int isCapable;
- int screen;
- char *driverName;
- char *curBusID;
- unsigned magic;
- int ddxDriverMajor;
- int ddxDriverMinor;
- int ddxDriverPatch;
- drm_handle_t sAreaOffset;
- int ret;
- int drmFD;
- drm_context_t hHWContext;
- XID id;
-
- dpy = XOpenDisplay(":0");
- if (!dpy) {
- fprintf(stderr, "Open Display Failed\n");
- return NULL;
- }
-
- screen = DefaultScreen(dpy);
- rootWin = RootWindow(dpy, screen);
- XGetWindowAttributes(dpy, rootWin, &winAttr);
-
- ret = uniDRIQueryDirectRenderingCapable(dpy, screen, &isCapable);
- if (!ret || !isCapable) {
- fprintf(stderr, "No DRI on this display:sceen\n");
- goto error;
- }
-
- if (!uniDRIOpenConnection(dpy, screen, &sAreaOffset,
- &curBusID)) {
- fprintf(stderr, "Could not open DRI connection.\n");
- goto error;
- }
-
- if (!uniDRIGetClientDriverName(dpy, screen, &ddxDriverMajor,
- &ddxDriverMinor, &ddxDriverPatch,
- &driverName)) {
- fprintf(stderr, "Could not get DRI driver name.\n");
- goto error;
- }
-
- if ((drmFD = drmOpen(NULL, curBusID)) < 0) {
- perror("DRM Device could not be opened");
- goto error;
- }
-
- drmGetMagic(drmFD, &magic);
- if (!uniDRIAuthConnection(dpy, screen, magic)) {
- fprintf(stderr, "Could not get X server to authenticate us.\n");
- goto error;
- }
-
- if (!uniDRICreateContext(dpy, screen, winAttr.visual,
- &id, &hHWContext)) {
- fprintf(stderr, "Could not create DRI context.\n");
- goto error;
- }
-
- /* FIXME: create a radeon pipe_screen from drmFD and hHWContext */
-
- return NULL;
-
-error:
- return NULL;
-}
-
-
-
-
-const struct st_winsys st_hardpipe_winsys = {
- &radeon_hardpipe_screen_create,
-};
-
diff --git a/src/gallium/winsys/drm/r600/python/xf86dri.c b/src/gallium/winsys/drm/r600/python/xf86dri.c
deleted file mode 100644
index 1736f1e54f..0000000000
--- a/src/gallium/winsys/drm/r600/python/xf86dri.c
+++ /dev/null
@@ -1,605 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-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 PRECISION INSIGHT 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:
- * Kevin E. Martin <martin@valinux.com>
- * Jens Owen <jens@tungstengraphics.com>
- * Rickard E. (Rik) Faith <faith@valinux.com>
- *
- */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include "xf86dristr.h"
-
-static XExtensionInfo _xf86dri_info_data;
-static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
-static char xf86dri_extension_name[] = XF86DRINAME;
-
-#define uniDRICheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xf86dri_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display * dpy, XExtCodes * extCodes);
-static /* const */ XExtensionHooks xf86dri_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static
-XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info,
- xf86dri_extension_name, &xf86dri_extension_hooks,
- 0, NULL)
-
- static XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info)
-
-/*****************************************************************************
- * *
- * public XFree86-DRI Extension routines *
- * *
- *****************************************************************************/
-#if 0
-#include <stdio.h>
-#define TRACE(msg) fprintf(stderr,"uniDRI%s\n", msg);
-#else
-#define TRACE(msg)
-#endif
- Bool uniDRIQueryExtension(dpy, event_basep, error_basep)
- Display *dpy;
- int *event_basep, *error_basep;
-{
- XExtDisplayInfo *info = find_display(dpy);
-
- TRACE("QueryExtension...");
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- TRACE("QueryExtension... return True");
- return True;
- } else {
- TRACE("QueryExtension... return False");
- return False;
- }
-}
-
-Bool
-uniDRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion)
- Display *dpy;
- int *majorVersion;
- int *minorVersion;
- int *patchVersion;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIQueryVersionReply rep;
- xXF86DRIQueryVersionReq *req;
-
- TRACE("QueryVersion...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIQueryVersion;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryVersion... return False");
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- *patchVersion = rep.patchVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryVersion... return True");
- return True;
-}
-
-Bool
-uniDRIQueryDirectRenderingCapable(dpy, screen, isCapable)
- Display *dpy;
- int screen;
- Bool *isCapable;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIQueryDirectRenderingCapableReply rep;
- xXF86DRIQueryDirectRenderingCapableReq *req;
-
- TRACE("QueryDirectRenderingCapable...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIQueryDirectRenderingCapable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryDirectRenderingCapable... return False");
- return False;
- }
- *isCapable = rep.isCapable;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryDirectRenderingCapable... return True");
- return True;
-}
-
-Bool
-uniDRIOpenConnection(dpy, screen, hSAREA, busIdString)
- Display *dpy;
- int screen;
- drm_handle_t *hSAREA;
- char **busIdString;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIOpenConnectionReply rep;
- xXF86DRIOpenConnectionReq *req;
-
- TRACE("OpenConnection...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIOpenConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIOpenConnection;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return False");
- return False;
- }
-
- *hSAREA = rep.hSAREALow;
-#ifdef LONG64
- if (sizeof(drm_handle_t) == 8) {
- *hSAREA |= ((unsigned long)rep.hSAREAHigh) << 32;
- }
-#endif
- if (rep.length) {
- if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) {
- _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return False");
- return False;
- }
- _XReadPad(dpy, *busIdString, rep.busIdStringLength);
- } else {
- *busIdString = NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return True");
- return True;
-}
-
-Bool
-uniDRIAuthConnection(dpy, screen, magic)
- Display *dpy;
- int screen;
- drm_magic_t magic;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIAuthConnectionReq *req;
- xXF86DRIAuthConnectionReply rep;
-
- TRACE("AuthConnection...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIAuthConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIAuthConnection;
- req->screen = screen;
- req->magic = magic;
- rep.authenticated = 0;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("AuthConnection... return False");
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("AuthConnection... return True");
- return True;
-}
-
-Bool
-uniDRICloseConnection(dpy, screen)
- Display *dpy;
- int screen;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRICloseConnectionReq *req;
-
- TRACE("CloseConnection...");
-
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICloseConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICloseConnection;
- req->screen = screen;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CloseConnection... return True");
- return True;
-}
-
-Bool
-uniDRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion,
- ddxDriverMinorVersion, ddxDriverPatchVersion,
- clientDriverName)
- Display *dpy;
- int screen;
- int *ddxDriverMajorVersion;
- int *ddxDriverMinorVersion;
- int *ddxDriverPatchVersion;
- char **clientDriverName;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIGetClientDriverNameReply rep;
- xXF86DRIGetClientDriverNameReq *req;
-
- TRACE("GetClientDriverName...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetClientDriverName, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetClientDriverName;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return False");
- return False;
- }
-
- *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
- *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
- *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
-
- if (rep.length) {
- if (!(*clientDriverName =
- (char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) {
- _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return False");
- return False;
- }
- _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
- } else {
- *clientDriverName = NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return True");
- return True;
-}
-
-Bool
-uniDRICreateContextWithConfig(dpy, screen, configID, context, hHWContext)
- Display *dpy;
- int screen;
- int configID;
- XID *context;
- drm_context_t *hHWContext;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRICreateContextReply rep;
- xXF86DRICreateContextReq *req;
-
- TRACE("CreateContext...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICreateContext, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICreateContext;
- req->visual = configID;
- req->screen = screen;
- *context = XAllocID(dpy);
- req->context = *context;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateContext... return False");
- return False;
- }
- *hHWContext = rep.hHWContext;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateContext... return True");
- return True;
-}
-
-Bool
-uniDRICreateContext(dpy, screen, visual, context, hHWContext)
- Display *dpy;
- int screen;
- Visual *visual;
- XID *context;
- drm_context_t *hHWContext;
-{
- return uniDRICreateContextWithConfig(dpy, screen, visual->visualid,
- context, hHWContext);
-}
-
-Bool
-uniDRIDestroyContext(Display * ndpy, int screen, XID context)
-{
- Display *const dpy = (Display *) ndpy;
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIDestroyContextReq *req;
-
- TRACE("DestroyContext...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIDestroyContext, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIDestroyContext;
- req->screen = screen;
- req->context = context;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("DestroyContext... return True");
- return True;
-}
-
-Bool
-uniDRICreateDrawable(Display * ndpy, int screen,
- Drawable drawable, drm_drawable_t * hHWDrawable)
-{
- Display *const dpy = (Display *) ndpy;
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRICreateDrawableReply rep;
- xXF86DRICreateDrawableReq *req;
-
- TRACE("CreateDrawable...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICreateDrawable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICreateDrawable;
- req->screen = screen;
- req->drawable = drawable;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateDrawable... return False");
- return False;
- }
- *hHWDrawable = rep.hHWDrawable;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateDrawable... return True");
- return True;
-}
-
-Bool
-uniDRIDestroyDrawable(Display * ndpy, int screen, Drawable drawable)
-{
- Display *const dpy = (Display *) ndpy;
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIDestroyDrawableReq *req;
-
- TRACE("DestroyDrawable...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIDestroyDrawable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIDestroyDrawable;
- req->screen = screen;
- req->drawable = drawable;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("DestroyDrawable... return True");
- return True;
-}
-
-Bool
-uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
- unsigned int *index, unsigned int *stamp,
- int *X, int *Y, int *W, int *H,
- int *numClipRects, drm_clip_rect_t ** pClipRects,
- int *backX, int *backY,
- int *numBackClipRects,
- drm_clip_rect_t ** pBackClipRects)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIGetDrawableInfoReply rep;
- xXF86DRIGetDrawableInfoReq *req;
- int total_rects;
-
- TRACE("GetDrawableInfo...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetDrawableInfo, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetDrawableInfo;
- req->screen = screen;
- req->drawable = drawable;
-
- if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return False");
- return False;
- }
- *index = rep.drawableTableIndex;
- *stamp = rep.drawableTableStamp;
- *X = (int)rep.drawableX;
- *Y = (int)rep.drawableY;
- *W = (int)rep.drawableWidth;
- *H = (int)rep.drawableHeight;
- *numClipRects = rep.numClipRects;
- total_rects = *numClipRects;
-
- *backX = rep.backX;
- *backY = rep.backY;
- *numBackClipRects = rep.numBackClipRects;
- total_rects += *numBackClipRects;
-
-#if 0
- /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
- * backwards compatibility (Because of the >> 2 shift) but the fix
- * enables multi-threaded apps to work.
- */
- if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
- SIZEOF(xGenericReply) +
- total_rects * sizeof(drm_clip_rect_t)) +
- 3) & ~3) >> 2)) {
- _XEatData(dpy, rep.length);
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return False");
- return False;
- }
-#endif
-
- if (*numClipRects) {
- int len = sizeof(drm_clip_rect_t) * (*numClipRects);
-
- *pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
- if (*pClipRects)
- _XRead(dpy, (char *)*pClipRects, len);
- } else {
- *pClipRects = NULL;
- }
-
- if (*numBackClipRects) {
- int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
-
- *pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
- if (*pBackClipRects)
- _XRead(dpy, (char *)*pBackClipRects, len);
- } else {
- *pBackClipRects = NULL;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return True");
- return True;
-}
-
-Bool
-uniDRIGetDeviceInfo(dpy, screen, hFrameBuffer,
- fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate)
- Display *dpy;
- int screen;
- drm_handle_t *hFrameBuffer;
- int *fbOrigin;
- int *fbSize;
- int *fbStride;
- int *devPrivateSize;
- void **pDevPrivate;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIGetDeviceInfoReply rep;
- xXF86DRIGetDeviceInfoReq *req;
-
- TRACE("GetDeviceInfo...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetDeviceInfo, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetDeviceInfo;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return False");
- return False;
- }
-
- *hFrameBuffer = rep.hFrameBufferLow;
-#ifdef LONG64
- if (sizeof(drm_handle_t) == 8) {
- *hFrameBuffer |= ((unsigned long)rep.hFrameBufferHigh) << 32;
- }
-#endif
-
- *fbOrigin = rep.framebufferOrigin;
- *fbSize = rep.framebufferSize;
- *fbStride = rep.framebufferStride;
- *devPrivateSize = rep.devPrivateSize;
-
- if (rep.length) {
- if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) {
- _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return False");
- return False;
- }
- _XRead(dpy, (char *)*pDevPrivate, rep.devPrivateSize);
- } else {
- *pDevPrivate = NULL;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return True");
- return True;
-}
diff --git a/src/gallium/winsys/drm/r600/python/xf86dri.h b/src/gallium/winsys/drm/r600/python/xf86dri.h
deleted file mode 100644
index bf6de37d9d..0000000000
--- a/src/gallium/winsys/drm/r600/python/xf86dri.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-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 PRECISION INSIGHT 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.
-
-**************************************************************************/
-
-/**
- * \file xf86dri.h
- * Protocol numbers and function prototypes for DRI X protocol.
- *
- * \author Kevin E. Martin <martin@valinux.com>
- * \author Jens Owen <jens@tungstengraphics.com>
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- */
-
-#ifndef _XF86DRI_H_
-#define _XF86DRI_H_
-
-#include <stdint.h>
-#include <X11/Xfuncproto.h>
-#include <drm/drm.h>
-
-#define X_XF86DRIQueryVersion 0
-#define X_XF86DRIQueryDirectRenderingCapable 1
-#define X_XF86DRIOpenConnection 2
-#define X_XF86DRICloseConnection 3
-#define X_XF86DRIGetClientDriverName 4
-#define X_XF86DRICreateContext 5
-#define X_XF86DRIDestroyContext 6
-#define X_XF86DRICreateDrawable 7
-#define X_XF86DRIDestroyDrawable 8
-#define X_XF86DRIGetDrawableInfo 9
-#define X_XF86DRIGetDeviceInfo 10
-#define X_XF86DRIAuthConnection 11
-#define X_XF86DRIOpenFullScreen 12 /* Deprecated */
-#define X_XF86DRICloseFullScreen 13 /* Deprecated */
-
-#define XF86DRINumberEvents 0
-
-#define XF86DRIClientNotLocal 0
-#define XF86DRIOperationNotSupported 1
-#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1)
-
-#ifndef _XF86DRI_SERVER_
-
-_XFUNCPROTOBEGIN
- Bool uniDRIQueryExtension(Display * dpy, int *event_base,
- int *error_base);
-
-Bool uniDRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
- int *patchVersion);
-
-Bool uniDRIQueryDirectRenderingCapable(Display * dpy, int screen,
- Bool * isCapable);
-
-Bool uniDRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
- char **busIDString);
-
-Bool uniDRIAuthConnection(Display * dpy, int screen, drm_magic_t magic);
-
-Bool uniDRICloseConnection(Display * dpy, int screen);
-
-Bool uniDRIGetClientDriverName(Display * dpy, int screen,
- int *ddxDriverMajorVersion,
- int *ddxDriverMinorVersion,
- int *ddxDriverPatchVersion,
- char **clientDriverName);
-
-Bool uniDRICreateContext(Display * dpy, int screen, Visual * visual,
- XID * ptr_to_returned_context_id,
- drm_context_t * hHWContext);
-
-Bool uniDRICreateContextWithConfig(Display * dpy, int screen, int configID,
- XID * ptr_to_returned_context_id,
- drm_context_t * hHWContext);
-
-extern Bool uniDRIDestroyContext(Display * dpy, int screen, XID context_id);
-
-extern Bool uniDRICreateDrawable(Display * dpy, int screen,
- Drawable drawable,
- drm_drawable_t * hHWDrawable);
-
-extern Bool uniDRIDestroyDrawable(Display * dpy, int screen,
- Drawable drawable);
-
-Bool uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
- unsigned int *index, unsigned int *stamp,
- int *X, int *Y, int *W, int *H,
- int *numClipRects, drm_clip_rect_t ** pClipRects,
- int *backX, int *backY,
- int *numBackClipRects,
- drm_clip_rect_t ** pBackClipRects);
-
-Bool uniDRIGetDeviceInfo(Display * dpy, int screen,
- drm_handle_t * hFrameBuffer, int *fbOrigin,
- int *fbSize, int *fbStride, int *devPrivateSize,
- void **pDevPrivate);
-
-_XFUNCPROTOEND
-#endif /* _XF86DRI_SERVER_ */
-#endif /* _XF86DRI_H_ */
diff --git a/src/gallium/winsys/drm/r600/python/xf86dristr.h b/src/gallium/winsys/drm/r600/python/xf86dristr.h
deleted file mode 100644
index d898996360..0000000000
--- a/src/gallium/winsys/drm/r600/python/xf86dristr.h
+++ /dev/null
@@ -1,389 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-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 PRECISION INSIGHT 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:
- * Kevin E. Martin <martin@valinux.com>
- * Jens Owen <jens@tungstengraphics.com>
- * Rickard E. (Rik) Fiath <faith@valinux.com>
- *
- */
-
-#ifndef _XF86DRISTR_H_
-#define _XF86DRISTR_H_
-
-#include "xf86dri.h"
-
-#define XF86DRINAME "XFree86-DRI"
-
-/* The DRI version number. This was originally set to be the same of the
- * XFree86 version number. However, this version is really indepedent of
- * the XFree86 version.
- *
- * Version History:
- * 4.0.0: Original
- * 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02
- * 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02
- */
-#define XF86DRI_MAJOR_VERSION 4
-#define XF86DRI_MINOR_VERSION 1
-#define XF86DRI_PATCH_VERSION 0
-
-typedef struct _XF86DRIQueryVersion
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIQueryVersion */
- CARD16 length B16;
-} xXF86DRIQueryVersionReq;
-
-#define sz_xXF86DRIQueryVersionReq 4
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD16 majorVersion B16; /* major version of DRI protocol */
- CARD16 minorVersion B16; /* minor version of DRI protocol */
- CARD32 patchVersion B32; /* patch version of DRI protocol */
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRIQueryVersionReply;
-
-#define sz_xXF86DRIQueryVersionReply 32
-
-typedef struct _XF86DRIQueryDirectRenderingCapable
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
- CARD16 length B16;
- CARD32 screen B32;
-} xXF86DRIQueryDirectRenderingCapableReq;
-
-#define sz_xXF86DRIQueryDirectRenderingCapableReq 8
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- BOOL isCapable;
- BOOL pad2;
- BOOL pad3;
- BOOL pad4;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
- CARD32 pad8 B32;
- CARD32 pad9 B32;
-} xXF86DRIQueryDirectRenderingCapableReply;
-
-#define sz_xXF86DRIQueryDirectRenderingCapableReply 32
-
-typedef struct _XF86DRIOpenConnection
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIOpenConnection */
- CARD16 length B16;
- CARD32 screen B32;
-} xXF86DRIOpenConnectionReq;
-
-#define sz_xXF86DRIOpenConnectionReq 8
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hSAREALow B32;
- CARD32 hSAREAHigh B32;
- CARD32 busIdStringLength B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
- CARD32 pad8 B32;
-} xXF86DRIOpenConnectionReply;
-
-#define sz_xXF86DRIOpenConnectionReply 32
-
-typedef struct _XF86DRIAuthConnection
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICloseConnection */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 magic B32;
-} xXF86DRIAuthConnectionReq;
-
-#define sz_xXF86DRIAuthConnectionReq 12
-
-typedef struct
-{
- BYTE type;
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 authenticated B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRIAuthConnectionReply;
-
-#define zx_xXF86DRIAuthConnectionReply 32
-
-typedef struct _XF86DRICloseConnection
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICloseConnection */
- CARD16 length B16;
- CARD32 screen B32;
-} xXF86DRICloseConnectionReq;
-
-#define sz_xXF86DRICloseConnectionReq 8
-
-typedef struct _XF86DRIGetClientDriverName
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIGetClientDriverName */
- CARD16 length B16;
- CARD32 screen B32;
-} xXF86DRIGetClientDriverNameReq;
-
-#define sz_xXF86DRIGetClientDriverNameReq 8
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 ddxDriverMajorVersion B32;
- CARD32 ddxDriverMinorVersion B32;
- CARD32 ddxDriverPatchVersion B32;
- CARD32 clientDriverNameLength B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRIGetClientDriverNameReply;
-
-#define sz_xXF86DRIGetClientDriverNameReply 32
-
-typedef struct _XF86DRICreateContext
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICreateContext */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 visual B32;
- CARD32 context B32;
-} xXF86DRICreateContextReq;
-
-#define sz_xXF86DRICreateContextReq 16
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hHWContext B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRICreateContextReply;
-
-#define sz_xXF86DRICreateContextReply 32
-
-typedef struct _XF86DRIDestroyContext
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIDestroyContext */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 context B32;
-} xXF86DRIDestroyContextReq;
-
-#define sz_xXF86DRIDestroyContextReq 12
-
-typedef struct _XF86DRICreateDrawable
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICreateDrawable */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
-} xXF86DRICreateDrawableReq;
-
-#define sz_xXF86DRICreateDrawableReq 12
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hHWDrawable B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRICreateDrawableReply;
-
-#define sz_xXF86DRICreateDrawableReply 32
-
-typedef struct _XF86DRIDestroyDrawable
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIDestroyDrawable */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
-} xXF86DRIDestroyDrawableReq;
-
-#define sz_xXF86DRIDestroyDrawableReq 12
-
-typedef struct _XF86DRIGetDrawableInfo
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIGetDrawableInfo */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
-} xXF86DRIGetDrawableInfoReq;
-
-#define sz_xXF86DRIGetDrawableInfoReq 12
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 drawableTableIndex B32;
- CARD32 drawableTableStamp B32;
- INT16 drawableX B16;
- INT16 drawableY B16;
- INT16 drawableWidth B16;
- INT16 drawableHeight B16;
- CARD32 numClipRects B32;
- INT16 backX B16;
- INT16 backY B16;
- CARD32 numBackClipRects B32;
-} xXF86DRIGetDrawableInfoReply;
-
-#define sz_xXF86DRIGetDrawableInfoReply 36
-
-typedef struct _XF86DRIGetDeviceInfo
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIGetDeviceInfo */
- CARD16 length B16;
- CARD32 screen B32;
-} xXF86DRIGetDeviceInfoReq;
-
-#define sz_xXF86DRIGetDeviceInfoReq 8
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hFrameBufferLow B32;
- CARD32 hFrameBufferHigh B32;
- CARD32 framebufferOrigin B32;
- CARD32 framebufferSize B32;
- CARD32 framebufferStride B32;
- CARD32 devPrivateSize B32;
-} xXF86DRIGetDeviceInfoReply;
-
-#define sz_xXF86DRIGetDeviceInfoReply 32
-
-typedef struct _XF86DRIOpenFullScreen
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIOpenFullScreen */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
-} xXF86DRIOpenFullScreenReq;
-
-#define sz_xXF86DRIOpenFullScreenReq 12
-
-typedef struct
-{
- BYTE type;
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 isFullScreen B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRIOpenFullScreenReply;
-
-#define sz_xXF86DRIOpenFullScreenReply 32
-
-typedef struct _XF86DRICloseFullScreen
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICloseFullScreen */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
-} xXF86DRICloseFullScreenReq;
-
-#define sz_xXF86DRICloseFullScreenReq 12
-
-typedef struct
-{
- BYTE type;
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
-} xXF86DRICloseFullScreenReply;
-
-#define sz_xXF86DRICloseFullScreenReply 32
-
-#endif /* _XF86DRISTR_H_ */
diff --git a/src/gallium/winsys/drm/r600/core/Makefile b/src/gallium/winsys/r600/drm/Makefile
index 0a8d987214..e3b943c4d4 100644
--- a/src/gallium/winsys/drm/r600/core/Makefile
+++ b/src/gallium/winsys/r600/drm/Makefile
@@ -1,4 +1,5 @@
-TOP = ../../../../../..
+
+TOP = ../../../../..
include $(TOP)/configs/current
LIBNAME = r600winsys
@@ -17,6 +18,6 @@ C_SOURCES = \
LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/r600 \
$(shell pkg-config libdrm --cflags-only-I)
-LIBRARY_DEFINES = $(shell pkg-config libdrm --cflags-only-other)
+include ../../../Makefile.template
-include ../../../../Makefile.template
+symlinks:
diff --git a/src/gallium/winsys/drm/r600/core/bof.c b/src/gallium/winsys/r600/drm/bof.c
index 0598cc6bc0..0598cc6bc0 100644
--- a/src/gallium/winsys/drm/r600/core/bof.c
+++ b/src/gallium/winsys/r600/drm/bof.c
diff --git a/src/gallium/winsys/drm/r600/core/bof.h b/src/gallium/winsys/r600/drm/bof.h
index 014affb74f..014affb74f 100644
--- a/src/gallium/winsys/drm/r600/core/bof.h
+++ b/src/gallium/winsys/r600/drm/bof.h
diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c
new file mode 100644
index 0000000000..b69af5e111
--- /dev/null
+++ b/src/gallium/winsys/r600/drm/r600_drm.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * 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
+ * THE AUTHOR(S) 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.
+ *
+ * Authors:
+ * Jerome Glisse
+ * Corbin Simpson <MostAwesomeDude@gmail.com>
+ * Joakim Sindholt <opensource@zhasha.com>
+ */
+#include <sys/ioctl.h>
+#include "trace/tr_drm.h"
+#include "util/u_inlines.h"
+#include "util/u_debug.h"
+#include "state_tracker/drm_api.h"
+#include "radeon_priv.h"
+#include "r600_screen.h"
+#include "r600_texture.h"
+
+static struct pipe_screen *r600_drm_create_screen(struct drm_api* api, int drmfd,
+ struct drm_create_screen_arg *arg)
+{
+ struct radeon *rw = radeon_new(drmfd, 0);
+
+ if (rw == NULL)
+ return NULL;
+ return radeon_create_screen(rw);
+}
+
+boolean r600_buffer_get_handle(struct radeon *rw,
+ struct pipe_resource *buf,
+ struct winsys_handle *whandle)
+{
+ struct drm_gem_flink flink;
+ struct r600_buffer* rbuffer;
+ int r;
+
+ rbuffer = (struct r600_buffer*)buf;
+ if (!rbuffer->flink) {
+ flink.handle = rbuffer->bo->handle;
+ r = ioctl(rw->fd, DRM_IOCTL_GEM_FLINK, &flink);
+ if (r) {
+ return FALSE;
+ }
+ rbuffer->flink = flink.name;
+ }
+ whandle->handle = rbuffer->flink;
+ return TRUE;
+}
+
+static void r600_drm_api_destroy(struct drm_api *api)
+{
+ return;
+}
+
+struct drm_api drm_api_hooks = {
+ .name = "r600",
+ .driver_name = "r600",
+ .create_screen = r600_drm_create_screen,
+ .destroy = r600_drm_api_destroy,
+};
+
+struct drm_api* drm_api_create()
+{
+#ifdef DEBUG
+ return trace_drm_create(&drm_api_hooks);
+#else
+ return &drm_api_hooks;
+#endif
+}
diff --git a/src/gallium/winsys/drm/r600/core/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c
index c93783b4b0..c93783b4b0 100644
--- a/src/gallium/winsys/drm/r600/core/r600_state.c
+++ b/src/gallium/winsys/r600/drm/r600_state.c
diff --git a/src/gallium/winsys/drm/r600/core/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h
index 5896df21b2..5896df21b2 100644
--- a/src/gallium/winsys/drm/r600/core/r600_states.h
+++ b/src/gallium/winsys/r600/drm/r600_states.h
diff --git a/src/gallium/winsys/drm/r600/core/r600d.h b/src/gallium/winsys/r600/drm/r600d.h
index 5d13378627..5d13378627 100644
--- a/src/gallium/winsys/drm/r600/core/r600d.h
+++ b/src/gallium/winsys/r600/drm/r600d.h
diff --git a/src/gallium/winsys/drm/r600/core/radeon.c b/src/gallium/winsys/r600/drm/radeon.c
index f2113c5807..f2113c5807 100644
--- a/src/gallium/winsys/drm/r600/core/radeon.c
+++ b/src/gallium/winsys/r600/drm/radeon.c
diff --git a/src/gallium/winsys/drm/r600/core/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c
index f259ae7fb5..f259ae7fb5 100644
--- a/src/gallium/winsys/drm/r600/core/radeon_bo.c
+++ b/src/gallium/winsys/r600/drm/radeon_bo.c
diff --git a/src/gallium/winsys/drm/r600/core/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c
index 0c8f1fac18..0c8f1fac18 100644
--- a/src/gallium/winsys/drm/r600/core/radeon_ctx.c
+++ b/src/gallium/winsys/r600/drm/radeon_ctx.c
diff --git a/src/gallium/winsys/drm/r600/core/radeon_draw.c b/src/gallium/winsys/r600/drm/radeon_draw.c
index 4413ed79fb..4413ed79fb 100644
--- a/src/gallium/winsys/drm/r600/core/radeon_draw.c
+++ b/src/gallium/winsys/r600/drm/radeon_draw.c
diff --git a/src/gallium/winsys/drm/r600/core/radeon_pciid.c b/src/gallium/winsys/r600/drm/radeon_pciid.c
index dd6156d585..dd6156d585 100644
--- a/src/gallium/winsys/drm/r600/core/radeon_pciid.c
+++ b/src/gallium/winsys/r600/drm/radeon_pciid.c
diff --git a/src/gallium/winsys/drm/r600/core/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h
index b91421f438..b91421f438 100644
--- a/src/gallium/winsys/drm/r600/core/radeon_priv.h
+++ b/src/gallium/winsys/r600/drm/radeon_priv.h
diff --git a/src/gallium/winsys/drm/r600/core/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c
index 308288557a..308288557a 100644
--- a/src/gallium/winsys/drm/r600/core/radeon_state.c
+++ b/src/gallium/winsys/r600/drm/radeon_state.c