From: Sam Ravnborg <sam@ravnborg.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: puck.chen@hisilicon.com, dri-devel@lists.freedesktop.org,
z.liuxinliang@hisilicon.com, kong.kongxinwei@hisilicon.com,
kraxel@redhat.com, zourongrong@gmail.com, airlied@redhat.com
Subject: Re: [PATCH 3/3] drm/vram-helper: Support struct drm_driver.gem_create_object
Date: Wed, 11 Dec 2019 20:11:28 +0100 [thread overview]
Message-ID: <20191211191128.GA8889@ravnborg.org> (raw)
In-Reply-To: <20191211180832.7159-4-tzimmermann@suse.de>
Hi Thomas,
On Wed, Dec 11, 2019 at 07:08:32PM +0100, Thomas Zimmermann wrote:
> Drivers that what to allocate VRAM GEM objects with additional fields
> can now do this by implementing struct drm_driver.gem_create_object.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/drm_gem_vram_helper.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> index b760fd27f3c0..d475d94e2e3e 100644
> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> @@ -2,6 +2,7 @@
>
> #include <drm/drm_debugfs.h>
> #include <drm/drm_device.h>
> +#include <drm/drm_drv.h>
> #include <drm/drm_file.h>
> #include <drm/drm_framebuffer.h>
> #include <drm/drm_gem_ttm_helper.h>
> @@ -142,13 +143,19 @@ struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev,
> size_t size,
> unsigned long pg_align)
> {
> + struct drm_gem_object *gem;
> struct drm_gem_vram_object *gbo;
> int ret;
>
> - gbo = kzalloc(sizeof(*gbo), GFP_KERNEL);
> - if (!gbo)
> + if (dev->driver->gem_create_object)
> + gem = dev->driver->gem_create_object(dev, size);
> + else
> + gem = kzalloc(sizeof(*gbo), GFP_KERNEL);
The size is (*gbo) but you assume it is a gem.
Looks wrong at first glance???
Sam
> + if (!gem)
> return ERR_PTR(-ENOMEM);
>
> + gbo = drm_gem_vram_of_gem(gem);
> +
> ret = drm_gem_vram_init(dev, gbo, size, pg_align);
> if (ret < 0)
> goto err_kfree;
> --
> 2.24.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-12-11 19:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 18:08 [PATCH 0/3] drm/vram-helper: Various cleanups Thomas Zimmermann
2019-12-11 18:08 ` [PATCH 1/3] drm/vram-helper: Remove interruptible flag from public interface Thomas Zimmermann
2019-12-13 10:05 ` Daniel Vetter
2019-12-11 18:08 ` [PATCH 2/3] drm/vram-helper: Remove BO device " Thomas Zimmermann
2019-12-13 10:08 ` Daniel Vetter
2019-12-11 18:08 ` [PATCH 3/3] drm/vram-helper: Support struct drm_driver.gem_create_object Thomas Zimmermann
2019-12-11 19:11 ` Sam Ravnborg [this message]
2019-12-12 5:39 ` Thomas Zimmermann
2019-12-13 10:23 ` Daniel Vetter
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=20191211191128.GA8889@ravnborg.org \
--to=sam@ravnborg.org \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kong.kongxinwei@hisilicon.com \
--cc=kraxel@redhat.com \
--cc=puck.chen@hisilicon.com \
--cc=tzimmermann@suse.de \
--cc=z.liuxinliang@hisilicon.com \
--cc=zourongrong@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox