Re: [RFC libdrm] Add NVIDIA Tegra support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx> 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: pgpBBPzqzHvBk.pgp
Description: PGP signature


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux