drm/vmwgfx: Make the driver work without the dummy resources
In commit1802537820
("drm/ttm: stop allocating dummy resources during BO creation") ttm stopped allocating dummy resources but vmwgfx was never ported to handle it. Make the driver treat null resources as initial creation and port code to handle null resources in general. Fixes kernel oops'es on boot with vmwgfx. Signed-off-by: Zack Rusin <zackr@vmware.com> Fixes:1802537820
("drm/ttm: stop allocating dummy resources during BO creation") Cc: Christian König <christian.koenig@amd.com> Cc: Matthew Auld <matthew.auld@intel.com> Cc: Nirmoy Das <nirmoy.das@intel.com> Cc: Christian Koenig <christian.koenig@amd.com> Cc: Huang Rui <ray.huang@amd.com> Cc: dri-devel@lists.freedesktop.org Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230210023437.2214816-1-zack@kde.org
This commit is contained in:
parent
668b206601
commit
a44df74c72
|
@ -837,7 +837,8 @@ void vmw_query_move_notify(struct ttm_buffer_object *bo,
|
||||||
mutex_lock(&dev_priv->binding_mutex);
|
mutex_lock(&dev_priv->binding_mutex);
|
||||||
|
|
||||||
/* If BO is being moved from MOB to system memory */
|
/* If BO is being moved from MOB to system memory */
|
||||||
if (new_mem->mem_type == TTM_PL_SYSTEM &&
|
if (old_mem &&
|
||||||
|
new_mem->mem_type == TTM_PL_SYSTEM &&
|
||||||
old_mem->mem_type == VMW_PL_MOB) {
|
old_mem->mem_type == VMW_PL_MOB) {
|
||||||
struct vmw_fence_obj *fence;
|
struct vmw_fence_obj *fence;
|
||||||
|
|
||||||
|
|
|
@ -515,9 +515,13 @@ static int vmw_move(struct ttm_buffer_object *bo,
|
||||||
struct ttm_resource *new_mem,
|
struct ttm_resource *new_mem,
|
||||||
struct ttm_place *hop)
|
struct ttm_place *hop)
|
||||||
{
|
{
|
||||||
struct ttm_resource_manager *old_man = ttm_manager_type(bo->bdev, bo->resource->mem_type);
|
struct ttm_resource_manager *new_man;
|
||||||
struct ttm_resource_manager *new_man = ttm_manager_type(bo->bdev, new_mem->mem_type);
|
struct ttm_resource_manager *old_man = NULL;
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
|
new_man = ttm_manager_type(bo->bdev, new_mem->mem_type);
|
||||||
|
if (bo->resource)
|
||||||
|
old_man = ttm_manager_type(bo->bdev, bo->resource->mem_type);
|
||||||
|
|
||||||
if (new_man->use_tt && !vmw_memtype_is_system(new_mem->mem_type)) {
|
if (new_man->use_tt && !vmw_memtype_is_system(new_mem->mem_type)) {
|
||||||
ret = vmw_ttm_bind(bo->bdev, bo->ttm, new_mem);
|
ret = vmw_ttm_bind(bo->bdev, bo->ttm, new_mem);
|
||||||
|
@ -525,9 +529,15 @@ static int vmw_move(struct ttm_buffer_object *bo,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!bo->resource || (bo->resource->mem_type == TTM_PL_SYSTEM &&
|
||||||
|
bo->ttm == NULL)) {
|
||||||
|
ttm_bo_move_null(bo, new_mem);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
vmw_move_notify(bo, bo->resource, new_mem);
|
vmw_move_notify(bo, bo->resource, new_mem);
|
||||||
|
|
||||||
if (old_man->use_tt && new_man->use_tt) {
|
if (old_man && old_man->use_tt && new_man->use_tt) {
|
||||||
if (vmw_memtype_is_system(bo->resource->mem_type)) {
|
if (vmw_memtype_is_system(bo->resource->mem_type)) {
|
||||||
ttm_bo_move_null(bo, new_mem);
|
ttm_bo_move_null(bo, new_mem);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue