From: Philipp Zabel <p.zabel@pengutronix.de>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
patchwork-lst@pengutronix.de, kernel@pengutronix.de,
Russell King <linux+etnaviv@armlinux.org.uk>
Subject: Re: [PATCH v2 2/3] drm/etnaviv: allocate unique ID per drm_file
Date: Wed, 16 Nov 2022 14:18:02 +0100 [thread overview]
Message-ID: <20221116131802.GA12239@pengutronix.de> (raw)
In-Reply-To: <20220916151205.165687-2-l.stach@pengutronix.de>
On Fri, Sep 16, 2022 at 05:12:04PM +0200, Lucas Stach wrote:
> Allows to easily track if several fd are pointing to the same
> execution context due to being dup'ed.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 3 +++
> drivers/gpu/drm/etnaviv/etnaviv_drv.h | 1 +
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 1d2b4fb4bcf8..b69edb40ae2a 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -49,6 +49,7 @@ static void load_gpu(struct drm_device *dev)
> static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
> {
> struct etnaviv_drm_private *priv = dev->dev_private;
> + static atomic_t ident = ATOMIC_INIT(0);
> struct etnaviv_file_private *ctx;
> int ret, i;
>
> @@ -56,6 +57,8 @@ static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
> if (!ctx)
> return -ENOMEM;
>
> + ctx->id = atomic_inc_return(&ident);
I suppose we can ignore that this could theoretically wrap around.
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
regards
Philipp
next prev parent reply other threads:[~2022-11-16 13:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 15:12 [PATCH v2 1/3] drm/scheduler: track GPU active time per entity Lucas Stach
2022-09-16 15:12 ` [PATCH v2 2/3] drm/etnaviv: allocate unique ID per drm_file Lucas Stach
2022-11-16 9:16 ` Lucas Stach
2022-11-16 13:18 ` Philipp Zabel [this message]
2022-11-16 14:47 ` Tvrtko Ursulin
2022-09-16 15:12 ` [PATCH v2 3/3] drm/etnaviv: export client GPU usage statistics via fdinfo Lucas Stach
2022-11-16 13:40 ` Philipp Zabel
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=20221116131802.GA12239@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=etnaviv@lists.freedesktop.org \
--cc=kernel@pengutronix.de \
--cc=l.stach@pengutronix.de \
--cc=linux+etnaviv@armlinux.org.uk \
--cc=patchwork-lst@pengutronix.de \
/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