From: Arto Merilainen <amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Thierry Reding
<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Cc: "dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [RFC libdrm] Add NVIDIA Tegra support
Date: Wed, 5 Dec 2012 09:39:11 +0200 [thread overview]
Message-ID: <50BEFA1F.5090907@nvidia.com> (raw)
In-Reply-To: <1354634032-9986-2-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
On 12/04/2012 05:13 PM, Thierry Reding wrote:
> +int drm_tegra_open(const char *path, struct drm_tegra **devicep)
> +{
> + struct drm_tegra *device;
> + int err;
> +
> + if (!path || !devicep)
> + return -EINVAL;
> +
> + device = calloc(1, sizeof(*device));
> + if (!device)
> + return -ENOMEM;
> +
> + DRMINITLISTHEAD(&device->bo_list);
> +
> + device->fd = open(path, O_RDWR);
> + if (device->fd < 0) {
> + err = -errno;
> + free(device);
> + return err;
> + }
> +
> + *devicep = device;
> +
> + return 0;
> +}
I think you shouldn't ask the path from the application (=DDX) here, but
use drmOpen() that automatically finds the correct device for you.
I'd also prefer letting the application open and close the device and
modify drm_tegra_open() to take the fd as a parameter. That way the DDX
could easily access also all generic libdrm functions.
- Arto
next prev parent reply other threads:[~2012-12-05 7:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-04 15:13 [RFC libdrm] Add NVIDIA Tegra support Thierry Reding
[not found] ` <1354634032-9986-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-12-04 15:13 ` Thierry Reding
2012-12-04 15:28 ` Rob Clark
[not found] ` <CAF6AEGum=cOxcHN1fBNfpLpm=bC-dXHZ_h2u96Ek4gwQSWSTtw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-04 15:38 ` Thierry Reding
[not found] ` <1354634032-9986-2-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-12-05 7:39 ` Arto Merilainen [this message]
[not found] ` <50BEFA1F.5090907-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-12-05 7:46 ` Thierry Reding
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=50BEFA1F.5090907@nvidia.com \
--to=amerilainen-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox