diff options
Diffstat (limited to 'intel')
-rw-r--r-- | intel/intel_bufmgr.c | 14 | ||||
-rw-r--r-- | intel/intel_bufmgr_fake.c | 18 |
2 files changed, 19 insertions, 13 deletions
diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c index 2b4e8883..f93a8707 100644 --- a/intel/intel_bufmgr.c +++ b/intel/intel_bufmgr.c @@ -94,19 +94,7 @@ int drm_intel_bo_subdata(drm_intel_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 0; - - ret = drm_intel_bo_map(bo, 1); - if (ret) - return ret; - memcpy((unsigned char *)bo->virtual + offset, data, size); - drm_intel_bo_unmap(bo); - return 0; + return bo->bufmgr->bo_subdata(bo, offset, size, data); } int diff --git a/intel/intel_bufmgr_fake.c b/intel/intel_bufmgr_fake.c index bc4a2ff9..d9b5cfdc 100644 --- a/intel/intel_bufmgr_fake.c +++ b/intel/intel_bufmgr_fake.c @@ -1121,6 +1121,23 @@ static int drm_intel_fake_bo_unmap(drm_intel_bo *bo) return ret; } +static int +drm_intel_fake_bo_subdata(drm_intel_bo *bo, unsigned long offset, + unsigned long size, const void *data) +{ + int ret; + + if (size == 0 || data == NULL) + return 0; + + ret = drm_intel_bo_map(bo, 1); + if (ret) + return ret; + memcpy((unsigned char *)bo->virtual + offset, data, size); + drm_intel_bo_unmap(bo); + return 0; +} + static void drm_intel_fake_kick_all_locked(drm_intel_bufmgr_fake *bufmgr_fake) { @@ -1599,6 +1616,7 @@ drm_intel_bufmgr *drm_intel_bufmgr_fake_init(int fd, bufmgr_fake->bufmgr.bo_unreference = drm_intel_fake_bo_unreference; bufmgr_fake->bufmgr.bo_map = drm_intel_fake_bo_map; bufmgr_fake->bufmgr.bo_unmap = drm_intel_fake_bo_unmap; + bufmgr_fake->bufmgr.bo_subdata = drm_intel_fake_bo_subdata; bufmgr_fake->bufmgr.bo_wait_rendering = drm_intel_fake_bo_wait_rendering; bufmgr_fake->bufmgr.bo_emit_reloc = drm_intel_fake_emit_reloc; |