]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/vmwgfx: don't use ttm bo->offset
authorNirmoy Das <nirmoy.aiemd@gmail.com>
Wed, 24 Jun 2020 18:26:43 +0000 (20:26 +0200)
committerChristian König <christian.koenig@amd.com>
Fri, 26 Jun 2020 12:00:41 +0000 (14:00 +0200)
Calculate GPU offset within vmwgfx driver itself without depending on
bo->offset.

Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/372933/
Signed-off-by: Christian König <christian.koenig@amd.com>
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c

index 8b71bf6b58ef64e2ce59b571025b39d6e392175f..1e59c019affab2964397a95a7c6d075bece4dd74 100644 (file)
@@ -258,7 +258,7 @@ int vmw_bo_pin_in_start_of_vram(struct vmw_private *dev_priv,
                ret = ttm_bo_validate(bo, &placement, &ctx);
 
        /* For some reason we didn't end up at the start of vram */
-       WARN_ON(ret == 0 && bo->offset != 0);
+       WARN_ON(ret == 0 && bo->mem.start != 0);
        if (!ret)
                vmw_bo_pin_reserved(buf, true);
 
@@ -317,7 +317,7 @@ void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *bo,
 {
        if (bo->mem.mem_type == TTM_PL_VRAM) {
                ptr->gmrId = SVGA_GMR_FRAMEBUFFER;
-               ptr->offset = bo->offset;
+               ptr->offset = bo->mem.start << PAGE_SHIFT;
        } else {
                ptr->gmrId = bo->mem.start;
                ptr->offset = 0;
index 367d5b87ee6a42a4d9245d8007c33db906ee785c..4284c4bd444d6a96b27b598c82154b34a31c1da8 100644 (file)
@@ -3696,7 +3696,7 @@ static void vmw_apply_relocations(struct vmw_sw_context *sw_context)
                bo = &reloc->vbo->base;
                switch (bo->mem.mem_type) {
                case TTM_PL_VRAM:
-                       reloc->location->offset += bo->offset;
+                       reloc->location->offset += bo->mem.start << PAGE_SHIFT;
                        reloc->location->gmrId = SVGA_GMR_FRAMEBUFFER;
                        break;
                case VMW_PL_GMR:
index 6941689085ed355fd7f72333e82b7c4d0a6f70d8..a95156fc5db73ebfaceda3f3cd1111bf836cd73d 100644 (file)
@@ -610,7 +610,7 @@ static int vmw_fifo_emit_dummy_legacy_query(struct vmw_private *dev_priv,
 
        if (bo->mem.mem_type == TTM_PL_VRAM) {
                cmd->body.guestResult.gmrId = SVGA_GMR_FRAMEBUFFER;
-               cmd->body.guestResult.offset = bo->offset;
+               cmd->body.guestResult.offset = bo->mem.start << PAGE_SHIFT;
        } else {
                cmd->body.guestResult.gmrId = bo->mem.start;
                cmd->body.guestResult.offset = 0;
index bf0bc4697959e75255e46f2931a69be780a3f85a..fbcd11a7b215658c18a9f228f49669eb4c4c6c79 100644 (file)
@@ -750,7 +750,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
        case TTM_PL_VRAM:
                /* "On-card" video ram */
                man->func = &vmw_thp_func;
-               man->gpu_offset = 0;
                man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE;
                man->available_caching = TTM_PL_FLAG_CACHED;
                man->default_caching = TTM_PL_FLAG_CACHED;
@@ -763,7 +762,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
                 *  slots as well as the bo size.
                 */
                man->func = &vmw_gmrid_manager_func;
-               man->gpu_offset = 0;
                man->flags = TTM_MEMTYPE_FLAG_CMA | TTM_MEMTYPE_FLAG_MAPPABLE;
                man->available_caching = TTM_PL_FLAG_CACHED;
                man->default_caching = TTM_PL_FLAG_CACHED;