summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/i915/sw
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/i915/sw')
-rw-r--r--src/gallium/winsys/i915/sw/Makefile.am33
-rw-r--r--src/gallium/winsys/i915/sw/Makefile.sources5
-rw-r--r--src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c159
-rw-r--r--src/gallium/winsys/i915/sw/i915_sw_buffer.c114
-rw-r--r--src/gallium/winsys/i915/sw/i915_sw_fence.c58
-rw-r--r--src/gallium/winsys/i915/sw/i915_sw_public.h9
-rw-r--r--src/gallium/winsys/i915/sw/i915_sw_winsys.c56
-rw-r--r--src/gallium/winsys/i915/sw/i915_sw_winsys.h56
8 files changed, 0 insertions, 490 deletions
diff --git a/src/gallium/winsys/i915/sw/Makefile.am b/src/gallium/winsys/i915/sw/Makefile.am
deleted file mode 100644
index 39f602242c3..00000000000
--- a/src/gallium/winsys/i915/sw/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright © 2012 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (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
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS 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 Makefile.sources
-include $(top_srcdir)/src/gallium/Automake.inc
-
-AM_CFLAGS = \
- -I$(top_srcdir)/src/gallium/drivers \
- $(GALLIUM_WINSYS_CFLAGS) \
- $(INTEL_CFLAGS)
-
-noinst_LTLIBRARIES = libi915sw.la
-
-libi915sw_la_SOURCES = $(C_SOURCES)
diff --git a/src/gallium/winsys/i915/sw/Makefile.sources b/src/gallium/winsys/i915/sw/Makefile.sources
deleted file mode 100644
index 89a38c6c63b..00000000000
--- a/src/gallium/winsys/i915/sw/Makefile.sources
+++ /dev/null
@@ -1,5 +0,0 @@
-C_SOURCES := \
- i915_sw_batchbuffer.c \
- i915_sw_buffer.c \
- i915_sw_fence.c \
- i915_sw_winsys.c
diff --git a/src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c b/src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c
deleted file mode 100644
index b52bbaa5077..00000000000
--- a/src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c
+++ /dev/null
@@ -1,159 +0,0 @@
-
-#include "i915_sw_winsys.h"
-#include "i915/i915_batchbuffer.h"
-#include "i915/i915_debug.h"
-#include "util/u_memory.h"
-
-#define BATCH_RESERVED 16
-
-#define INTEL_DEFAULT_RELOCS 100
-#define INTEL_MAX_RELOCS 400
-
-#define INTEL_BATCH_NO_CLIPRECTS 0x1
-#define INTEL_BATCH_CLIPRECTS 0x2
-
-#define INTEL_ALWAYS_FLUSH
-
-struct i915_sw_batchbuffer
-{
- struct i915_winsys_batchbuffer base;
-
- size_t actual_size;
-};
-
-static INLINE struct i915_sw_batchbuffer *
-i915_sw_batchbuffer(struct i915_winsys_batchbuffer *batch)
-{
- return (struct i915_sw_batchbuffer *)batch;
-}
-
-static void
-i915_sw_batchbuffer_reset(struct i915_sw_batchbuffer *batch)
-{
- memset(batch->base.map, 0, batch->actual_size);
- batch->base.ptr = batch->base.map;
- batch->base.size = batch->actual_size - BATCH_RESERVED;
- batch->base.relocs = 0;
-}
-
-static struct i915_winsys_batchbuffer *
-i915_sw_batchbuffer_create(struct i915_winsys *iws)
-{
- struct i915_sw_winsys *isws = i915_sw_winsys(iws);
- struct i915_sw_batchbuffer *batch = CALLOC_STRUCT(i915_sw_batchbuffer);
-
- batch->actual_size = isws->max_batch_size;
-
- batch->base.map = MALLOC(batch->actual_size);
- batch->base.ptr = NULL;
- batch->base.size = 0;
-
- batch->base.relocs = 0;
-
- batch->base.iws = iws;
-
- i915_sw_batchbuffer_reset(batch);
-
- return &batch->base;
-}
-
-static boolean
-i915_sw_batchbuffer_validate_buffers(struct i915_winsys_batchbuffer *batch,
- struct i915_winsys_buffer **buffer,
- int num_of_buffers)
-{
- return TRUE;
-}
-
-static int
-i915_sw_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch,
- struct i915_winsys_buffer *buffer,
- enum i915_winsys_buffer_usage usage,
- unsigned pre_add, boolean fenced)
-{
- struct i915_sw_batchbuffer *batch = i915_sw_batchbuffer(ibatch);
- int ret = 0;
-
- if (usage == I915_USAGE_SAMPLER) {
-
- } else if (usage == I915_USAGE_RENDER) {
-
- } else if (usage == I915_USAGE_2D_TARGET) {
-
- } else if (usage == I915_USAGE_2D_SOURCE) {
-
- } else if (usage == I915_USAGE_VERTEX) {
-
- } else {
- assert(0);
- return -1;
- }
-
- ((uint32_t*)batch->base.ptr)[0] = 0;
- batch->base.ptr += 4;
-
- if (!ret)
- batch->base.relocs++;
-
- return ret;
-}
-
-static void
-i915_sw_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch,
- struct pipe_fence_handle **fence,
- enum i915_winsys_flush_flags flags)
-{
- struct i915_sw_batchbuffer *batch = i915_sw_batchbuffer(ibatch);
- unsigned used = 0;
-
- assert(i915_winsys_batchbuffer_space(ibatch) >= 0);
-
- used = batch->base.ptr - batch->base.map;
- assert((used & 3) == 0);
-
-#ifdef INTEL_ALWAYS_FLUSH
- /* MI_FLUSH | FLUSH_MAP_CACHE */
- i915_winsys_batchbuffer_dword_unchecked(ibatch, (0x4<<23)|(1<<0));
- used += 4;
-#endif
-
- if ((used & 4) == 0) {
- /* MI_NOOP */
- i915_winsys_batchbuffer_dword_unchecked(ibatch, 0);
- }
- /* MI_BATCH_BUFFER_END */
- i915_winsys_batchbuffer_dword_unchecked(ibatch, (0xA<<23));
-
- used = batch->base.ptr - batch->base.map;
- assert((used & 4) == 0);
-
- if (i915_sw_winsys(ibatch->iws)->dump_cmd) {
- i915_dump_batchbuffer(ibatch);
- }
-
- if (fence) {
- ibatch->iws->fence_reference(ibatch->iws, fence, NULL);
-
- (*fence) = i915_sw_fence_create();
- }
-
- i915_sw_batchbuffer_reset(batch);
-}
-
-static void
-i915_sw_batchbuffer_destroy(struct i915_winsys_batchbuffer *ibatch)
-{
- struct i915_sw_batchbuffer *batch = i915_sw_batchbuffer(ibatch);
-
- FREE(batch->base.map);
- FREE(batch);
-}
-
-void i915_sw_winsys_init_batchbuffer_functions(struct i915_sw_winsys *isws)
-{
- isws->base.batchbuffer_create = i915_sw_batchbuffer_create;
- isws->base.validate_buffers = i915_sw_batchbuffer_validate_buffers;
- isws->base.batchbuffer_reloc = i915_sw_batchbuffer_reloc;
- isws->base.batchbuffer_flush = i915_sw_batchbuffer_flush;
- isws->base.batchbuffer_destroy = i915_sw_batchbuffer_destroy;
-}
diff --git a/src/gallium/winsys/i915/sw/i915_sw_buffer.c b/src/gallium/winsys/i915/sw/i915_sw_buffer.c
deleted file mode 100644
index 9a7e90e2173..00000000000
--- a/src/gallium/winsys/i915/sw/i915_sw_buffer.c
+++ /dev/null
@@ -1,114 +0,0 @@
-
-#include "i915_sw_winsys.h"
-#include "util/u_memory.h"
-
-static struct i915_winsys_buffer *
-i915_sw_buffer_create(struct i915_winsys *iws,
- unsigned size,
- enum i915_winsys_buffer_type type)
-{
- struct i915_sw_buffer *buf = CALLOC_STRUCT(i915_sw_buffer);
-
- if (!buf)
- return NULL;
-
- buf->magic = 0xDEAD1337;
- buf->type = type;
- buf->ptr = CALLOC(size, 1);
-
- if (!buf->ptr)
- goto err;
-
- return (struct i915_winsys_buffer *)buf;
-
-err:
- assert(0);
- FREE(buf);
- return NULL;
-}
-
-static struct i915_winsys_buffer *
-i915_sw_buffer_create_tiled(struct i915_winsys *iws,
- unsigned *stride, unsigned height,
- enum i915_winsys_buffer_tile *tiling,
- enum i915_winsys_buffer_type type)
-{
- struct i915_sw_buffer *buf = CALLOC_STRUCT(i915_sw_buffer);
-
- if (!buf)
- return NULL;
-
- buf->magic = 0xDEAD1337;
- buf->type = type;
- buf->ptr = CALLOC(*stride * height, 1);
- buf->tiling = *tiling;
- buf->stride = *stride;
-
- if (!buf->ptr)
- goto err;
-
- return (struct i915_winsys_buffer *)buf;
-
-err:
- assert(0);
- FREE(buf);
- return NULL;
-}
-
-static void *
-i915_sw_buffer_map(struct i915_winsys *iws,
- struct i915_winsys_buffer *buffer,
- boolean write)
-{
- struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
-
- buf->map_count += 1;
- return buf->ptr;
-}
-
-static void
-i915_sw_buffer_unmap(struct i915_winsys *iws,
- struct i915_winsys_buffer *buffer)
-{
- struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
-
- buf->map_count -= 1;
-}
-
-static int
-i915_sw_buffer_write(struct i915_winsys *iws,
- struct i915_winsys_buffer *buffer,
- size_t offset,
- size_t size,
- const void *data)
-{
- struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
-
- memcpy((char*)buf->ptr + offset, data, size);
- return 0;
-}
-
-static void
-i915_sw_buffer_destroy(struct i915_winsys *iws,
- struct i915_winsys_buffer *buffer)
-{
- struct i915_sw_buffer *buf = i915_sw_buffer(buffer);
-
-#ifdef DEBUG
- buf->magic = 0;
-#endif
-
- FREE(buf->ptr);
- FREE(buf);
-}
-
-void
-i915_sw_winsys_init_buffer_functions(struct i915_sw_winsys *isws)
-{
- isws->base.buffer_create = i915_sw_buffer_create;
- isws->base.buffer_create_tiled = i915_sw_buffer_create_tiled;
- isws->base.buffer_map = i915_sw_buffer_map;
- isws->base.buffer_unmap = i915_sw_buffer_unmap;
- isws->base.buffer_write = i915_sw_buffer_write;
- isws->base.buffer_destroy = i915_sw_buffer_destroy;
-}
diff --git a/src/gallium/winsys/i915/sw/i915_sw_fence.c b/src/gallium/winsys/i915/sw/i915_sw_fence.c
deleted file mode 100644
index 4b61b2a5e30..00000000000
--- a/src/gallium/winsys/i915/sw/i915_sw_fence.c
+++ /dev/null
@@ -1,58 +0,0 @@
-
-#include "i915_sw_winsys.h"
-#include "util/u_memory.h"
-#include "util/u_atomic.h"
-#include "util/u_inlines.h"
-
-struct i915_sw_fence
-{
- struct pipe_reference reference;
-};
-
-struct pipe_fence_handle *
-i915_sw_fence_create()
-{
- struct i915_sw_fence *fence = CALLOC_STRUCT(i915_sw_fence);
-
- pipe_reference_init(&fence->reference, 1);
-
- return (struct pipe_fence_handle *)fence;
-}
-
-static void
-i915_sw_fence_reference(struct i915_winsys *iws,
- struct pipe_fence_handle **ptr,
- struct pipe_fence_handle *fence)
-{
- struct i915_sw_fence *old = (struct i915_sw_fence *)*ptr;
- struct i915_sw_fence *f = (struct i915_sw_fence *)fence;
-
- if (pipe_reference(&((struct i915_sw_fence *)(*ptr))->reference, &f->reference)) {
- FREE(old);
- }
- *ptr = fence;
-}
-
-static int
-i915_sw_fence_signalled(struct i915_winsys *iws,
- struct pipe_fence_handle *fence)
-{
- assert(0);
-
- return 0;
-}
-
-static int
-i915_sw_fence_finish(struct i915_winsys *iws,
- struct pipe_fence_handle *fence)
-{
- return 0;
-}
-
-void
-i915_sw_winsys_init_fence_functions(struct i915_sw_winsys *isws)
-{
- isws->base.fence_reference = i915_sw_fence_reference;
- isws->base.fence_signalled = i915_sw_fence_signalled;
- isws->base.fence_finish = i915_sw_fence_finish;
-}
diff --git a/src/gallium/winsys/i915/sw/i915_sw_public.h b/src/gallium/winsys/i915/sw/i915_sw_public.h
deleted file mode 100644
index e951a32917f..00000000000
--- a/src/gallium/winsys/i915/sw/i915_sw_public.h
+++ /dev/null
@@ -1,9 +0,0 @@
-
-#ifndef I915_SW_PUBLIC_H
-#define I915_SW_PUBLIC_H
-
-struct i915_winsys;
-
-struct i915_winsys * i915_sw_winsys_create(void);
-
-#endif
diff --git a/src/gallium/winsys/i915/sw/i915_sw_winsys.c b/src/gallium/winsys/i915/sw/i915_sw_winsys.c
deleted file mode 100644
index fc48da6fb92..00000000000
--- a/src/gallium/winsys/i915/sw/i915_sw_winsys.c
+++ /dev/null
@@ -1,56 +0,0 @@
-
-#include "i915_sw_winsys.h"
-#include "i915_sw_public.h"
-#include "util/u_memory.h"
-
-
-/*
- * Helper functions
- */
-
-
-static void
-i915_sw_get_device_id(unsigned int *device_id)
-{
- /* just pick a i945 hw id */
- *device_id = 0x27A2;
-}
-
-static void
-i915_sw_destroy(struct i915_winsys *iws)
-{
- struct i915_sw_winsys *isws = i915_sw_winsys(iws);
- FREE(isws);
-}
-
-
-/*
- * Exported functions
- */
-
-
-struct i915_winsys *
-i915_sw_winsys_create()
-{
- struct i915_sw_winsys *isws;
- unsigned int deviceID;
-
- isws = CALLOC_STRUCT(i915_sw_winsys);
- if (!isws)
- return NULL;
-
- i915_sw_get_device_id(&deviceID);
-
- i915_sw_winsys_init_batchbuffer_functions(isws);
- i915_sw_winsys_init_buffer_functions(isws);
- i915_sw_winsys_init_fence_functions(isws);
-
- isws->base.destroy = i915_sw_destroy;
-
- isws->base.pci_id = deviceID;
- isws->max_batch_size = 16 * 4096;
-
- isws->dump_cmd = debug_get_bool_option("I915_DUMP_CMD", FALSE);
-
- return &isws->base;
-}
diff --git a/src/gallium/winsys/i915/sw/i915_sw_winsys.h b/src/gallium/winsys/i915/sw/i915_sw_winsys.h
deleted file mode 100644
index 3af2548419e..00000000000
--- a/src/gallium/winsys/i915/sw/i915_sw_winsys.h
+++ /dev/null
@@ -1,56 +0,0 @@
-
-#ifndef I915_SW_WINSYS_H
-#define I915_SW_WINSYS_H
-
-#include "i915/i915_winsys.h"
-
-
-/*
- * Winsys
- */
-
-
-struct i915_sw_winsys
-{
- struct i915_winsys base;
-
- boolean dump_cmd;
-
- size_t max_batch_size;
-};
-
-static INLINE struct i915_sw_winsys *
-i915_sw_winsys(struct i915_winsys *iws)
-{
- return (struct i915_sw_winsys *)iws;
-}
-
-struct pipe_fence_handle * i915_sw_fence_create(void);
-
-void i915_sw_winsys_init_batchbuffer_functions(struct i915_sw_winsys *idws);
-void i915_sw_winsys_init_buffer_functions(struct i915_sw_winsys *idws);
-void i915_sw_winsys_init_fence_functions(struct i915_sw_winsys *idws);
-
-
-/*
- * Buffer
- */
-
-
-struct i915_sw_buffer {
- unsigned magic;
-
- void *ptr;
- unsigned map_count;
- enum i915_winsys_buffer_type type;
- enum i915_winsys_buffer_tile tiling;
- unsigned stride;
-};
-
-static INLINE struct i915_sw_buffer *
-i915_sw_buffer(struct i915_winsys_buffer *buffer)
-{
- return (struct i915_sw_buffer *)buffer;
-}
-
-#endif