[RFC PATCH 5/6] drm/qxl: don't use ttm bo->offset

Nirmoy nirmodas at amd.com
Thu Feb 13 14:52:59 UTC 2020


On 2/13/20 3:30 PM, Gerd Hoffmann wrote:
>> @@ -311,10 +311,8 @@ qxl_bo_physical_address(struct qxl_device *qdev, struct qxl_bo *bo,
>>   		(bo->tbo.mem.mem_type == TTM_PL_VRAM)
>>   		? &qdev->main_slot : &qdev->surfaces_slot;
>>   
>> -	WARN_ON_ONCE((bo->tbo.offset & slot->gpu_offset) != slot->gpu_offset);
>> -
>> -	/* TODO - need to hold one of the locks to read tbo.offset */
>> -	return slot->high_bits | (bo->tbo.offset - slot->gpu_offset + offset);
>> +	return slot->high_bits | ((bo->tbo.mem.start << PAGE_SHIFT) +
>> +				  slot->gpu_offset + offset);
>>   }
> --verbose please.
>
> I don't get the logic behind this change.

Hi Gerd,

I borrowed the logic for removed ttm part

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 229205e499db..2ccfebc3c9a2 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -382,12 +381,6 @@ static int ttm_bo_handle_move_mem(struct 
ttm_buffer_object *bo,
                 bo->evicted = false;
         }

-       if (bo->mem.mm_node)
-               bo->offset = (bo->mem.start << PAGE_SHIFT) +
-                   bdev->man[bo->mem.mem_type].gpu_offset;
-       else
-               bo->offset = 0;
-


My assumption is

  (bo->tbo.offset - slot->gpu_offset + offset) == (bo->tbo.mem.start << PAGE_SHIFT) + bdev->man[bo->mem.mem_type].gpu_offset - slot->gpu_offset + offset)

-> == (bo->tbo.mem.start << PAGE_SHIFT) + offset

and we loose  slot->gpu_offset so I thought it should be

((bo->tbo.mem.start << PAGE_SHIFT) + slot->gpu_offset + offset);

Can you please suggest me how to calculate the offset  correctly here.


Regards,

Nirmo

>
> The other chunks look sane, calculating slot->gpu_offset
> in setup_slot() certainly makes sense.
>
> cheers,
>    Gerd
>


More information about the dri-devel mailing list