[PATCH 1/2] drm/etnaviv: use new iterator in etnaviv_gem_describe

Christian König ckoenig.leichtzumerken at gmail.com
Thu Oct 28 11:01:02 UTC 2021



Am 28.10.21 um 12:02 schrieb Lucas Stach:
> Am Montag, dem 25.10.2021 um 10:05 +0200 schrieb Christian König:
>> Instead of hand rolling the logic.
>>
>> Signed-off-by: Christian König <christian.koenig at amd.com>
>> ---
>>   drivers/gpu/drm/etnaviv/etnaviv_gem.c | 31 ++++++++++-----------------
>>   1 file changed, 11 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
>> index 8f1b5af47dd6..0eeb33de2ff4 100644
>> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
>> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
>> @@ -428,19 +428,17 @@ int etnaviv_gem_wait_bo(struct etnaviv_gpu *gpu, struct drm_gem_object *obj,
>>   static void etnaviv_gem_describe_fence(struct dma_fence *fence,
>>   	const char *type, struct seq_file *m)
>>   {
>> -	if (!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
>> -		seq_printf(m, "\t%9s: %s %s seq %llu\n",
>> -			   type,
>> -			   fence->ops->get_driver_name(fence),
>> -			   fence->ops->get_timeline_name(fence),
>> -			   fence->seqno);
>> +	seq_printf(m, "\t%9s: %s %s seq %llu\n", type,
>> +		   fence->ops->get_driver_name(fence),
>> +		   fence->ops->get_timeline_name(fence),
>> +		   fence->seqno);
> Please just move this in the function below, it seems pretty pointless
> now to have a separate function just to wrap the printf.

Good point, but I've already gone ahead and pushed this to drm-misc-next 
because I wanted to get the follow up stuff out of the door.

See the mailing lists for the next set of patches which also contains 
"[PATCH 3/4] drm/etnaviv: use dma_resv_describe".

That one provides an unified function in the dma_resv and dma_fence code 
for debugfs dumps of fences.

Can we get that one reviewed and upstream? I think it would be even 
cleaner :)

Thank a lot in advantage,
Christian.

>
> Other than this nit, both patches are:
> Reviewed-by: Lucas Stach <l.stach at pengutronix.de>
>
>>   }
>>   
>>   static void etnaviv_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
>>   {
>>   	struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
>>   	struct dma_resv *robj = obj->resv;
>> -	struct dma_resv_list *fobj;
>> +	struct dma_resv_iter cursor;
>>   	struct dma_fence *fence;
>>   	unsigned long off = drm_vma_node_start(&obj->vma_node);
>>   
>> @@ -449,21 +447,14 @@ static void etnaviv_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
>>   			obj->name, kref_read(&obj->refcount),
>>   			off, etnaviv_obj->vaddr, obj->size);
>>   
>> -	rcu_read_lock();
>> -	fobj = dma_resv_shared_list(robj);
>> -	if (fobj) {
>> -		unsigned int i, shared_count = fobj->shared_count;
>> -
>> -		for (i = 0; i < shared_count; i++) {
>> -			fence = rcu_dereference(fobj->shared[i]);
>> +	dma_resv_iter_begin(&cursor, robj, true);
>> +	dma_resv_for_each_fence_unlocked(&cursor, fence) {
>> +		if (dma_resv_iter_is_exclusive(&cursor))
>> +			etnaviv_gem_describe_fence(fence, "Exclusive", m);
>> +		else
>>   			etnaviv_gem_describe_fence(fence, "Shared", m);
>> -		}
>>   	}
>> -
>> -	fence = dma_resv_excl_fence(robj);
>> -	if (fence)
>> -		etnaviv_gem_describe_fence(fence, "Exclusive", m);
>> -	rcu_read_unlock();
>> +	dma_resv_iter_end(&cursor);
>>   }
>>   
>>   void etnaviv_gem_describe_objects(struct etnaviv_drm_private *priv,
>



More information about the dri-devel mailing list