diff options
author | Keith Packard <keithp@keithp.com> | 2008-05-11 00:16:25 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2008-05-11 00:16:25 -0700 |
commit | 145523ba3acb95a9ff390430a9e0a3fa958cae1b (patch) | |
tree | b783bdcfe39964f41f0fb85e05ec6a666937ab35 /src/mesa/drivers/dri/common/dri_bufmgr.c | |
parent | 0cb006c1fdb75e1fe282120cc5455a4e8c59b1a7 (diff) |
[intel] update GEM api. Add bo_subdata and bo_get_subdata driver hooks.
Track DRM GEM name changes.
Add driver hooks for bo_subdata and bo_get_subdata so that GEM can use pread
and pwrite.
Diffstat (limited to 'src/mesa/drivers/dri/common/dri_bufmgr.c')
-rw-r--r-- | src/mesa/drivers/dri/common/dri_bufmgr.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 5967d7dafb..19ea2a8f86 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -90,28 +90,41 @@ dri_bo_unmap(dri_bo *buf) return buf->bufmgr->bo_unmap(buf); } -void +int dri_bo_subdata(dri_bo *bo, unsigned long offset, unsigned long size, const void *data) { + int ret; + if (bo->bufmgr->bo_subdata) + return bo->bufmgr->bo_subdata(bo, offset, size, data); if (size == 0 || data == NULL) - return; + return 0; - dri_bo_map(bo, GL_TRUE); + ret = dri_bo_map(bo, GL_TRUE); + if (ret) + return ret; memcpy((unsigned char *)bo->virtual + offset, data, size); dri_bo_unmap(bo); + return 0; } -void +int dri_bo_get_subdata(dri_bo *bo, unsigned long offset, unsigned long size, void *data) { + int ret; + if (bo->bufmgr->bo_subdata) + return bo->bufmgr->bo_get_subdata(bo, offset, size, data); + if (size == 0 || data == NULL) - return; + return 0; - dri_bo_map(bo, GL_FALSE); + ret = dri_bo_map(bo, GL_FALSE); + if (ret) + return ret; memcpy(data, (unsigned char *)bo->virtual + offset, size); dri_bo_unmap(bo); + return 0; } void |