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 BR, -R > + > + *bop = bo; > + > + return 0; > +} _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel