diff options
author | Jakob Bornecrantz <wallbraker@gmail.com> | 2009-09-09 00:38:04 +0100 |
---|---|---|
committer | Jakob Bornecrantz <jakob@vmware.com> | 2009-09-09 00:43:36 +0100 |
commit | e589a37f7b72da4f5eb8cbb46443d7baf710b37c (patch) | |
tree | 101fd89d276eb12d107fdfb910e92108a089074b /src/gallium | |
parent | d1121328402dc2e9480ca69bcfd9e3aac5f024a4 (diff) |
i915g: Add buffer write callback
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/i915simple/intel_winsys.h | 11 | ||||
-rw-r--r-- | src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c | 13 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/i915simple/intel_winsys.h b/src/gallium/drivers/i915simple/intel_winsys.h index f949f52a9c..42c5e7470e 100644 --- a/src/gallium/drivers/i915simple/intel_winsys.h +++ b/src/gallium/drivers/i915simple/intel_winsys.h @@ -150,6 +150,17 @@ struct intel_winsys { void (*buffer_unmap)(struct intel_winsys *iws, struct intel_buffer *buffer); + /** + * Write to a buffer. + * + * Arguments follows pwrite(2) + */ + int (*buffer_write)(struct intel_winsys *iws, + struct intel_buffer *dst, + const void *src, + size_t size, + size_t offset); + void (*buffer_destroy)(struct intel_winsys *iws, struct intel_buffer *buffer); /*@}*/ diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c b/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c index e932f71e42..0030f915a3 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c @@ -110,6 +110,18 @@ intel_drm_buffer_unmap(struct intel_winsys *iws, drm_intel_bo_unmap(intel_bo(buffer)); } +static int +intel_drm_buffer_write(struct intel_winsys *iws, + struct intel_buffer *buffer, + const void *data, + size_t size, + size_t offset) +{ + struct intel_drm_buffer *buf = intel_drm_buffer(buffer); + + return drm_intel_bo_subdata(buf->bo, offset, size, (void*)data); +} + static void intel_drm_buffer_destroy(struct intel_winsys *iws, struct intel_buffer *buffer) @@ -131,5 +143,6 @@ intel_drm_winsys_init_buffer_functions(struct intel_drm_winsys *idws) idws->base.buffer_set_fence_reg = intel_drm_buffer_set_fence_reg; idws->base.buffer_map = intel_drm_buffer_map; idws->base.buffer_unmap = intel_drm_buffer_unmap; + idws->base.buffer_write = intel_drm_buffer_write; idws->base.buffer_destroy = intel_drm_buffer_destroy; } |