[PATCH v2 04/21] drm/exynos: Introduce GEM object functions
Thomas Zimmermann
tzimmermann at suse.de
Wed Sep 16 06:36:28 EDT 2020
Hi
Am 16.09.20 um 12:03 schrieb Daniel Vetter:
> On Tue, Sep 15, 2020 at 04:59:41PM +0200, Thomas Zimmermann wrote:
>> GEM object functions deprecate several similar callback interfaces in
>> struct drm_driver. This patch replaces the per-driver callbacks with
>> per-instance callbacks in exynos. The only exception is gem_prime_mmap,
>> which is non-trivial to convert.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
>> ---
>> drivers/gpu/drm/exynos/exynos_drm_drv.c | 10 ----------
>> drivers/gpu/drm/exynos/exynos_drm_gem.c | 15 +++++++++++++++
>> 2 files changed, 15 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> index dbd80f1e4c78..fe46680ca208 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> @@ -75,11 +75,6 @@ static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
>> file->driver_priv = NULL;
>> }
>>
>> -static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
>> - .open = drm_gem_vm_open,
>> - .close = drm_gem_vm_close,
>> -};
>> -
>> static const struct drm_ioctl_desc exynos_ioctls[] = {
>> DRM_IOCTL_DEF_DRV(EXYNOS_GEM_CREATE, exynos_drm_gem_create_ioctl,
>> DRM_RENDER_ALLOW),
>> @@ -124,16 +119,11 @@ static struct drm_driver exynos_drm_driver = {
>> .open = exynos_drm_open,
>> .lastclose = drm_fb_helper_lastclose,
>> .postclose = exynos_drm_postclose,
>> - .gem_free_object_unlocked = exynos_drm_gem_free_object,
>> - .gem_vm_ops = &exynos_drm_gem_vm_ops,
>> .dumb_create = exynos_drm_gem_dumb_create,
>> .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>> .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>> .gem_prime_import = exynos_drm_gem_prime_import,
>> - .gem_prime_get_sg_table = exynos_drm_gem_prime_get_sg_table,
>> .gem_prime_import_sg_table = exynos_drm_gem_prime_import_sg_table,
>> - .gem_prime_vmap = exynos_drm_gem_prime_vmap,
>> - .gem_prime_vunmap = exynos_drm_gem_prime_vunmap,
>> .gem_prime_mmap = exynos_drm_gem_prime_mmap,
>> .ioctls = exynos_ioctls,
>> .num_ioctls = ARRAY_SIZE(exynos_ioctls),
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
>> index efa476858db5..69a5cf28b4ae 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
>> @@ -129,6 +129,19 @@ void exynos_drm_gem_destroy(struct exynos_drm_gem *exynos_gem)
>> kfree(exynos_gem);
>> }
>>
>> +static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
>> + .open = drm_gem_vm_open,
>> + .close = drm_gem_vm_close,
>> +};
>
> Hm moving the drm_gem_cma_vm_ops into drm_gem.h or so and maybe calling
> them drm_gem_simple_ops or so would remove a pile of these. But perhaps a
> quick follow up series.
Good idea. Several interfaces use the term 'default' in their name, so
something like drm_gem_default_vm_ops seems appropriate.
BTW is there a reason why we have file operations like
DEFINE_DRM_GEM_CMA_FOPS() in each module? It seems like this could also
be provided by the rsp memory-manager library.
Best regards
Thomas
>
> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
>
>> +
>> +static const struct drm_gem_object_funcs exynos_drm_gem_object_funcs = {
>> + .free = exynos_drm_gem_free_object,
>> + .get_sg_table = exynos_drm_gem_prime_get_sg_table,
>> + .vmap = exynos_drm_gem_prime_vmap,
>> + .vunmap = exynos_drm_gem_prime_vunmap,
>> + .vm_ops = &exynos_drm_gem_vm_ops,
>> +};
>> +
>> static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev,
>> unsigned long size)
>> {
>> @@ -143,6 +156,8 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev,
>> exynos_gem->size = size;
>> obj = &exynos_gem->base;
>>
>> + obj->funcs = &exynos_drm_gem_object_funcs;
>> +
>> ret = drm_gem_object_init(dev, obj, size);
>> if (ret < 0) {
>> DRM_DEV_ERROR(dev->dev, "failed to initialize gem object\n");
>> --
>> 2.28.0
>>
>
--
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 516 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20200916/29142c2b/attachment.sig>
More information about the Linux-mediatek
mailing list