From ddd92ee9a173bbb087ef67b4a36ac231e30c941f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Nov 2007 14:15:36 -0800 Subject: [PATCH] [intel] Fix the type and naming of the flags/mask args to TTM functions. The uint64_t flags (as defined by drm.h) were being used as unsigned ints in many places. --- src/mesa/drivers/dri/common/dri_bufmgr.c | 9 ++--- src/mesa/drivers/dri/common/dri_bufmgr.h | 13 +++---- src/mesa/drivers/dri/common/dri_bufmgr_fake.c | 12 +++---- src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c | 36 +++++++++---------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 72a4a171500..757a2374948 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -35,7 +35,7 @@ dri_bo * dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size, - unsigned int alignment, unsigned int location_mask) + unsigned int alignment, uint64_t location_mask) { assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 | @@ -48,7 +48,7 @@ dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size, dri_bo * dri_bo_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset, unsigned long size, void *virtual, - unsigned int location_mask) + uint64_t location_mask) { assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 | @@ -139,9 +139,10 @@ dri_bufmgr_destroy(dri_bufmgr *bufmgr) } -void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee) +void dri_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, + GLuint offset, dri_bo *target_buf) { - batch_buf->bufmgr->emit_reloc(batch_buf, flags, delta, offset, relocatee); + reloc_buf->bufmgr->emit_reloc(reloc_buf, flags, delta, offset, target_buf); } void *dri_process_relocs(dri_bo *batch_buf, GLuint *count) diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h index 5c519cb38f4..b3a170496e9 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.h +++ b/src/mesa/drivers/dri/common/dri_bufmgr.h @@ -84,7 +84,7 @@ struct _dri_bufmgr { */ dri_bo *(*bo_alloc)(dri_bufmgr *bufmgr_ctx, const char *name, unsigned long size, unsigned int alignment, - unsigned int location_mask); + uint64_t location_mask); /** * Allocates a buffer object for a static allocation. @@ -94,7 +94,7 @@ struct _dri_bufmgr { */ dri_bo *(*bo_alloc_static)(dri_bufmgr *bufmgr_ctx, const char *name, unsigned long offset, unsigned long size, - void *virtual, unsigned int location_mask); + void *virtual, uint64_t location_mask); /** Takes a reference on a buffer object */ void (*bo_reference)(dri_bo *bo); @@ -153,7 +153,7 @@ struct _dri_bufmgr { * \param target Buffer whose offset should be written into the relocation * entry. */ - void (*emit_reloc)(dri_bo *reloc_buf, GLuint flags, GLuint delta, + void (*emit_reloc)(dri_bo *reloc_buf, uint64_t flags, GLuint delta, GLuint offset, dri_bo *target); /** @@ -175,10 +175,10 @@ struct _dri_bufmgr { }; dri_bo *dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size, - unsigned int alignment, unsigned int location_mask); + unsigned int alignment, uint64_t location_mask); dri_bo *dri_bo_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset, unsigned long size, - void *virtual, unsigned int location_mask); + void *virtual, uint64_t location_mask); void dri_bo_reference(dri_bo *bo); void dri_bo_unreference(dri_bo *bo); int dri_bo_map(dri_bo *buf, GLboolean write_enable); @@ -207,7 +207,8 @@ void dri_bufmgr_destroy(dri_bufmgr *bufmgr); dri_bo *dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, unsigned int handle); -void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); +void dri_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, + GLuint offset, dri_bo *target_buf); void *dri_process_relocs(dri_bo *batch_buf, uint32_t *count); void dri_post_process_relocs(dri_bo *batch_buf); void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence); diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c index fa82599094b..029f29ad693 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c @@ -66,7 +66,7 @@ struct fake_buffer_reloc dri_bo *target_buf; GLuint offset; GLuint delta; - GLuint validate_flags; + uint64_t validate_flags; GLboolean relocated; }; @@ -161,7 +161,7 @@ typedef struct _dri_bo_fake { * DRM_BO_NO_BACKING_STORE and BM_NO_FENCE_SUBDATA, which are the first two * driver private flags. */ - unsigned int flags; + uint64_t flags; unsigned int alignment; GLboolean is_static, validated; unsigned int map_count; @@ -576,7 +576,7 @@ dri_bufmgr_fake_contended_lock_take(dri_bufmgr *bufmgr) static dri_bo * dri_fake_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size, unsigned int alignment, - unsigned int location_mask) + uint64_t location_mask) { dri_bufmgr_fake *bufmgr_fake; dri_bo_fake *bo_fake; @@ -614,7 +614,7 @@ dri_fake_bo_alloc(dri_bufmgr *bufmgr, const char *name, static dri_bo * dri_fake_bo_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset, unsigned long size, - void *virtual, unsigned int location_mask) + void *virtual, uint64_t location_mask) { dri_bufmgr_fake *bufmgr_fake; dri_bo_fake *bo_fake; @@ -770,7 +770,7 @@ dri_fake_bo_unmap(dri_bo *bo) } static int -dri_fake_bo_validate(dri_bo *bo, unsigned int flags) +dri_fake_bo_validate(dri_bo *bo, uint64_t flags) { dri_bufmgr_fake *bufmgr_fake; dri_bo_fake *bo_fake = (dri_bo_fake *)bo; @@ -914,7 +914,7 @@ dri_fake_destroy(dri_bufmgr *bufmgr) } static void -dri_fake_emit_reloc(dri_bo *reloc_buf, GLuint flags, GLuint delta, +dri_fake_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, GLuint offset, dri_bo *target_buf) { dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)reloc_buf->bufmgr; diff --git a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c index 8cd3374c5de..301b142cdce 100644 --- a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c @@ -54,7 +54,7 @@ struct intel_reloc_info { GLuint type; GLuint reloc; - GLuint delta; /* not needed? */ + GLuint delta; GLuint index; drm_handle_t handle; }; @@ -64,8 +64,8 @@ struct intel_bo_node drmMMListHead head; drmBO *buf; struct drm_i915_op_arg bo_arg; - unsigned long arg0; - unsigned long arg1; + uint64_t flags; + uint64_t mask; void (*destroy)(void *); void *priv; }; @@ -190,9 +190,9 @@ intel_setup_validate_list(int fd, struct intel_bo_list *list, prevNext = &arg->next; req->bo_req.handle = node->buf->handle; req->op = drm_bo_validate; - req->bo_req.flags = node->arg0; + req->bo_req.flags = node->flags; req->bo_req.hint = 0; - req->bo_req.mask = node->arg1; + req->bo_req.mask = node->mask; req->bo_req.fence_class = 0; /* Backwards compat. */ arg->reloc_handle = 0; @@ -255,7 +255,7 @@ intel_free_reloc_list(int fd, struct intel_bo_list *reloc_list) static int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, - unsigned flags, unsigned mask, + uint64_t flags, uint64_t mask, int *itemLoc, void (*destroy_cb)(void *)) { struct intel_bo_node *node, *cur; @@ -281,25 +281,25 @@ intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, } cur->buf = buf_bo; cur->priv = buf; - cur->arg0 = flags; - cur->arg1 = mask; + cur->flags = flags; + cur->mask = mask; cur->destroy = destroy_cb; ret = 1; DRMLISTADDTAIL(&cur->head, &list->list); } else { - unsigned memMask = (cur->arg1 | mask) & DRM_BO_MASK_MEM; - unsigned memFlags = cur->arg0 & flags & memMask; + uint64_t memMask = (cur->mask | mask) & DRM_BO_MASK_MEM; + uint64_t memFlags = cur->flags & flags & memMask; if (!memFlags) { return -EINVAL; } - if (mask & cur->arg1 & ~DRM_BO_MASK_MEM & (cur->arg0 ^ flags)) { + if (mask & cur->mask & ~DRM_BO_MASK_MEM & (cur->flags ^ flags)) { return -EINVAL; } - cur->arg1 |= mask; - cur->arg0 = memFlags | ((cur->arg0 | flags) & - cur->arg1 & ~DRM_BO_MASK_MEM); + cur->mask |= mask; + cur->flags = memFlags | ((cur->flags | flags) & + cur->mask & ~DRM_BO_MASK_MEM); } *itemLoc = count; return ret; @@ -335,7 +335,6 @@ intel_create_new_reloc_type_list(int fd, struct intel_bo_reloc_list *cur_type, return 0; } - static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, struct intel_reloc_info *reloc_info, @@ -450,7 +449,7 @@ driFenceSignaled(DriFenceObject * fence, unsigned type) static dri_bo * dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size, unsigned int alignment, - unsigned int location_mask) + uint64_t location_mask) { dri_bufmgr_ttm *ttm_bufmgr; dri_bo_ttm *ttm_buf; @@ -500,7 +499,7 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name, static dri_bo * dri_ttm_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset, unsigned long size, void *virtual, - unsigned int location_mask) + uint64_t location_mask) { return NULL; } @@ -758,7 +757,7 @@ intel_dribo_destroy_callback(void *priv) } static void -dri_ttm_emit_reloc(dri_bo *reloc_buf, GLuint flags, GLuint delta, +dri_ttm_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta, GLuint offset, dri_bo *target_buf) { dri_bo_ttm *ttm_buf = (dri_bo_ttm *)reloc_buf; @@ -787,7 +786,6 @@ dri_ttm_emit_reloc(dri_bo *reloc_buf, GLuint flags, GLuint delta, intel_add_validate_reloc(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list, &reloc, bufmgr_ttm->max_relocs); - return; } -- 2.30.2