aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding2014-11-27 08:32:43 -0600
committerThierry Reding2014-11-27 10:20:32 -0600
commitf99522e678dbbaffeca9462a8edcbe900574dc12 (patch)
tree32cceb8018648474e208c12056f80367282e32b9 /tegra/tegra.c
parentd3ad65db4215f5fb5419d78a14c12833d5ed150a (diff)
downloadexternal-libdrm-f99522e678dbbaffeca9462a8edcbe900574dc12.tar.gz
external-libdrm-f99522e678dbbaffeca9462a8edcbe900574dc12.tar.xz
external-libdrm-f99522e678dbbaffeca9462a8edcbe900574dc12.zip
tegra: Implement drm_tegra_bo_{get,set}_tiling()
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.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/tegra/tegra.c b/tegra/tegra.c
index 614ab965..f8d40786 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -292,3 +292,54 @@ int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags)
292 292
293 return 0; 293 return 0;
294} 294}
295
296drm_public
297int drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
298 struct drm_tegra_bo_tiling *tiling)
299{
300 struct drm_tegra_gem_get_tiling args;
301 struct drm_tegra *drm = bo->drm;
302 int err;
303
304 if (!bo)
305 return -EINVAL;
306
307 memset(&args, 0, sizeof(args));
308 args.handle = bo->handle;
309
310 err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_TILING, &args,
311 sizeof(args));
312 if (err < 0)
313 return -errno;
314
315 if (tiling) {
316 tiling->mode = args.mode;
317 tiling->value = args.value;
318 }
319
320 return 0;
321}
322
323drm_public
324int drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
325 const struct drm_tegra_bo_tiling *tiling)
326{
327 struct drm_tegra_gem_set_tiling args;
328 struct drm_tegra *drm = bo->drm;
329 int err;
330
331 if (!bo)
332 return -EINVAL;
333
334 memset(&args, 0, sizeof(args));
335 args.handle = bo->handle;
336 args.mode = tiling->mode;
337 args.value = tiling->value;
338
339 err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_TILING, &args,
340 sizeof(args));
341 if (err < 0)
342 return -errno;
343
344 return 0;
345}