From: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
To: Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC libdrm] Add NVIDIA Tegra support
Date: Tue, 4 Dec 2012 16:38:41 +0100 [thread overview]
Message-ID: <20121204153841.GA18320@avionic-0098.adnet.avionic-design.de> (raw)
In-Reply-To: <CAF6AEGum=cOxcHN1fBNfpLpm=bC-dXHZ_h2u96Ek4gwQSWSTtw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2202 bytes --]
On Tue, Dec 04, 2012 at 09:28:25AM -0600, Rob Clark wrote:
> On Tue, Dec 4, 2012 at 9:13 AM, Thierry Reding
> <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org> wrote:
> > +int drm_tegra_bo_new(struct drm_tegra *device, uint32_t flags, uint32_t size,
> > + struct drm_tegra_bo **bop)
> > +{
> > + struct drm_tegra_gem_create args;
> > + struct drm_tegra_bo *bo;
> > + struct tegra_bo *priv;
> > + int err;
> > +
> > + if (!device || size == 0 || !bop)
> > + return -EINVAL;
> > +
> > + bo = calloc(1, sizeof(*bo));
> > + if (!bo)
> > + return -ENOMEM;
> > +
> > + priv = tegra_bo(bo);
> > +
> > + DRMLISTINITHEAD(&priv->list);
> > + atomic_set(&priv->ref, 1);
> > + bo->device = device;
> > + bo->flags = flags;
> > + bo->size = size;
> > +
> > + memset(&args, 0, sizeof(args));
> > + args.flags = flags;
> > + args.size = size;
> > +
> > + err = drmCommandWriteRead(device->fd, DRM_TEGRA_GEM_CREATE, &args,
> > + sizeof(args));
> > + if (err < 0) {
> > + err = -errno;
> > + free(bo);
> > + return err;
> > + }
> > +
> > + DRMLISTADD(&priv->list, &device->bo_list);
> > + bo->handle = args.handle;
> > + bo->offset = args.offset;
>
> btw, x11 can rapidly create/destroy temporary pixmaps.. which don't
> necessarily need userspace access. You might prefer to avoid creating
> mmap offset on GEM bo creation, and instead do this only if userspace
> needs to mmap the bo
Ah, so that's the reason for the MMAP IOCTL provided by other DRMs. Yes,
that might be better in the long run. For now I don't think it makes
much of a difference since the GEM objects are backed by CMA, and
therefore the offset will be created along with the GEM anyway.
With Terje's upcoming rework that handles all the allocations in host1x
this should become more important, especially when the mapping is done
through the Tegra30's IOMMU.
I'll rework that. Thanks for the quick reply.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-12-04 15:38 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 [this message]
[not found] ` <1354634032-9986-2-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-12-05 7:39 ` Arto Merilainen
[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=20121204153841.GA18320@avionic-0098.adnet.avionic-design.de \
--to=thierry.reding-rm9k5ik7kjkj5m59nbduvrnah6klmebb@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@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