summaryrefslogtreecommitdiffstats
path: root/include/drm/drm_adreno.h
blob: 7d60dfdb5431ac8bbb255250b41a06e3a8b97a52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Copyright (C) 2013 Pengutronix
 * Author: Lucas Stach <l.stach@pengutronix.de>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published by
 * the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __DRM_ADRENO_H__
#define __DRM_ADRENO_H__

#include <drm/drmP.h>

struct adreno_gpu;

#define ADRENO_SUBMIT_MAX_CMDS 4
struct adreno_submit {
	unsigned int nr_cmds;
	struct {
		uint32_t type;
		uint32_t size;  /* in dwords */
		uint32_t iova;
	} cmd[ADRENO_SUBMIT_MAX_CMDS];

	uint32_t fence;
};

struct adreno_context {
	int dummy;
};

struct adreno_gpu_funcs {
	int (*get_param)(struct adreno_gpu *gpu, uint32_t param, uint64_t *value);
	int (*hw_init)(struct adreno_gpu *gpu);
	int (*pm_suspend)(struct adreno_gpu *gpu);
	int (*pm_resume)(struct adreno_gpu *gpu);
	int (*submit)(struct adreno_gpu *gpu, struct adreno_submit *submit,
			struct adreno_context *ctx);
	void (*flush)(struct adreno_gpu *gpu);
	void (*idle)(struct adreno_gpu *gpu);
	irqreturn_t (*irq)(struct adreno_gpu *irq);
	uint32_t (*last_fence)(struct adreno_gpu *gpu);
	void (*recover)(struct adreno_gpu *gpu);
	void (*destroy)(struct adreno_gpu *gpu);
#ifdef CONFIG_DEBUG_FS
	/* show GPU status in debugfs: */
	void (*show)(struct adreno_gpu *gpu, struct seq_file *m);
#endif
};

struct adreno_gem {
	void *priv;
	struct drm_gem_object *(*gem_new)(void *gem_priv,
					  uint32_t size, uint32_t flags);
	int (*gem_get_iova_locked)(void *gem_priv, struct drm_gem_object *obj,
				   uint32_t *iova);
	int (*gem_get_iova)(void *gem_priv, struct drm_gem_object *obj,
			    uint32_t *iova);
	void (*gem_put_iova)(void *gem_priv, struct drm_gem_object *obj);
	void *(*gem_vaddr_locked)(void *gem_priv, struct drm_gem_object *obj);
	void *(*gem_vaddr)(void *gem_priv, struct drm_gem_object *obj);
	void (*gem_retire)(void *gem_priv);
};

const char *adreno_get_name(struct adreno_gpu *gpu);

/* Adreno 3xx module functions */
int a3xx_gpu_init(struct drm_device *dev,
		const struct adreno_gem *gem, struct workqueue_struct *wq,
		int reglog, struct adreno_gpu **gpu,
		struct adreno_gpu_funcs **funcs);
void __init a3xx_register(void);
void __exit a3xx_unregister(void);

#endif /* __DRM_ADRENO_H__ */