Home | History | Annotate | Download | only in tegra
      1 /*
      2  * Copyright  2012, 2013 Thierry Reding
      3  * Copyright  2013 Erik Faye-Lund
      4  * Copyright  2014 NVIDIA Corporation
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the "Software"),
      8  * to deal in the Software without restriction, including without limitation
      9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  * and/or sell copies of the Software, and to permit persons to whom the
     11  * Software is furnished to do so, subject to the following conditions:
     12  *
     13  * The above copyright notice and this permission notice shall be included in
     14  * all copies or substantial portions of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  * OTHER DEALINGS IN THE SOFTWARE.
     23  */
     24 
     25 #ifndef __DRM_TEGRA_H__
     26 #define __DRM_TEGRA_H__ 1
     27 
     28 #include <stdint.h>
     29 #include <stdlib.h>
     30 
     31 struct drm_tegra_bo;
     32 struct drm_tegra;
     33 
     34 int drm_tegra_new(struct drm_tegra **drmp, int fd);
     35 void drm_tegra_close(struct drm_tegra *drm);
     36 
     37 int drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
     38 		     uint32_t flags, uint32_t size);
     39 int drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
     40 		      uint32_t handle, uint32_t flags, uint32_t size);
     41 
     42 int drm_tegra_bo_name_ref(struct drm_tegra *drm, uint32_t name, uint32_t size,
     43 			 struct drm_tegra_bo **bop);
     44 int drm_tegra_bo_name_get(struct drm_tegra_bo *bo, uint32_t *name);
     45 
     46 struct drm_tegra_bo *drm_tegra_bo_ref(struct drm_tegra_bo *bo);
     47 void drm_tegra_bo_unref(struct drm_tegra_bo *bo);
     48 int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle);
     49 int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr);
     50 int drm_tegra_bo_unmap(struct drm_tegra_bo *bo);
     51 
     52 int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags);
     53 int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags);
     54 
     55 struct drm_tegra_bo_tiling {
     56 	uint32_t mode;
     57 	uint32_t value;
     58 };
     59 
     60 int drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
     61 			    struct drm_tegra_bo_tiling *tiling);
     62 int drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
     63 			    const struct drm_tegra_bo_tiling *tiling);
     64 
     65 #endif /* __DRM_TEGRA_H__ */
     66