diff options
author | Jesse Barnes <jbarnes@jbarnes-t61.(none)> | 2008-06-18 15:25:54 -0700 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-06-18 15:25:54 -0700 |
commit | 86accbcb344ff25fbb47a788bb0f7464b5cd797f (patch) | |
tree | d023b852e7dab469bcc1d2b7f37493709e657fe5 /libdrm/intel | |
parent | c843d47b906e57fb3002af4a609d3cb95c5e195d (diff) | |
parent | e7424e4580159b0ac3e232674dff5c862e851dff (diff) |
Merge commit 'origin/drm-gem' into modesetting-gem
Lots of conflicts, seems to load ok, but I'm sure some bugs snuck in.
Conflicts:
linux-core/drmP.h
linux-core/drm_lock.c
linux-core/i915_gem.c
shared-core/drm.h
shared-core/i915_dma.c
shared-core/i915_drv.h
shared-core/i915_irq.c
Diffstat (limited to 'libdrm/intel')
-rw-r--r-- | libdrm/intel/intel_bufmgr_fake.c | 14 | ||||
-rw-r--r-- | libdrm/intel/intel_bufmgr_gem.c | 37 | ||||
-rw-r--r-- | libdrm/intel/mm.c | 12 | ||||
-rw-r--r-- | libdrm/intel/mm.h | 22 |
4 files changed, 50 insertions, 35 deletions
diff --git a/libdrm/intel/intel_bufmgr_fake.c b/libdrm/intel/intel_bufmgr_fake.c index 3f5a22d3..e988eb58 100644 --- a/libdrm/intel/intel_bufmgr_fake.c +++ b/libdrm/intel/intel_bufmgr_fake.c @@ -252,7 +252,7 @@ alloc_block(dri_bo *bo) sz = (bo->size + bo_fake->alignment - 1) & ~(bo_fake->alignment - 1); - block->mem = drmmmAllocMem(bufmgr_fake->heap, sz, align_log2, 0); + block->mem = mmAllocMem(bufmgr_fake->heap, sz, align_log2, 0); if (!block->mem) { free(block); return 0; @@ -300,7 +300,7 @@ static void free_block(dri_bufmgr_fake *bufmgr_fake, struct block *block) DBG(" - free immediately\n"); DRMLISTDEL(block); - drmmmFreeMem(block->mem); + mmFreeMem(block->mem); free(block); } } @@ -415,7 +415,7 @@ static int clear_fenced(dri_bufmgr_fake *bufmgr_fake, DBG("delayed free: offset %x sz %x\n", block->mem->ofs, block->mem->size); DRMLISTDEL(block); - drmmmFreeMem(block->mem); + mmFreeMem(block->mem); free(block); } else { @@ -923,7 +923,7 @@ dri_fake_destroy(dri_bufmgr *bufmgr) { dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bufmgr; - drmmmDestroy(bufmgr_fake->heap); + mmDestroy(bufmgr_fake->heap); free(bufmgr); } @@ -1062,7 +1062,7 @@ dri_fake_process_relocs(dri_bo *batch_buf) dri_fake_calculate_domains(batch_buf); - batch_fake->read_domains = DRM_GEM_DOMAIN_I915_COMMAND; + batch_fake->read_domains = I915_GEM_DOMAIN_COMMAND; /* we've ran out of RAM so blow the whole lot away and retry */ restart: @@ -1074,7 +1074,7 @@ dri_fake_process_relocs(dri_bo *batch_buf) bufmgr_fake->fail = 0; goto restart; } else /* dump out the memory here */ - drmmmDumpMemInfo(bufmgr_fake->heap); + mmDumpMemInfo(bufmgr_fake->heap); } assert(ret == 0); @@ -1193,7 +1193,7 @@ intel_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, bufmgr_fake->low_offset = low_offset; bufmgr_fake->virtual = low_virtual; bufmgr_fake->size = size; - bufmgr_fake->heap = drmmmInit(low_offset, size); + bufmgr_fake->heap = mmInit(low_offset, size); /* Hook in methods */ bufmgr_fake->bufmgr.bo_alloc = dri_fake_bo_alloc; diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c index a65ae982..5a28bd14 100644 --- a/libdrm/intel/intel_bufmgr_gem.c +++ b/libdrm/intel/intel_bufmgr_gem.c @@ -299,7 +299,7 @@ dri_gem_bo_alloc(dri_bufmgr *bufmgr, const char *name, } if (!alloc_from_cache) { - struct drm_gem_create create; + struct drm_i915_gem_create create; bo_gem = calloc(1, sizeof(*bo_gem)); if (!bo_gem) @@ -309,7 +309,7 @@ dri_gem_bo_alloc(dri_bufmgr *bufmgr, const char *name, memset(&create, 0, sizeof(create)); create.size = bo_size; - ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_GEM_CREATE, &create); + ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_CREATE, &create); bo_gem->gem_handle = create.handle; if (ret != 0) { free(bo_gem); @@ -455,7 +455,7 @@ dri_gem_bo_map(dri_bo *bo, int write_enable) { dri_bufmgr_gem *bufmgr_gem; dri_bo_gem *bo_gem = (dri_bo_gem *)bo; - struct drm_gem_set_domain set_domain; + struct drm_i915_gem_set_domain set_domain; int ret; bufmgr_gem = (dri_bufmgr_gem *)bo->bufmgr; @@ -470,13 +470,13 @@ dri_gem_bo_map(dri_bo *bo, int write_enable) DBG("bo_map: %d (%s)\n", bo_gem->gem_handle, bo_gem->name); if (bo_gem->virtual == NULL) { - struct drm_gem_mmap mmap_arg; + struct drm_i915_gem_mmap mmap_arg; memset(&mmap_arg, 0, sizeof(mmap_arg)); mmap_arg.handle = bo_gem->gem_handle; mmap_arg.offset = 0; mmap_arg.size = bo->size; - ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_GEM_MMAP, &mmap_arg); + ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg); if (ret != 0) { fprintf(stderr, "%s:%d: Error mapping buffer %d (%s): %s .\n", __FILE__, __LINE__, @@ -491,9 +491,12 @@ dri_gem_bo_map(dri_bo *bo, int write_enable) if (!bo_gem->cpu_domain_set) { set_domain.handle = bo_gem->gem_handle; - set_domain.read_domains = DRM_GEM_DOMAIN_CPU; - set_domain.write_domain = write_enable ? DRM_GEM_DOMAIN_CPU : 0; - ret = ioctl (bufmgr_gem->fd, DRM_IOCTL_GEM_SET_DOMAIN, &set_domain); + set_domain.read_domains = I915_GEM_DOMAIN_CPU; + set_domain.write_domain = write_enable ? I915_GEM_DOMAIN_CPU : 0; + do { + ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, + &set_domain); + } while (ret == -1 && errno == EINTR); if (ret != 0) { fprintf (stderr, "%s:%d: Error setting memory domains %d (%08x %08x): %s .\n", __FILE__, __LINE__, @@ -525,7 +528,7 @@ dri_gem_bo_subdata (dri_bo *bo, unsigned long offset, { dri_bufmgr_gem *bufmgr_gem = (dri_bufmgr_gem *)bo->bufmgr; dri_bo_gem *bo_gem = (dri_bo_gem *)bo; - struct drm_gem_pwrite pwrite; + struct drm_i915_gem_pwrite pwrite; int ret; memset (&pwrite, 0, sizeof (pwrite)); @@ -533,7 +536,9 @@ dri_gem_bo_subdata (dri_bo *bo, unsigned long offset, pwrite.offset = offset; pwrite.size = size; pwrite.data_ptr = (uint64_t) (uintptr_t) data; - ret = ioctl (bufmgr_gem->fd, DRM_IOCTL_GEM_PWRITE, &pwrite); + do { + ret = ioctl (bufmgr_gem->fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite); + } while (ret == -1 && errno == EINTR); if (ret != 0) { fprintf (stderr, "%s:%d: Error writing data to buffer %d: (%d %d) %s .\n", __FILE__, __LINE__, @@ -549,7 +554,7 @@ dri_gem_bo_get_subdata (dri_bo *bo, unsigned long offset, { dri_bufmgr_gem *bufmgr_gem = (dri_bufmgr_gem *)bo->bufmgr; dri_bo_gem *bo_gem = (dri_bo_gem *)bo; - struct drm_gem_pread pread; + struct drm_i915_gem_pread pread; int ret; memset (&pread, 0, sizeof (pread)); @@ -557,7 +562,9 @@ dri_gem_bo_get_subdata (dri_bo *bo, unsigned long offset, pread.offset = offset; pread.size = size; pread.data_ptr = (uint64_t) (uintptr_t) data; - ret = ioctl (bufmgr_gem->fd, DRM_IOCTL_GEM_PREAD, &pread); + do { + ret = ioctl (bufmgr_gem->fd, DRM_IOCTL_I915_GEM_PREAD, &pread); + } while (ret == -1 && errno == EINTR); if (ret != 0) { fprintf (stderr, "%s:%d: Error reading data from buffer %d: (%d %d) %s .\n", __FILE__, __LINE__, @@ -572,13 +579,13 @@ dri_gem_bo_wait_rendering(dri_bo *bo) { dri_bufmgr_gem *bufmgr_gem = (dri_bufmgr_gem *)bo->bufmgr; dri_bo_gem *bo_gem = (dri_bo_gem *)bo; - struct drm_gem_set_domain set_domain; + struct drm_i915_gem_set_domain set_domain; int ret; set_domain.handle = bo_gem->gem_handle; - set_domain.read_domains = DRM_GEM_DOMAIN_CPU; + set_domain.read_domains = I915_GEM_DOMAIN_CPU; set_domain.write_domain = 0; - ret = ioctl (bufmgr_gem->fd, DRM_IOCTL_GEM_SET_DOMAIN, &set_domain); + ret = ioctl (bufmgr_gem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain); if (ret != 0) { fprintf (stderr, "%s:%d: Error setting memory domains %d (%08x %08x): %s .\n", __FILE__, __LINE__, diff --git a/libdrm/intel/mm.c b/libdrm/intel/mm.c index 2605d8ec..98146405 100644 --- a/libdrm/intel/mm.c +++ b/libdrm/intel/mm.c @@ -29,7 +29,7 @@ #include "mm.h" void -drmmmDumpMemInfo(const struct mem_block *heap) +mmDumpMemInfo(const struct mem_block *heap) { drmMsg("Memory heap %p:\n", (void *)heap); if (heap == 0) { @@ -56,7 +56,7 @@ drmmmDumpMemInfo(const struct mem_block *heap) } struct mem_block * -drmmmInit(int ofs, int size) +mmInit(int ofs, int size) { struct mem_block *heap, *block; @@ -163,7 +163,7 @@ SliceBlock(struct mem_block *p, struct mem_block * -drmmmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) +mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) { struct mem_block *p; const int mask = (1 << align2)-1; @@ -196,7 +196,7 @@ drmmmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) struct mem_block * -drmmmFindBlock(struct mem_block *heap, int start) +mmFindBlock(struct mem_block *heap, int start) { struct mem_block *p; @@ -235,7 +235,7 @@ Join2Blocks(struct mem_block *p) } int -drmmmFreeMem(struct mem_block *b) +mmFreeMem(struct mem_block *b) { if (!b) return 0; @@ -264,7 +264,7 @@ drmmmFreeMem(struct mem_block *b) void -drmmmDestroy(struct mem_block *heap) +mmDestroy(struct mem_block *heap) { struct mem_block *p; diff --git a/libdrm/intel/mm.h b/libdrm/intel/mm.h index 965bb0cd..49e3eecc 100644 --- a/libdrm/intel/mm.h +++ b/libdrm/intel/mm.h @@ -40,13 +40,21 @@ struct mem_block { unsigned int reserved:1; }; - +/* Rename the variables in the drm copy of this code so that it doesn't + * conflict with mesa or whoever else has copied it around. + */ +#define mmInit drm_mmInit +#define mmAllocMem drm_mmAllocMem +#define mmFreeMem drm_mmFreeMem +#define mmFindBlock drm_mmFindBlock +#define mmDestroy drm_mmDestroy +#define mmDumpMemInfo drm_mmDumpMemInfo /** * input: total size in bytes * return: a heap pointer if OK, NULL if error */ -extern struct mem_block *drmmmInit(int ofs, int size); +extern struct mem_block *mmInit(int ofs, int size); /** * Allocate 'size' bytes with 2^align2 bytes alignment, @@ -58,7 +66,7 @@ extern struct mem_block *drmmmInit(int ofs, int size); * startSearch = linear offset from start of heap to begin search * return: pointer to the allocated block, 0 if error */ -extern struct mem_block *drmmmAllocMem(struct mem_block *heap, int size, +extern struct mem_block *mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch); /** @@ -66,23 +74,23 @@ extern struct mem_block *drmmmAllocMem(struct mem_block *heap, int size, * input: pointer to a block * return: 0 if OK, -1 if error */ -extern int drmmmFreeMem(struct mem_block *b); +extern int mmFreeMem(struct mem_block *b); /** * Free block starts at offset * input: pointer to a heap, start offset * return: pointer to a block */ -extern struct mem_block *drmmmFindBlock(struct mem_block *heap, int start); +extern struct mem_block *mmFindBlock(struct mem_block *heap, int start); /** * destroy MM */ -extern void drmmmDestroy(struct mem_block *mmInit); +extern void mmDestroy(struct mem_block *mmInit); /** * For debuging purpose. */ -extern void drmmmDumpMemInfo(const struct mem_block *mmInit); +extern void mmDumpMemInfo(const struct mem_block *mmInit); #endif |