diff options
author | Eric Anholt <[email protected]> | 2011-10-14 14:50:50 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-10-28 11:32:10 -0700 |
commit | 974c66875e719051831e2bd874db4ba7fdaffa02 (patch) | |
tree | 29a1415e1f3cf9855258df3e41ecc4dd32f7632a /src/mesa | |
parent | 830e546f94c53d3f6878a188a2bdb5d2f3cf74bd (diff) |
radeon: Remove the non-libdrm kernel memory manager support.
We should have never been building this at this point.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/r200/Makefile | 7 | ||||
l--------- | src/mesa/drivers/dri/r200/radeon_bo.c | 1 | ||||
l--------- | src/mesa/drivers/dri/r200/radeon_cs.c | 1 | ||||
l--------- | src/mesa/drivers/dri/r200/radeon_cs_space_drm.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/Makefile | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_bo.c | 110 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_cs.c | 95 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c | 244 |
8 files changed, 2 insertions, 464 deletions
diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile index dc857b86a8b..0f44f46dd1d 100644 --- a/src/mesa/drivers/dri/r200/Makefile +++ b/src/mesa/drivers/dri/r200/Makefile @@ -7,10 +7,6 @@ LIBNAME = r200_dri.so include ../Makefile.defines -ifeq ($(RADEON_LDFLAGS),) -CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c -endif - RADEON_COMMON_SOURCES = \ radeon_buffer_objects.c \ radeon_common_context.c \ @@ -42,8 +38,7 @@ DRIVER_SOURCES = r200_context.c \ r200_blit.c \ radeon_screen.c \ $(EGL_SOURCES) \ - $(RADEON_COMMON_SOURCES) \ - $(CS_SOURCES) + $(RADEON_COMMON_SOURCES) C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES) diff --git a/src/mesa/drivers/dri/r200/radeon_bo.c b/src/mesa/drivers/dri/r200/radeon_bo.c deleted file mode 120000 index 9448ffee54b..00000000000 --- a/src/mesa/drivers/dri/r200/radeon_bo.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_bo.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r200/radeon_cs.c b/src/mesa/drivers/dri/r200/radeon_cs.c deleted file mode 120000 index 66b7ad1eb03..00000000000 --- a/src/mesa/drivers/dri/r200/radeon_cs.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_cs.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/r200/radeon_cs_space_drm.c b/src/mesa/drivers/dri/r200/radeon_cs_space_drm.c deleted file mode 120000 index c248ea7d1a5..00000000000 --- a/src/mesa/drivers/dri/r200/radeon_cs_space_drm.c +++ /dev/null @@ -1 +0,0 @@ -../radeon/radeon_cs_space_drm.c
\ No newline at end of file diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile index 1aaa17cf3d7..3cb1dc54ab7 100644 --- a/src/mesa/drivers/dri/radeon/Makefile +++ b/src/mesa/drivers/dri/radeon/Makefile @@ -8,10 +8,6 @@ LIBNAME = radeon_dri.so include ../Makefile.defines -ifeq ($(RADEON_LIBS),) -CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c -endif - RADEON_COMMON_SOURCES = \ radeon_buffer_objects.c \ radeon_common_context.c \ @@ -44,8 +40,7 @@ DRIVER_SOURCES = \ C_SOURCES = \ $(COMMON_SOURCES) \ - $(DRIVER_SOURCES) \ - $(CS_SOURCES) + $(DRIVER_SOURCES) DRIVER_DEFINES = -DRADEON_R100 diff --git a/src/mesa/drivers/dri/radeon/radeon_bo.c b/src/mesa/drivers/dri/radeon/radeon_bo.c deleted file mode 100644 index 393d156cdea..00000000000 --- a/src/mesa/drivers/dri/radeon/radeon_bo.c +++ /dev/null @@ -1,110 +0,0 @@ -#include <radeon_bocs_wrapper.h> -#include <radeon_bo_int_drm.h> - -void radeon_bo_debug(struct radeon_bo *bo, - const char *op) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - - fprintf(stderr, "%s %p 0x%08X 0x%08X 0x%08X\n", - op, bo, bo->handle, boi->size, boi->cref); -} - -struct radeon_bo *radeon_bo_open(struct radeon_bo_manager *bom, - uint32_t handle, - uint32_t size, - uint32_t alignment, - uint32_t domains, - uint32_t flags) -{ - struct radeon_bo *bo; - bo = bom->funcs->bo_open(bom, handle, size, alignment, domains, flags); - return bo; -} - -void radeon_bo_ref(struct radeon_bo *bo) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - boi->cref++; - boi->bom->funcs->bo_ref(boi); -} - -struct radeon_bo *radeon_bo_unref(struct radeon_bo *bo) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - boi->cref--; - return boi->bom->funcs->bo_unref(boi); -} - -int radeon_bo_map(struct radeon_bo *bo, int write) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - return boi->bom->funcs->bo_map(boi, write); -} - -int radeon_bo_unmap(struct radeon_bo *bo) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - return boi->bom->funcs->bo_unmap(boi); -} - -int radeon_bo_wait(struct radeon_bo *bo) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - if (!boi->bom->funcs->bo_wait) - return 0; - return boi->bom->funcs->bo_wait(boi); -} - -int radeon_bo_is_busy(struct radeon_bo *bo, - uint32_t *domain) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - return boi->bom->funcs->bo_is_busy(boi, domain); -} - -int radeon_bo_set_tiling(struct radeon_bo *bo, - uint32_t tiling_flags, uint32_t pitch) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - return boi->bom->funcs->bo_set_tiling(boi, tiling_flags, pitch); -} - -int radeon_bo_get_tiling(struct radeon_bo *bo, - uint32_t *tiling_flags, uint32_t *pitch) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - return boi->bom->funcs->bo_get_tiling(boi, tiling_flags, pitch); -} - -int radeon_bo_is_static(struct radeon_bo *bo) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - if (boi->bom->funcs->bo_is_static) - return boi->bom->funcs->bo_is_static(boi); - return 0; -} - -int radeon_bo_is_referenced_by_cs(struct radeon_bo *bo, - struct radeon_cs *cs) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - return boi->cref > 1; -} - -uint32_t radeon_bo_get_handle(struct radeon_bo *bo) -{ - return bo->handle; -} - -uint32_t radeon_bo_get_src_domain(struct radeon_bo *bo) -{ - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - uint32_t src_domain; - - src_domain = boi->space_accounted & 0xffff; - if (!src_domain) - src_domain = boi->space_accounted >> 16; - - return src_domain; -} diff --git a/src/mesa/drivers/dri/radeon/radeon_cs.c b/src/mesa/drivers/dri/radeon/radeon_cs.c deleted file mode 100644 index 17e74333697..00000000000 --- a/src/mesa/drivers/dri/radeon/radeon_cs.c +++ /dev/null @@ -1,95 +0,0 @@ - -#include <stdio.h> -#include <stdint.h> -#include "drm.h" -#include "radeon_drm.h" -#include "radeon_bocs_wrapper.h" -#include "radeon_cs_int_drm.h" - -struct radeon_cs *radeon_cs_create(struct radeon_cs_manager *csm, - uint32_t ndw) -{ - struct radeon_cs_int *csi = csm->funcs->cs_create(csm, ndw); - return (struct radeon_cs *)csi; -} - -int radeon_cs_write_reloc(struct radeon_cs *cs, - struct radeon_bo *bo, - uint32_t read_domain, - uint32_t write_domain, - uint32_t flags) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - - return csi->csm->funcs->cs_write_reloc(csi, - bo, - read_domain, - write_domain, - flags); -} - -int radeon_cs_begin(struct radeon_cs *cs, - uint32_t ndw, - const char *file, - const char *func, - int line) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - return csi->csm->funcs->cs_begin(csi, ndw, file, func, line); -} - -int radeon_cs_end(struct radeon_cs *cs, - const char *file, - const char *func, - int line) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - return csi->csm->funcs->cs_end(csi, file, func, line); -} - -int radeon_cs_emit(struct radeon_cs *cs) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - return csi->csm->funcs->cs_emit(csi); -} - -int radeon_cs_destroy(struct radeon_cs *cs) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - return csi->csm->funcs->cs_destroy(csi); -} - -int radeon_cs_erase(struct radeon_cs *cs) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - return csi->csm->funcs->cs_erase(csi); -} - -int radeon_cs_need_flush(struct radeon_cs *cs) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - return csi->csm->funcs->cs_need_flush(csi); -} - -void radeon_cs_print(struct radeon_cs *cs, FILE *file) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - csi->csm->funcs->cs_print(csi, file); -} - -void radeon_cs_set_limit(struct radeon_cs *cs, uint32_t domain, uint32_t limit) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - if (domain == RADEON_GEM_DOMAIN_VRAM) - csi->csm->vram_limit = limit; - else - csi->csm->gart_limit = limit; -} - -void radeon_cs_space_set_flush(struct radeon_cs *cs, void (*fn)(void *), void *data) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - csi->space_flush_fn = fn; - csi->space_flush_data = data; -} - diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c b/src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c deleted file mode 100644 index e22b437d561..00000000000 --- a/src/mesa/drivers/dri/radeon/radeon_cs_space_drm.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright © 2009 Red Hat 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 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. - */ -/* - */ -#include <assert.h> -#include <errno.h> -#include <stdlib.h> -#include "radeon_bocs_wrapper.h" -#include "radeon_bo_int_drm.h" -#include "radeon_cs_int_drm.h" - -struct rad_sizes { - int32_t op_read; - int32_t op_gart_write; - int32_t op_vram_write; -}; - -static inline int radeon_cs_setup_bo(struct radeon_cs_space_check *sc, struct rad_sizes *sizes) -{ - uint32_t read_domains, write_domain; - struct radeon_bo_int *bo; - - bo = sc->bo; - sc->new_accounted = 0; - read_domains = sc->read_domains; - write_domain = sc->write_domain; - - /* legacy needs a static check */ - if (radeon_bo_is_static((struct radeon_bo *)sc->bo)) { - bo->space_accounted = sc->new_accounted = (read_domains << 16) | write_domain; - return 0; - } - - /* already accounted this bo */ - if (write_domain && (write_domain == bo->space_accounted)) { - sc->new_accounted = bo->space_accounted; - return 0; - } - if (read_domains && ((read_domains << 16) == bo->space_accounted)) { - sc->new_accounted = bo->space_accounted; - return 0; - } - - if (bo->space_accounted == 0) { - if (write_domain == RADEON_GEM_DOMAIN_VRAM) - sizes->op_vram_write += bo->size; - else if (write_domain == RADEON_GEM_DOMAIN_GTT) - sizes->op_gart_write += bo->size; - else - sizes->op_read += bo->size; - sc->new_accounted = (read_domains << 16) | write_domain; - } else { - uint16_t old_read, old_write; - - old_read = bo->space_accounted >> 16; - old_write = bo->space_accounted & 0xffff; - - if (write_domain && (old_read & write_domain)) { - sc->new_accounted = write_domain; - /* moving from read to a write domain */ - if (write_domain == RADEON_GEM_DOMAIN_VRAM) { - sizes->op_read -= bo->size; - sizes->op_vram_write += bo->size; - } else if (write_domain == RADEON_GEM_DOMAIN_GTT) { - sizes->op_read -= bo->size; - sizes->op_gart_write += bo->size; - } - } else if (read_domains & old_write) { - sc->new_accounted = bo->space_accounted & 0xffff; - } else { - /* rewrite the domains */ - if (write_domain != old_write) - fprintf(stderr,"WRITE DOMAIN RELOC FAILURE 0x%x %d %d\n", bo->handle, write_domain, old_write); - if (read_domains != old_read) - fprintf(stderr,"READ DOMAIN RELOC FAILURE 0x%x %d %d\n", bo->handle, read_domains, old_read); - return RADEON_CS_SPACE_FLUSH; - } - } - return 0; -} - -static int radeon_cs_do_space_check(struct radeon_cs_int *cs, struct radeon_cs_space_check *new_tmp) -{ - struct radeon_cs_manager *csm = cs->csm; - int i; - struct radeon_bo_int *bo; - struct rad_sizes sizes; - int ret; - - /* check the totals for this operation */ - - if (cs->bo_count == 0 && !new_tmp) - return 0; - - memset(&sizes, 0, sizeof(struct rad_sizes)); - - /* prepare */ - for (i = 0; i < cs->bo_count; i++) { - ret = radeon_cs_setup_bo(&cs->bos[i], &sizes); - if (ret) - return ret; - } - - if (new_tmp) { - ret = radeon_cs_setup_bo(new_tmp, &sizes); - if (ret) - return ret; - } - - if (sizes.op_read < 0) - sizes.op_read = 0; - - /* check sizes - operation first */ - if ((sizes.op_read + sizes.op_gart_write > csm->gart_limit) || - (sizes.op_vram_write > csm->vram_limit)) { - return RADEON_CS_SPACE_OP_TO_BIG; - } - - if (((csm->vram_write_used + sizes.op_vram_write) > csm->vram_limit) || - ((csm->read_used + csm->gart_write_used + sizes.op_gart_write + sizes.op_read) > csm->gart_limit)) { - return RADEON_CS_SPACE_FLUSH; - } - - csm->gart_write_used += sizes.op_gart_write; - csm->vram_write_used += sizes.op_vram_write; - csm->read_used += sizes.op_read; - /* commit */ - for (i = 0; i < cs->bo_count; i++) { - bo = cs->bos[i].bo; - bo->space_accounted = cs->bos[i].new_accounted; - } - if (new_tmp) - new_tmp->bo->space_accounted = new_tmp->new_accounted; - - return RADEON_CS_SPACE_OK; -} - -void radeon_cs_space_add_persistent_bo(struct radeon_cs *cs, struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - int i; - for (i = 0; i < csi->bo_count; i++) { - if (csi->bos[i].bo == boi && - csi->bos[i].read_domains == read_domains && - csi->bos[i].write_domain == write_domain) - return; - } - radeon_bo_ref(bo); - i = csi->bo_count; - csi->bos[i].bo = boi; - csi->bos[i].read_domains = read_domains; - csi->bos[i].write_domain = write_domain; - csi->bos[i].new_accounted = 0; - csi->bo_count++; - - assert(csi->bo_count < MAX_SPACE_BOS); -} - -static int radeon_cs_check_space_internal(struct radeon_cs_int *cs, - struct radeon_cs_space_check *tmp_bo) -{ - int ret; - int flushed = 0; - -again: - ret = radeon_cs_do_space_check(cs, tmp_bo); - if (ret == RADEON_CS_SPACE_OP_TO_BIG) - return -1; - if (ret == RADEON_CS_SPACE_FLUSH) { - (*cs->space_flush_fn)(cs->space_flush_data); - if (flushed) - return -1; - flushed = 1; - goto again; - } - return 0; -} - -int radeon_cs_space_check_with_bo(struct radeon_cs *cs, - struct radeon_bo *bo, - uint32_t read_domains, uint32_t write_domain) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - struct radeon_bo_int *boi = (struct radeon_bo_int *)bo; - struct radeon_cs_space_check temp_bo; - - int ret = 0; - - if (bo) { - temp_bo.bo = boi; - temp_bo.read_domains = read_domains; - temp_bo.write_domain = write_domain; - temp_bo.new_accounted = 0; - } - - ret = radeon_cs_check_space_internal(csi, bo ? &temp_bo : NULL); - return ret; -} - -int radeon_cs_space_check(struct radeon_cs *cs) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - return radeon_cs_check_space_internal(csi, NULL); -} - -void radeon_cs_space_reset_bos(struct radeon_cs *cs) -{ - struct radeon_cs_int *csi = (struct radeon_cs_int *)cs; - int i; - for (i = 0; i < csi->bo_count; i++) { - radeon_bo_unref((struct radeon_bo *)csi->bos[i].bo); - csi->bos[i].bo = NULL; - csi->bos[i].read_domains = 0; - csi->bos[i].write_domain = 0; - csi->bos[i].new_accounted = 0; - } - csi->bo_count = 0; -} - - |