From: Thomas Zimmermann <tzimmermann@suse.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: airlied@linux.ie, puck.chen@hisilicon.com,
dri-devel@lists.freedesktop.org,
virtualization@lists.linux-foundation.org,
z.liuxinliang@hisilicon.com, hdegoede@redhat.com,
kong.kongxinwei@hisilicon.com, ray.huang@amd.com,
kraxel@redhat.com, zourongrong@gmail.com, Jerry.Zhang@amd.com,
christian.koenig@amd.com
Subject: Re: [PATCH v3 01/19] drm: Add |struct drm_gem_vram_object| and helpers
Date: Tue, 30 Apr 2019 09:18:42 +0200 [thread overview]
Message-ID: <1d14ef87-e1cd-4f4a-3632-bc045a1981c6@suse.de> (raw)
In-Reply-To: <20190429195855.GA6610@ravnborg.org>
[-- Attachment #1.1.1: Type: text/plain, Size: 5106 bytes --]
Hi,
thanks for the feedback.
Am 29.04.19 um 21:58 schrieb Sam Ravnborg:
> Hi Thomas.
>
> Some minor things and some bikeshedding too.
>
> One general^Wbikeshedding thing - unint32_t is used in many places.
> And then s64 in one place.
> Seems like two concepts are mixed.
> Maybe be consistent and use u32, s32 everywhere?
The DRM API already has a mixture of such types and I tried to use the
type that best fits the current context. But yeah, I don't mind some
consistency. I'll see if I can replace some of these instances.
>> +config DRM_GEM_VRAM_HELPER
>> + bool
>> + depends on DRM
>> + select DRM_VRAM_HELPER
>> + help
>> + Choose this if you need the GEM VRAM helper functions
>> +
> I cannot remember how select will deal with symbols whos has
> a "depends on".
> But if I recall correct then the "depends on" will be ignored
> or in best case trigger a warning.
> In other words - when we have symbols we select they should not
> have a depends on.
>
> What can be done is something like:
>
> symbol foo
> bool
>
> symbol bar
> depends on foo
>
>
> symbol foobar
> bool "This is what you need - select me"
> select foo
>
> So when one chooses "foobar" then we will select "foo" and this will
> satisfy bar.
>
> But maybe this rambling is irrelevant - maybe check what we do with
> other selectable symbols in DRM.
It may not strictly be necessary here, but the other helpers' symbols
depend on DRM. I'd like to keep it consistent unless there's a strong
reason not to.
>
>
>> +/**
>> + * DOC: overview
>> + *
>> + * This library provides a GEM object that is backed by VRAM. It
>> + * can be used for simple framebuffer devices with dedicated memory.
>> + */
> It is likely only me, but...
> I could use a short explanation what is GEM and maybe also VRAM.
>
> VRAM as video RAM, but maybe there is more constraints?
> (When I first looked at DRM I wondered what you used Virtual RAM for.
> But thats a long time ago so it counts only as a funny story.
OK :)
>> +/*
>> + * Buffer-object helpers
>> + */
>> +
>> +/**
>> + * struct drm_gem_vram_object - GEM object backed by VRAM
>> + * @gem: GEM object
>> + * @bo: TTM buffer object
>> + * @kmap: Mapping information for @bo
>> + * @placement: TTM placement information. Supported placements are \
>> + %TTM_PL_VRAM and %TTM_PL_SYSTEM
>> + * @placements: TTM placement information.
>> + * @pin_count: Pin counter
>> + *
>> + * The type struct drm_gem_vram_object represents a GEM object that is
>> + * backed by VRAM. It can be used for simple frambuffer devices with
>> + * dedicated memory. The buffer object can be evicted to system memory if
>> + * video memory becomes scarce.
>> + */
>> +struct drm_gem_vram_object {
>> + struct drm_gem_object gem;
>> + struct ttm_buffer_object bo;
>> + struct ttm_bo_kmap_obj kmap;
>> +
>> + /* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */
>> + struct ttm_placement placement;
>> + struct ttm_place placements[3];
>> +
>> + int pin_count;
>> +};
> Use tabs for indent - not spaces.
> Ask checkpatch if anything similar needs to be adjusted.
Oh well, I should have checked this. Thanks for reporting.
>> +
>> +/**
>> + * Returns the container of type &struct drm_gem_vram_object
>> + * for field bo.
>> + * @bo: the VRAM buffer object
>> + * Returns: The containing GEM VRAM object
>> + */
>> +static inline struct drm_gem_vram_object* drm_gem_vram_of_bo(
>> + struct ttm_buffer_object *bo)
>> +{
>> + return container_of(bo, struct drm_gem_vram_object, bo);
>> +}
> Indent funny. USe same indent as used in other parts of file for
> function arguments.
If I put the argument next to the function's name, it will exceed the
80-character limit. From the coding-style document, I could not see what
to do in this case. One solution would move the return type to a
separate line before the function name. I've not seen that anywhere in
the source code, so moving the argument onto a separate line and
indenting by one tab appears to be the next best solution. Please let me
know if there's if there's a preferred style for cases like this one.
Best regards
Thomas
>> +
>> +/**
>> + * Returns the container of type &struct drm_gem_vram_object
>> + * for field gem.
>> + * @gem: the GEM object
>> + * Returns: The containing GEM VRAM object
>> + */
>> +static inline struct drm_gem_vram_object* drm_gem_vram_of_gem(
>> + struct drm_gem_object *gem)
>> +{
>> + return container_of(gem, struct drm_gem_vram_object, gem);
>> +}
> ditto
>
>> +
>> +struct drm_gem_vram_object* drm_gem_vram_create(struct drm_device *dev,
>> + struct ttm_bo_device* bdev,
>> + unsigned long size,
>> + uint32_t pg_align,
>> + bool interruptible);
>
> Here is is "normal"
>
--
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)
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-04-30 7:18 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-29 14:43 [PATCH v3 00/19] Share TTM code among DRM framebuffer drivers Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 01/19] drm: Add |struct drm_gem_vram_object| and helpers Thomas Zimmermann
2019-04-29 19:58 ` Sam Ravnborg
2019-04-30 7:18 ` Thomas Zimmermann [this message]
2019-04-30 9:23 ` Sam Ravnborg
2019-04-30 9:35 ` Koenig, Christian
2019-05-03 10:14 ` Thomas Zimmermann
2019-05-03 12:01 ` Daniel Vetter
2019-05-03 12:07 ` Koenig, Christian
2019-05-03 12:27 ` Thomas Zimmermann
2019-05-03 13:29 ` Thomas Zimmermann
2019-04-30 14:27 ` Daniel Vetter
2019-04-30 14:40 ` Daniel Vetter
2019-04-29 14:43 ` [PATCH v3 02/19] drm: Add |struct drm_gem_vram_object| callbacks for |struct ttm_bo_driver| Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 03/19] drm: Add |struct drm_gem_vram_object| callbacks for |struct drm_driver| Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 04/19] drm: Add drm_gem_vram_fill_create_dumb() to create dumb buffers Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 05/19] drm: Add VRAM MM, a simple memory manager for dedicated VRAM Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 06/19] drm: Add default instance for VRAM MM callback functions Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 07/19] drm: Integrate VRAM MM into struct drm_device Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 08/19] drm/ast: Convert AST driver to |struct drm_gem_vram_object| Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 09/19] drm/ast: Convert AST driver to VRAM MM Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 10/19] drm/ast: Replace mapping code with drm_gem_vram_{kmap/kunmap}() Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 11/19] drm/bochs: Convert bochs driver to |struct drm_gem_vram_object| Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 12/19] drm/bochs: Convert bochs driver to VRAM MM Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 13/19] drm/mgag200: Convert mgag200 driver to |struct drm_gem_vram_object| Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 14/19] drm/mgag200: Convert mgag200 driver to VRAM MM Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 15/19] drm/mgag200: Replace mapping code with drm_gem_vram_{kmap/kunmap}() Thomas Zimmermann
2019-04-30 14:41 ` Daniel Vetter
2019-04-29 14:43 ` [PATCH v3 16/19] drm/vboxvideo: Convert vboxvideo driver to |struct drm_gem_vram_object| Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 17/19] drm/vboxvideo: Convert vboxvideo driver to VRAM MM Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 18/19] drm/hisilicon: Convert hibmc-drm driver to |struct drm_gem_vram_object| Thomas Zimmermann
2019-04-29 14:43 ` [PATCH v3 19/19] drm/hisilicon: Convert hibmc-drm driver to VRAM MM Thomas Zimmermann
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=1d14ef87-e1cd-4f4a-3632-bc045a1981c6@suse.de \
--to=tzimmermann@suse.de \
--cc=Jerry.Zhang@amd.com \
--cc=airlied@linux.ie \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=kong.kongxinwei@hisilicon.com \
--cc=kraxel@redhat.com \
--cc=puck.chen@hisilicon.com \
--cc=ray.huang@amd.com \
--cc=sam@ravnborg.org \
--cc=virtualization@lists.linux-foundation.org \
--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