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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
/*
* linux/drivers/gpu/exynos/g2d/g2d.h
*
* Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Samsung Graphics 2D driver
*
* 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.
*/
#ifndef __EXYNOS_G2D_H__
#define __EXYNOS_G2D_H__
#include <linux/kernel.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/miscdevice.h>
#include <media/exynos_repeater.h>
#include <linux/pm_qos.h>
struct g2d_task; /* defined in g2d_task.h */
enum g2d_priority {
G2D_LOW_PRIORITY,
G2D_MEDIUM_PRIORITY,
G2D_DEFAULT_PRIORITY = G2D_MEDIUM_PRIORITY,
G2D_HIGH_PRIORITY,
G2D_HIGHEST_PRIORITY,
G2D_PRIORITY_END
};
/*
* G2D_DEVICE_STATE_SUSPEND should be treated under g2d_dev->lock_task held
* because it should be consistent with the state of all tasks attached to
* g2d_dev->tasks_active.
*/
#define G2D_DEVICE_STATE_SUSPEND 1
#define G2D_DEVICE_STATE_IOVMM_DISABLED 2
enum g2d_hw_ppc_rot {
PPC_NO_ROTATE,
PPC_ROTATE,
PPC_ROT,
};
enum g2d_hw_ppc_fmt {
PPC_RGB,
PPC_YUV2P,
PPC_YUV2P_82,
PPC_FMT,
};
enum g2d_hw_ppc_sc {
PPC_SC_UP,
PPC_NO_SCALE,
PPC_SC_DOWN_1,
PPC_SC_DOWN_4,
PPC_SC_DOWN_9,
PPC_SC_DOWN_16,
PPC_SC,
};
enum g2d_hw_ppc {
PPC_COLORFILL = PPC_FMT * PPC_ROT * PPC_SC,
PPC_END,
};
struct g2d_dvfs_table {
u32 lv;
u32 freq;
};
struct g2d_device {
unsigned long state;
struct miscdevice misc[2];
struct device *dev;
struct clk *clock;
void __iomem *reg;
u64 fence_context;
atomic_t fence_timeline;
spinlock_t fence_lock;
/* task management */
spinlock_t lock_task;
struct g2d_task *tasks;
struct list_head tasks_free;
struct list_head tasks_free_hwfc;
struct list_head tasks_prepared;
struct list_head tasks_active;
struct workqueue_struct *schedule_workq;
struct notifier_block pm_notifier;
wait_queue_head_t freeze_wait;
struct dentry *debug_root;
struct dentry *debug;
struct dentry *debug_logs;
atomic_t prior_stats[G2D_PRIORITY_END];
struct mutex lock_qos;
struct list_head qos_contexts;
u32 hw_ppc[PPC_END];
struct g2d_dvfs_table *dvfs_table;
u32 dvfs_table_cnt;
};
#define G2D_AUTHORITY_HIGHUSER 1
struct g2d_context {
struct g2d_device *g2d_dev;
struct shared_buffer_info *hwfc_info;
u32 priority;
int authority;
struct delayed_work dwork;
struct pm_qos_request req;
struct list_head qos_node;
struct mutex lock_context;
u64 r_bw;
u64 w_bw;
};
int g2d_device_run(struct g2d_device *g2d_dev, struct g2d_task *task);
void g2d_hw_timeout_handler(unsigned long arg);
#endif /* __EXYNOS_G2D_H__ */
|