aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding2014-11-27 08:31:34 -0600
committerThierry Reding2014-11-27 10:20:32 -0600
commitd3ad65db4215f5fb5419d78a14c12833d5ed150a (patch)
tree5eb28b801442d36ea9f198507429721a604f8982 /tegra/tegra.c
parent7b5e65268962d277c4e9e623d284150a715c541c (diff)
downloadexternal-libdrm-d3ad65db4215f5fb5419d78a14c12833d5ed150a.tar.gz
external-libdrm-d3ad65db4215f5fb5419d78a14c12833d5ed150a.tar.xz
external-libdrm-d3ad65db4215f5fb5419d78a14c12833d5ed150a.zip
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/tegra.c')
-rw-r--r--tegra/tegra.c46
1 files changed, 46 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)
246 246
247 return 0; 247 return 0;
248} 248}
249
250drm_public
251int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags)
252{
253 struct drm_tegra_gem_get_flags args;
254 struct drm_tegra *drm = bo->drm;
255 int err;
256
257 if (!bo)
258 return -EINVAL;
259
260 memset(&args, 0, sizeof(args));
261 args.handle = bo->handle;
262
263 err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_FLAGS, &args,
264 sizeof(args));
265 if (err < 0)
266 return -errno;
267
268 if (flags)
269 *flags = args.flags;
270
271 return 0;
272}
273
274drm_public
275int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags)
276{
277 struct drm_tegra_gem_get_flags args;
278 struct drm_tegra *drm = bo->drm;
279 int err;
280
281 if (!bo)
282 return -EINVAL;
283
284 memset(&args, 0, sizeof(args));
285 args.handle = bo->handle;
286 args.flags = flags;
287
288 err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_FLAGS, &args,
289 sizeof(args));
290 if (err < 0)
291 return -errno;
292
293 return 0;
294}