summaryrefslogtreecommitdiff
path: root/tegra
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-11-27 15:31:34 +0100
committerThierry Reding <treding@nvidia.com>2014-11-27 17:20:32 +0100
commitd3ad65db4215f5fb5419d78a14c12833d5ed150a (patch)
tree5eb28b801442d36ea9f198507429721a604f8982 /tegra
parent7b5e65268962d277c4e9e623d284150a715c541c (diff)
tegra: Implement drm_tegra_bo_{get,set}_flags()
These two functions are simple wrappers around the corresponding IOCTLs and operate on drm_tegra_bo objects. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'tegra')
-rw-r--r--tegra/tegra.c46
-rw-r--r--tegra/tegra.h3
2 files changed, 49 insertions, 0 deletions
diff --git a/tegra/tegra.c b/tegra/tegra.c
index ec5bf76c..614ab965 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -246,3 +246,49 @@ int drm_tegra_bo_unmap(struct drm_tegra_bo *bo)
return 0;
}
+
+drm_public
+int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags)
+{
+ struct drm_tegra_gem_get_flags args;
+ struct drm_tegra *drm = bo->drm;
+ int err;
+
+ if (!bo)
+ return -EINVAL;
+
+ memset(&args, 0, sizeof(args));
+ args.handle = bo->handle;
+
+ err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_FLAGS, &args,
+ sizeof(args));
+ if (err < 0)
+ return -errno;
+
+ if (flags)
+ *flags = args.flags;
+
+ return 0;
+}
+
+drm_public
+int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags)
+{
+ struct drm_tegra_gem_get_flags args;
+ struct drm_tegra *drm = bo->drm;
+ int err;
+
+ if (!bo)
+ return -EINVAL;
+
+ memset(&args, 0, sizeof(args));
+ args.handle = bo->handle;
+ args.flags = flags;
+
+ err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_FLAGS, &args,
+ sizeof(args));
+ if (err < 0)
+ return -errno;
+
+ return 0;
+}
diff --git a/tegra/tegra.h b/tegra/tegra.h
index ed29505d..a8624180 100644
--- a/tegra/tegra.h
+++ b/tegra/tegra.h
@@ -44,4 +44,7 @@ int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle);
int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr);
int drm_tegra_bo_unmap(struct drm_tegra_bo *bo);
+int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags);
+int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags);
+
#endif /* __DRM_TEGRA_H__ */