diff options
author | Jakob Bornecrantz <jakob@vmware.com> | 2010-03-16 13:54:18 +0000 |
---|---|---|
committer | Jakob Bornecrantz <jakob@vmware.com> | 2010-03-24 17:02:17 +0100 |
commit | c9f98673c5b6830cd1f41c0c53a9e5e299d47464 (patch) | |
tree | 16fc810d458932cd99c1029af1993314c7489353 /src/gallium/winsys/drm/i965/xlib/xlib_i965.c | |
parent | 43218a45a4cdbe2bc92867dc143f4b0e5fe9ca8d (diff) |
gallium: Reorg winsys directories
Attached output from commit.
delete mode 100644 src/gallium/winsys/drm/SConscript
delete mode 100644 src/gallium/winsys/drm/i965/SConscript
delete mode 100644 src/gallium/winsys/drm/intel/Makefile
delete mode 100644 src/gallium/winsys/drm/intel/SConscript
delete mode 100644 src/gallium/winsys/drm/nouveau/Makefile
delete mode 100644 src/gallium/winsys/drm/radeon/Makefile
delete mode 100644 src/gallium/winsys/drm/radeon/SConscript
delete mode 100644 src/gallium/winsys/drm/vmware/Makefile
delete mode 100644 src/gallium/winsys/drm/vmware/SConscript
rename src/gallium/winsys/{drm/intel/gem => i915/drm}/Makefile (82%)
rename src/gallium/winsys/{drm/intel/gem => i915/drm}/SConscript (100%)
rename src/gallium/winsys/{drm/intel/gem => i915/drm}/intel_drm_api.c (100%)
rename src/gallium/winsys/{drm/intel/gem => i915/drm}/intel_drm_batchbuffer.c (100%)
rename src/gallium/winsys/{drm/intel/gem => i915/drm}/intel_drm_buffer.c (100%)
rename src/gallium/winsys/{drm/intel/gem => i915/drm}/intel_drm_fence.c (100%)
rename src/gallium/winsys/{drm/intel/gem => i915/drm}/intel_drm_winsys.h (100%)
rename src/gallium/winsys/{drm/i965/gem => i965/drm}/Makefile (78%)
rename src/gallium/winsys/{drm/i965/gem => i965/drm}/SConscript (100%)
rename src/gallium/winsys/{drm/i965/gem => i965/drm}/i965_drm_api.c (98%)
rename src/gallium/winsys/{drm/i965/gem => i965/drm}/i965_drm_buffer.c (100%)
rename src/gallium/winsys/{drm/i965/gem => i965/drm}/i965_drm_winsys.h (100%)
rename src/gallium/winsys/{drm => }/i965/xlib/Makefile (97%)
rename src/gallium/winsys/{drm => }/i965/xlib/xlib_i965.c (100%)
rename src/gallium/winsys/{drm => }/nouveau/drm/Makefile (79%)
rename src/gallium/winsys/{drm => }/nouveau/drm/nouveau_dri.h (100%)
rename src/gallium/winsys/{drm => }/nouveau/drm/nouveau_drm_api.c (100%)
rename src/gallium/winsys/{drm => }/nouveau/drm/nouveau_drm_api.h (100%)
rename src/gallium/winsys/{drm/radeon/core => radeon/drm}/Makefile (79%)
rename src/gallium/winsys/{drm/radeon/core => radeon/drm}/SConscript (100%)
rename src/gallium/winsys/{drm/radeon/core => radeon/drm}/radeon_buffer.h (100%)
rename src/gallium/winsys/{drm/radeon/core => radeon/drm}/radeon_drm.c (100%)
rename src/gallium/winsys/{drm/radeon/core => radeon/drm}/radeon_drm.h (100%)
rename src/gallium/winsys/{drm/radeon/core => radeon/drm}/radeon_drm_buffer.c (100%)
rename src/gallium/winsys/{drm/radeon/core => radeon/drm}/radeon_r300.c (100%)
rename src/gallium/winsys/{drm/radeon/core => radeon/drm}/radeon_r300.h (100%)
rename src/gallium/winsys/{drm/radeon/core => radeon/drm}/radeon_winsys.h (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/Makefile (63%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/SConscript (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_buffer.c (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_buffer.h (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_context.c (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_context.h (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_fence.c (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_fence.h (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_screen.c (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_screen.h (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_screen_dri.c (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_screen_ioctl.c (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_screen_pools.c (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_screen_svga.c (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_surface.c (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmw_surface.h (100%)
rename src/gallium/winsys/{drm/vmware/core => svga/drm}/vmwgfx_drm.h (100%)
rename src/gallium/winsys/{drm/i965 => sw}/Makefile (61%)
copy src/gallium/winsys/{drm/sw => sw/drm}/Makefile (73%)
rename src/gallium/winsys/{drm/sw => sw/drm}/sw_drm_api.c (98%)
rename src/gallium/winsys/{drm/sw => sw/drm}/sw_drm_api.h (100%)
rename src/gallium/winsys/{ => sw}/gdi/SConscript (100%)
rename src/gallium/winsys/{ => sw}/gdi/gdi_sw_winsys.c (100%)
rename src/gallium/winsys/{ => sw}/gdi/gdi_sw_winsys.h (100%)
rename src/gallium/winsys/{ => sw}/null/Makefile (78%)
rename src/gallium/winsys/{ => sw}/null/SConscript (100%)
rename src/gallium/winsys/{ => sw}/null/null_sw_winsys.c (100%)
rename src/gallium/winsys/{ => sw}/null/null_sw_winsys.h (100%)
rename src/gallium/winsys/{drm/sw => sw/wrapper}/Makefile (65%)
rename src/gallium/winsys/{drm/sw => sw/wrapper}/wrapper_sw_winsys.c (100%)
rename src/gallium/winsys/{drm/sw => sw/wrapper}/wrapper_sw_winsys.h (100%)
rename src/gallium/winsys/{ => sw}/xlib/Makefile (79%)
rename src/gallium/winsys/{ => sw}/xlib/SConscript (100%)
rename src/gallium/winsys/{ => sw}/xlib/xlib_sw_winsys.c (100%)
Diffstat (limited to 'src/gallium/winsys/drm/i965/xlib/xlib_i965.c')
-rw-r--r-- | src/gallium/winsys/drm/i965/xlib/xlib_i965.c | 503 |
1 files changed, 0 insertions, 503 deletions
diff --git a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c b/src/gallium/winsys/drm/i965/xlib/xlib_i965.c deleted file mode 100644 index 063e9f600b..0000000000 --- a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c +++ /dev/null @@ -1,503 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * - **************************************************************************/ - -/* - * Authors: - * Keith Whitwell - * Brian Paul - */ - - -#include "util/u_memory.h" -#include "util/u_math.h" -#include "pipe/p_error.h" -#include "pipe/p_context.h" - -#include "xm_public.h" - -#include "i965/brw_winsys.h" -#include "i965/brw_screen.h" -#include "i965/brw_reg.h" -#include "i965/brw_structs_dump.h" - -#define MAX_VRAM (128*1024*1024) - - - -extern int brw_disasm (FILE *file, - const struct brw_instruction *inst, - unsigned count ); - -extern int intel_decode(const uint32_t *data, - int count, - uint32_t hw_offset, - uint32_t devid); - -struct xlib_brw_buffer -{ - struct brw_winsys_buffer base; - char *virtual; - unsigned offset; - unsigned type; - int map_count; - boolean modified; -}; - - -/** - * Subclass of brw_winsys_screen for Xlib winsys - */ -struct xlib_brw_winsys -{ - struct brw_winsys_screen base; - struct brw_chipset chipset; - - unsigned size; - unsigned used; -}; - -static struct xlib_brw_winsys * -xlib_brw_winsys( struct brw_winsys_screen *screen ) -{ - return (struct xlib_brw_winsys *)screen; -} - - -static struct xlib_brw_buffer * -xlib_brw_buffer( struct brw_winsys_buffer *buffer ) -{ - return (struct xlib_brw_buffer *)buffer; -} - - - -const char *names[BRW_BUFFER_TYPE_MAX] = { - "TEXTURE", - "SCANOUT", - "VERTEX", - "CURBE", - "QUERY", - "SHADER_CONSTANTS", - "WM_SCRATCH", - "BATCH", - "GENERAL_STATE", - "SURFACE_STATE", - "PIXEL", - "GENERIC", -}; - -const char *usages[BRW_USAGE_MAX] = { - "STATE", - "QUERY_RESULT", - "RENDER_TARGET", - "DEPTH_BUFFER", - "BLIT_SOURCE", - "BLIT_DEST", - "SAMPLER", - "VERTEX", - "SCRATCH" -}; - - -const char *data_types[BRW_DATA_MAX] = -{ - "GS: CC_VP", - "GS: CC_UNIT", - "GS: WM_PROG", - "GS: SAMPLER_DEFAULT_COLOR", - "GS: SAMPLER", - "GS: WM_UNIT", - "GS: SF_PROG", - "GS: SF_VP", - "GS: SF_UNIT", - "GS: VS_UNIT", - "GS: VS_PROG", - "GS: GS_UNIT", - "GS: GS_PROG", - "GS: CLIP_VP", - "GS: CLIP_UNIT", - "GS: CLIP_PROG", - "SS: SURFACE", - "SS: SURF_BIND", - "CONSTANT DATA", - "BATCH DATA", - "(untyped)" -}; - - -static enum pipe_error -xlib_brw_bo_alloc( struct brw_winsys_screen *sws, - enum brw_buffer_type type, - unsigned size, - unsigned alignment, - struct brw_winsys_buffer **bo_out ) -{ - struct xlib_brw_winsys *xbw = xlib_brw_winsys(sws); - struct xlib_brw_buffer *buf; - - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("%s type %s sz %d align %d\n", - __FUNCTION__, names[type], size, alignment ); - - buf = CALLOC_STRUCT(xlib_brw_buffer); - if (!buf) - return PIPE_ERROR_OUT_OF_MEMORY; - - pipe_reference_init(&buf->base.reference, 1); - - buf->offset = align(xbw->used, alignment); - buf->type = type; - buf->virtual = MALLOC(size); - buf->base.size = size; - buf->base.sws = sws; - - xbw->used = align(xbw->used, alignment) + size; - if (xbw->used > MAX_VRAM) - goto err; - - /* XXX: possibly rentrant call to bo_destroy: - */ - bo_reference(bo_out, &buf->base); - return PIPE_OK; - -err: - assert(0); - FREE(buf->virtual); - FREE(buf); - return PIPE_ERROR_OUT_OF_MEMORY; -} - -static void -xlib_brw_bo_destroy( struct brw_winsys_buffer *buffer ) -{ - struct xlib_brw_buffer *buf = xlib_brw_buffer(buffer); - - FREE(buf); -} - -static int -xlib_brw_bo_emit_reloc( struct brw_winsys_buffer *buffer, - enum brw_buffer_usage usage, - unsigned delta, - unsigned offset, - struct brw_winsys_buffer *buffer2) -{ - struct xlib_brw_buffer *buf = xlib_brw_buffer(buffer); - struct xlib_brw_buffer *buf2 = xlib_brw_buffer(buffer2); - - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("%s buf %p offset %x val %x + %x buf2 %p/%s/%s\n", - __FUNCTION__, (void *)buffer, offset, - buf2->offset, delta, - (void *)buffer2, names[buf2->type], usages[usage]); - - *(uint32_t *)(buf->virtual + offset) = buf2->offset + delta; - - return 0; -} - -static int -xlib_brw_bo_exec( struct brw_winsys_buffer *buffer, - unsigned bytes_used ) -{ - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("execute buffer %p, bytes %d\n", (void *)buffer, bytes_used); - - return 0; -} - - - - -static int -xlib_brw_bo_subdata(struct brw_winsys_buffer *buffer, - enum brw_buffer_data_type data_type, - size_t offset, - size_t size, - const void *data, - const struct brw_winsys_reloc *reloc, - unsigned nr_relocs) -{ - struct xlib_brw_buffer *buf = xlib_brw_buffer(buffer); - struct xlib_brw_winsys *xbw = xlib_brw_winsys(buffer->sws); - unsigned i; - - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("%s buf %p off %d sz %d %s relocs: %d\n", - __FUNCTION__, - (void *)buffer, offset, size, - data_types[data_type], - nr_relocs); - - assert(buf->base.size >= offset + size); - memcpy(buf->virtual + offset, data, size); - - /* Apply the relocations: - */ - for (i = 0; i < nr_relocs; i++) { - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("\treloc[%d] usage %s off %d value %x+%x\n", - i, usages[reloc[i].usage], reloc[i].offset, - xlib_brw_buffer(reloc[i].bo)->offset, reloc[i].delta); - - *(unsigned *)(buf->virtual + offset + reloc[i].offset) = - xlib_brw_buffer(reloc[i].bo)->offset + reloc[i].delta; - } - - if (BRW_DUMP) - brw_dump_data( xbw->chipset.pci_id, - data_type, - buf->offset + offset, - buf->virtual + offset, size ); - - - return 0; -} - - -static boolean -xlib_brw_bo_is_busy(struct brw_winsys_buffer *buffer) -{ - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("%s %p\n", __FUNCTION__, (void *)buffer); - return TRUE; -} - -static boolean -xlib_brw_bo_references(struct brw_winsys_buffer *a, - struct brw_winsys_buffer *b) -{ - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("%s %p %p\n", __FUNCTION__, (void *)a, (void *)b); - return TRUE; -} - -static enum pipe_error -xlib_brw_check_aperture_space( struct brw_winsys_screen *iws, - struct brw_winsys_buffer **buffers, - unsigned count ) -{ - unsigned tot_size = 0; - unsigned i; - - for (i = 0; i < count; i++) - tot_size += buffers[i]->size; - - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("%s %d bufs, tot_size: %d kb\n", - __FUNCTION__, count, - (tot_size + 1023) / 1024); - - return PIPE_OK; -} - -static void * -xlib_brw_bo_map(struct brw_winsys_buffer *buffer, - enum brw_buffer_data_type data_type, - unsigned offset, - unsigned length, - boolean write, - boolean discard, - boolean explicit) -{ - struct xlib_brw_buffer *buf = xlib_brw_buffer(buffer); - - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("%s %p %s %s\n", __FUNCTION__, (void *)buffer, - write ? "read/write" : "read", - write ? data_types[data_type] : ""); - - if (write) - buf->modified = 1; - - buf->map_count++; - return buf->virtual; -} - - -static void -xlib_brw_bo_flush_range( struct brw_winsys_buffer *buffer, - unsigned offset, - unsigned length ) -{ -} - - -static void -xlib_brw_bo_unmap(struct brw_winsys_buffer *buffer) -{ - struct xlib_brw_buffer *buf = xlib_brw_buffer(buffer); - - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("%s %p\n", __FUNCTION__, (void *)buffer); - - --buf->map_count; - assert(buf->map_count >= 0); - - if (buf->map_count == 0 && - buf->modified) { - - buf->modified = 0; - - /* Consider dumping new buffer contents here, using the - * flush-range info to minimize verbosity. - */ - } -} - - -static void -xlib_brw_bo_wait_idle( struct brw_winsys_buffer *buffer ) -{ -} - - -static void -xlib_brw_winsys_destroy( struct brw_winsys_screen *sws ) -{ - struct xlib_brw_winsys *xbw = xlib_brw_winsys(sws); - - FREE(xbw); -} - -static struct brw_winsys_screen * -xlib_create_brw_winsys_screen( void ) -{ - struct xlib_brw_winsys *ws; - - ws = CALLOC_STRUCT(xlib_brw_winsys); - if (!ws) - return NULL; - - ws->used = 0; - - ws->base.destroy = xlib_brw_winsys_destroy; - ws->base.bo_alloc = xlib_brw_bo_alloc; - ws->base.bo_destroy = xlib_brw_bo_destroy; - ws->base.bo_emit_reloc = xlib_brw_bo_emit_reloc; - ws->base.bo_exec = xlib_brw_bo_exec; - ws->base.bo_subdata = xlib_brw_bo_subdata; - ws->base.bo_is_busy = xlib_brw_bo_is_busy; - ws->base.bo_references = xlib_brw_bo_references; - ws->base.check_aperture_space = xlib_brw_check_aperture_space; - ws->base.bo_map = xlib_brw_bo_map; - ws->base.bo_flush_range = xlib_brw_bo_flush_range; - ws->base.bo_unmap = xlib_brw_bo_unmap; - ws->base.bo_wait_idle = xlib_brw_bo_wait_idle; - - return &ws->base; -} - - -/*********************************************************************** - * Implementation of Xlib co-state-tracker's winsys interface - */ - -static void -xlib_i965_display_surface(struct xmesa_buffer *xm_buffer, - struct pipe_surface *surf) -{ - struct brw_surface *surface = brw_surface(surf); - struct xlib_brw_buffer *bo = xlib_brw_buffer(surface->bo); - - if (BRW_DEBUG & DEBUG_WINSYS) - debug_printf("%s offset %x+%x sz %dx%d\n", __FUNCTION__, - bo->offset, - surface->draw_offset, - surf->width, - surf->height); -} - -static void -xlib_i965_flush_frontbuffer(struct pipe_screen *screen, - struct pipe_surface *surf, - void *context_private) -{ - xlib_i965_display_surface(NULL, surf); -} - - -static struct pipe_screen * -xlib_create_i965_screen( void ) -{ - struct brw_winsys_screen *winsys; - struct pipe_screen *screen; - - winsys = xlib_create_brw_winsys_screen(); - if (winsys == NULL) - return NULL; - - screen = brw_create_screen(winsys, PCI_CHIP_GM45_GM); - if (screen == NULL) - goto fail; - - xlib_brw_winsys(winsys)->chipset = brw_screen(screen)->chipset; - - screen->flush_frontbuffer = xlib_i965_flush_frontbuffer; - return screen; - -fail: - if (winsys) - winsys->destroy( winsys ); - - return NULL; -} - - - - - -struct xm_driver xlib_i965_driver = -{ - .create_pipe_screen = xlib_create_i965_screen, - .display_surface = xlib_i965_display_surface -}; - - -/* Register this driver at library load: - */ -static void _init( void ) __attribute__((constructor)); -static void _init( void ) -{ - xmesa_set_driver( &xlib_i965_driver ); -} - - - -/*********************************************************************** - * - * Butt-ugly hack to convince the linker not to throw away public GL - * symbols (they are all referenced from getprocaddress, I guess). - */ -extern void (*linker_foo(const unsigned char *procName))(); -extern void (*glXGetProcAddress(const unsigned char *procName))(); - -extern void (*linker_foo(const unsigned char *procName))() -{ - return glXGetProcAddress(procName); -} |