Merge tag 'staging-4.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[deliverable/linux.git] / drivers / gpu / drm / tegra / gem.h
CommitLineData
de2ba664
AM
1/*
2 * Tegra host1x GEM implementation
3 *
4 * Copyright (c) 2012-2013, NVIDIA Corporation.
5 *
9a2ac2dc
TR
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.
de2ba664
AM
9 */
10
11#ifndef __HOST1X_GEM_H
12#define __HOST1X_GEM_H
13
35d747a8
TR
14#include <linux/host1x.h>
15
de2ba664
AM
16#include <drm/drm.h>
17#include <drm/drmP.h>
d9fc9413 18#include <drm/drm_gem.h>
de2ba664 19
c134f019
TR
20#define TEGRA_BO_BOTTOM_UP (1 << 0)
21
22enum tegra_bo_tiling_mode {
23 TEGRA_BO_TILING_MODE_PITCH,
24 TEGRA_BO_TILING_MODE_TILED,
25 TEGRA_BO_TILING_MODE_BLOCK,
26};
27
28struct tegra_bo_tiling {
29 enum tegra_bo_tiling_mode mode;
30 unsigned long value;
31};
773af77f 32
de2ba664
AM
33struct tegra_bo {
34 struct drm_gem_object gem;
35 struct host1x_bo base;
773af77f 36 unsigned long flags;
3800391d 37 struct sg_table *sgt;
de2ba664
AM
38 dma_addr_t paddr;
39 void *vaddr;
c134f019 40
df06b759
TR
41 struct drm_mm_node *mm;
42 unsigned long num_pages;
43 struct page **pages;
44 /* size of IOMMU mapping */
45 size_t size;
46
c134f019 47 struct tegra_bo_tiling tiling;
de2ba664
AM
48};
49
50static inline struct tegra_bo *to_tegra_bo(struct drm_gem_object *gem)
51{
52 return container_of(gem, struct tegra_bo, gem);
53}
54
71c38629 55struct tegra_bo *tegra_bo_create(struct drm_device *drm, size_t size,
773af77f 56 unsigned long flags);
de2ba664 57struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file,
773af77f 58 struct drm_device *drm,
71c38629 59 size_t size,
773af77f 60 unsigned long flags,
71c38629 61 u32 *handle);
de2ba664 62void tegra_bo_free_object(struct drm_gem_object *gem);
de2ba664
AM
63int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
64 struct drm_mode_create_dumb *args);
65int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm,
71c38629 66 u32 handle, u64 *offset);
de2ba664
AM
67
68int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
69
70extern const struct vm_operations_struct tegra_bo_vm_ops;
71
3800391d
TR
72struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
73 struct drm_gem_object *gem,
74 int flags);
75struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm,
76 struct dma_buf *buf);
77
de2ba664 78#endif
This page took 0.165552 seconds and 5 git commands to generate.