mirror of
https://github.com/torvalds/linux.git
synced 2026-04-27 02:52:27 -04:00
drm/ttm: cleanup BO size handling v3
Based on an idea from Dave, but cleaned up a bit. We had multiple fields for essentially the same thing. Now bo->base.size is the original size of the BO in arbitrary units, usually bytes. bo->mem.num_pages is the size in number of pages in the resource domain of bo->mem.mem_type. v2: use the GEM object size instead of the BO size v3: fix printks in some places Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> (v1) Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/406831/
This commit is contained in:
@@ -1042,7 +1042,7 @@ static int vmw_query_bo_switch_prepare(struct vmw_private *dev_priv,
|
||||
|
||||
if (unlikely(new_query_bo != sw_context->cur_query_bo)) {
|
||||
|
||||
if (unlikely(new_query_bo->base.num_pages > 4)) {
|
||||
if (unlikely(new_query_bo->base.mem.num_pages > 4)) {
|
||||
VMW_DEBUG_USER("Query buffer too large.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1541,7 +1541,7 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv,
|
||||
return ret;
|
||||
|
||||
/* Make sure DMA doesn't cross BO boundaries. */
|
||||
bo_size = vmw_bo->base.num_pages * PAGE_SIZE;
|
||||
bo_size = vmw_bo->base.base.size;
|
||||
if (unlikely(cmd->body.guest.ptr.offset > bo_size)) {
|
||||
VMW_DEBUG_USER("Invalid DMA offset.\n");
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user