[PATCH 1/4] drm/vram: Set GEM object functions for PRIME

Thomas Zimmermann tzimmermann at suse.de
Mon Jul 1 14:45:56 UTC 2019


Hi

Am 01.07.19 um 10:48 schrieb Gerd Hoffmann:
> On Mon, Jul 01, 2019 at 09:28:59AM +0200, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 01.07.19 um 08:32 schrieb Gerd Hoffmann:
>>> On Fri, Jun 28, 2019 at 02:26:56PM +0200, Thomas Zimmermann wrote:
>>>> PRIME functionality is now provided via the callback functions in
>>>> struct drm_gem_object_funcs. The driver-structure functions are obsolete.
>>>> As a side effect of this patch, VRAM-based drivers get basic PRIME
>>>> support automatically without having to set any flags or additional
>>>> fields.
>>>
>>>> +static void drm_gem_vram_object_free(struct drm_gem_object *gem)
>>>> +static int drm_gem_vram_object_funcs_pin(struct drm_gem_object *gem)
>>>> +static void drm_gem_vram_object_funcs_unpin(struct drm_gem_object *gem)
>>>> +static void *drm_gem_vram_object_funcs_vmap(struct drm_gem_object *gem)
>>>> +static void drm_gem_vram_object_funcs_vunmap(struct drm_gem_object *gem,
>>>> +					     void *vaddr)
>>>
>>>> +static const struct drm_gem_object_funcs drm_gem_vram_object_funcs = {
>>>> +	.free	= drm_gem_vram_object_free,
>>>> +	.pin	= drm_gem_vram_object_funcs_pin,
>>>> +	.unpin	= drm_gem_vram_object_funcs_unpin,
>>>> +	.vmap	= drm_gem_vram_object_funcs_vmap,
>>>> +	.vunmap	= drm_gem_vram_object_funcs_vunmap
>>>> +};
>>>
>>> Why new functions?  Can't you just hook up the existing prime functions?
>>
>> The final patch will remove the existing functions, so drivers won't use
>> them accidentally.
> 
> But the new and the old ones are identical, right?  So why add/remove?
> Why not just rename them?

Hmm, OK. Does that somehow make a difference (e.g., easier backporting
or maintenance)?

> I'd also suggest to name them consistently (free has no _funcs, all
> others have).  I'd drop _funcs from all function names.

This inconsistency is actually an error in the patch. Thanks

Best regards
Thomas

> cheers,
>   Gerd
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190701/5cb5a3de/attachment.sig>


More information about the dri-devel mailing list