diff options
author | Marek Olšák <[email protected]> | 2011-08-02 20:25:13 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-08-16 09:15:10 +0200 |
commit | 2ce783d8ddec1b1fcadc0798af0ebb045bba1cc4 (patch) | |
tree | 155806fae29db972c4aafcc98c922cf946c401fa /src/gallium/winsys/r600 | |
parent | 354f76f386afd980e8c1564c0b0502f9768007b5 (diff) |
r600g: put radeon_winsys in screen::winsys, don't include drm_driver in the pipe
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/winsys/r600')
-rw-r--r-- | src/gallium/winsys/r600/drm/evergreen_hw_context.c | 1 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_bo.c | 11 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_drm.c | 18 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_drm_public.h | 2 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_hw_context.c | 1 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_priv.h | 1 |
6 files changed, 20 insertions, 14 deletions
diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 412533e44bc..94206d5568b 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -902,6 +902,7 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) memset(ctx, 0, sizeof(struct r600_context)); ctx->radeon = radeon; + LIST_INITHEAD(&ctx->query_list); /* init dirty list */ diff --git a/src/gallium/winsys/r600/drm/r600_bo.c b/src/gallium/winsys/r600/drm/r600_bo.c index f6e15630d71..bbd52a1fdde 100644 --- a/src/gallium/winsys/r600/drm/r600_bo.c +++ b/src/gallium/winsys/r600/drm/r600_bo.c @@ -86,23 +86,26 @@ struct r600_bo *r600_bo(struct radeon *radeon, return bo; } -struct r600_bo *r600_bo_handle(struct radeon *radeon, - unsigned handle, unsigned *array_mode) +struct r600_bo *r600_bo_handle(struct radeon *radeon, struct winsys_handle *whandle, + unsigned *stride, unsigned *array_mode) { struct r600_bo *bo = calloc(1, sizeof(struct r600_bo)); struct radeon_bo *rbo; - rbo = bo->bo = radeon_bo(radeon, handle, 0, 0, 0); + rbo = bo->bo = radeon_bo(radeon, whandle->handle, 0, 0, 0); if (rbo == NULL) { free(bo); return NULL; } + + pipe_reference_init(&bo->reference, 1); bo->size = rbo->size; bo->domains = (RADEON_GEM_DOMAIN_CPU | RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM); - pipe_reference_init(&bo->reference, 1); + if (stride) + *stride = whandle->stride; radeon_bo_get_tiling_flags(radeon, rbo, &bo->tiling_flags, &bo->kernel_pitch); if (array_mode) { diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index 3a2186c6f4a..1cf905f2575 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -28,6 +28,7 @@ #include "r600_priv.h" #include "r600_drm_public.h" +#include "util/u_memory.h" #include <radeon_drm.h> #include <xf86drm.h> #include <errno.h> @@ -244,22 +245,21 @@ static int handle_compare(void *key1, void *key2) return PTR_TO_UINT(key1) != PTR_TO_UINT(key2); } -struct radeon *r600_drm_winsys_create(struct radeon_winsys *rw) +struct radeon *radeon_create(struct radeon_winsys *ws) { - struct radeon *radeon; int r; - - radeon = calloc(1, sizeof(*radeon)); + struct radeon *radeon = CALLOC_STRUCT(radeon); if (radeon == NULL) { return NULL; } - rw->query_info(rw, &radeon->info); + radeon->ws = ws; + ws->query_info(ws, &radeon->info); radeon->family = radeon_family_from_device(radeon->info.pci_id); if (radeon->family == CHIP_UNKNOWN) { fprintf(stderr, "Unknown chipset 0x%04X\n", radeon->info.pci_id); - return radeon_decref(radeon); + return radeon_destroy(radeon); } /* setup class */ switch (radeon->family) { @@ -323,7 +323,7 @@ struct radeon *r600_drm_winsys_create(struct radeon_winsys *rw) } r = radeon_init_fence(radeon); if (r) { - radeon_decref(radeon); + radeon_destroy(radeon); return NULL; } @@ -332,7 +332,7 @@ struct radeon *r600_drm_winsys_create(struct radeon_winsys *rw) return radeon; } -struct radeon *radeon_decref(struct radeon *radeon) +struct radeon *radeon_destroy(struct radeon *radeon) { if (radeon == NULL) return NULL; @@ -346,6 +346,6 @@ struct radeon *radeon_decref(struct radeon *radeon) if (radeon->bomgr) r600_bomgr_destroy(radeon->bomgr); - free(radeon); + FREE(radeon); return NULL; } diff --git a/src/gallium/winsys/r600/drm/r600_drm_public.h b/src/gallium/winsys/r600/drm/r600_drm_public.h index 1d990f91013..b8a37c7574f 100644 --- a/src/gallium/winsys/r600/drm/r600_drm_public.h +++ b/src/gallium/winsys/r600/drm/r600_drm_public.h @@ -28,6 +28,6 @@ struct radeon_winsys; -struct radeon *r600_drm_winsys_create(struct radeon_winsys *rw); +struct radeon *radeon_create(struct radeon_winsys *ws); #endif diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 60de24fa67f..8ab4d94a6ee 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -874,6 +874,7 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) memset(ctx, 0, sizeof(struct r600_context)); ctx->radeon = radeon; + LIST_INITHEAD(&ctx->query_list); /* init dirty list */ diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 08a3552803c..8296aa1bdd1 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -38,6 +38,7 @@ struct r600_bomgr; struct r600_bo; struct radeon { + struct radeon_winsys *ws; struct radeon_info info; unsigned family; enum chip_class chip_class; |