diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_bufmgr.c | 24 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_bufmgr.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_buffer_objects.c | 11 |
3 files changed, 10 insertions, 28 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c index 11251f15edc..30e4b28b9e0 100644 --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c @@ -820,30 +820,6 @@ brw_bo_subdata(struct brw_bo *bo, uint64_t offset, return ret; } -int -brw_bo_get_subdata(struct brw_bo *bo, uint64_t offset, - uint64_t size, void *data) -{ - struct brw_bufmgr *bufmgr = bo->bufmgr; - struct drm_i915_gem_pread pread; - int ret; - - memclear(pread); - pread.handle = bo->gem_handle; - pread.offset = offset; - pread.size = size; - pread.data_ptr = (uint64_t) (uintptr_t) data; - ret = drmIoctl(bufmgr->fd, DRM_IOCTL_I915_GEM_PREAD, &pread); - if (ret != 0) { - ret = -errno; - DBG("%s:%d: Error reading data from buffer %d: " - "(%"PRIu64" %"PRIu64") %s .\n", - __FILE__, __LINE__, bo->gem_handle, offset, size, strerror(errno)); - } - - return ret; -} - /** Waits for all GPU rendering with the object to have completed. */ void brw_bo_wait_rendering(struct brw_bo *bo) diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.h b/src/mesa/drivers/dri/i965/brw_bufmgr.h index d388e5ad150..01a540f5315 100644 --- a/src/mesa/drivers/dri/i965/brw_bufmgr.h +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.h @@ -222,9 +222,6 @@ static inline int brw_bo_unmap(struct brw_bo *bo) { return 0; } /** Write data into an object. */ int brw_bo_subdata(struct brw_bo *bo, uint64_t offset, uint64_t size, const void *data); -/** Read data from an object. */ -int brw_bo_get_subdata(struct brw_bo *bo, uint64_t offset, - uint64_t size, void *data); /** * Waits for rendering to an object by the GPU to have completed. * diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c index a9ac29a6a81..85cc1a694bf 100644 --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c @@ -289,7 +289,16 @@ brw_get_buffer_subdata(struct gl_context *ctx, if (brw_batch_references(&brw->batch, intel_obj->buffer)) { intel_batchbuffer_flush(brw); } - brw_bo_get_subdata(intel_obj->buffer, offset, size, data); + + void *map = brw_bo_map(brw, intel_obj->buffer, MAP_READ); + + if (unlikely(!map)) { + _mesa_error_no_memory(__func__); + return; + } + + memcpy(data, map + offset, size); + brw_bo_unmap(intel_obj->buffer); mark_buffer_inactive(intel_obj); } |