1*dee8268fSThierry Reding /* 2*dee8268fSThierry Reding * Tegra host1x GEM implementation 3*dee8268fSThierry Reding * 4*dee8268fSThierry Reding * Copyright (c) 2012-2013, NVIDIA Corporation. 5*dee8268fSThierry Reding * 6*dee8268fSThierry Reding * This program is free software; you can redistribute it and/or modify it 7*dee8268fSThierry Reding * under the terms and conditions of the GNU General Public License, 8*dee8268fSThierry Reding * version 2, as published by the Free Software Foundation. 9*dee8268fSThierry Reding * 10*dee8268fSThierry Reding * This program is distributed in the hope it will be useful, but WITHOUT 11*dee8268fSThierry Reding * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12*dee8268fSThierry Reding * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13*dee8268fSThierry Reding * more details. 14*dee8268fSThierry Reding * 15*dee8268fSThierry Reding * You should have received a copy of the GNU General Public License 16*dee8268fSThierry Reding * along with this program. If not, see <http://www.gnu.org/licenses/>. 17*dee8268fSThierry Reding */ 18*dee8268fSThierry Reding 19*dee8268fSThierry Reding #ifndef __HOST1X_GEM_H 20*dee8268fSThierry Reding #define __HOST1X_GEM_H 21*dee8268fSThierry Reding 22*dee8268fSThierry Reding #include <linux/host1x.h> 23*dee8268fSThierry Reding 24*dee8268fSThierry Reding #include <drm/drm.h> 25*dee8268fSThierry Reding #include <drm/drmP.h> 26*dee8268fSThierry Reding 27*dee8268fSThierry Reding struct tegra_bo { 28*dee8268fSThierry Reding struct drm_gem_object gem; 29*dee8268fSThierry Reding struct host1x_bo base; 30*dee8268fSThierry Reding dma_addr_t paddr; 31*dee8268fSThierry Reding void *vaddr; 32*dee8268fSThierry Reding }; 33*dee8268fSThierry Reding 34*dee8268fSThierry Reding static inline struct tegra_bo *to_tegra_bo(struct drm_gem_object *gem) 35*dee8268fSThierry Reding { 36*dee8268fSThierry Reding return container_of(gem, struct tegra_bo, gem); 37*dee8268fSThierry Reding } 38*dee8268fSThierry Reding 39*dee8268fSThierry Reding extern const struct host1x_bo_ops tegra_bo_ops; 40*dee8268fSThierry Reding 41*dee8268fSThierry Reding struct tegra_bo *tegra_bo_create(struct drm_device *drm, unsigned int size); 42*dee8268fSThierry Reding struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file, 43*dee8268fSThierry Reding struct drm_device *drm, 44*dee8268fSThierry Reding unsigned int size, 45*dee8268fSThierry Reding unsigned int *handle); 46*dee8268fSThierry Reding void tegra_bo_free_object(struct drm_gem_object *gem); 47*dee8268fSThierry Reding int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm, 48*dee8268fSThierry Reding struct drm_mode_create_dumb *args); 49*dee8268fSThierry Reding int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm, 50*dee8268fSThierry Reding uint32_t handle, uint64_t *offset); 51*dee8268fSThierry Reding 52*dee8268fSThierry Reding int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma); 53*dee8268fSThierry Reding 54*dee8268fSThierry Reding extern const struct vm_operations_struct tegra_bo_vm_ops; 55*dee8268fSThierry Reding 56*dee8268fSThierry Reding #endif 57