From: Thomas Zimmermann <tzimmermann@suse.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: airlied@linux.ie, jiayang5@huawei.com,
dri-devel@lists.freedesktop.org, butterflyhuangxx@gmail.com
Subject: Re: [PATCH 3/3] drm/vram-helper: Set object function iff they are not provided by driver
Date: Fri, 17 Jul 2020 08:26:00 +0200 [thread overview]
Message-ID: <3033edf9-9be5-2c00-4f45-014dba53b17f@suse.de> (raw)
In-Reply-To: <20200716201137.GB2254583@ravnborg.org>
[-- Attachment #1.1.1: Type: text/plain, Size: 3031 bytes --]
Hi Sam
Am 16.07.20 um 22:11 schrieb Sam Ravnborg:
> On Tue, Jul 14, 2020 at 10:32:38AM +0200, Thomas Zimmermann wrote:
>> Don't override the GEM object functions unconditionally. If the driver
>> sets the GEM functions, VRAM helpers will now them. The idea has been
> s/now/own
Ooops, I forgot a word. This should have been 'will now use them'.
>> taken from SHMEM helpers. If drivers need special versions of some of
>> the GEM functions, they can now override them.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>> drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
>> index af767d3da5da..7194144610cb 100644
>> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
>> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
>> @@ -190,6 +190,7 @@ struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev,
>> unsigned long pg_align)
>
> The documentation of drm_gem_vram_create() could really use some love
> here. It should document the behavior around gem_create_object(), and
> the default allocation of drm_gem_vram_object with no drm_gem_object
> assigned etc.
Sure
Best regards
Thomas
>
> Sam
>
>
>> {
>> struct drm_gem_vram_object *gbo;
>> + struct drm_gem_object *gem;
>> struct drm_vram_mm *vmm = dev->vram_mm;
>> struct ttm_bo_device *bdev;
>> int ret;
>> @@ -199,8 +200,7 @@ struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev,
>> return ERR_PTR(-EINVAL);
>>
>> if (dev->driver->gem_create_object) {
>> - struct drm_gem_object *gem =
>> - dev->driver->gem_create_object(dev, size);
>> + gem = dev->driver->gem_create_object(dev, size);
>> if (!gem)
>> return ERR_PTR(-ENOMEM);
>> gbo = drm_gem_vram_of_gem(gem);
>> @@ -208,11 +208,13 @@ struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev,
>> gbo = kzalloc(sizeof(*gbo), GFP_KERNEL);
>> if (!gbo)
>> return ERR_PTR(-ENOMEM);
>> + gem = &gbo->bo.base;
>> }
>>
>> - gbo->bo.base.funcs = &drm_gem_vram_object_funcs;
>> + if (!gem->funcs)
>> + gem->funcs = &drm_gem_vram_object_funcs;
>>
>> - ret = drm_gem_object_init(dev, &gbo->bo.base, size);
>> + ret = drm_gem_object_init(dev, gem, size);
>> if (ret) {
>> kfree(gbo);
>> return ERR_PTR(ret);
>> --
>> 2.27.0
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> 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 #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 516 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2020-07-17 6:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-14 8:32 [PATCH 0/3] drm/vram-helper: Update GEM VRAM object creation Thomas Zimmermann
2020-07-14 8:32 ` [PATCH 1/3] drm: fix double free for gbo in drm_gem_vram_init and drm_gem_vram_create Thomas Zimmermann
2020-07-14 8:32 ` [PATCH 2/3] drm/vram-helper: Integrate drm_gem_vram_init() into drm_gem_vram_create() Thomas Zimmermann
2020-07-16 20:04 ` Sam Ravnborg
2020-07-14 8:32 ` [PATCH 3/3] drm/vram-helper: Set object function iff they are not provided by driver Thomas Zimmermann
2020-07-16 20:11 ` Sam Ravnborg
2020-07-17 6:26 ` Thomas Zimmermann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3033edf9-9be5-2c00-4f45-014dba53b17f@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@linux.ie \
--cc=butterflyhuangxx@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jiayang5@huawei.com \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.