From: Jakob Bornecrantz Date: Tue, 8 Sep 2009 23:38:04 +0000 (+0100) Subject: i915g: Add buffer write callback X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e589a37f7b72da4f5eb8cbb46443d7baf710b37c;p=mesa.git i915g: Add buffer write callback --- diff --git a/src/gallium/drivers/i915simple/intel_winsys.h b/src/gallium/drivers/i915simple/intel_winsys.h index f949f52a9ce..42c5e7470ec 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 e932f71e42c..0030f915a36 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; }