tegra.h revision 08d7334d
108d7334dSsnj/*
208d7334dSsnj * Copyright © 2012, 2013 Thierry Reding
308d7334dSsnj * Copyright © 2013 Erik Faye-Lund
408d7334dSsnj * Copyright © 2014 NVIDIA Corporation
508d7334dSsnj *
608d7334dSsnj * Permission is hereby granted, free of charge, to any person obtaining a
708d7334dSsnj * copy of this software and associated documentation files (the "Software"),
808d7334dSsnj * to deal in the Software without restriction, including without limitation
908d7334dSsnj * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1008d7334dSsnj * and/or sell copies of the Software, and to permit persons to whom the
1108d7334dSsnj * Software is furnished to do so, subject to the following conditions:
1208d7334dSsnj *
1308d7334dSsnj * The above copyright notice and this permission notice shall be included in
1408d7334dSsnj * all copies or substantial portions of the Software.
1508d7334dSsnj *
1608d7334dSsnj * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1708d7334dSsnj * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1808d7334dSsnj * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1908d7334dSsnj * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
2008d7334dSsnj * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2108d7334dSsnj * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2208d7334dSsnj * OTHER DEALINGS IN THE SOFTWARE.
2308d7334dSsnj */
2408d7334dSsnj
2508d7334dSsnj#ifndef __DRM_TEGRA_H__
2608d7334dSsnj#define __DRM_TEGRA_H__ 1
2708d7334dSsnj
2808d7334dSsnj#include <stdint.h>
2908d7334dSsnj#include <stdlib.h>
3008d7334dSsnj
3108d7334dSsnjstruct drm_tegra_bo;
3208d7334dSsnjstruct drm_tegra;
3308d7334dSsnj
3408d7334dSsnjint drm_tegra_new(struct drm_tegra **drmp, int fd);
3508d7334dSsnjvoid drm_tegra_close(struct drm_tegra *drm);
3608d7334dSsnj
3708d7334dSsnjint drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
3808d7334dSsnj		     uint32_t flags, uint32_t size);
3908d7334dSsnjint drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
4008d7334dSsnj		      uint32_t handle, uint32_t flags, uint32_t size);
4108d7334dSsnjstruct drm_tegra_bo *drm_tegra_bo_ref(struct drm_tegra_bo *bo);
4208d7334dSsnjvoid drm_tegra_bo_unref(struct drm_tegra_bo *bo);
4308d7334dSsnjint drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle);
4408d7334dSsnjint drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr);
4508d7334dSsnjint drm_tegra_bo_unmap(struct drm_tegra_bo *bo);
4608d7334dSsnj
4708d7334dSsnjint drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags);
4808d7334dSsnjint drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags);
4908d7334dSsnj
5008d7334dSsnjstruct drm_tegra_bo_tiling {
5108d7334dSsnj	uint32_t mode;
5208d7334dSsnj	uint32_t value;
5308d7334dSsnj};
5408d7334dSsnj
5508d7334dSsnjint drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
5608d7334dSsnj			    struct drm_tegra_bo_tiling *tiling);
5708d7334dSsnjint drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
5808d7334dSsnj			    const struct drm_tegra_bo_tiling *tiling);
5908d7334dSsnj
6008d7334dSsnj#endif /* __DRM_TEGRA_H__ */
61