Re: [PATCH 3/7] drm/udl: Vmap framebuffer after all tests succeeded in damage handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sam

Am 04.12.19 um 15:25 schrieb Sam Ravnborg:
> Hi Thomas.
> 
> I did a casual browse of the patches.
> Looks like some nice cleanup.
> 
> On Wed, Dec 04, 2019 at 02:24:26PM +0100, Thomas Zimmermann wrote:
>> We now do the fast tests before the potentially expensive vmap operation.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
>> ---
>>  drivers/gpu/drm/udl/udl_fb.c       | 19 +++++++------------
>>  drivers/gpu/drm/udl/udl_transfer.c |  1 -
>>  2 files changed, 7 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
>> index ed6d9476b25b..dd7ba7f63214 100644
>> --- a/drivers/gpu/drm/udl/udl_fb.c
>> +++ b/drivers/gpu/drm/udl/udl_fb.c
>> @@ -85,12 +85,6 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
>>  	}
>>  	spin_unlock(&udl->active_fb_16_lock);
>>  
>> -	vaddr = drm_gem_shmem_vmap(fb->obj[0]);
>> -	if (IS_ERR(vaddr)) {
>> -		DRM_ERROR("failed to vmap fb\n");
>> -		return 0;
>> -	}
>> -
>>  	aligned_x = DL_ALIGN_DOWN(x, sizeof(unsigned long));
>>  	width = DL_ALIGN_UP(width + (x-aligned_x), sizeof(unsigned long));
>>  	x = aligned_x;
>> @@ -98,8 +92,13 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
>>  	if ((width <= 0) ||
>>  	    (x + width > fb->width) ||
>>  	    (y + height > fb->height)) {
>> -		ret = -EINVAL;
>> -		goto err_drm_gem_shmem_vunmap;
>> +		return -EINVAL;
>> +	}
>> +
>> +	vaddr = drm_gem_shmem_vmap(fb->obj[0]);
>> +	if (IS_ERR(vaddr)) {
>> +		DRM_ERROR("failed to vmap fb\n");
>> +		return 0;
>>  	}
>>  
>>  	urb = udl_get_urb(dev);
>> @@ -131,10 +130,6 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
>>  	drm_gem_shmem_vunmap(fb->obj[0], vaddr);
>>  
>>  	return 0;
>> -
>> -err_drm_gem_shmem_vunmap:
>> -	drm_gem_shmem_vunmap(fb->obj[0], vaddr);
>> -	return ret;
> This label is reintroduced two patches later.
> Is this on purpose it is gone and reintroduced?

This label is for rollback during error handling. The label in [6/7] is
called out_drm_gem_shmem_vunmap and it's part of the regular flow.

Admittedly, it's a bit unfortunate. OTOH the alternative is to add
dma-buf calls before moving around the vmap call. That seems like the
worse option.

Best regards
Thomas

> 
> 	Sam
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux