drm: Extract <drm/drm_gem.h>
[deliverable/linux.git] / drivers / gpu / drm / tegra / gem.h
1 /*
2 * Tegra host1x GEM implementation
3 *
4 * Copyright (c) 2012-2013, NVIDIA Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11 #ifndef __HOST1X_GEM_H
12 #define __HOST1X_GEM_H
13
14 #include <linux/host1x.h>
15
16 #include <drm/drm.h>
17 #include <drm/drmP.h>
18 #include <drm/drm_gem.h>
19
20 #define TEGRA_BO_BOTTOM_UP (1 << 0)
21
22 enum tegra_bo_tiling_mode {
23 TEGRA_BO_TILING_MODE_PITCH,
24 TEGRA_BO_TILING_MODE_TILED,
25 TEGRA_BO_TILING_MODE_BLOCK,
26 };
27
28 struct tegra_bo_tiling {
29 enum tegra_bo_tiling_mode mode;
30 unsigned long value;
31 };
32
33 struct tegra_bo {
34 struct drm_gem_object gem;
35 struct host1x_bo base;
36 unsigned long flags;
37 struct sg_table *sgt;
38 dma_addr_t paddr;
39 void *vaddr;
40
41 struct tegra_bo_tiling tiling;
42 };
43
44 static inline struct tegra_bo *to_tegra_bo(struct drm_gem_object *gem)
45 {
46 return container_of(gem, struct tegra_bo, gem);
47 }
48
49 struct tegra_bo *tegra_bo_create(struct drm_device *drm, unsigned int size,
50 unsigned long flags);
51 struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file,
52 struct drm_device *drm,
53 unsigned int size,
54 unsigned long flags,
55 unsigned int *handle);
56 void tegra_bo_free_object(struct drm_gem_object *gem);
57 int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
58 struct drm_mode_create_dumb *args);
59 int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm,
60 uint32_t handle, uint64_t *offset);
61
62 int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
63
64 extern const struct vm_operations_struct tegra_bo_vm_ops;
65
66 struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
67 struct drm_gem_object *gem,
68 int flags);
69 struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm,
70 struct dma_buf *buf);
71
72 #endif
This page took 0.069401 seconds and 5 git commands to generate.