summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/drm/nouveau
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/drm/nouveau')
-rw-r--r--src/gallium/winsys/drm/nouveau/Makefile12
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/Makefile24
-rw-r--r--src/gallium/winsys/drm/nouveau/drm/Makefile11
-rw-r--r--src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h28
-rw-r--r--src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c219
-rw-r--r--src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h31
-rw-r--r--src/gallium/winsys/drm/nouveau/egl/Makefile16
-rw-r--r--src/gallium/winsys/drm/nouveau/egl/dummy.c3
-rw-r--r--src/gallium/winsys/drm/nouveau/xorg/Makefile58
-rw-r--r--src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c149
10 files changed, 0 insertions, 551 deletions
diff --git a/src/gallium/winsys/drm/nouveau/Makefile b/src/gallium/winsys/drm/nouveau/Makefile
deleted file mode 100644
index 6c9cbef26d..0000000000
--- a/src/gallium/winsys/drm/nouveau/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# src/gallium/winsys/drm/nouveau/Makefile
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-SUBDIRS = drm $(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/nouveau/dri/Makefile b/src/gallium/winsys/drm/nouveau/dri/Makefile
deleted file mode 100644
index 7e95f79d03..0000000000
--- a/src/gallium/winsys/drm/nouveau/dri/Makefile
+++ /dev/null
@@ -1,24 +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/nv30/libnv30.a \
- $(TOP)/src/gallium/drivers/nv40/libnv40.a \
- $(TOP)/src/gallium/drivers/nv50/libnv50.a \
- $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
-
-DRIVER_SOURCES =
-
-C_SOURCES = \
- $(COMMON_GALLIUM_SOURCES) \
- $(DRIVER_SOURCES)
-
-include ../../Makefile.template
-
-DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs)
-
-symlinks:
diff --git a/src/gallium/winsys/drm/nouveau/drm/Makefile b/src/gallium/winsys/drm/nouveau/drm/Makefile
deleted file mode 100644
index 54c3b26c75..0000000000
--- a/src/gallium/winsys/drm/nouveau/drm/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = nouveaudrm
-
-C_SOURCES = nouveau_drm_api.c
-
-LIBRARY_INCLUDES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-I)
-LIBRARY_DEFINES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-other)
-
-include ../../../../Makefile.template
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h b/src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h
deleted file mode 100644
index 1207c2d609..0000000000
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _NOUVEAU_DRI_
-#define _NOUVEAU_DRI_
-
-#include "xf86drm.h"
-#include "drm.h"
-#include "nouveau_drm.h"
-
-struct nouveau_dri {
- uint32_t device_id; /**< \brief PCI device ID */
- uint32_t width; /**< \brief width in pixels of display */
- uint32_t height; /**< \brief height in scanlines of display */
- uint32_t depth; /**< \brief depth of display (8, 15, 16, 24) */
- uint32_t bpp; /**< \brief bit depth of display (8, 16, 24, 32) */
-
- uint32_t bus_type; /**< \brief ths bus type */
- uint32_t bus_mode; /**< \brief bus mode (used for AGP, maybe also for PCI-E ?) */
-
- uint32_t front_offset; /**< \brief front buffer offset */
- uint32_t front_pitch; /**< \brief front buffer pitch */
- uint32_t back_offset; /**< \brief private back buffer offset */
- uint32_t back_pitch; /**< \brief private back buffer pitch */
- uint32_t depth_offset; /**< \brief private depth buffer offset */
- uint32_t depth_pitch; /**< \brief private depth buffer pitch */
-
-};
-
-#endif
-
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
deleted file mode 100644
index 0d05f316c4..0000000000
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
+++ /dev/null
@@ -1,219 +0,0 @@
-#include "pipe/p_context.h"
-#include "pipe/p_state.h"
-#include "util/u_format.h"
-#include "util/u_memory.h"
-#include "util/u_inlines.h"
-
-#include "nouveau_drm_api.h"
-
-#include "nouveau_drmif.h"
-#include "nouveau_channel.h"
-#include "nouveau_bo.h"
-
-#include "nouveau/nouveau_winsys.h"
-#include "nouveau/nouveau_screen.h"
-
-static struct pipe_surface *
-dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen,
- unsigned handle, enum pipe_format format,
- unsigned width, unsigned height, unsigned pitch)
-{
- struct pipe_surface *ps = NULL;
- struct pipe_texture *pt = NULL;
- struct pipe_texture tmpl;
-
- memset(&tmpl, 0, sizeof(tmpl));
- tmpl.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY;
- tmpl.target = PIPE_TEXTURE_2D;
- tmpl.last_level = 0;
- tmpl.depth0 = 1;
- tmpl.format = format;
- tmpl.width0 = width;
- tmpl.height0 = height;
-
- pt = api->texture_from_shared_handle(api, pscreen, &tmpl,
- "front buffer", pitch, handle);
- if (!pt)
- return NULL;
-
- ps = pscreen->get_tex_surface(pscreen, pt, 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(&pt, NULL);
- return ps;
-}
-
-static struct pipe_surface *
-nouveau_dri1_front_surface(struct pipe_context *pipe)
-{
- return nouveau_winsys_screen(pipe->screen)->front;
-}
-
-static struct dri1_api nouveau_dri1_api = {
- nouveau_dri1_front_surface,
-};
-
-static void
-nouveau_drm_destroy_winsys(struct pipe_winsys *s)
-{
- struct nouveau_winsys *nv_winsys = nouveau_winsys(s);
- struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys->pscreen);
- nouveau_device_close(&nv_screen->device);
- FREE(nv_winsys);
-}
-
-static struct pipe_screen *
-nouveau_drm_create_screen(struct drm_api *api, int fd,
- struct drm_create_screen_arg *arg)
-{
- struct dri1_create_screen_arg *dri1 = (void *)arg;
- struct nouveau_winsys *nvws;
- struct pipe_winsys *ws;
- struct nouveau_device *dev = NULL;
- struct pipe_screen *(*init)(struct pipe_winsys *,
- struct nouveau_device *);
- int ret;
-
- ret = nouveau_device_open_existing(&dev, 0, fd, 0);
- if (ret)
- return NULL;
-
- switch (dev->chipset & 0xf0) {
- case 0x30:
- init = nv30_screen_create;
- break;
- case 0x40:
- case 0x60:
- init = nv40_screen_create;
- break;
- case 0x50:
- case 0x80:
- case 0x90:
- case 0xa0:
- init = nv50_screen_create;
- break;
- default:
- debug_printf("%s: unknown chipset nv%02x\n", __func__,
- dev->chipset);
- return NULL;
- }
-
- nvws = CALLOC_STRUCT(nouveau_winsys);
- if (!nvws) {
- nouveau_device_close(&dev);
- return NULL;
- }
- ws = &nvws->base;
- ws->destroy = nouveau_drm_destroy_winsys;
-
- nvws->pscreen = init(ws, dev);
- if (!nvws->pscreen) {
- ws->destroy(ws);
- return NULL;
- }
-
- if (arg && arg->mode == DRM_CREATE_DRI1) {
- struct nouveau_dri *nvdri = dri1->ddx_info;
- enum pipe_format format;
-
- if (nvdri->bpp == 16)
- format = PIPE_FORMAT_B5G6R5_UNORM;
- else
- format = PIPE_FORMAT_B8G8R8A8_UNORM;
-
- nvws->front = dri_surface_from_handle(api, nvws->pscreen,
- nvdri->front_offset,
- format, nvdri->width,
- nvdri->height,
- nvdri->front_pitch *
- (nvdri->bpp / 8));
- if (!nvws->front) {
- debug_printf("%s: error referencing front buffer\n",
- __func__);
- ws->destroy(ws);
- return NULL;
- }
-
- dri1->api = &nouveau_dri1_api;
- }
-
- return nvws->pscreen;
-}
-
-static struct pipe_texture *
-nouveau_drm_pt_from_name(struct drm_api *api, struct pipe_screen *pscreen,
- struct pipe_texture *templ, const char *name,
- unsigned stride, unsigned handle)
-{
- struct nouveau_device *dev = nouveau_screen(pscreen)->device;
- struct pipe_texture *pt;
- struct pipe_buffer *pb;
- int ret;
-
- pb = CALLOC(1, sizeof(struct pipe_buffer) + sizeof(struct nouveau_bo*));
- if (!pb)
- return NULL;
-
- ret = nouveau_bo_handle_ref(dev, handle, (struct nouveau_bo**)(pb+1));
- if (ret) {
- debug_printf("%s: ref name 0x%08x failed with %d\n",
- __func__, handle, ret);
- FREE(pb);
- return NULL;
- }
-
- pipe_reference_init(&pb->reference, 1);
- pb->screen = pscreen;
- pb->alignment = 0;
- pb->usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE |
- PIPE_BUFFER_USAGE_CPU_READ_WRITE;
- pb->size = nouveau_bo(pb)->size;
- pt = pscreen->texture_blanket(pscreen, templ, &stride, pb);
- pipe_buffer_reference(&pb, NULL);
- return pt;
-}
-
-static boolean
-nouveau_drm_name_from_pt(struct drm_api *api, struct pipe_screen *pscreen,
- struct pipe_texture *pt, unsigned *stride,
- unsigned *handle)
-{
- struct nouveau_miptree *mt = nouveau_miptree(pt);
-
- if (!mt || !mt->bo)
- return false;
-
- return nouveau_bo_handle_get(mt->bo, handle) == 0;
-}
-
-static boolean
-nouveau_drm_handle_from_pt(struct drm_api *api, struct pipe_screen *pscreen,
- struct pipe_texture *pt, unsigned *stride,
- unsigned *handle)
-{
- struct nouveau_miptree *mt = nouveau_miptree(pt);
-
- if (!mt || !mt->bo)
- return false;
-
- *handle = mt->bo->handle;
- *stride = util_format_get_stride(mt->base.format, mt->base.width0);
- return true;
-}
-
-struct drm_api drm_api_hooks = {
- .name = "nouveau",
- .driver_name = "nouveau",
- .create_screen = nouveau_drm_create_screen,
- .texture_from_shared_handle = nouveau_drm_pt_from_name,
- .shared_handle_from_texture = nouveau_drm_name_from_pt,
- .local_handle_from_texture = nouveau_drm_handle_from_pt,
-};
-
-struct drm_api *
-drm_api_create() {
- return &drm_api_hooks;
-}
-
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h
deleted file mode 100644
index a91aad7df8..0000000000
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef __NOUVEAU_DRM_API_H__
-#define __NOUVEAU_DRM_API_H__
-
-#include "state_tracker/drm_api.h"
-#include "state_tracker/dri1_api.h"
-
-#include "util/u_simple_screen.h"
-
-#include "nouveau_dri.h"
-
-struct nouveau_winsys {
- struct pipe_winsys base;
-
- struct pipe_screen *pscreen;
-
- struct pipe_surface *front;
-};
-
-static INLINE struct nouveau_winsys *
-nouveau_winsys(struct pipe_winsys *ws)
-{
- return (struct nouveau_winsys *)ws;
-}
-
-static INLINE struct nouveau_winsys *
-nouveau_winsys_screen(struct pipe_screen *pscreen)
-{
- return nouveau_winsys(pscreen->winsys);
-}
-
-#endif
diff --git a/src/gallium/winsys/drm/nouveau/egl/Makefile b/src/gallium/winsys/drm/nouveau/egl/Makefile
deleted file mode 100644
index 2c35260332..0000000000
--- a/src/gallium/winsys/drm/nouveau/egl/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-EGL_DRIVER_NAME = nouveau
-EGL_DRIVER_SOURCES = dummy.c
-EGL_DRIVER_LIBS = -ldrm_nouveau
-
-EGL_DRIVER_PIPES = \
- $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
- $(TOP)/src/gallium/drivers/nv30/libnv30.a \
- $(TOP)/src/gallium/drivers/nv40/libnv40.a \
- $(TOP)/src/gallium/drivers/nv50/libnv50.a \
- $(TOP)/src/gallium/drivers/nouveau/libnouveau.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
-
-include ../../Makefile.egl
diff --git a/src/gallium/winsys/drm/nouveau/egl/dummy.c b/src/gallium/winsys/drm/nouveau/egl/dummy.c
deleted file mode 100644
index 3181d0ba7e..0000000000
--- a/src/gallium/winsys/drm/nouveau/egl/dummy.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* A poor man's --whole-archive for EGL drivers */
-void *_eglMain(void *);
-void *_eglWholeArchive = (void *) _eglMain;
diff --git a/src/gallium/winsys/drm/nouveau/xorg/Makefile b/src/gallium/winsys/drm/nouveau/xorg/Makefile
deleted file mode 100644
index 179b50230b..0000000000
--- a/src/gallium/winsys/drm/nouveau/xorg/Makefile
+++ /dev/null
@@ -1,58 +0,0 @@
-TARGET = modesetting_drv.so
-CFILES = $(wildcard ./*.c)
-OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES))
-TOP = ../../../../../..
-
-include $(TOP)/configs/current
-
-INCLUDES = \
- $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
- -I../gem \
- -I$(TOP)/src/gallium/include \
- -I$(TOP)/src/gallium/drivers \
- -I$(TOP)/src/gallium/auxiliary \
- -I$(TOP)/src/mesa \
- -I$(TOP)/include \
- -I$(TOP)/src/egl/main
-
-LIBS = \
- $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \
- $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
- $(TOP)/src/gallium/drivers/nv30/libnv30.a \
- $(TOP)/src/gallium/drivers/nv40/libnv40.a \
- $(TOP)/src/gallium/drivers/nv50/libnv50.a \
- $(TOP)/src/gallium/drivers/nouveau/libnouveau.a \
- $(GALLIUM_AUXILIARIES)
-
-DRIVER_DEFINES = \
- -DHAVE_CONFIG_H
-
-
-#############################################
-
-
-
-all default: $(TARGET)
-
-$(TARGET): $(OBJECTS) Makefile $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a $(LIBS)
- $(TOP)/bin/mklib -noprefix -o $@ \
- $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_nouveau
-
-clean:
- rm -rf $(OBJECTS) $(TARGET)
-
-install:
- $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
- $(MINSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)
-
-
-##############################################
-
-
-.c.o:
- $(CC) -c $(CFLAGS) $(INCLUDES) $(DRIVER_DEFINES) $< -o $@
-
-
-##############################################
-
-.PHONY = all clean install
diff --git a/src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c b/src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c
deleted file mode 100644
index a669b3080a..0000000000
--- a/src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright 2008 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.
- *
- *
- * Author: Alan Hourihane <alanh@tungstengraphics.com>
- * Author: Jakob Bornecrantz <wallbraker@gmail.com>
- *
- */
-
-#include "../../../../state_trackers/xorg/xorg_winsys.h"
-
-static void nouveau_xorg_identify(int flags);
-static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num,
- struct pci_device *device,
- intptr_t match_data);
-
-static const struct pci_id_match nouveau_xorg_device_match[] = {
- { 0x10de, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
- 0x00030000, 0x00ffffff, 0 },
- { 0x12d2, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
- 0x00030000, 0x00ffffff, 0 },
- {0, 0, 0},
-};
-
-static SymTabRec nouveau_xorg_chipsets[] = {
- {PCI_MATCH_ANY, "NVIDIA Graphics Device"},
- {-1, NULL}
-};
-
-static PciChipsets nouveau_xorg_pci_devices[] = {
- {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL},
- {-1, -1, NULL}
-};
-
-static XF86ModuleVersionInfo nouveau_xorg_version = {
- "modesetting",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 0, 1, 0, /* major, minor, patch */
- ABI_CLASS_VIDEODRV,
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_VIDEODRV,
- {0, 0, 0, 0}
-};
-
-/*
- * Xorg driver exported structures
- */
-
-_X_EXPORT DriverRec modesetting = {
- 1,
- "modesetting",
- nouveau_xorg_identify,
- NULL,
- xorg_tracker_available_options,
- NULL,
- 0,
- NULL,
- nouveau_xorg_device_match,
- nouveau_xorg_pci_probe
-};
-
-static MODULESETUPPROTO(nouveau_xorg_setup);
-
-_X_EXPORT XF86ModuleData modesettingModuleData = {
- &nouveau_xorg_version,
- nouveau_xorg_setup,
- NULL
-};
-
-/*
- * Xorg driver functions
- */
-
-static pointer
-nouveau_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- static Bool setupDone = 0;
-
- /* This module should be loaded only once, but check to be sure.
- */
- if (!setupDone) {
- setupDone = 1;
- xf86AddDriver(&modesetting, module, HaveDriverFuncs);
-
- /*
- * The return value must be non-NULL on success even though there
- * is no TearDownProc.
- */
- return (pointer) 1;
- } else {
- if (errmaj)
- *errmaj = LDR_ONCEONLY;
- return NULL;
- }
-}
-
-static void
-nouveau_xorg_identify(int flags)
-{
- xf86PrintChipsets("modesetting", "Driver for Modesetting Kernel Drivers",
- nouveau_xorg_chipsets);
-}
-
-static Bool
-nouveau_xorg_pci_probe(DriverPtr driver,
- int entity_num, struct pci_device *device, intptr_t match_data)
-{
- ScrnInfoPtr scrn = NULL;
- EntityInfoPtr entity;
-
- scrn = xf86ConfigPciEntity(scrn, 0, entity_num, nouveau_xorg_pci_devices,
- NULL, NULL, NULL, NULL, NULL);
- if (scrn != NULL) {
- scrn->driverVersion = 1;
- scrn->driverName = "i915";
- scrn->name = "modesetting";
- scrn->Probe = NULL;
-
- entity = xf86GetEntityInfo(entity_num);
-
- /* Use all the functions from the xorg tracker */
- xorg_tracker_set_functions(scrn);
- }
- return scrn != NULL;
-}