diff options
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 5 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_bo.h | 1 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_winsys.h | 4 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index 2605ca6238f..8f4b13576b9 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -345,6 +345,10 @@ void *radeon_bo_do_map(struct radeon_bo *bo) struct drm_radeon_gem_mmap args = {0}; void *ptr; + /* If the buffer is created from user memory, return the user pointer. */ + if (bo->user_ptr) + return bo->user_ptr; + /* Return the pointer if it's already mapped. */ if (bo->ptr) return bo->ptr; @@ -900,6 +904,7 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws, bo->base.vtbl = &radeon_bo_vtbl; bo->mgr = mgr; bo->rws = mgr->rws; + bo->user_ptr = pointer; bo->va = 0; bo->initial_domain = RADEON_DOMAIN_GTT; pipe_mutex_init(bo->map_mutex); diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.h b/src/gallium/winsys/radeon/drm/radeon_drm_bo.h index 1c00a13c1e0..b83ce168b4e 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.h +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.h @@ -50,6 +50,7 @@ struct radeon_bo { struct radeon_bomgr *mgr; struct radeon_drm_winsys *rws; + void *user_ptr; /* from buffer_from_ptr */ void *ptr; pipe_mutex map_mutex; diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h index d9fa1ab7878..3a6037c0542 100644 --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h @@ -394,8 +394,8 @@ struct radeon_winsys { unsigned *stride); /** - * Get a winsys buffer from a user pointer. The resulting buffer can't be - * mapped or exported. Both pointer and size must be page aligned. + * Get a winsys buffer from a user pointer. The resulting buffer can't + * be exported. Both pointer and size must be page aligned. * * \param ws The winsys this function is called from. * \param pointer User pointer to turn into a buffer object. |