diff options
author | Dave Airlie <airlied@redhat.com> | 2016-08-15 02:46:36 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-08-15 02:46:36 -0400 |
commit | f8725ad1da5182aea9b08c8ef300e83bac74f756 (patch) | |
tree | e98c5046b05422db1f3ce900daa0c5391b9d2d6d | |
parent | a02b5a155e21b6d324045eca2e30e93f4ff4c51c (diff) | |
parent | 3590d50e2313644cd192ff55e83df76dea232319 (diff) |
Merge tag 'topic/drm-misc-2016-08-12' of git://anongit.freedesktop.org/drm-intel into drm-next
- more fence destaging and cleanup (Gustavo&Sumit)
- DRIVER_LEGACY to untangle from DRIVER_MODESET
- drm_mm refactor (Chris)
- fbdev-less compile fies
- clipped plane src/dst rects (Ville)
- + a few mediatek patches that build on top of that (Bibby+Daniel)
- small stuff all over really
* tag 'topic/drm-misc-2016-08-12' of git://anongit.freedesktop.org/drm-intel: (43 commits)
dma-buf/fence: kerneldoc: remove spurious section header
dma-buf/fence: kerneldoc: remove unused struct members
Revert "gpu: drm: omapdrm: dss-of: add missing of_node_put after calling of_parse_phandle"
drm: Protect fb_defio in drivers with CONFIG_KMS_FBDEV_EMULATION
drm/radeon|amgpu: Make fbdev emulation optional
drm/vmwgfx: select CONFIG_FB
drm: Remove superflous linux/fb.h includes
drm/fb-helper: Add a dummy remove_conflicting_framebuffers
dma-buf/sync_file: only enable fence signalling on poll()
Documentation: add doc for sync_file_get_fence()
dma-buf/sync_file: add sync_file_get_fence()
dma-buf/sync_file: refactor fence storage in struct sync_file
dma-buf/fence-array: add fence_is_array()
drm/dp_helper: Rate limit timeout errors from drm_dp_i2c_do_msg()
drm/dp_helper: Print first error received on failure in drm_dp_dpcd_access()
drm: Add ratelimited versions of the DRM_DEBUG* macros
drm: Make sure drm_vblank_no_hw_counter isn't abused
drm/mediatek: Fix mtk_atomic_complete for runtime_pm
drm/mediatek: plane: Use FB's format's cpp to compute x offset
drm/mediatek: plane: Merge mtk_plane_enable into mtk_plane_atomic_update
...
103 files changed, 959 insertions, 747 deletions
diff --git a/Documentation/gpu/drm-internals.rst b/Documentation/gpu/drm-internals.rst index 3bb26135971f..37284bcc7764 100644 --- a/Documentation/gpu/drm-internals.rst +++ b/Documentation/gpu/drm-internals.rst | |||
@@ -53,9 +53,12 @@ u32 driver_features; | |||
53 | DRIVER_USE_AGP | 53 | DRIVER_USE_AGP |
54 | Driver uses AGP interface, the DRM core will manage AGP resources. | 54 | Driver uses AGP interface, the DRM core will manage AGP resources. |
55 | 55 | ||
56 | DRIVER_REQUIRE_AGP | 56 | DRIVER_LEGACY |
57 | Driver needs AGP interface to function. AGP initialization failure | 57 | Denote a legacy driver using shadow attach. Don't use. |
58 | will become a fatal error. | 58 | |
59 | DRIVER_KMS_LEGACY_CONTEXT | ||
60 | Used only by nouveau for backwards compatibility with existing userspace. | ||
61 | Don't use. | ||
59 | 62 | ||
60 | DRIVER_PCI_DMA | 63 | DRIVER_PCI_DMA |
61 | Driver is capable of PCI DMA, mapping of PCI DMA buffers to | 64 | Driver is capable of PCI DMA, mapping of PCI DMA buffers to |
diff --git a/Documentation/sync_file.txt b/Documentation/sync_file.txt index e8e2ebafe5fa..b63a68531afd 100644 --- a/Documentation/sync_file.txt +++ b/Documentation/sync_file.txt | |||
@@ -64,6 +64,20 @@ The sync_file fd now can be sent to userspace. | |||
64 | If the creation process fail, or the sync_file needs to be released by any | 64 | If the creation process fail, or the sync_file needs to be released by any |
65 | other reason fput(sync_file->file) should be used. | 65 | other reason fput(sync_file->file) should be used. |
66 | 66 | ||
67 | Receiving Sync Files from Userspace | ||
68 | ----------------------------------- | ||
69 | |||
70 | When userspace needs to send an in-fence to the driver it passes file descriptor | ||
71 | of the Sync File to the kernel. The kernel can then retrieve the fences | ||
72 | from it. | ||
73 | |||
74 | Interface: | ||
75 | struct fence *sync_file_get_fence(int fd); | ||
76 | |||
77 | |||
78 | The returned reference is owned by the caller and must be disposed of | ||
79 | afterwards using fence_put(). In case of error, a NULL is returned instead. | ||
80 | |||
67 | References: | 81 | References: |
68 | [1] struct sync_file in include/linux/sync_file.h | 82 | [1] struct sync_file in include/linux/sync_file.h |
69 | [2] All interfaces mentioned above defined in include/linux/sync_file.h | 83 | [2] All interfaces mentioned above defined in include/linux/sync_file.h |
diff --git a/drivers/dma-buf/fence-array.c b/drivers/dma-buf/fence-array.c index a8731c853da6..ee500226197b 100644 --- a/drivers/dma-buf/fence-array.c +++ b/drivers/dma-buf/fence-array.c | |||
@@ -99,6 +99,7 @@ const struct fence_ops fence_array_ops = { | |||
99 | .wait = fence_default_wait, | 99 | .wait = fence_default_wait, |
100 | .release = fence_array_release, | 100 | .release = fence_array_release, |
101 | }; | 101 | }; |
102 | EXPORT_SYMBOL(fence_array_ops); | ||
102 | 103 | ||
103 | /** | 104 | /** |
104 | * fence_array_create - Create a custom fence array | 105 | * fence_array_create - Create a custom fence array |
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c index 9aaa608dfe01..486d29c1a830 100644 --- a/drivers/dma-buf/sync_file.c +++ b/drivers/dma-buf/sync_file.c | |||
@@ -28,11 +28,11 @@ | |||
28 | 28 | ||
29 | static const struct file_operations sync_file_fops; | 29 | static const struct file_operations sync_file_fops; |
30 | 30 | ||
31 | static struct sync_file *sync_file_alloc(int size) | 31 | static struct sync_file *sync_file_alloc(void) |
32 | { | 32 | { |
33 | struct sync_file *sync_file; | 33 | struct sync_file *sync_file; |
34 | 34 | ||
35 | sync_file = kzalloc(size, GFP_KERNEL); | 35 | sync_file = kzalloc(sizeof(*sync_file), GFP_KERNEL); |
36 | if (!sync_file) | 36 | if (!sync_file) |
37 | return NULL; | 37 | return NULL; |
38 | 38 | ||
@@ -45,6 +45,8 @@ static struct sync_file *sync_file_alloc(int size) | |||
45 | 45 | ||
46 | init_waitqueue_head(&sync_file->wq); | 46 | init_waitqueue_head(&sync_file->wq); |
47 | 47 | ||
48 | INIT_LIST_HEAD(&sync_file->cb.node); | ||
49 | |||
48 | return sync_file; | 50 | return sync_file; |
49 | 51 | ||
50 | err: | 52 | err: |
@@ -54,14 +56,11 @@ err: | |||
54 | 56 | ||
55 | static void fence_check_cb_func(struct fence *f, struct fence_cb *cb) | 57 | static void fence_check_cb_func(struct fence *f, struct fence_cb *cb) |
56 | { | 58 | { |
57 | struct sync_file_cb *check; | ||
58 | struct sync_file *sync_file; | 59 | struct sync_file *sync_file; |
59 | 60 | ||
60 | check = container_of(cb, struct sync_file_cb, cb); | 61 | sync_file = container_of(cb, struct sync_file, cb); |
61 | sync_file = check->sync_file; | ||
62 | 62 | ||
63 | if (atomic_dec_and_test(&sync_file->status)) | 63 | wake_up_all(&sync_file->wq); |
64 | wake_up_all(&sync_file->wq); | ||
65 | } | 64 | } |
66 | 65 | ||
67 | /** | 66 | /** |
@@ -76,23 +75,17 @@ struct sync_file *sync_file_create(struct fence *fence) | |||
76 | { | 75 | { |
77 | struct sync_file *sync_file; | 76 | struct sync_file *sync_file; |
78 | 77 | ||
79 | sync_file = sync_file_alloc(offsetof(struct sync_file, cbs[1])); | 78 | sync_file = sync_file_alloc(); |
80 | if (!sync_file) | 79 | if (!sync_file) |
81 | return NULL; | 80 | return NULL; |
82 | 81 | ||
83 | sync_file->num_fences = 1; | 82 | sync_file->fence = fence; |
84 | atomic_set(&sync_file->status, 1); | 83 | |
85 | snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%llu-%d", | 84 | snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%llu-%d", |
86 | fence->ops->get_driver_name(fence), | 85 | fence->ops->get_driver_name(fence), |
87 | fence->ops->get_timeline_name(fence), fence->context, | 86 | fence->ops->get_timeline_name(fence), fence->context, |
88 | fence->seqno); | 87 | fence->seqno); |
89 | 88 | ||
90 | sync_file->cbs[0].fence = fence; | ||
91 | sync_file->cbs[0].sync_file = sync_file; | ||
92 | if (fence_add_callback(fence, &sync_file->cbs[0].cb, | ||
93 | fence_check_cb_func)) | ||
94 | atomic_dec(&sync_file->status); | ||
95 | |||
96 | return sync_file; | 89 | return sync_file; |
97 | } | 90 | } |
98 | EXPORT_SYMBOL(sync_file_create); | 91 | EXPORT_SYMBOL(sync_file_create); |
@@ -121,14 +114,72 @@ err: | |||
121 | return NULL; | 114 | return NULL; |
122 | } | 115 | } |
123 | 116 | ||
124 | static void sync_file_add_pt(struct sync_file *sync_file, int *i, | 117 | /** |
125 | struct fence *fence) | 118 | * sync_file_get_fence - get the fence related to the sync_file fd |
119 | * @fd: sync_file fd to get the fence from | ||
120 | * | ||
121 | * Ensures @fd references a valid sync_file and returns a fence that | ||
122 | * represents all fence in the sync_file. On error NULL is returned. | ||
123 | */ | ||
124 | struct fence *sync_file_get_fence(int fd) | ||
125 | { | ||
126 | struct sync_file *sync_file; | ||
127 | struct fence *fence; | ||
128 | |||
129 | sync_file = sync_file_fdget(fd); | ||
130 | if (!sync_file) | ||
131 | return NULL; | ||
132 | |||
133 | fence = fence_get(sync_file->fence); | ||
134 | fput(sync_file->file); | ||
135 | |||
136 | return fence; | ||
137 | } | ||
138 | EXPORT_SYMBOL(sync_file_get_fence); | ||
139 | |||
140 | static int sync_file_set_fence(struct sync_file *sync_file, | ||
141 | struct fence **fences, int num_fences) | ||
126 | { | 142 | { |
127 | sync_file->cbs[*i].fence = fence; | 143 | struct fence_array *array; |
128 | sync_file->cbs[*i].sync_file = sync_file; | 144 | |
145 | /* | ||
146 | * The reference for the fences in the new sync_file and held | ||
147 | * in add_fence() during the merge procedure, so for num_fences == 1 | ||
148 | * we already own a new reference to the fence. For num_fence > 1 | ||
149 | * we own the reference of the fence_array creation. | ||
150 | */ | ||
151 | if (num_fences == 1) { | ||
152 | sync_file->fence = fences[0]; | ||
153 | } else { | ||
154 | array = fence_array_create(num_fences, fences, | ||
155 | fence_context_alloc(1), 1, false); | ||
156 | if (!array) | ||
157 | return -ENOMEM; | ||
158 | |||
159 | sync_file->fence = &array->base; | ||
160 | } | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static struct fence **get_fences(struct sync_file *sync_file, int *num_fences) | ||
166 | { | ||
167 | if (fence_is_array(sync_file->fence)) { | ||
168 | struct fence_array *array = to_fence_array(sync_file->fence); | ||
169 | |||
170 | *num_fences = array->num_fences; | ||
171 | return array->fences; | ||
172 | } | ||
129 | 173 | ||
130 | if (!fence_add_callback(fence, &sync_file->cbs[*i].cb, | 174 | *num_fences = 1; |
131 | fence_check_cb_func)) { | 175 | return &sync_file->fence; |
176 | } | ||
177 | |||
178 | static void add_fence(struct fence **fences, int *i, struct fence *fence) | ||
179 | { | ||
180 | fences[*i] = fence; | ||
181 | |||
182 | if (!fence_is_signaled(fence)) { | ||
132 | fence_get(fence); | 183 | fence_get(fence); |
133 | (*i)++; | 184 | (*i)++; |
134 | } | 185 | } |
@@ -147,16 +198,24 @@ static void sync_file_add_pt(struct sync_file *sync_file, int *i, | |||
147 | static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, | 198 | static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, |
148 | struct sync_file *b) | 199 | struct sync_file *b) |
149 | { | 200 | { |
150 | int num_fences = a->num_fences + b->num_fences; | ||
151 | struct sync_file *sync_file; | 201 | struct sync_file *sync_file; |
152 | int i, i_a, i_b; | 202 | struct fence **fences, **nfences, **a_fences, **b_fences; |
153 | unsigned long size = offsetof(struct sync_file, cbs[num_fences]); | 203 | int i, i_a, i_b, num_fences, a_num_fences, b_num_fences; |
154 | 204 | ||
155 | sync_file = sync_file_alloc(size); | 205 | sync_file = sync_file_alloc(); |
156 | if (!sync_file) | 206 | if (!sync_file) |
157 | return NULL; | 207 | return NULL; |
158 | 208 | ||
159 | atomic_set(&sync_file->status, num_fences); | 209 | a_fences = get_fences(a, &a_num_fences); |
210 | b_fences = get_fences(b, &b_num_fences); | ||
211 | if (a_num_fences > INT_MAX - b_num_fences) | ||
212 | return NULL; | ||
213 | |||
214 | num_fences = a_num_fences + b_num_fences; | ||
215 | |||
216 | fences = kcalloc(num_fences, sizeof(*fences), GFP_KERNEL); | ||
217 | if (!fences) | ||
218 | goto err; | ||
160 | 219 | ||
161 | /* | 220 | /* |
162 | * Assume sync_file a and b are both ordered and have no | 221 | * Assume sync_file a and b are both ordered and have no |
@@ -165,55 +224,71 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, | |||
165 | * If a sync_file can only be created with sync_file_merge | 224 | * If a sync_file can only be created with sync_file_merge |
166 | * and sync_file_create, this is a reasonable assumption. | 225 | * and sync_file_create, this is a reasonable assumption. |
167 | */ | 226 | */ |
168 | for (i = i_a = i_b = 0; i_a < a->num_fences && i_b < b->num_fences; ) { | 227 | for (i = i_a = i_b = 0; i_a < a_num_fences && i_b < b_num_fences; ) { |
169 | struct fence *pt_a = a->cbs[i_a].fence; | 228 | struct fence *pt_a = a_fences[i_a]; |
170 | struct fence *pt_b = b->cbs[i_b].fence; | 229 | struct fence *pt_b = b_fences[i_b]; |
171 | 230 | ||
172 | if (pt_a->context < pt_b->context) { | 231 | if (pt_a->context < pt_b->context) { |
173 | sync_file_add_pt(sync_file, &i, pt_a); | 232 | add_fence(fences, &i, pt_a); |
174 | 233 | ||
175 | i_a++; | 234 | i_a++; |
176 | } else if (pt_a->context > pt_b->context) { | 235 | } else if (pt_a->context > pt_b->context) { |
177 | sync_file_add_pt(sync_file, &i, pt_b); | 236 | add_fence(fences, &i, pt_b); |
178 | 237 | ||
179 | i_b++; | 238 | i_b++; |
180 | } else { | 239 | } else { |
181 | if (pt_a->seqno - pt_b->seqno <= INT_MAX) | 240 | if (pt_a->seqno - pt_b->seqno <= INT_MAX) |
182 | sync_file_add_pt(sync_file, &i, pt_a); | 241 | add_fence(fences, &i, pt_a); |
183 | else | 242 | else |
184 | sync_file_add_pt(sync_file, &i, pt_b); | 243 | add_fence(fences, &i, pt_b); |
185 | 244 | ||
186 | i_a++; | 245 | i_a++; |
187 | i_b++; | 246 | i_b++; |
188 | } | 247 | } |
189 | } | 248 | } |
190 | 249 | ||
191 | for (; i_a < a->num_fences; i_a++) | 250 | for (; i_a < a_num_fences; i_a++) |
192 | sync_file_add_pt(sync_file, &i, a->cbs[i_a].fence); | 251 | add_fence(fences, &i, a_fences[i_a]); |
252 | |||
253 | for (; i_b < b_num_fences; i_b++) | ||
254 | add_fence(fences, &i, b_fences[i_b]); | ||
255 | |||
256 | if (i == 0) { | ||
257 | add_fence(fences, &i, a_fences[0]); | ||
258 | i++; | ||
259 | } | ||
193 | 260 | ||
194 | for (; i_b < b->num_fences; i_b++) | 261 | if (num_fences > i) { |
195 | sync_file_add_pt(sync_file, &i, b->cbs[i_b].fence); | 262 | nfences = krealloc(fences, i * sizeof(*fences), |
263 | GFP_KERNEL); | ||
264 | if (!nfences) | ||
265 | goto err; | ||
196 | 266 | ||
197 | if (num_fences > i) | 267 | fences = nfences; |
198 | atomic_sub(num_fences - i, &sync_file->status); | 268 | } |
199 | sync_file->num_fences = i; | 269 | |
270 | if (sync_file_set_fence(sync_file, fences, i) < 0) { | ||
271 | kfree(fences); | ||
272 | goto err; | ||
273 | } | ||
200 | 274 | ||
201 | strlcpy(sync_file->name, name, sizeof(sync_file->name)); | 275 | strlcpy(sync_file->name, name, sizeof(sync_file->name)); |
202 | return sync_file; | 276 | return sync_file; |
277 | |||
278 | err: | ||
279 | fput(sync_file->file); | ||
280 | return NULL; | ||
281 | |||
203 | } | 282 | } |
204 | 283 | ||
205 | static void sync_file_free(struct kref *kref) | 284 | static void sync_file_free(struct kref *kref) |
206 | { | 285 | { |
207 | struct sync_file *sync_file = container_of(kref, struct sync_file, | 286 | struct sync_file *sync_file = container_of(kref, struct sync_file, |
208 | kref); | 287 | kref); |
209 | int i; | ||
210 | |||
211 | for (i = 0; i < sync_file->num_fences; ++i) { | ||
212 | fence_remove_callback(sync_file->cbs[i].fence, | ||
213 | &sync_file->cbs[i].cb); | ||
214 | fence_put(sync_file->cbs[i].fence); | ||
215 | } | ||
216 | 288 | ||
289 | if (test_bit(POLL_ENABLED, &sync_file->fence->flags)) | ||
290 | fence_remove_callback(sync_file->fence, &sync_file->cb); | ||
291 | fence_put(sync_file->fence); | ||
217 | kfree(sync_file); | 292 | kfree(sync_file); |
218 | } | 293 | } |
219 | 294 | ||
@@ -228,17 +303,16 @@ static int sync_file_release(struct inode *inode, struct file *file) | |||
228 | static unsigned int sync_file_poll(struct file *file, poll_table *wait) | 303 | static unsigned int sync_file_poll(struct file *file, poll_table *wait) |
229 | { | 304 | { |
230 | struct sync_file *sync_file = file->private_data; | 305 | struct sync_file *sync_file = file->private_data; |
231 | int status; | ||
232 | 306 | ||
233 | poll_wait(file, &sync_file->wq, wait); | 307 | poll_wait(file, &sync_file->wq, wait); |
234 | 308 | ||
235 | status = atomic_read(&sync_file->status); | 309 | if (!test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) { |
310 | if (fence_add_callback(sync_file->fence, &sync_file->cb, | ||
311 | fence_check_cb_func) < 0) | ||
312 | wake_up_all(&sync_file->wq); | ||
313 | } | ||
236 | 314 | ||
237 | if (!status) | 315 | return fence_is_signaled(sync_file->fence) ? POLLIN : 0; |
238 | return POLLIN; | ||
239 | if (status < 0) | ||
240 | return POLLERR; | ||
241 | return 0; | ||
242 | } | 316 | } |
243 | 317 | ||
244 | static long sync_file_ioctl_merge(struct sync_file *sync_file, | 318 | static long sync_file_ioctl_merge(struct sync_file *sync_file, |
@@ -315,8 +389,9 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file, | |||
315 | { | 389 | { |
316 | struct sync_file_info info; | 390 | struct sync_file_info info; |
317 | struct sync_fence_info *fence_info = NULL; | 391 | struct sync_fence_info *fence_info = NULL; |
392 | struct fence **fences; | ||
318 | __u32 size; | 393 | __u32 size; |
319 | int ret, i; | 394 | int num_fences, ret, i; |
320 | 395 | ||
321 | if (copy_from_user(&info, (void __user *)arg, sizeof(info))) | 396 | if (copy_from_user(&info, (void __user *)arg, sizeof(info))) |
322 | return -EFAULT; | 397 | return -EFAULT; |
@@ -324,6 +399,8 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file, | |||
324 | if (info.flags || info.pad) | 399 | if (info.flags || info.pad) |
325 | return -EINVAL; | 400 | return -EINVAL; |
326 | 401 | ||
402 | fences = get_fences(sync_file, &num_fences); | ||
403 | |||
327 | /* | 404 | /* |
328 | * Passing num_fences = 0 means that userspace doesn't want to | 405 | * Passing num_fences = 0 means that userspace doesn't want to |
329 | * retrieve any sync_fence_info. If num_fences = 0 we skip filling | 406 | * retrieve any sync_fence_info. If num_fences = 0 we skip filling |
@@ -333,16 +410,16 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file, | |||
333 | if (!info.num_fences) | 410 | if (!info.num_fences) |
334 | goto no_fences; | 411 | goto no_fences; |
335 | 412 | ||
336 | if (info.num_fences < sync_file->num_fences) | 413 | if (info.num_fences < num_fences) |
337 | return -EINVAL; | 414 | return -EINVAL; |
338 | 415 | ||
339 | size = sync_file->num_fences * sizeof(*fence_info); | 416 | size = num_fences * sizeof(*fence_info); |
340 | fence_info = kzalloc(size, GFP_KERNEL); | 417 | fence_info = kzalloc(size, GFP_KERNEL); |
341 | if (!fence_info) | 418 | if (!fence_info) |
342 | return -ENOMEM; | 419 | return -ENOMEM; |
343 | 420 | ||
344 | for (i = 0; i < sync_file->num_fences; ++i) | 421 | for (i = 0; i < num_fences; i++) |
345 | sync_fill_fence_info(sync_file->cbs[i].fence, &fence_info[i]); | 422 | sync_fill_fence_info(fences[i], &fence_info[i]); |
346 | 423 | ||
347 | if (copy_to_user(u64_to_user_ptr(info.sync_fence_info), fence_info, | 424 | if (copy_to_user(u64_to_user_ptr(info.sync_fence_info), fence_info, |
348 | size)) { | 425 | size)) { |
@@ -352,11 +429,8 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file, | |||
352 | 429 | ||
353 | no_fences: | 430 | no_fences: |
354 | strlcpy(info.name, sync_file->name, sizeof(info.name)); | 431 | strlcpy(info.name, sync_file->name, sizeof(info.name)); |
355 | info.status = atomic_read(&sync_file->status); | 432 | info.status = fence_is_signaled(sync_file->fence); |
356 | if (info.status >= 0) | 433 | info.num_fences = num_fences; |
357 | info.status = !info.status; | ||
358 | |||
359 | info.num_fences = sync_file->num_fences; | ||
360 | 434 | ||
361 | if (copy_to_user((void __user *)arg, &info, sizeof(info))) | 435 | if (copy_to_user((void __user *)arg, &info, sizeof(info))) |
362 | ret = -EFAULT; | 436 | ret = -EFAULT; |
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index fc357319de35..fe1e86ea6d27 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -129,12 +129,8 @@ config DRM_R128 | |||
129 | config DRM_RADEON | 129 | config DRM_RADEON |
130 | tristate "ATI Radeon" | 130 | tristate "ATI Radeon" |
131 | depends on DRM && PCI | 131 | depends on DRM && PCI |
132 | select FB_CFB_FILLRECT | ||
133 | select FB_CFB_COPYAREA | ||
134 | select FB_CFB_IMAGEBLIT | ||
135 | select FW_LOADER | 132 | select FW_LOADER |
136 | select DRM_KMS_HELPER | 133 | select DRM_KMS_HELPER |
137 | select DRM_KMS_FB_HELPER | ||
138 | select DRM_TTM | 134 | select DRM_TTM |
139 | select POWER_SUPPLY | 135 | select POWER_SUPPLY |
140 | select HWMON | 136 | select HWMON |
@@ -153,12 +149,8 @@ source "drivers/gpu/drm/radeon/Kconfig" | |||
153 | config DRM_AMDGPU | 149 | config DRM_AMDGPU |
154 | tristate "AMD GPU" | 150 | tristate "AMD GPU" |
155 | depends on DRM && PCI | 151 | depends on DRM && PCI |
156 | select FB_CFB_FILLRECT | ||
157 | select FB_CFB_COPYAREA | ||
158 | select FB_CFB_IMAGEBLIT | ||
159 | select FW_LOADER | 152 | select FW_LOADER |
160 | select DRM_KMS_HELPER | 153 | select DRM_KMS_HELPER |
161 | select DRM_KMS_FB_HELPER | ||
162 | select DRM_TTM | 154 | select DRM_TTM |
163 | select POWER_SUPPLY | 155 | select POWER_SUPPLY |
164 | select HWMON | 156 | select HWMON |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 9aa533cf4ad1..11263c5b9967 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |||
@@ -341,7 +341,7 @@ static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev) | |||
341 | #ifdef CONFIG_X86 | 341 | #ifdef CONFIG_X86 |
342 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 342 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
343 | #endif | 343 | #endif |
344 | remove_conflicting_framebuffers(ap, "amdgpudrmfb", primary); | 344 | drm_fb_helper_remove_conflicting_framebuffers(ap, "amdgpudrmfb", primary); |
345 | kfree(ap); | 345 | kfree(ap); |
346 | 346 | ||
347 | return 0; | 347 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c index 919146780a15..bf033b58056c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | |||
@@ -25,7 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/fb.h> | ||
29 | 28 | ||
30 | #include <drm/drmP.h> | 29 | #include <drm/drmP.h> |
31 | #include <drm/drm_crtc.h> | 30 | #include <drm/drm_crtc.h> |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c index 120a9e2c3152..6483d680bbc8 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | |||
@@ -22,7 +22,6 @@ | |||
22 | */ | 22 | */ |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/fb.h> | ||
26 | #include "linux/delay.h" | 25 | #include "linux/delay.h" |
27 | 26 | ||
28 | #include "hwmgr.h" | 27 | #include "hwmgr.h" |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c index 769636a0c5b5..783dcc3384f1 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | |||
@@ -22,7 +22,6 @@ | |||
22 | */ | 22 | */ |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/fb.h> | ||
26 | #include <asm/div64.h> | 25 | #include <asm/div64.h> |
27 | #include "linux/delay.h" | 26 | #include "linux/delay.h" |
28 | #include "pp_acpi.h" | 27 | #include "pp_acpi.h" |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c index 26f3e30d0fef..1126bd4f74dc 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c | |||
@@ -22,7 +22,6 @@ | |||
22 | */ | 22 | */ |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/fb.h> | ||
26 | 25 | ||
27 | #include "ppatomctrl.h" | 26 | #include "ppatomctrl.h" |
28 | #include "atombios.h" | 27 | #include "atombios.h" |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index c7dc111221c2..7dc4afd19d26 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | |||
@@ -22,7 +22,6 @@ | |||
22 | */ | 22 | */ |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/fb.h> | ||
26 | #include "linux/delay.h" | 25 | #include "linux/delay.h" |
27 | #include "pp_acpi.h" | 26 | #include "pp_acpi.h" |
28 | #include "hwmgr.h" | 27 | #include "hwmgr.h" |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c index cfb647f76cbe..a0ffd4a73d8c 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | |||
@@ -22,7 +22,6 @@ | |||
22 | */ | 22 | */ |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/fb.h> | ||
26 | 25 | ||
27 | #include "tonga_processpptables.h" | 26 | #include "tonga_processpptables.h" |
28 | #include "ppatomctrl.h" | 27 | #include "ppatomctrl.h" |
diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h index 95558fde214b..271d2fb9711c 100644 --- a/drivers/gpu/drm/arm/malidp_drv.h +++ b/drivers/gpu/drm/arm/malidp_drv.h | |||
@@ -49,6 +49,6 @@ void malidp_de_planes_destroy(struct drm_device *drm); | |||
49 | int malidp_crtc_init(struct drm_device *drm); | 49 | int malidp_crtc_init(struct drm_device *drm); |
50 | 50 | ||
51 | /* often used combination of rotational bits */ | 51 | /* often used combination of rotational bits */ |
52 | #define MALIDP_ROTATED_MASK (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)) | 52 | #define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270) |
53 | 53 | ||
54 | #endif /* __MALIDP_DRV_H__ */ | 54 | #endif /* __MALIDP_DRV_H__ */ |
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 725098d6179a..82c193e5e0d6 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c | |||
@@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *plane, | |||
108 | return -EINVAL; | 108 | return -EINVAL; |
109 | 109 | ||
110 | /* packed RGB888 / BGR888 can't be rotated or flipped */ | 110 | /* packed RGB888 / BGR888 can't be rotated or flipped */ |
111 | if (state->rotation != BIT(DRM_ROTATE_0) && | 111 | if (state->rotation != DRM_ROTATE_0 && |
112 | (state->fb->pixel_format == DRM_FORMAT_RGB888 || | 112 | (state->fb->pixel_format == DRM_FORMAT_RGB888 || |
113 | state->fb->pixel_format == DRM_FORMAT_BGR888)) | 113 | state->fb->pixel_format == DRM_FORMAT_BGR888)) |
114 | return -EINVAL; | 114 | return -EINVAL; |
@@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane *plane, | |||
188 | /* setup the rotation and axis flip bits */ | 188 | /* setup the rotation and axis flip bits */ |
189 | if (plane->state->rotation & DRM_ROTATE_MASK) | 189 | if (plane->state->rotation & DRM_ROTATE_MASK) |
190 | val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET; | 190 | val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET; |
191 | if (plane->state->rotation & BIT(DRM_REFLECT_X)) | 191 | if (plane->state->rotation & DRM_REFLECT_X) |
192 | val |= LAYER_V_FLIP; | 192 | val |= LAYER_V_FLIP; |
193 | if (plane->state->rotation & BIT(DRM_REFLECT_Y)) | 193 | if (plane->state->rotation & DRM_REFLECT_Y) |
194 | val |= LAYER_H_FLIP; | 194 | val |= LAYER_H_FLIP; |
195 | 195 | ||
196 | /* set the 'enable layer' bit */ | 196 | /* set the 'enable layer' bit */ |
@@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm) | |||
255 | goto cleanup; | 255 | goto cleanup; |
256 | 256 | ||
257 | if (!drm->mode_config.rotation_property) { | 257 | if (!drm->mode_config.rotation_property) { |
258 | unsigned long flags = BIT(DRM_ROTATE_0) | | 258 | unsigned long flags = DRM_ROTATE_0 | |
259 | BIT(DRM_ROTATE_90) | | 259 | DRM_ROTATE_90 | |
260 | BIT(DRM_ROTATE_180) | | 260 | DRM_ROTATE_180 | |
261 | BIT(DRM_ROTATE_270) | | 261 | DRM_ROTATE_270 | |
262 | BIT(DRM_REFLECT_X) | | 262 | DRM_REFLECT_X | |
263 | BIT(DRM_REFLECT_Y); | 263 | DRM_REFLECT_Y; |
264 | drm->mode_config.rotation_property = | 264 | drm->mode_config.rotation_property = |
265 | drm_mode_create_rotation_property(drm, flags); | 265 | drm_mode_create_rotation_property(drm, flags); |
266 | } | 266 | } |
@@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm) | |||
268 | if (drm->mode_config.rotation_property && (id != DE_SMART)) | 268 | if (drm->mode_config.rotation_property && (id != DE_SMART)) |
269 | drm_object_attach_property(&plane->base.base, | 269 | drm_object_attach_property(&plane->base.base, |
270 | drm->mode_config.rotation_property, | 270 | drm->mode_config.rotation_property, |
271 | BIT(DRM_ROTATE_0)); | 271 | DRM_ROTATE_0); |
272 | 272 | ||
273 | drm_plane_helper_add(&plane->base, | 273 | drm_plane_helper_add(&plane->base, |
274 | &malidp_de_plane_helper_funcs); | 274 | &malidp_de_plane_helper_funcs); |
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c index 7d03c51abcb9..ca73ad8614fe 100644 --- a/drivers/gpu/drm/armada/armada_fbdev.c +++ b/drivers/gpu/drm/armada/armada_fbdev.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
10 | #include <linux/fb.h> | ||
11 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
13 | 12 | ||
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c index 1ee707ef6b8d..152b4e716269 100644 --- a/drivers/gpu/drm/armada/armada_overlay.c +++ b/drivers/gpu/drm/armada/armada_overlay.c | |||
@@ -121,7 +121,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
121 | int ret; | 121 | int ret; |
122 | 122 | ||
123 | ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip, | 123 | ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip, |
124 | BIT(DRM_ROTATE_0), | 124 | DRM_ROTATE_0, |
125 | 0, INT_MAX, true, false, &visible); | 125 | 0, INT_MAX, true, false, &visible); |
126 | if (ret) | 126 | if (ret) |
127 | return ret; | 127 | return ret; |
diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c index c017a9330a18..7a86e24e2687 100644 --- a/drivers/gpu/drm/ast/ast_fb.c +++ b/drivers/gpu/drm/ast/ast_fb.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/tty.h> | 33 | #include <linux/tty.h> |
34 | #include <linux/sysrq.h> | 34 | #include <linux/sysrq.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/fb.h> | ||
37 | #include <linux/init.h> | 36 | #include <linux/init.h> |
38 | 37 | ||
39 | 38 | ||
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index 016c191221f3..146809a97a07 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | |||
@@ -393,7 +393,7 @@ static void atmel_hlcdc_plane_update_format(struct atmel_hlcdc_plane *plane, | |||
393 | 393 | ||
394 | if ((state->base.fb->pixel_format == DRM_FORMAT_YUV422 || | 394 | if ((state->base.fb->pixel_format == DRM_FORMAT_YUV422 || |
395 | state->base.fb->pixel_format == DRM_FORMAT_NV61) && | 395 | state->base.fb->pixel_format == DRM_FORMAT_NV61) && |
396 | (state->base.rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)))) | 396 | (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270))) |
397 | cfg |= ATMEL_HLCDC_YUV422ROT; | 397 | cfg |= ATMEL_HLCDC_YUV422ROT; |
398 | 398 | ||
399 | atmel_hlcdc_layer_update_cfg(&plane->layer, | 399 | atmel_hlcdc_layer_update_cfg(&plane->layer, |
@@ -628,7 +628,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, | |||
628 | /* | 628 | /* |
629 | * Swap width and size in case of 90 or 270 degrees rotation | 629 | * Swap width and size in case of 90 or 270 degrees rotation |
630 | */ | 630 | */ |
631 | if (state->base.rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) { | 631 | if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) { |
632 | tmp = state->crtc_w; | 632 | tmp = state->crtc_w; |
633 | state->crtc_w = state->crtc_h; | 633 | state->crtc_w = state->crtc_h; |
634 | state->crtc_h = tmp; | 634 | state->crtc_h = tmp; |
@@ -677,7 +677,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, | |||
677 | return -EINVAL; | 677 | return -EINVAL; |
678 | 678 | ||
679 | switch (state->base.rotation & DRM_ROTATE_MASK) { | 679 | switch (state->base.rotation & DRM_ROTATE_MASK) { |
680 | case BIT(DRM_ROTATE_90): | 680 | case DRM_ROTATE_90: |
681 | offset = ((y_offset + state->src_y + patched_src_w - 1) / | 681 | offset = ((y_offset + state->src_y + patched_src_w - 1) / |
682 | ydiv) * fb->pitches[i]; | 682 | ydiv) * fb->pitches[i]; |
683 | offset += ((x_offset + state->src_x) / xdiv) * | 683 | offset += ((x_offset + state->src_x) / xdiv) * |
@@ -686,7 +686,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, | |||
686 | fb->pitches[i]; | 686 | fb->pitches[i]; |
687 | state->pstride[i] = -fb->pitches[i] - state->bpp[i]; | 687 | state->pstride[i] = -fb->pitches[i] - state->bpp[i]; |
688 | break; | 688 | break; |
689 | case BIT(DRM_ROTATE_180): | 689 | case DRM_ROTATE_180: |
690 | offset = ((y_offset + state->src_y + patched_src_h - 1) / | 690 | offset = ((y_offset + state->src_y + patched_src_h - 1) / |
691 | ydiv) * fb->pitches[i]; | 691 | ydiv) * fb->pitches[i]; |
692 | offset += ((x_offset + state->src_x + patched_src_w - 1) / | 692 | offset += ((x_offset + state->src_x + patched_src_w - 1) / |
@@ -695,7 +695,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, | |||
695 | state->bpp[i]) - fb->pitches[i]; | 695 | state->bpp[i]) - fb->pitches[i]; |
696 | state->pstride[i] = -2 * state->bpp[i]; | 696 | state->pstride[i] = -2 * state->bpp[i]; |
697 | break; | 697 | break; |
698 | case BIT(DRM_ROTATE_270): | 698 | case DRM_ROTATE_270: |
699 | offset = ((y_offset + state->src_y) / ydiv) * | 699 | offset = ((y_offset + state->src_y) / ydiv) * |
700 | fb->pitches[i]; | 700 | fb->pitches[i]; |
701 | offset += ((x_offset + state->src_x + patched_src_h - 1) / | 701 | offset += ((x_offset + state->src_x + patched_src_h - 1) / |
@@ -705,7 +705,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, | |||
705 | (2 * state->bpp[i]); | 705 | (2 * state->bpp[i]); |
706 | state->pstride[i] = fb->pitches[i] - state->bpp[i]; | 706 | state->pstride[i] = fb->pitches[i] - state->bpp[i]; |
707 | break; | 707 | break; |
708 | case BIT(DRM_ROTATE_0): | 708 | case DRM_ROTATE_0: |
709 | default: | 709 | default: |
710 | offset = ((y_offset + state->src_y) / ydiv) * | 710 | offset = ((y_offset + state->src_y) / ydiv) * |
711 | fb->pitches[i]; | 711 | fb->pitches[i]; |
@@ -905,7 +905,7 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane, | |||
905 | if (desc->layout.xstride && desc->layout.pstride) | 905 | if (desc->layout.xstride && desc->layout.pstride) |
906 | drm_object_attach_property(&plane->base.base, | 906 | drm_object_attach_property(&plane->base.base, |
907 | plane->base.dev->mode_config.rotation_property, | 907 | plane->base.dev->mode_config.rotation_property, |
908 | BIT(DRM_ROTATE_0)); | 908 | DRM_ROTATE_0); |
909 | 909 | ||
910 | if (desc->layout.csc) { | 910 | if (desc->layout.csc) { |
911 | /* | 911 | /* |
@@ -1056,10 +1056,10 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev) | |||
1056 | 1056 | ||
1057 | dev->mode_config.rotation_property = | 1057 | dev->mode_config.rotation_property = |
1058 | drm_mode_create_rotation_property(dev, | 1058 | drm_mode_create_rotation_property(dev, |
1059 | BIT(DRM_ROTATE_0) | | 1059 | DRM_ROTATE_0 | |
1060 | BIT(DRM_ROTATE_90) | | 1060 | DRM_ROTATE_90 | |
1061 | BIT(DRM_ROTATE_180) | | 1061 | DRM_ROTATE_180 | |
1062 | BIT(DRM_ROTATE_270)); | 1062 | DRM_ROTATE_270); |
1063 | if (!dev->mode_config.rotation_property) | 1063 | if (!dev->mode_config.rotation_property) |
1064 | return ERR_PTR(-ENOMEM); | 1064 | return ERR_PTR(-ENOMEM); |
1065 | 1065 | ||
diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h index 19b5adaebe24..32dfe418cc98 100644 --- a/drivers/gpu/drm/bochs/bochs.h +++ b/drivers/gpu/drm/bochs/bochs.h | |||
@@ -1,5 +1,4 @@ | |||
1 | #include <linux/io.h> | 1 | #include <linux/io.h> |
2 | #include <linux/fb.h> | ||
3 | #include <linux/console.h> | 2 | #include <linux/console.h> |
4 | 3 | ||
5 | #include <drm/drmP.h> | 4 | #include <drm/drmP.h> |
diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c index abace82de6ea..277654abe0f7 100644 --- a/drivers/gpu/drm/bochs/bochs_drv.c +++ b/drivers/gpu/drm/bochs/bochs_drv.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
11 | #include <drm/drm_fb_helper.h> | ||
11 | 12 | ||
12 | #include "bochs.h" | 13 | #include "bochs.h" |
13 | 14 | ||
@@ -153,7 +154,7 @@ static int bochs_kick_out_firmware_fb(struct pci_dev *pdev) | |||
153 | 154 | ||
154 | ap->ranges[0].base = pci_resource_start(pdev, 0); | 155 | ap->ranges[0].base = pci_resource_start(pdev, 0); |
155 | ap->ranges[0].size = pci_resource_len(pdev, 0); | 156 | ap->ranges[0].size = pci_resource_len(pdev, 0); |
156 | remove_conflicting_framebuffers(ap, "bochsdrmfb", false); | 157 | drm_fb_helper_remove_conflicting_framebuffers(ap, "bochsdrmfb", false); |
157 | kfree(ap); | 158 | kfree(ap); |
158 | 159 | ||
159 | return 0; | 160 | return 0; |
diff --git a/drivers/gpu/drm/bridge/parade-ps8622.c b/drivers/gpu/drm/bridge/parade-ps8622.c index 583b8ce614e3..f1b39a2645cc 100644 --- a/drivers/gpu/drm/bridge/parade-ps8622.c +++ b/drivers/gpu/drm/bridge/parade-ps8622.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/backlight.h> | 16 | #include <linux/backlight.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
19 | #include <linux/fb.h> | ||
20 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
21 | #include <linux/gpio/consumer.h> | 20 | #include <linux/gpio/consumer.h> |
22 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c index b05f7eae32ce..6c76d125995b 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.c +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c | |||
@@ -57,7 +57,7 @@ static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev) | |||
57 | #ifdef CONFIG_X86 | 57 | #ifdef CONFIG_X86 |
58 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 58 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
59 | #endif | 59 | #endif |
60 | remove_conflicting_framebuffers(ap, "cirrusdrmfb", primary); | 60 | drm_fb_helper_remove_conflicting_framebuffers(ap, "cirrusdrmfb", primary); |
61 | kfree(ap); | 61 | kfree(ap); |
62 | 62 | ||
63 | return 0; | 63 | return 0; |
diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c index 3b5be7272357..daecf1ad76a4 100644 --- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c +++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c | |||
@@ -13,8 +13,6 @@ | |||
13 | #include <drm/drm_fb_helper.h> | 13 | #include <drm/drm_fb_helper.h> |
14 | #include <drm/drm_crtc_helper.h> | 14 | #include <drm/drm_crtc_helper.h> |
15 | 15 | ||
16 | #include <linux/fb.h> | ||
17 | |||
18 | #include "cirrus_drv.h" | 16 | #include "cirrus_drv.h" |
19 | 17 | ||
20 | static void cirrus_dirty_update(struct cirrus_fbdev *afbdev, | 18 | static void cirrus_dirty_update(struct cirrus_fbdev *afbdev, |
diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c index 605bd243fb36..d621c8a4cf00 100644 --- a/drivers/gpu/drm/drm_agpsupport.c +++ b/drivers/gpu/drm/drm_agpsupport.c | |||
@@ -430,9 +430,7 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) | |||
430 | * intact so it can still be used. It is safe to call this if AGP is disabled or | 430 | * intact so it can still be used. It is safe to call this if AGP is disabled or |
431 | * was already removed. | 431 | * was already removed. |
432 | * | 432 | * |
433 | * If DRIVER_MODESET is active, nothing is done to protect the modesetting | 433 | * Cleanup is only done for drivers who have DRIVER_LEGACY set. |
434 | * resources from getting destroyed. Drivers are responsible of cleaning them up | ||
435 | * during device shutdown. | ||
436 | */ | 434 | */ |
437 | void drm_legacy_agp_clear(struct drm_device *dev) | 435 | void drm_legacy_agp_clear(struct drm_device *dev) |
438 | { | 436 | { |
@@ -440,7 +438,7 @@ void drm_legacy_agp_clear(struct drm_device *dev) | |||
440 | 438 | ||
441 | if (!dev->agp) | 439 | if (!dev->agp) |
442 | return; | 440 | return; |
443 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 441 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
444 | return; | 442 | return; |
445 | 443 | ||
446 | list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) { | 444 | list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) { |
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 99365087645b..e1f5de274913 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
@@ -1635,6 +1635,9 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev, | |||
1635 | 1635 | ||
1636 | funcs = plane->helper_private; | 1636 | funcs = plane->helper_private; |
1637 | 1637 | ||
1638 | if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc)) | ||
1639 | continue; | ||
1640 | |||
1638 | if (funcs->prepare_fb) { | 1641 | if (funcs->prepare_fb) { |
1639 | ret = funcs->prepare_fb(plane, plane_state); | 1642 | ret = funcs->prepare_fb(plane, plane_state); |
1640 | if (ret) | 1643 | if (ret) |
@@ -1651,11 +1654,13 @@ fail: | |||
1651 | if (j >= i) | 1654 | if (j >= i) |
1652 | continue; | 1655 | continue; |
1653 | 1656 | ||
1657 | if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc)) | ||
1658 | continue; | ||
1659 | |||
1654 | funcs = plane->helper_private; | 1660 | funcs = plane->helper_private; |
1655 | 1661 | ||
1656 | if (funcs->cleanup_fb) | 1662 | if (funcs->cleanup_fb) |
1657 | funcs->cleanup_fb(plane, plane_state); | 1663 | funcs->cleanup_fb(plane, plane_state); |
1658 | |||
1659 | } | 1664 | } |
1660 | 1665 | ||
1661 | return ret; | 1666 | return ret; |
@@ -1898,6 +1903,9 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev, | |||
1898 | for_each_plane_in_state(old_state, plane, plane_state, i) { | 1903 | for_each_plane_in_state(old_state, plane, plane_state, i) { |
1899 | const struct drm_plane_helper_funcs *funcs; | 1904 | const struct drm_plane_helper_funcs *funcs; |
1900 | 1905 | ||
1906 | if (!drm_atomic_helper_framebuffer_changed(dev, old_state, plane_state->crtc)) | ||
1907 | continue; | ||
1908 | |||
1901 | funcs = plane->helper_private; | 1909 | funcs = plane->helper_private; |
1902 | 1910 | ||
1903 | if (funcs->cleanup_fb) | 1911 | if (funcs->cleanup_fb) |
@@ -2358,7 +2366,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set, | |||
2358 | primary_state->crtc_h = vdisplay; | 2366 | primary_state->crtc_h = vdisplay; |
2359 | primary_state->src_x = set->x << 16; | 2367 | primary_state->src_x = set->x << 16; |
2360 | primary_state->src_y = set->y << 16; | 2368 | primary_state->src_y = set->y << 16; |
2361 | if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) { | 2369 | if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) { |
2362 | primary_state->src_w = vdisplay << 16; | 2370 | primary_state->src_w = vdisplay << 16; |
2363 | primary_state->src_h = hdisplay << 16; | 2371 | primary_state->src_h = hdisplay << 16; |
2364 | } else { | 2372 | } else { |
@@ -3043,7 +3051,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane) | |||
3043 | 3051 | ||
3044 | if (plane->state) { | 3052 | if (plane->state) { |
3045 | plane->state->plane = plane; | 3053 | plane->state->plane = plane; |
3046 | plane->state->rotation = BIT(DRM_ROTATE_0); | 3054 | plane->state->rotation = DRM_ROTATE_0; |
3047 | } | 3055 | } |
3048 | } | 3056 | } |
3049 | EXPORT_SYMBOL(drm_atomic_helper_plane_reset); | 3057 | EXPORT_SYMBOL(drm_atomic_helper_plane_reset); |
diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c index 4153e8a193af..6b143514a566 100644 --- a/drivers/gpu/drm/drm_auth.c +++ b/drivers/gpu/drm/drm_auth.c | |||
@@ -251,7 +251,7 @@ void drm_master_release(struct drm_file *file_priv) | |||
251 | if (!drm_is_current_master(file_priv)) | 251 | if (!drm_is_current_master(file_priv)) |
252 | goto out; | 252 | goto out; |
253 | 253 | ||
254 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) { | 254 | if (drm_core_check_feature(dev, DRIVER_LEGACY)) { |
255 | /* | 255 | /* |
256 | * Since the master is disappearing, so is the | 256 | * Since the master is disappearing, so is the |
257 | * possibility to lock. | 257 | * possibility to lock. |
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index c3a12cd8bd0d..32191513e82d 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -397,7 +397,7 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data, | |||
397 | return -EPERM; | 397 | return -EPERM; |
398 | 398 | ||
399 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 399 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
400 | drm_core_check_feature(dev, DRIVER_MODESET)) | 400 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
401 | return -EINVAL; | 401 | return -EINVAL; |
402 | 402 | ||
403 | err = drm_addmap_core(dev, map->offset, map->size, map->type, | 403 | err = drm_addmap_core(dev, map->offset, map->size, map->type, |
@@ -443,7 +443,7 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data, | |||
443 | int i; | 443 | int i; |
444 | 444 | ||
445 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 445 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
446 | drm_core_check_feature(dev, DRIVER_MODESET)) | 446 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
447 | return -EINVAL; | 447 | return -EINVAL; |
448 | 448 | ||
449 | idx = map->offset; | 449 | idx = map->offset; |
@@ -545,7 +545,7 @@ EXPORT_SYMBOL(drm_legacy_rmmap_locked); | |||
545 | void drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map) | 545 | void drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map) |
546 | { | 546 | { |
547 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 547 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
548 | drm_core_check_feature(dev, DRIVER_MODESET)) | 548 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
549 | return; | 549 | return; |
550 | 550 | ||
551 | mutex_lock(&dev->struct_mutex); | 551 | mutex_lock(&dev->struct_mutex); |
@@ -558,7 +558,7 @@ void drm_legacy_master_rmmaps(struct drm_device *dev, struct drm_master *master) | |||
558 | { | 558 | { |
559 | struct drm_map_list *r_list, *list_temp; | 559 | struct drm_map_list *r_list, *list_temp; |
560 | 560 | ||
561 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 561 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
562 | return; | 562 | return; |
563 | 563 | ||
564 | mutex_lock(&dev->struct_mutex); | 564 | mutex_lock(&dev->struct_mutex); |
@@ -595,7 +595,7 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data, | |||
595 | int ret; | 595 | int ret; |
596 | 596 | ||
597 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 597 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
598 | drm_core_check_feature(dev, DRIVER_MODESET)) | 598 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
599 | return -EINVAL; | 599 | return -EINVAL; |
600 | 600 | ||
601 | mutex_lock(&dev->struct_mutex); | 601 | mutex_lock(&dev->struct_mutex); |
@@ -1220,7 +1220,7 @@ int drm_legacy_addbufs(struct drm_device *dev, void *data, | |||
1220 | struct drm_buf_desc *request = data; | 1220 | struct drm_buf_desc *request = data; |
1221 | int ret; | 1221 | int ret; |
1222 | 1222 | ||
1223 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 1223 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
1224 | return -EINVAL; | 1224 | return -EINVAL; |
1225 | 1225 | ||
1226 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) | 1226 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) |
@@ -1266,7 +1266,7 @@ int drm_legacy_infobufs(struct drm_device *dev, void *data, | |||
1266 | int i; | 1266 | int i; |
1267 | int count; | 1267 | int count; |
1268 | 1268 | ||
1269 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 1269 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
1270 | return -EINVAL; | 1270 | return -EINVAL; |
1271 | 1271 | ||
1272 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) | 1272 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) |
@@ -1347,7 +1347,7 @@ int drm_legacy_markbufs(struct drm_device *dev, void *data, | |||
1347 | int order; | 1347 | int order; |
1348 | struct drm_buf_entry *entry; | 1348 | struct drm_buf_entry *entry; |
1349 | 1349 | ||
1350 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 1350 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
1351 | return -EINVAL; | 1351 | return -EINVAL; |
1352 | 1352 | ||
1353 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) | 1353 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) |
@@ -1395,7 +1395,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data, | |||
1395 | int idx; | 1395 | int idx; |
1396 | struct drm_buf *buf; | 1396 | struct drm_buf *buf; |
1397 | 1397 | ||
1398 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 1398 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
1399 | return -EINVAL; | 1399 | return -EINVAL; |
1400 | 1400 | ||
1401 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) | 1401 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) |
@@ -1450,7 +1450,7 @@ int drm_legacy_mapbufs(struct drm_device *dev, void *data, | |||
1450 | struct drm_buf_map *request = data; | 1450 | struct drm_buf_map *request = data; |
1451 | int i; | 1451 | int i; |
1452 | 1452 | ||
1453 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 1453 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
1454 | return -EINVAL; | 1454 | return -EINVAL; |
1455 | 1455 | ||
1456 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) | 1456 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) |
@@ -1530,7 +1530,7 @@ int drm_legacy_mapbufs(struct drm_device *dev, void *data, | |||
1530 | int drm_legacy_dma_ioctl(struct drm_device *dev, void *data, | 1530 | int drm_legacy_dma_ioctl(struct drm_device *dev, void *data, |
1531 | struct drm_file *file_priv) | 1531 | struct drm_file *file_priv) |
1532 | { | 1532 | { |
1533 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 1533 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
1534 | return -EINVAL; | 1534 | return -EINVAL; |
1535 | 1535 | ||
1536 | if (dev->driver->dma_ioctl) | 1536 | if (dev->driver->dma_ioctl) |
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c index 192a5f9eeb74..3c4000facb36 100644 --- a/drivers/gpu/drm/drm_context.c +++ b/drivers/gpu/drm/drm_context.c | |||
@@ -54,7 +54,7 @@ struct drm_ctx_list { | |||
54 | void drm_legacy_ctxbitmap_free(struct drm_device * dev, int ctx_handle) | 54 | void drm_legacy_ctxbitmap_free(struct drm_device * dev, int ctx_handle) |
55 | { | 55 | { |
56 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 56 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
57 | drm_core_check_feature(dev, DRIVER_MODESET)) | 57 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
58 | return; | 58 | return; |
59 | 59 | ||
60 | mutex_lock(&dev->struct_mutex); | 60 | mutex_lock(&dev->struct_mutex); |
@@ -92,7 +92,7 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * dev) | |||
92 | void drm_legacy_ctxbitmap_init(struct drm_device * dev) | 92 | void drm_legacy_ctxbitmap_init(struct drm_device * dev) |
93 | { | 93 | { |
94 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 94 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
95 | drm_core_check_feature(dev, DRIVER_MODESET)) | 95 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
96 | return; | 96 | return; |
97 | 97 | ||
98 | idr_init(&dev->ctx_idr); | 98 | idr_init(&dev->ctx_idr); |
@@ -109,7 +109,7 @@ void drm_legacy_ctxbitmap_init(struct drm_device * dev) | |||
109 | void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev) | 109 | void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev) |
110 | { | 110 | { |
111 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 111 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
112 | drm_core_check_feature(dev, DRIVER_MODESET)) | 112 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
113 | return; | 113 | return; |
114 | 114 | ||
115 | mutex_lock(&dev->struct_mutex); | 115 | mutex_lock(&dev->struct_mutex); |
@@ -131,7 +131,7 @@ void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file) | |||
131 | struct drm_ctx_list *pos, *tmp; | 131 | struct drm_ctx_list *pos, *tmp; |
132 | 132 | ||
133 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 133 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
134 | drm_core_check_feature(dev, DRIVER_MODESET)) | 134 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
135 | return; | 135 | return; |
136 | 136 | ||
137 | mutex_lock(&dev->ctxlist_mutex); | 137 | mutex_lock(&dev->ctxlist_mutex); |
@@ -177,7 +177,7 @@ int drm_legacy_getsareactx(struct drm_device *dev, void *data, | |||
177 | struct drm_map_list *_entry; | 177 | struct drm_map_list *_entry; |
178 | 178 | ||
179 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 179 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
180 | drm_core_check_feature(dev, DRIVER_MODESET)) | 180 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
181 | return -EINVAL; | 181 | return -EINVAL; |
182 | 182 | ||
183 | mutex_lock(&dev->struct_mutex); | 183 | mutex_lock(&dev->struct_mutex); |
@@ -225,7 +225,7 @@ int drm_legacy_setsareactx(struct drm_device *dev, void *data, | |||
225 | struct drm_map_list *r_list = NULL; | 225 | struct drm_map_list *r_list = NULL; |
226 | 226 | ||
227 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 227 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
228 | drm_core_check_feature(dev, DRIVER_MODESET)) | 228 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
229 | return -EINVAL; | 229 | return -EINVAL; |
230 | 230 | ||
231 | mutex_lock(&dev->struct_mutex); | 231 | mutex_lock(&dev->struct_mutex); |
@@ -329,7 +329,7 @@ int drm_legacy_resctx(struct drm_device *dev, void *data, | |||
329 | int i; | 329 | int i; |
330 | 330 | ||
331 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 331 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
332 | drm_core_check_feature(dev, DRIVER_MODESET)) | 332 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
333 | return -EINVAL; | 333 | return -EINVAL; |
334 | 334 | ||
335 | if (res->count >= DRM_RESERVED_CONTEXTS) { | 335 | if (res->count >= DRM_RESERVED_CONTEXTS) { |
@@ -363,7 +363,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data, | |||
363 | struct drm_ctx *ctx = data; | 363 | struct drm_ctx *ctx = data; |
364 | 364 | ||
365 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 365 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
366 | drm_core_check_feature(dev, DRIVER_MODESET)) | 366 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
367 | return -EINVAL; | 367 | return -EINVAL; |
368 | 368 | ||
369 | ctx->handle = drm_legacy_ctxbitmap_next(dev); | 369 | ctx->handle = drm_legacy_ctxbitmap_next(dev); |
@@ -410,7 +410,7 @@ int drm_legacy_getctx(struct drm_device *dev, void *data, | |||
410 | struct drm_ctx *ctx = data; | 410 | struct drm_ctx *ctx = data; |
411 | 411 | ||
412 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 412 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
413 | drm_core_check_feature(dev, DRIVER_MODESET)) | 413 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
414 | return -EINVAL; | 414 | return -EINVAL; |
415 | 415 | ||
416 | /* This is 0, because we don't handle any context flags */ | 416 | /* This is 0, because we don't handle any context flags */ |
@@ -436,7 +436,7 @@ int drm_legacy_switchctx(struct drm_device *dev, void *data, | |||
436 | struct drm_ctx *ctx = data; | 436 | struct drm_ctx *ctx = data; |
437 | 437 | ||
438 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 438 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
439 | drm_core_check_feature(dev, DRIVER_MODESET)) | 439 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
440 | return -EINVAL; | 440 | return -EINVAL; |
441 | 441 | ||
442 | DRM_DEBUG("%d\n", ctx->handle); | 442 | DRM_DEBUG("%d\n", ctx->handle); |
@@ -460,7 +460,7 @@ int drm_legacy_newctx(struct drm_device *dev, void *data, | |||
460 | struct drm_ctx *ctx = data; | 460 | struct drm_ctx *ctx = data; |
461 | 461 | ||
462 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 462 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
463 | drm_core_check_feature(dev, DRIVER_MODESET)) | 463 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
464 | return -EINVAL; | 464 | return -EINVAL; |
465 | 465 | ||
466 | DRM_DEBUG("%d\n", ctx->handle); | 466 | DRM_DEBUG("%d\n", ctx->handle); |
@@ -486,7 +486,7 @@ int drm_legacy_rmctx(struct drm_device *dev, void *data, | |||
486 | struct drm_ctx *ctx = data; | 486 | struct drm_ctx *ctx = data; |
487 | 487 | ||
488 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | 488 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && |
489 | drm_core_check_feature(dev, DRIVER_MODESET)) | 489 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
490 | return -EINVAL; | 490 | return -EINVAL; |
491 | 491 | ||
492 | DRM_DEBUG("%d\n", ctx->handle); | 492 | DRM_DEBUG("%d\n", ctx->handle); |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index b1dbb60af99f..e92bb9d3f90f 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -2802,8 +2802,8 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc, | |||
2802 | drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay); | 2802 | drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay); |
2803 | 2803 | ||
2804 | if (crtc->state && | 2804 | if (crtc->state && |
2805 | crtc->primary->state->rotation & (BIT(DRM_ROTATE_90) | | 2805 | crtc->primary->state->rotation & (DRM_ROTATE_90 | |
2806 | BIT(DRM_ROTATE_270))) | 2806 | DRM_ROTATE_270)) |
2807 | swap(hdisplay, vdisplay); | 2807 | swap(hdisplay, vdisplay); |
2808 | 2808 | ||
2809 | return check_src_coords(x << 16, y << 16, | 2809 | return check_src_coords(x << 16, y << 16, |
@@ -5644,9 +5644,9 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, | |||
5644 | * Eg. if the hardware supports everything except DRM_REFLECT_X | 5644 | * Eg. if the hardware supports everything except DRM_REFLECT_X |
5645 | * one could call this function like this: | 5645 | * one could call this function like this: |
5646 | * | 5646 | * |
5647 | * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) | | 5647 | * drm_rotation_simplify(rotation, DRM_ROTATE_0 | |
5648 | * BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) | | 5648 | * DRM_ROTATE_90 | DRM_ROTATE_180 | |
5649 | * BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y)); | 5649 | * DRM_ROTATE_270 | DRM_REFLECT_Y); |
5650 | * | 5650 | * |
5651 | * to eliminate the DRM_ROTATE_X flag. Depending on what kind of | 5651 | * to eliminate the DRM_ROTATE_X flag. Depending on what kind of |
5652 | * transforms the hardware supports, this function may not | 5652 | * transforms the hardware supports, this function may not |
@@ -5657,7 +5657,7 @@ unsigned int drm_rotation_simplify(unsigned int rotation, | |||
5657 | unsigned int supported_rotations) | 5657 | unsigned int supported_rotations) |
5658 | { | 5658 | { |
5659 | if (rotation & ~supported_rotations) { | 5659 | if (rotation & ~supported_rotations) { |
5660 | rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y); | 5660 | rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y; |
5661 | rotation = (rotation & DRM_REFLECT_MASK) | | 5661 | rotation = (rotation & DRM_REFLECT_MASK) | |
5662 | BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4); | 5662 | BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4); |
5663 | } | 5663 | } |
@@ -5786,12 +5786,12 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev, | |||
5786 | unsigned int supported_rotations) | 5786 | unsigned int supported_rotations) |
5787 | { | 5787 | { |
5788 | static const struct drm_prop_enum_list props[] = { | 5788 | static const struct drm_prop_enum_list props[] = { |
5789 | { DRM_ROTATE_0, "rotate-0" }, | 5789 | { __builtin_ffs(DRM_ROTATE_0) - 1, "rotate-0" }, |
5790 | { DRM_ROTATE_90, "rotate-90" }, | 5790 | { __builtin_ffs(DRM_ROTATE_90) - 1, "rotate-90" }, |
5791 | { DRM_ROTATE_180, "rotate-180" }, | 5791 | { __builtin_ffs(DRM_ROTATE_180) - 1, "rotate-180" }, |
5792 | { DRM_ROTATE_270, "rotate-270" }, | 5792 | { __builtin_ffs(DRM_ROTATE_270) - 1, "rotate-270" }, |
5793 | { DRM_REFLECT_X, "reflect-x" }, | 5793 | { __builtin_ffs(DRM_REFLECT_X) - 1, "reflect-x" }, |
5794 | { DRM_REFLECT_Y, "reflect-y" }, | 5794 | { __builtin_ffs(DRM_REFLECT_Y) - 1, "reflect-y" }, |
5795 | }; | 5795 | }; |
5796 | 5796 | ||
5797 | return drm_property_create_bitmask(dev, 0, "rotation", | 5797 | return drm_property_create_bitmask(dev, 0, "rotation", |
diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c index ea481800ef56..3f83e2ca80ad 100644 --- a/drivers/gpu/drm/drm_dma.c +++ b/drivers/gpu/drm/drm_dma.c | |||
@@ -50,9 +50,8 @@ int drm_legacy_dma_setup(struct drm_device *dev) | |||
50 | int i; | 50 | int i; |
51 | 51 | ||
52 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) || | 52 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) || |
53 | drm_core_check_feature(dev, DRIVER_MODESET)) { | 53 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
54 | return 0; | 54 | return 0; |
55 | } | ||
56 | 55 | ||
57 | dev->buf_use = 0; | 56 | dev->buf_use = 0; |
58 | atomic_set(&dev->buf_alloc, 0); | 57 | atomic_set(&dev->buf_alloc, 0); |
@@ -81,9 +80,8 @@ void drm_legacy_dma_takedown(struct drm_device *dev) | |||
81 | int i, j; | 80 | int i, j; |
82 | 81 | ||
83 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) || | 82 | if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) || |
84 | drm_core_check_feature(dev, DRIVER_MODESET)) { | 83 | !drm_core_check_feature(dev, DRIVER_LEGACY)) |
85 | return; | 84 | return; |
86 | } | ||
87 | 85 | ||
88 | if (!dma) | 86 | if (!dma) |
89 | return; | 87 | return; |
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index eae5ef963cb7..5d20255f3db3 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c | |||
@@ -223,7 +223,7 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, | |||
223 | err = ret; | 223 | err = ret; |
224 | } | 224 | } |
225 | 225 | ||
226 | DRM_DEBUG_KMS("too many retries, giving up\n"); | 226 | DRM_DEBUG_KMS("Too many retries, giving up. First error: %d\n", err); |
227 | ret = err; | 227 | ret = err; |
228 | 228 | ||
229 | unlock: | 229 | unlock: |
@@ -574,7 +574,17 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | |||
574 | if (ret == -EBUSY) | 574 | if (ret == -EBUSY) |
575 | continue; | 575 | continue; |
576 | 576 | ||
577 | DRM_DEBUG_KMS("transaction failed: %d\n", ret); | 577 | /* |
578 | * While timeouts can be errors, they're usually normal | ||
579 | * behavior (for instance, when a driver tries to | ||
580 | * communicate with a non-existant DisplayPort device). | ||
581 | * Avoid spamming the kernel log with timeout errors. | ||
582 | */ | ||
583 | if (ret == -ETIMEDOUT) | ||
584 | DRM_DEBUG_KMS_RATELIMITED("transaction timed out\n"); | ||
585 | else | ||
586 | DRM_DEBUG_KMS("transaction failed: %d\n", ret); | ||
587 | |||
578 | return ret; | 588 | return ret; |
579 | } | 589 | } |
580 | 590 | ||
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index be27ed36f56e..57ce9734e0c6 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -112,7 +112,7 @@ static struct drm_minor **drm_minor_get_slot(struct drm_device *dev, | |||
112 | unsigned int type) | 112 | unsigned int type) |
113 | { | 113 | { |
114 | switch (type) { | 114 | switch (type) { |
115 | case DRM_MINOR_LEGACY: | 115 | case DRM_MINOR_PRIMARY: |
116 | return &dev->primary; | 116 | return &dev->primary; |
117 | case DRM_MINOR_RENDER: | 117 | case DRM_MINOR_RENDER: |
118 | return &dev->render; | 118 | return &dev->render; |
@@ -512,7 +512,7 @@ int drm_dev_init(struct drm_device *dev, | |||
512 | goto err_minors; | 512 | goto err_minors; |
513 | } | 513 | } |
514 | 514 | ||
515 | ret = drm_minor_alloc(dev, DRM_MINOR_LEGACY); | 515 | ret = drm_minor_alloc(dev, DRM_MINOR_PRIMARY); |
516 | if (ret) | 516 | if (ret) |
517 | goto err_minors; | 517 | goto err_minors; |
518 | 518 | ||
@@ -545,7 +545,7 @@ err_ctxbitmap: | |||
545 | drm_legacy_ctxbitmap_cleanup(dev); | 545 | drm_legacy_ctxbitmap_cleanup(dev); |
546 | drm_ht_remove(&dev->map_hash); | 546 | drm_ht_remove(&dev->map_hash); |
547 | err_minors: | 547 | err_minors: |
548 | drm_minor_free(dev, DRM_MINOR_LEGACY); | 548 | drm_minor_free(dev, DRM_MINOR_PRIMARY); |
549 | drm_minor_free(dev, DRM_MINOR_RENDER); | 549 | drm_minor_free(dev, DRM_MINOR_RENDER); |
550 | drm_minor_free(dev, DRM_MINOR_CONTROL); | 550 | drm_minor_free(dev, DRM_MINOR_CONTROL); |
551 | drm_fs_inode_free(dev->anon_inode); | 551 | drm_fs_inode_free(dev->anon_inode); |
@@ -608,7 +608,7 @@ static void drm_dev_release(struct kref *ref) | |||
608 | drm_ht_remove(&dev->map_hash); | 608 | drm_ht_remove(&dev->map_hash); |
609 | drm_fs_inode_free(dev->anon_inode); | 609 | drm_fs_inode_free(dev->anon_inode); |
610 | 610 | ||
611 | drm_minor_free(dev, DRM_MINOR_LEGACY); | 611 | drm_minor_free(dev, DRM_MINOR_PRIMARY); |
612 | drm_minor_free(dev, DRM_MINOR_RENDER); | 612 | drm_minor_free(dev, DRM_MINOR_RENDER); |
613 | drm_minor_free(dev, DRM_MINOR_CONTROL); | 613 | drm_minor_free(dev, DRM_MINOR_CONTROL); |
614 | 614 | ||
@@ -684,7 +684,7 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) | |||
684 | if (ret) | 684 | if (ret) |
685 | goto err_minors; | 685 | goto err_minors; |
686 | 686 | ||
687 | ret = drm_minor_register(dev, DRM_MINOR_LEGACY); | 687 | ret = drm_minor_register(dev, DRM_MINOR_PRIMARY); |
688 | if (ret) | 688 | if (ret) |
689 | goto err_minors; | 689 | goto err_minors; |
690 | 690 | ||
@@ -701,7 +701,7 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) | |||
701 | goto out_unlock; | 701 | goto out_unlock; |
702 | 702 | ||
703 | err_minors: | 703 | err_minors: |
704 | drm_minor_unregister(dev, DRM_MINOR_LEGACY); | 704 | drm_minor_unregister(dev, DRM_MINOR_PRIMARY); |
705 | drm_minor_unregister(dev, DRM_MINOR_RENDER); | 705 | drm_minor_unregister(dev, DRM_MINOR_RENDER); |
706 | drm_minor_unregister(dev, DRM_MINOR_CONTROL); | 706 | drm_minor_unregister(dev, DRM_MINOR_CONTROL); |
707 | out_unlock: | 707 | out_unlock: |
@@ -741,7 +741,7 @@ void drm_dev_unregister(struct drm_device *dev) | |||
741 | list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) | 741 | list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) |
742 | drm_legacy_rmmap(dev, r_list->map); | 742 | drm_legacy_rmmap(dev, r_list->map); |
743 | 743 | ||
744 | drm_minor_unregister(dev, DRM_MINOR_LEGACY); | 744 | drm_minor_unregister(dev, DRM_MINOR_PRIMARY); |
745 | drm_minor_unregister(dev, DRM_MINOR_RENDER); | 745 | drm_minor_unregister(dev, DRM_MINOR_RENDER); |
746 | drm_minor_unregister(dev, DRM_MINOR_CONTROL); | 746 | drm_minor_unregister(dev, DRM_MINOR_CONTROL); |
747 | } | 747 | } |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index ce54e985d91b..aed79d31930c 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/sysrq.h> | 33 | #include <linux/sysrq.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/fb.h> | ||
36 | #include <linux/module.h> | 35 | #include <linux/module.h> |
37 | #include <drm/drmP.h> | 36 | #include <drm/drmP.h> |
38 | #include <drm/drm_crtc.h> | 37 | #include <drm/drm_crtc.h> |
@@ -335,7 +334,7 @@ retry: | |||
335 | goto fail; | 334 | goto fail; |
336 | } | 335 | } |
337 | 336 | ||
338 | plane_state->rotation = BIT(DRM_ROTATE_0); | 337 | plane_state->rotation = DRM_ROTATE_0; |
339 | 338 | ||
340 | plane->old_fb = plane->fb; | 339 | plane->old_fb = plane->fb; |
341 | plane_mask |= 1 << drm_plane_index(plane); | 340 | plane_mask |= 1 << drm_plane_index(plane); |
@@ -395,7 +394,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper) | |||
395 | if (dev->mode_config.rotation_property) { | 394 | if (dev->mode_config.rotation_property) { |
396 | drm_mode_plane_set_obj_prop(plane, | 395 | drm_mode_plane_set_obj_prop(plane, |
397 | dev->mode_config.rotation_property, | 396 | dev->mode_config.rotation_property, |
398 | BIT(DRM_ROTATE_0)); | 397 | DRM_ROTATE_0); |
399 | } | 398 | } |
400 | } | 399 | } |
401 | 400 | ||
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 323c238fcac7..036cd275c53e 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -92,7 +92,7 @@ static int drm_setup(struct drm_device * dev) | |||
92 | int ret; | 92 | int ret; |
93 | 93 | ||
94 | if (dev->driver->firstopen && | 94 | if (dev->driver->firstopen && |
95 | !drm_core_check_feature(dev, DRIVER_MODESET)) { | 95 | drm_core_check_feature(dev, DRIVER_LEGACY)) { |
96 | ret = dev->driver->firstopen(dev); | 96 | ret = dev->driver->firstopen(dev); |
97 | if (ret != 0) | 97 | if (ret != 0) |
98 | return ret; | 98 | return ret; |
@@ -346,7 +346,7 @@ void drm_lastclose(struct drm_device * dev) | |||
346 | dev->driver->lastclose(dev); | 346 | dev->driver->lastclose(dev); |
347 | DRM_DEBUG("driver lastclose completed\n"); | 347 | DRM_DEBUG("driver lastclose completed\n"); |
348 | 348 | ||
349 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 349 | if (drm_core_check_feature(dev, DRIVER_LEGACY)) |
350 | drm_legacy_dev_reinit(dev); | 350 | drm_legacy_dev_reinit(dev); |
351 | } | 351 | } |
352 | 352 | ||
@@ -389,7 +389,7 @@ int drm_release(struct inode *inode, struct file *filp) | |||
389 | (long)old_encode_dev(file_priv->minor->kdev->devt), | 389 | (long)old_encode_dev(file_priv->minor->kdev->devt), |
390 | dev->open_count); | 390 | dev->open_count); |
391 | 391 | ||
392 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 392 | if (drm_core_check_feature(dev, DRIVER_LEGACY)) |
393 | drm_legacy_lock_release(dev, filp); | 393 | drm_legacy_lock_release(dev, filp); |
394 | 394 | ||
395 | if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) | 395 | if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) |
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 33af4a5ddca1..bb51ee97956d 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c | |||
@@ -714,9 +714,9 @@ long drm_ioctl(struct file *filp, | |||
714 | if (ksize > in_size) | 714 | if (ksize > in_size) |
715 | memset(kdata + in_size, 0, ksize - in_size); | 715 | memset(kdata + in_size, 0, ksize - in_size); |
716 | 716 | ||
717 | /* Enforce sane locking for kms driver ioctls. Core ioctls are | 717 | /* Enforce sane locking for modern driver ioctls. Core ioctls are |
718 | * too messy still. */ | 718 | * too messy still. */ |
719 | if ((drm_core_check_feature(dev, DRIVER_MODESET) && is_driver_ioctl) || | 719 | if ((!drm_core_check_feature(dev, DRIVER_LEGACY) && is_driver_ioctl) || |
720 | (ioctl->flags & DRM_UNLOCKED)) | 720 | (ioctl->flags & DRM_UNLOCKED)) |
721 | retcode = func(dev, kdata, file_priv); | 721 | retcode = func(dev, kdata, file_priv); |
722 | else { | 722 | else { |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 77f357b2c386..c0c3f2006203 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -482,7 +482,7 @@ int drm_irq_install(struct drm_device *dev, int irq) | |||
482 | return ret; | 482 | return ret; |
483 | } | 483 | } |
484 | 484 | ||
485 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 485 | if (drm_core_check_feature(dev, DRIVER_LEGACY)) |
486 | vga_client_register(dev->pdev, (void *)dev, drm_irq_vgaarb_nokms, NULL); | 486 | vga_client_register(dev->pdev, (void *)dev, drm_irq_vgaarb_nokms, NULL); |
487 | 487 | ||
488 | /* After installing handler */ | 488 | /* After installing handler */ |
@@ -491,7 +491,7 @@ int drm_irq_install(struct drm_device *dev, int irq) | |||
491 | 491 | ||
492 | if (ret < 0) { | 492 | if (ret < 0) { |
493 | dev->irq_enabled = false; | 493 | dev->irq_enabled = false; |
494 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 494 | if (drm_core_check_feature(dev, DRIVER_LEGACY)) |
495 | vga_client_register(dev->pdev, NULL, NULL, NULL); | 495 | vga_client_register(dev->pdev, NULL, NULL, NULL); |
496 | free_irq(irq, dev); | 496 | free_irq(irq, dev); |
497 | } else { | 497 | } else { |
@@ -557,7 +557,7 @@ int drm_irq_uninstall(struct drm_device *dev) | |||
557 | 557 | ||
558 | DRM_DEBUG("irq=%d\n", dev->irq); | 558 | DRM_DEBUG("irq=%d\n", dev->irq); |
559 | 559 | ||
560 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 560 | if (drm_core_check_feature(dev, DRIVER_LEGACY)) |
561 | vga_client_register(dev->pdev, NULL, NULL, NULL); | 561 | vga_client_register(dev->pdev, NULL, NULL, NULL); |
562 | 562 | ||
563 | if (dev->driver->irq_uninstall) | 563 | if (dev->driver->irq_uninstall) |
@@ -592,7 +592,7 @@ int drm_control(struct drm_device *dev, void *data, | |||
592 | 592 | ||
593 | if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) | 593 | if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) |
594 | return 0; | 594 | return 0; |
595 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 595 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
596 | return 0; | 596 | return 0; |
597 | /* UMS was only ever supported on pci devices. */ | 597 | /* UMS was only ever supported on pci devices. */ |
598 | if (WARN_ON(!dev->pdev)) | 598 | if (WARN_ON(!dev->pdev)) |
@@ -1295,7 +1295,7 @@ void drm_vblank_off(struct drm_device *dev, unsigned int pipe) | |||
1295 | if (e->pipe != pipe) | 1295 | if (e->pipe != pipe) |
1296 | continue; | 1296 | continue; |
1297 | DRM_DEBUG("Sending premature vblank event on disable: " | 1297 | DRM_DEBUG("Sending premature vblank event on disable: " |
1298 | "wanted %d, current %d\n", | 1298 | "wanted %u, current %u\n", |
1299 | e->event.sequence, seq); | 1299 | e->event.sequence, seq); |
1300 | list_del(&e->base.link); | 1300 | list_del(&e->base.link); |
1301 | drm_vblank_put(dev, pipe); | 1301 | drm_vblank_put(dev, pipe); |
@@ -1519,7 +1519,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data, | |||
1519 | return 0; | 1519 | return 0; |
1520 | 1520 | ||
1521 | /* KMS drivers handle this internally */ | 1521 | /* KMS drivers handle this internally */ |
1522 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 1522 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
1523 | return 0; | 1523 | return 0; |
1524 | 1524 | ||
1525 | pipe = modeset->crtc; | 1525 | pipe = modeset->crtc; |
@@ -1585,7 +1585,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe, | |||
1585 | 1585 | ||
1586 | seq = drm_vblank_count_and_time(dev, pipe, &now); | 1586 | seq = drm_vblank_count_and_time(dev, pipe, &now); |
1587 | 1587 | ||
1588 | DRM_DEBUG("event on vblank count %d, current %d, crtc %u\n", | 1588 | DRM_DEBUG("event on vblank count %u, current %u, crtc %u\n", |
1589 | vblwait->request.sequence, seq, pipe); | 1589 | vblwait->request.sequence, seq, pipe); |
1590 | 1590 | ||
1591 | trace_drm_vblank_event_queued(current->pid, pipe, | 1591 | trace_drm_vblank_event_queued(current->pid, pipe, |
@@ -1693,7 +1693,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
1693 | return drm_queue_vblank_event(dev, pipe, vblwait, file_priv); | 1693 | return drm_queue_vblank_event(dev, pipe, vblwait, file_priv); |
1694 | } | 1694 | } |
1695 | 1695 | ||
1696 | DRM_DEBUG("waiting on vblank count %d, crtc %u\n", | 1696 | DRM_DEBUG("waiting on vblank count %u, crtc %u\n", |
1697 | vblwait->request.sequence, pipe); | 1697 | vblwait->request.sequence, pipe); |
1698 | DRM_WAIT_ON(ret, vblank->queue, 3 * HZ, | 1698 | DRM_WAIT_ON(ret, vblank->queue, 3 * HZ, |
1699 | (((drm_vblank_count(dev, pipe) - | 1699 | (((drm_vblank_count(dev, pipe) - |
@@ -1708,7 +1708,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
1708 | vblwait->reply.tval_sec = now.tv_sec; | 1708 | vblwait->reply.tval_sec = now.tv_sec; |
1709 | vblwait->reply.tval_usec = now.tv_usec; | 1709 | vblwait->reply.tval_usec = now.tv_usec; |
1710 | 1710 | ||
1711 | DRM_DEBUG("returning %d to client\n", | 1711 | DRM_DEBUG("returning %u to client\n", |
1712 | vblwait->reply.sequence); | 1712 | vblwait->reply.sequence); |
1713 | } else { | 1713 | } else { |
1714 | DRM_DEBUG("vblank wait interrupted by signal\n"); | 1714 | DRM_DEBUG("vblank wait interrupted by signal\n"); |
@@ -1735,7 +1735,7 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) | |||
1735 | if ((seq - e->event.sequence) > (1<<23)) | 1735 | if ((seq - e->event.sequence) > (1<<23)) |
1736 | continue; | 1736 | continue; |
1737 | 1737 | ||
1738 | DRM_DEBUG("vblank event on %d, current %d\n", | 1738 | DRM_DEBUG("vblank event on %u, current %u\n", |
1739 | e->event.sequence, seq); | 1739 | e->event.sequence, seq); |
1740 | 1740 | ||
1741 | list_del(&e->base.link); | 1741 | list_del(&e->base.link); |
@@ -1826,6 +1826,7 @@ EXPORT_SYMBOL(drm_crtc_handle_vblank); | |||
1826 | */ | 1826 | */ |
1827 | u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe) | 1827 | u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe) |
1828 | { | 1828 | { |
1829 | WARN_ON_ONCE(dev->max_vblank_count != 0); | ||
1829 | return 0; | 1830 | return 0; |
1830 | } | 1831 | } |
1831 | EXPORT_SYMBOL(drm_vblank_no_hw_counter); | 1832 | EXPORT_SYMBOL(drm_vblank_no_hw_counter); |
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c index 48ac0ebbd663..c901f3c5b269 100644 --- a/drivers/gpu/drm/drm_lock.c +++ b/drivers/gpu/drm/drm_lock.c | |||
@@ -163,7 +163,7 @@ int drm_legacy_lock(struct drm_device *dev, void *data, | |||
163 | struct drm_master *master = file_priv->master; | 163 | struct drm_master *master = file_priv->master; |
164 | int ret = 0; | 164 | int ret = 0; |
165 | 165 | ||
166 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 166 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
167 | return -EINVAL; | 167 | return -EINVAL; |
168 | 168 | ||
169 | ++file_priv->lock_count; | 169 | ++file_priv->lock_count; |
@@ -252,7 +252,7 @@ int drm_legacy_unlock(struct drm_device *dev, void *data, struct drm_file *file_ | |||
252 | struct drm_lock *lock = data; | 252 | struct drm_lock *lock = data; |
253 | struct drm_master *master = file_priv->master; | 253 | struct drm_master *master = file_priv->master; |
254 | 254 | ||
255 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 255 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
256 | return -EINVAL; | 256 | return -EINVAL; |
257 | 257 | ||
258 | if (lock->context == DRM_KERNEL_CONTEXT) { | 258 | if (lock->context == DRM_KERNEL_CONTEXT) { |
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index cb39f45d6a16..11d44a1e0ab3 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/seq_file.h> | 47 | #include <linux/seq_file.h> |
48 | #include <linux/export.h> | 48 | #include <linux/export.h> |
49 | #include <linux/interval_tree_generic.h> | ||
49 | 50 | ||
50 | /** | 51 | /** |
51 | * DOC: Overview | 52 | * DOC: Overview |
@@ -103,6 +104,72 @@ static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_ | |||
103 | u64 end, | 104 | u64 end, |
104 | enum drm_mm_search_flags flags); | 105 | enum drm_mm_search_flags flags); |
105 | 106 | ||
107 | #define START(node) ((node)->start) | ||
108 | #define LAST(node) ((node)->start + (node)->size - 1) | ||
109 | |||
110 | INTERVAL_TREE_DEFINE(struct drm_mm_node, rb, | ||
111 | u64, __subtree_last, | ||
112 | START, LAST, static inline, drm_mm_interval_tree) | ||
113 | |||
114 | struct drm_mm_node * | ||
115 | drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last) | ||
116 | { | ||
117 | return drm_mm_interval_tree_iter_first(&mm->interval_tree, | ||
118 | start, last); | ||
119 | } | ||
120 | EXPORT_SYMBOL(drm_mm_interval_first); | ||
121 | |||
122 | struct drm_mm_node * | ||
123 | drm_mm_interval_next(struct drm_mm_node *node, u64 start, u64 last) | ||
124 | { | ||
125 | return drm_mm_interval_tree_iter_next(node, start, last); | ||
126 | } | ||
127 | EXPORT_SYMBOL(drm_mm_interval_next); | ||
128 | |||
129 | static void drm_mm_interval_tree_add_node(struct drm_mm_node *hole_node, | ||
130 | struct drm_mm_node *node) | ||
131 | { | ||
132 | struct drm_mm *mm = hole_node->mm; | ||
133 | struct rb_node **link, *rb; | ||
134 | struct drm_mm_node *parent; | ||
135 | |||
136 | node->__subtree_last = LAST(node); | ||
137 | |||
138 | if (hole_node->allocated) { | ||
139 | rb = &hole_node->rb; | ||
140 | while (rb) { | ||
141 | parent = rb_entry(rb, struct drm_mm_node, rb); | ||
142 | if (parent->__subtree_last >= node->__subtree_last) | ||
143 | break; | ||
144 | |||
145 | parent->__subtree_last = node->__subtree_last; | ||
146 | rb = rb_parent(rb); | ||
147 | } | ||
148 | |||
149 | rb = &hole_node->rb; | ||
150 | link = &hole_node->rb.rb_right; | ||
151 | } else { | ||
152 | rb = NULL; | ||
153 | link = &mm->interval_tree.rb_node; | ||
154 | } | ||
155 | |||
156 | while (*link) { | ||
157 | rb = *link; | ||
158 | parent = rb_entry(rb, struct drm_mm_node, rb); | ||
159 | if (parent->__subtree_last < node->__subtree_last) | ||
160 | parent->__subtree_last = node->__subtree_last; | ||
161 | if (node->start < parent->start) | ||
162 | link = &parent->rb.rb_left; | ||
163 | else | ||
164 | link = &parent->rb.rb_right; | ||
165 | } | ||
166 | |||
167 | rb_link_node(&node->rb, rb, link); | ||
168 | rb_insert_augmented(&node->rb, | ||
169 | &mm->interval_tree, | ||
170 | &drm_mm_interval_tree_augment); | ||
171 | } | ||
172 | |||
106 | static void drm_mm_insert_helper(struct drm_mm_node *hole_node, | 173 | static void drm_mm_insert_helper(struct drm_mm_node *hole_node, |
107 | struct drm_mm_node *node, | 174 | struct drm_mm_node *node, |
108 | u64 size, unsigned alignment, | 175 | u64 size, unsigned alignment, |
@@ -150,9 +217,10 @@ static void drm_mm_insert_helper(struct drm_mm_node *hole_node, | |||
150 | node->color = color; | 217 | node->color = color; |
151 | node->allocated = 1; | 218 | node->allocated = 1; |
152 | 219 | ||
153 | INIT_LIST_HEAD(&node->hole_stack); | ||
154 | list_add(&node->node_list, &hole_node->node_list); | 220 | list_add(&node->node_list, &hole_node->node_list); |
155 | 221 | ||
222 | drm_mm_interval_tree_add_node(hole_node, node); | ||
223 | |||
156 | BUG_ON(node->start + node->size > adj_end); | 224 | BUG_ON(node->start + node->size > adj_end); |
157 | 225 | ||
158 | node->hole_follows = 0; | 226 | node->hole_follows = 0; |
@@ -178,41 +246,54 @@ static void drm_mm_insert_helper(struct drm_mm_node *hole_node, | |||
178 | */ | 246 | */ |
179 | int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node) | 247 | int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node) |
180 | { | 248 | { |
249 | u64 end = node->start + node->size; | ||
181 | struct drm_mm_node *hole; | 250 | struct drm_mm_node *hole; |
182 | u64 end; | 251 | u64 hole_start, hole_end; |
183 | u64 hole_start; | ||
184 | u64 hole_end; | ||
185 | 252 | ||
186 | BUG_ON(node == NULL); | 253 | if (WARN_ON(node->size == 0)) |
254 | return -EINVAL; | ||
187 | 255 | ||
188 | end = node->start + node->size; | 256 | end = node->start + node->size; |
189 | 257 | ||
190 | /* Find the relevant hole to add our node to */ | 258 | /* Find the relevant hole to add our node to */ |
191 | drm_mm_for_each_hole(hole, mm, hole_start, hole_end) { | 259 | hole = drm_mm_interval_tree_iter_first(&mm->interval_tree, |
192 | if (hole_start > node->start || hole_end < end) | 260 | node->start, ~(u64)0); |
193 | continue; | 261 | if (hole) { |
262 | if (hole->start < end) | ||
263 | return -ENOSPC; | ||
264 | } else { | ||
265 | hole = list_entry(&mm->head_node.node_list, | ||
266 | typeof(*hole), node_list); | ||
267 | } | ||
194 | 268 | ||
195 | node->mm = mm; | 269 | hole = list_last_entry(&hole->node_list, typeof(*hole), node_list); |
196 | node->allocated = 1; | 270 | if (!hole->hole_follows) |
271 | return -ENOSPC; | ||
197 | 272 | ||
198 | INIT_LIST_HEAD(&node->hole_stack); | 273 | hole_start = __drm_mm_hole_node_start(hole); |
199 | list_add(&node->node_list, &hole->node_list); | 274 | hole_end = __drm_mm_hole_node_end(hole); |
275 | if (hole_start > node->start || hole_end < end) | ||
276 | return -ENOSPC; | ||
200 | 277 | ||
201 | if (node->start == hole_start) { | 278 | node->mm = mm; |
202 | hole->hole_follows = 0; | 279 | node->allocated = 1; |
203 | list_del_init(&hole->hole_stack); | ||
204 | } | ||
205 | 280 | ||
206 | node->hole_follows = 0; | 281 | list_add(&node->node_list, &hole->node_list); |
207 | if (end != hole_end) { | ||
208 | list_add(&node->hole_stack, &mm->hole_stack); | ||
209 | node->hole_follows = 1; | ||
210 | } | ||
211 | 282 | ||
212 | return 0; | 283 | drm_mm_interval_tree_add_node(hole, node); |
284 | |||
285 | if (node->start == hole_start) { | ||
286 | hole->hole_follows = 0; | ||
287 | list_del(&hole->hole_stack); | ||
213 | } | 288 | } |
214 | 289 | ||
215 | return -ENOSPC; | 290 | node->hole_follows = 0; |
291 | if (end != hole_end) { | ||
292 | list_add(&node->hole_stack, &mm->hole_stack); | ||
293 | node->hole_follows = 1; | ||
294 | } | ||
295 | |||
296 | return 0; | ||
216 | } | 297 | } |
217 | EXPORT_SYMBOL(drm_mm_reserve_node); | 298 | EXPORT_SYMBOL(drm_mm_reserve_node); |
218 | 299 | ||
@@ -239,6 +320,9 @@ int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node, | |||
239 | { | 320 | { |
240 | struct drm_mm_node *hole_node; | 321 | struct drm_mm_node *hole_node; |
241 | 322 | ||
323 | if (WARN_ON(size == 0)) | ||
324 | return -EINVAL; | ||
325 | |||
242 | hole_node = drm_mm_search_free_generic(mm, size, alignment, | 326 | hole_node = drm_mm_search_free_generic(mm, size, alignment, |
243 | color, sflags); | 327 | color, sflags); |
244 | if (!hole_node) | 328 | if (!hole_node) |
@@ -299,9 +383,10 @@ static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, | |||
299 | node->color = color; | 383 | node->color = color; |
300 | node->allocated = 1; | 384 | node->allocated = 1; |
301 | 385 | ||
302 | INIT_LIST_HEAD(&node->hole_stack); | ||
303 | list_add(&node->node_list, &hole_node->node_list); | 386 | list_add(&node->node_list, &hole_node->node_list); |
304 | 387 | ||
388 | drm_mm_interval_tree_add_node(hole_node, node); | ||
389 | |||
305 | BUG_ON(node->start < start); | 390 | BUG_ON(node->start < start); |
306 | BUG_ON(node->start < adj_start); | 391 | BUG_ON(node->start < adj_start); |
307 | BUG_ON(node->start + node->size > adj_end); | 392 | BUG_ON(node->start + node->size > adj_end); |
@@ -340,6 +425,9 @@ int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *n | |||
340 | { | 425 | { |
341 | struct drm_mm_node *hole_node; | 426 | struct drm_mm_node *hole_node; |
342 | 427 | ||
428 | if (WARN_ON(size == 0)) | ||
429 | return -EINVAL; | ||
430 | |||
343 | hole_node = drm_mm_search_free_in_range_generic(mm, | 431 | hole_node = drm_mm_search_free_in_range_generic(mm, |
344 | size, alignment, color, | 432 | size, alignment, color, |
345 | start, end, sflags); | 433 | start, end, sflags); |
@@ -390,6 +478,7 @@ void drm_mm_remove_node(struct drm_mm_node *node) | |||
390 | } else | 478 | } else |
391 | list_move(&prev_node->hole_stack, &mm->hole_stack); | 479 | list_move(&prev_node->hole_stack, &mm->hole_stack); |
392 | 480 | ||
481 | drm_mm_interval_tree_remove(node, &mm->interval_tree); | ||
393 | list_del(&node->node_list); | 482 | list_del(&node->node_list); |
394 | node->allocated = 0; | 483 | node->allocated = 0; |
395 | } | 484 | } |
@@ -516,11 +605,13 @@ void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new) | |||
516 | { | 605 | { |
517 | list_replace(&old->node_list, &new->node_list); | 606 | list_replace(&old->node_list, &new->node_list); |
518 | list_replace(&old->hole_stack, &new->hole_stack); | 607 | list_replace(&old->hole_stack, &new->hole_stack); |
608 | rb_replace_node(&old->rb, &new->rb, &old->mm->interval_tree); | ||
519 | new->hole_follows = old->hole_follows; | 609 | new->hole_follows = old->hole_follows; |
520 | new->mm = old->mm; | 610 | new->mm = old->mm; |
521 | new->start = old->start; | 611 | new->start = old->start; |
522 | new->size = old->size; | 612 | new->size = old->size; |
523 | new->color = old->color; | 613 | new->color = old->color; |
614 | new->__subtree_last = old->__subtree_last; | ||
524 | 615 | ||
525 | old->allocated = 0; | 616 | old->allocated = 0; |
526 | new->allocated = 1; | 617 | new->allocated = 1; |
@@ -748,7 +839,6 @@ void drm_mm_init(struct drm_mm * mm, u64 start, u64 size) | |||
748 | 839 | ||
749 | /* Clever trick to avoid a special case in the free hole tracking. */ | 840 | /* Clever trick to avoid a special case in the free hole tracking. */ |
750 | INIT_LIST_HEAD(&mm->head_node.node_list); | 841 | INIT_LIST_HEAD(&mm->head_node.node_list); |
751 | INIT_LIST_HEAD(&mm->head_node.hole_stack); | ||
752 | mm->head_node.hole_follows = 1; | 842 | mm->head_node.hole_follows = 1; |
753 | mm->head_node.scanned_block = 0; | 843 | mm->head_node.scanned_block = 0; |
754 | mm->head_node.scanned_prev_free = 0; | 844 | mm->head_node.scanned_prev_free = 0; |
@@ -758,6 +848,8 @@ void drm_mm_init(struct drm_mm * mm, u64 start, u64 size) | |||
758 | mm->head_node.size = start - mm->head_node.start; | 848 | mm->head_node.size = start - mm->head_node.start; |
759 | list_add_tail(&mm->head_node.hole_stack, &mm->hole_stack); | 849 | list_add_tail(&mm->head_node.hole_stack, &mm->hole_stack); |
760 | 850 | ||
851 | mm->interval_tree = RB_ROOT; | ||
852 | |||
761 | mm->color_adjust = NULL; | 853 | mm->color_adjust = NULL; |
762 | } | 854 | } |
763 | EXPORT_SYMBOL(drm_mm_init); | 855 | EXPORT_SYMBOL(drm_mm_init); |
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index b2f8f1062d5f..d86362fc8ac6 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -175,7 +175,7 @@ int drm_irq_by_busid(struct drm_device *dev, void *data, | |||
175 | { | 175 | { |
176 | struct drm_irq_busid *p = data; | 176 | struct drm_irq_busid *p = data; |
177 | 177 | ||
178 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 178 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
179 | return -EINVAL; | 179 | return -EINVAL; |
180 | 180 | ||
181 | /* UMS was only ever support on PCI devices. */ | 181 | /* UMS was only ever support on PCI devices. */ |
@@ -263,7 +263,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, | |||
263 | 263 | ||
264 | /* No locking needed since shadow-attach is single-threaded since it may | 264 | /* No locking needed since shadow-attach is single-threaded since it may |
265 | * only be called from the per-driver module init hook. */ | 265 | * only be called from the per-driver module init hook. */ |
266 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 266 | if (drm_core_check_feature(dev, DRIVER_LEGACY)) |
267 | list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list); | 267 | list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list); |
268 | 268 | ||
269 | return 0; | 269 | return 0; |
@@ -299,7 +299,7 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) | |||
299 | 299 | ||
300 | DRM_DEBUG("\n"); | 300 | DRM_DEBUG("\n"); |
301 | 301 | ||
302 | if (driver->driver_features & DRIVER_MODESET) | 302 | if (!(driver->driver_features & DRIVER_LEGACY)) |
303 | return pci_register_driver(pdriver); | 303 | return pci_register_driver(pdriver); |
304 | 304 | ||
305 | /* If not using KMS, fall back to stealth mode manual scanning. */ | 305 | /* If not using KMS, fall back to stealth mode manual scanning. */ |
@@ -421,7 +421,7 @@ void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver) | |||
421 | struct drm_device *dev, *tmp; | 421 | struct drm_device *dev, *tmp; |
422 | DRM_DEBUG("\n"); | 422 | DRM_DEBUG("\n"); |
423 | 423 | ||
424 | if (driver->driver_features & DRIVER_MODESET) { | 424 | if (!(driver->driver_features & DRIVER_LEGACY)) { |
425 | pci_unregister_driver(pdriver); | 425 | pci_unregister_driver(pdriver); |
426 | } else { | 426 | } else { |
427 | list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list, | 427 | list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list, |
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 16c4a7bd7465..b522aabd1ab0 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c | |||
@@ -108,14 +108,9 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc, | |||
108 | } | 108 | } |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * drm_plane_helper_check_update() - Check plane update for validity | 111 | * drm_plane_helper_check_state() - Check plane state for validity |
112 | * @plane: plane object to update | 112 | * @state: plane state to check |
113 | * @crtc: owning CRTC of owning plane | ||
114 | * @fb: framebuffer to flip onto plane | ||
115 | * @src: source coordinates in 16.16 fixed point | ||
116 | * @dest: integer destination coordinates | ||
117 | * @clip: integer clipping coordinates | 113 | * @clip: integer clipping coordinates |
118 | * @rotation: plane rotation | ||
119 | * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point | 114 | * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point |
120 | * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point | 115 | * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point |
121 | * @can_position: is it legal to position the plane such that it | 116 | * @can_position: is it legal to position the plane such that it |
@@ -123,10 +118,9 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc, | |||
123 | * only be false for primary planes. | 118 | * only be false for primary planes. |
124 | * @can_update_disabled: can the plane be updated while the crtc | 119 | * @can_update_disabled: can the plane be updated while the crtc |
125 | * is disabled? | 120 | * is disabled? |
126 | * @visible: output parameter indicating whether plane is still visible after | ||
127 | * clipping | ||
128 | * | 121 | * |
129 | * Checks that a desired plane update is valid. Drivers that provide | 122 | * Checks that a desired plane update is valid, and updates various |
123 | * bits of derived state (clipped coordinates etc.). Drivers that provide | ||
130 | * their own plane handling rather than helper-provided implementations may | 124 | * their own plane handling rather than helper-provided implementations may |
131 | * still wish to call this function to avoid duplication of error checking | 125 | * still wish to call this function to avoid duplication of error checking |
132 | * code. | 126 | * code. |
@@ -134,29 +128,38 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc, | |||
134 | * RETURNS: | 128 | * RETURNS: |
135 | * Zero if update appears valid, error code on failure | 129 | * Zero if update appears valid, error code on failure |
136 | */ | 130 | */ |
137 | int drm_plane_helper_check_update(struct drm_plane *plane, | 131 | int drm_plane_helper_check_state(struct drm_plane_state *state, |
138 | struct drm_crtc *crtc, | 132 | const struct drm_rect *clip, |
139 | struct drm_framebuffer *fb, | 133 | int min_scale, |
140 | struct drm_rect *src, | 134 | int max_scale, |
141 | struct drm_rect *dest, | 135 | bool can_position, |
142 | const struct drm_rect *clip, | 136 | bool can_update_disabled) |
143 | unsigned int rotation, | ||
144 | int min_scale, | ||
145 | int max_scale, | ||
146 | bool can_position, | ||
147 | bool can_update_disabled, | ||
148 | bool *visible) | ||
149 | { | 137 | { |
138 | struct drm_crtc *crtc = state->crtc; | ||
139 | struct drm_framebuffer *fb = state->fb; | ||
140 | struct drm_rect *src = &state->src; | ||
141 | struct drm_rect *dst = &state->dst; | ||
142 | unsigned int rotation = state->rotation; | ||
150 | int hscale, vscale; | 143 | int hscale, vscale; |
151 | 144 | ||
145 | src->x1 = state->src_x; | ||
146 | src->y1 = state->src_y; | ||
147 | src->x2 = state->src_x + state->src_w; | ||
148 | src->y2 = state->src_y + state->src_h; | ||
149 | |||
150 | dst->x1 = state->crtc_x; | ||
151 | dst->y1 = state->crtc_y; | ||
152 | dst->x2 = state->crtc_x + state->crtc_w; | ||
153 | dst->y2 = state->crtc_y + state->crtc_h; | ||
154 | |||
152 | if (!fb) { | 155 | if (!fb) { |
153 | *visible = false; | 156 | state->visible = false; |
154 | return 0; | 157 | return 0; |
155 | } | 158 | } |
156 | 159 | ||
157 | /* crtc should only be NULL when disabling (i.e., !fb) */ | 160 | /* crtc should only be NULL when disabling (i.e., !fb) */ |
158 | if (WARN_ON(!crtc)) { | 161 | if (WARN_ON(!crtc)) { |
159 | *visible = false; | 162 | state->visible = false; |
160 | return 0; | 163 | return 0; |
161 | } | 164 | } |
162 | 165 | ||
@@ -168,20 +171,20 @@ int drm_plane_helper_check_update(struct drm_plane *plane, | |||
168 | drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation); | 171 | drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation); |
169 | 172 | ||
170 | /* Check scaling */ | 173 | /* Check scaling */ |
171 | hscale = drm_rect_calc_hscale(src, dest, min_scale, max_scale); | 174 | hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale); |
172 | vscale = drm_rect_calc_vscale(src, dest, min_scale, max_scale); | 175 | vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale); |
173 | if (hscale < 0 || vscale < 0) { | 176 | if (hscale < 0 || vscale < 0) { |
174 | DRM_DEBUG_KMS("Invalid scaling of plane\n"); | 177 | DRM_DEBUG_KMS("Invalid scaling of plane\n"); |
175 | drm_rect_debug_print("src: ", src, true); | 178 | drm_rect_debug_print("src: ", &state->src, true); |
176 | drm_rect_debug_print("dst: ", dest, false); | 179 | drm_rect_debug_print("dst: ", &state->dst, false); |
177 | return -ERANGE; | 180 | return -ERANGE; |
178 | } | 181 | } |
179 | 182 | ||
180 | *visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale); | 183 | state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale); |
181 | 184 | ||
182 | drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation); | 185 | drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation); |
183 | 186 | ||
184 | if (!*visible) | 187 | if (!state->visible) |
185 | /* | 188 | /* |
186 | * Plane isn't visible; some drivers can handle this | 189 | * Plane isn't visible; some drivers can handle this |
187 | * so we just return success here. Drivers that can't | 190 | * so we just return success here. Drivers that can't |
@@ -191,15 +194,87 @@ int drm_plane_helper_check_update(struct drm_plane *plane, | |||
191 | */ | 194 | */ |
192 | return 0; | 195 | return 0; |
193 | 196 | ||
194 | if (!can_position && !drm_rect_equals(dest, clip)) { | 197 | if (!can_position && !drm_rect_equals(dst, clip)) { |
195 | DRM_DEBUG_KMS("Plane must cover entire CRTC\n"); | 198 | DRM_DEBUG_KMS("Plane must cover entire CRTC\n"); |
196 | drm_rect_debug_print("dst: ", dest, false); | 199 | drm_rect_debug_print("dst: ", dst, false); |
197 | drm_rect_debug_print("clip: ", clip, false); | 200 | drm_rect_debug_print("clip: ", clip, false); |
198 | return -EINVAL; | 201 | return -EINVAL; |
199 | } | 202 | } |
200 | 203 | ||
201 | return 0; | 204 | return 0; |
202 | } | 205 | } |
206 | EXPORT_SYMBOL(drm_plane_helper_check_state); | ||
207 | |||
208 | /** | ||
209 | * drm_plane_helper_check_update() - Check plane update for validity | ||
210 | * @plane: plane object to update | ||
211 | * @crtc: owning CRTC of owning plane | ||
212 | * @fb: framebuffer to flip onto plane | ||
213 | * @src: source coordinates in 16.16 fixed point | ||
214 | * @dest: integer destination coordinates | ||
215 | * @clip: integer clipping coordinates | ||
216 | * @rotation: plane rotation | ||
217 | * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point | ||
218 | * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point | ||
219 | * @can_position: is it legal to position the plane such that it | ||
220 | * doesn't cover the entire crtc? This will generally | ||
221 | * only be false for primary planes. | ||
222 | * @can_update_disabled: can the plane be updated while the crtc | ||
223 | * is disabled? | ||
224 | * @visible: output parameter indicating whether plane is still visible after | ||
225 | * clipping | ||
226 | * | ||
227 | * Checks that a desired plane update is valid. Drivers that provide | ||
228 | * their own plane handling rather than helper-provided implementations may | ||
229 | * still wish to call this function to avoid duplication of error checking | ||
230 | * code. | ||
231 | * | ||
232 | * RETURNS: | ||
233 | * Zero if update appears valid, error code on failure | ||
234 | */ | ||
235 | int drm_plane_helper_check_update(struct drm_plane *plane, | ||
236 | struct drm_crtc *crtc, | ||
237 | struct drm_framebuffer *fb, | ||
238 | struct drm_rect *src, | ||
239 | struct drm_rect *dst, | ||
240 | const struct drm_rect *clip, | ||
241 | unsigned int rotation, | ||
242 | int min_scale, | ||
243 | int max_scale, | ||
244 | bool can_position, | ||
245 | bool can_update_disabled, | ||
246 | bool *visible) | ||
247 | { | ||
248 | struct drm_plane_state state = { | ||
249 | .plane = plane, | ||
250 | .crtc = crtc, | ||
251 | .fb = fb, | ||
252 | .src_x = src->x1, | ||
253 | .src_y = src->y1, | ||
254 | .src_w = drm_rect_width(src), | ||
255 | .src_h = drm_rect_height(src), | ||
256 | .crtc_x = dst->x1, | ||
257 | .crtc_y = dst->y1, | ||
258 | .crtc_w = drm_rect_width(dst), | ||
259 | .crtc_h = drm_rect_height(dst), | ||
260 | .rotation = rotation, | ||
261 | .visible = *visible, | ||
262 | }; | ||
263 | int ret; | ||
264 | |||
265 | ret = drm_plane_helper_check_state(&state, clip, | ||
266 | min_scale, max_scale, | ||
267 | can_position, | ||
268 | can_update_disabled); | ||
269 | if (ret) | ||
270 | return ret; | ||
271 | |||
272 | *src = state.src; | ||
273 | *dst = state.dst; | ||
274 | *visible = state.visible; | ||
275 | |||
276 | return 0; | ||
277 | } | ||
203 | EXPORT_SYMBOL(drm_plane_helper_check_update); | 278 | EXPORT_SYMBOL(drm_plane_helper_check_update); |
204 | 279 | ||
205 | /** | 280 | /** |
@@ -274,7 +349,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
274 | 349 | ||
275 | ret = drm_plane_helper_check_update(plane, crtc, fb, | 350 | ret = drm_plane_helper_check_update(plane, crtc, fb, |
276 | &src, &dest, &clip, | 351 | &src, &dest, &clip, |
277 | BIT(DRM_ROTATE_0), | 352 | DRM_ROTATE_0, |
278 | DRM_PLANE_HELPER_NO_SCALING, | 353 | DRM_PLANE_HELPER_NO_SCALING, |
279 | DRM_PLANE_HELPER_NO_SCALING, | 354 | DRM_PLANE_HELPER_NO_SCALING, |
280 | false, false, &visible); | 355 | false, false, &visible); |
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c index a8e2c8603945..73e53a8d1b37 100644 --- a/drivers/gpu/drm/drm_rect.c +++ b/drivers/gpu/drm/drm_rect.c | |||
@@ -100,7 +100,7 @@ static int drm_calc_scale(int src, int dst) | |||
100 | { | 100 | { |
101 | int scale = 0; | 101 | int scale = 0; |
102 | 102 | ||
103 | if (src < 0 || dst < 0) | 103 | if (WARN_ON(src < 0 || dst < 0)) |
104 | return -EINVAL; | 104 | return -EINVAL; |
105 | 105 | ||
106 | if (dst == 0) | 106 | if (dst == 0) |
@@ -317,38 +317,38 @@ void drm_rect_rotate(struct drm_rect *r, | |||
317 | { | 317 | { |
318 | struct drm_rect tmp; | 318 | struct drm_rect tmp; |
319 | 319 | ||
320 | if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) { | 320 | if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) { |
321 | tmp = *r; | 321 | tmp = *r; |
322 | 322 | ||
323 | if (rotation & BIT(DRM_REFLECT_X)) { | 323 | if (rotation & DRM_REFLECT_X) { |
324 | r->x1 = width - tmp.x2; | 324 | r->x1 = width - tmp.x2; |
325 | r->x2 = width - tmp.x1; | 325 | r->x2 = width - tmp.x1; |
326 | } | 326 | } |
327 | 327 | ||
328 | if (rotation & BIT(DRM_REFLECT_Y)) { | 328 | if (rotation & DRM_REFLECT_Y) { |
329 | r->y1 = height - tmp.y2; | 329 | r->y1 = height - tmp.y2; |
330 | r->y2 = height - tmp.y1; | 330 | r->y2 = height - tmp.y1; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | 333 | ||
334 | switch (rotation & DRM_ROTATE_MASK) { | 334 | switch (rotation & DRM_ROTATE_MASK) { |
335 | case BIT(DRM_ROTATE_0): | 335 | case DRM_ROTATE_0: |
336 | break; | 336 | break; |
337 | case BIT(DRM_ROTATE_90): | 337 | case DRM_ROTATE_90: |
338 | tmp = *r; | 338 | tmp = *r; |
339 | r->x1 = tmp.y1; | 339 | r->x1 = tmp.y1; |
340 | r->x2 = tmp.y2; | 340 | r->x2 = tmp.y2; |
341 | r->y1 = width - tmp.x2; | 341 | r->y1 = width - tmp.x2; |
342 | r->y2 = width - tmp.x1; | 342 | r->y2 = width - tmp.x1; |
343 | break; | 343 | break; |
344 | case BIT(DRM_ROTATE_180): | 344 | case DRM_ROTATE_180: |
345 | tmp = *r; | 345 | tmp = *r; |
346 | r->x1 = width - tmp.x2; | 346 | r->x1 = width - tmp.x2; |
347 | r->x2 = width - tmp.x1; | 347 | r->x2 = width - tmp.x1; |
348 | r->y1 = height - tmp.y2; | 348 | r->y1 = height - tmp.y2; |
349 | r->y2 = height - tmp.y1; | 349 | r->y2 = height - tmp.y1; |
350 | break; | 350 | break; |
351 | case BIT(DRM_ROTATE_270): | 351 | case DRM_ROTATE_270: |
352 | tmp = *r; | 352 | tmp = *r; |
353 | r->x1 = height - tmp.y2; | 353 | r->x1 = height - tmp.y2; |
354 | r->x2 = height - tmp.y1; | 354 | r->x2 = height - tmp.y1; |
@@ -392,23 +392,23 @@ void drm_rect_rotate_inv(struct drm_rect *r, | |||
392 | struct drm_rect tmp; | 392 | struct drm_rect tmp; |
393 | 393 | ||
394 | switch (rotation & DRM_ROTATE_MASK) { | 394 | switch (rotation & DRM_ROTATE_MASK) { |
395 | case BIT(DRM_ROTATE_0): | 395 | case DRM_ROTATE_0: |
396 | break; | 396 | break; |
397 | case BIT(DRM_ROTATE_90): | 397 | case DRM_ROTATE_90: |
398 | tmp = *r; | 398 | tmp = *r; |
399 | r->x1 = width - tmp.y2; | 399 | r->x1 = width - tmp.y2; |
400 | r->x2 = width - tmp.y1; | 400 | r->x2 = width - tmp.y1; |
401 | r->y1 = tmp.x1; | 401 | r->y1 = tmp.x1; |
402 | r->y2 = tmp.x2; | 402 | r->y2 = tmp.x2; |
403 | break; | 403 | break; |
404 | case BIT(DRM_ROTATE_180): | 404 | case DRM_ROTATE_180: |
405 | tmp = *r; | 405 | tmp = *r; |
406 | r->x1 = width - tmp.x2; | 406 | r->x1 = width - tmp.x2; |
407 | r->x2 = width - tmp.x1; | 407 | r->x2 = width - tmp.x1; |
408 | r->y1 = height - tmp.y2; | 408 | r->y1 = height - tmp.y2; |
409 | r->y2 = height - tmp.y1; | 409 | r->y2 = height - tmp.y1; |
410 | break; | 410 | break; |
411 | case BIT(DRM_ROTATE_270): | 411 | case DRM_ROTATE_270: |
412 | tmp = *r; | 412 | tmp = *r; |
413 | r->x1 = tmp.y1; | 413 | r->x1 = tmp.y1; |
414 | r->x2 = tmp.y2; | 414 | r->x2 = tmp.y2; |
@@ -419,15 +419,15 @@ void drm_rect_rotate_inv(struct drm_rect *r, | |||
419 | break; | 419 | break; |
420 | } | 420 | } |
421 | 421 | ||
422 | if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) { | 422 | if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) { |
423 | tmp = *r; | 423 | tmp = *r; |
424 | 424 | ||
425 | if (rotation & BIT(DRM_REFLECT_X)) { | 425 | if (rotation & DRM_REFLECT_X) { |
426 | r->x1 = width - tmp.x2; | 426 | r->x1 = width - tmp.x2; |
427 | r->x2 = width - tmp.x1; | 427 | r->x2 = width - tmp.x1; |
428 | } | 428 | } |
429 | 429 | ||
430 | if (rotation & BIT(DRM_REFLECT_Y)) { | 430 | if (rotation & DRM_REFLECT_Y) { |
431 | r->y1 = height - tmp.y2; | 431 | r->y1 = height - tmp.y2; |
432 | r->y2 = height - tmp.y1; | 432 | r->y2 = height - tmp.y1; |
433 | } | 433 | } |
diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c index bf70431073f6..275bca44f38c 100644 --- a/drivers/gpu/drm/drm_scatter.c +++ b/drivers/gpu/drm/drm_scatter.c | |||
@@ -68,7 +68,7 @@ static void drm_sg_cleanup(struct drm_sg_mem * entry) | |||
68 | void drm_legacy_sg_cleanup(struct drm_device *dev) | 68 | void drm_legacy_sg_cleanup(struct drm_device *dev) |
69 | { | 69 | { |
70 | if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg && | 70 | if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg && |
71 | !drm_core_check_feature(dev, DRIVER_MODESET)) { | 71 | drm_core_check_feature(dev, DRIVER_LEGACY)) { |
72 | drm_sg_cleanup(dev->sg); | 72 | drm_sg_cleanup(dev->sg); |
73 | dev->sg = NULL; | 73 | dev->sg = NULL; |
74 | } | 74 | } |
@@ -88,7 +88,7 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data, | |||
88 | 88 | ||
89 | DRM_DEBUG("\n"); | 89 | DRM_DEBUG("\n"); |
90 | 90 | ||
91 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 91 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
92 | return -EINVAL; | 92 | return -EINVAL; |
93 | 93 | ||
94 | if (!drm_core_check_feature(dev, DRIVER_SG)) | 94 | if (!drm_core_check_feature(dev, DRIVER_SG)) |
@@ -201,7 +201,7 @@ int drm_legacy_sg_free(struct drm_device *dev, void *data, | |||
201 | struct drm_scatter_gather *request = data; | 201 | struct drm_scatter_gather *request = data; |
202 | struct drm_sg_mem *entry; | 202 | struct drm_sg_mem *entry; |
203 | 203 | ||
204 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 204 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
205 | return -EINVAL; | 205 | return -EINVAL; |
206 | 206 | ||
207 | if (!drm_core_check_feature(dev, DRIVER_SG)) | 207 | if (!drm_core_check_feature(dev, DRIVER_SG)) |
diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index 0db36d27e90b..0a02efe978ee 100644 --- a/drivers/gpu/drm/drm_simple_kms_helper.c +++ b/drivers/gpu/drm/drm_simple_kms_helper.c | |||
@@ -73,22 +73,9 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = { | |||
73 | static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane, | 73 | static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane, |
74 | struct drm_plane_state *plane_state) | 74 | struct drm_plane_state *plane_state) |
75 | { | 75 | { |
76 | struct drm_rect src = { | ||
77 | .x1 = plane_state->src_x, | ||
78 | .y1 = plane_state->src_y, | ||
79 | .x2 = plane_state->src_x + plane_state->src_w, | ||
80 | .y2 = plane_state->src_y + plane_state->src_h, | ||
81 | }; | ||
82 | struct drm_rect dest = { | ||
83 | .x1 = plane_state->crtc_x, | ||
84 | .y1 = plane_state->crtc_y, | ||
85 | .x2 = plane_state->crtc_x + plane_state->crtc_w, | ||
86 | .y2 = plane_state->crtc_y + plane_state->crtc_h, | ||
87 | }; | ||
88 | struct drm_rect clip = { 0 }; | 76 | struct drm_rect clip = { 0 }; |
89 | struct drm_simple_display_pipe *pipe; | 77 | struct drm_simple_display_pipe *pipe; |
90 | struct drm_crtc_state *crtc_state; | 78 | struct drm_crtc_state *crtc_state; |
91 | bool visible; | ||
92 | int ret; | 79 | int ret; |
93 | 80 | ||
94 | pipe = container_of(plane, struct drm_simple_display_pipe, plane); | 81 | pipe = container_of(plane, struct drm_simple_display_pipe, plane); |
@@ -102,17 +89,15 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane, | |||
102 | 89 | ||
103 | clip.x2 = crtc_state->adjusted_mode.hdisplay; | 90 | clip.x2 = crtc_state->adjusted_mode.hdisplay; |
104 | clip.y2 = crtc_state->adjusted_mode.vdisplay; | 91 | clip.y2 = crtc_state->adjusted_mode.vdisplay; |
105 | ret = drm_plane_helper_check_update(plane, &pipe->crtc, | 92 | |
106 | plane_state->fb, | 93 | ret = drm_plane_helper_check_state(plane_state, &clip, |
107 | &src, &dest, &clip, | 94 | DRM_PLANE_HELPER_NO_SCALING, |
108 | plane_state->rotation, | 95 | DRM_PLANE_HELPER_NO_SCALING, |
109 | DRM_PLANE_HELPER_NO_SCALING, | 96 | false, true); |
110 | DRM_PLANE_HELPER_NO_SCALING, | ||
111 | false, true, &visible); | ||
112 | if (ret) | 97 | if (ret) |
113 | return ret; | 98 | return ret; |
114 | 99 | ||
115 | if (!visible) | 100 | if (!plane_state->visible) |
116 | return -EINVAL; | 101 | return -EINVAL; |
117 | 102 | ||
118 | if (!pipe->funcs || !pipe->funcs->check) | 103 | if (!pipe->funcs || !pipe->funcs->check) |
diff --git a/drivers/gpu/drm/drm_vma_manager.c b/drivers/gpu/drm/drm_vma_manager.c index f306c8855978..0aef432679f9 100644 --- a/drivers/gpu/drm/drm_vma_manager.c +++ b/drivers/gpu/drm/drm_vma_manager.c | |||
@@ -86,7 +86,6 @@ void drm_vma_offset_manager_init(struct drm_vma_offset_manager *mgr, | |||
86 | unsigned long page_offset, unsigned long size) | 86 | unsigned long page_offset, unsigned long size) |
87 | { | 87 | { |
88 | rwlock_init(&mgr->vm_lock); | 88 | rwlock_init(&mgr->vm_lock); |
89 | mgr->vm_addr_space_rb = RB_ROOT; | ||
90 | drm_mm_init(&mgr->vm_addr_space_mm, page_offset, size); | 89 | drm_mm_init(&mgr->vm_addr_space_mm, page_offset, size); |
91 | } | 90 | } |
92 | EXPORT_SYMBOL(drm_vma_offset_manager_init); | 91 | EXPORT_SYMBOL(drm_vma_offset_manager_init); |
@@ -145,16 +144,16 @@ struct drm_vma_offset_node *drm_vma_offset_lookup_locked(struct drm_vma_offset_m | |||
145 | unsigned long start, | 144 | unsigned long start, |
146 | unsigned long pages) | 145 | unsigned long pages) |
147 | { | 146 | { |
148 | struct drm_vma_offset_node *node, *best; | 147 | struct drm_mm_node *node, *best; |
149 | struct rb_node *iter; | 148 | struct rb_node *iter; |
150 | unsigned long offset; | 149 | unsigned long offset; |
151 | 150 | ||
152 | iter = mgr->vm_addr_space_rb.rb_node; | 151 | iter = mgr->vm_addr_space_mm.interval_tree.rb_node; |
153 | best = NULL; | 152 | best = NULL; |
154 | 153 | ||
155 | while (likely(iter)) { | 154 | while (likely(iter)) { |
156 | node = rb_entry(iter, struct drm_vma_offset_node, vm_rb); | 155 | node = rb_entry(iter, struct drm_mm_node, rb); |
157 | offset = node->vm_node.start; | 156 | offset = node->start; |
158 | if (start >= offset) { | 157 | if (start >= offset) { |
159 | iter = iter->rb_right; | 158 | iter = iter->rb_right; |
160 | best = node; | 159 | best = node; |
@@ -167,38 +166,17 @@ struct drm_vma_offset_node *drm_vma_offset_lookup_locked(struct drm_vma_offset_m | |||
167 | 166 | ||
168 | /* verify that the node spans the requested area */ | 167 | /* verify that the node spans the requested area */ |
169 | if (best) { | 168 | if (best) { |
170 | offset = best->vm_node.start + best->vm_node.size; | 169 | offset = best->start + best->size; |
171 | if (offset < start + pages) | 170 | if (offset < start + pages) |
172 | best = NULL; | 171 | best = NULL; |
173 | } | 172 | } |
174 | 173 | ||
175 | return best; | 174 | if (!best) |
176 | } | 175 | return NULL; |
177 | EXPORT_SYMBOL(drm_vma_offset_lookup_locked); | ||
178 | |||
179 | /* internal helper to link @node into the rb-tree */ | ||
180 | static void _drm_vma_offset_add_rb(struct drm_vma_offset_manager *mgr, | ||
181 | struct drm_vma_offset_node *node) | ||
182 | { | ||
183 | struct rb_node **iter = &mgr->vm_addr_space_rb.rb_node; | ||
184 | struct rb_node *parent = NULL; | ||
185 | struct drm_vma_offset_node *iter_node; | ||
186 | |||
187 | while (likely(*iter)) { | ||
188 | parent = *iter; | ||
189 | iter_node = rb_entry(*iter, struct drm_vma_offset_node, vm_rb); | ||
190 | 176 | ||
191 | if (node->vm_node.start < iter_node->vm_node.start) | 177 | return container_of(best, struct drm_vma_offset_node, vm_node); |
192 | iter = &(*iter)->rb_left; | ||
193 | else if (node->vm_node.start > iter_node->vm_node.start) | ||
194 | iter = &(*iter)->rb_right; | ||
195 | else | ||
196 | BUG(); | ||
197 | } | ||
198 | |||
199 | rb_link_node(&node->vm_rb, parent, iter); | ||
200 | rb_insert_color(&node->vm_rb, &mgr->vm_addr_space_rb); | ||
201 | } | 178 | } |
179 | EXPORT_SYMBOL(drm_vma_offset_lookup_locked); | ||
202 | 180 | ||
203 | /** | 181 | /** |
204 | * drm_vma_offset_add() - Add offset node to manager | 182 | * drm_vma_offset_add() - Add offset node to manager |
@@ -240,8 +218,6 @@ int drm_vma_offset_add(struct drm_vma_offset_manager *mgr, | |||
240 | if (ret) | 218 | if (ret) |
241 | goto out_unlock; | 219 | goto out_unlock; |
242 | 220 | ||
243 | _drm_vma_offset_add_rb(mgr, node); | ||
244 | |||
245 | out_unlock: | 221 | out_unlock: |
246 | write_unlock(&mgr->vm_lock); | 222 | write_unlock(&mgr->vm_lock); |
247 | return ret; | 223 | return ret; |
@@ -265,7 +241,6 @@ void drm_vma_offset_remove(struct drm_vma_offset_manager *mgr, | |||
265 | write_lock(&mgr->vm_lock); | 241 | write_lock(&mgr->vm_lock); |
266 | 242 | ||
267 | if (drm_mm_node_allocated(&node->vm_node)) { | 243 | if (drm_mm_node_allocated(&node->vm_node)) { |
268 | rb_erase(&node->vm_rb, &mgr->vm_addr_space_rb); | ||
269 | drm_mm_remove_node(&node->vm_node); | 244 | drm_mm_remove_node(&node->vm_node); |
270 | memset(&node->vm_node, 0, sizeof(node->vm_node)); | 245 | memset(&node->vm_node, 0, sizeof(node->vm_node)); |
271 | } | 246 | } |
diff --git a/drivers/gpu/drm/gma500/accel_2d.c b/drivers/gpu/drm/gma500/accel_2d.c index db9f7d011832..0d2bb1682508 100644 --- a/drivers/gpu/drm/gma500/accel_2d.c +++ b/drivers/gpu/drm/gma500/accel_2d.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/tty.h> | 28 | #include <linux/tty.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/fb.h> | ||
32 | #include <linux/init.h> | 31 | #include <linux/init.h> |
33 | #include <linux/console.h> | 32 | #include <linux/console.h> |
34 | 33 | ||
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c index 0fcdce0817de..3a44e705db53 100644 --- a/drivers/gpu/drm/gma500/framebuffer.c +++ b/drivers/gpu/drm/gma500/framebuffer.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/tty.h> | 26 | #include <linux/tty.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/fb.h> | ||
30 | #include <linux/init.h> | 29 | #include <linux/init.h> |
31 | #include <linux/console.h> | 30 | #include <linux/console.h> |
32 | 31 | ||
diff --git a/drivers/gpu/drm/gma500/psb_intel_modes.c b/drivers/gpu/drm/gma500/psb_intel_modes.c index 4fca0d6feebe..e5360726d80b 100644 --- a/drivers/gpu/drm/gma500/psb_intel_modes.c +++ b/drivers/gpu/drm/gma500/psb_intel_modes.c | |||
@@ -18,7 +18,6 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/fb.h> | ||
22 | #include <drm/drmP.h> | 21 | #include <drm/drmP.h> |
23 | #include "psb_intel_drv.h" | 22 | #include "psb_intel_drv.h" |
24 | 23 | ||
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c index 44f4a131c8dd..0be55dc1ef4b 100644 --- a/drivers/gpu/drm/i810/i810_drv.c +++ b/drivers/gpu/drm/i810/i810_drv.c | |||
@@ -56,9 +56,7 @@ static const struct file_operations i810_driver_fops = { | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | static struct drm_driver driver = { | 58 | static struct drm_driver driver = { |
59 | .driver_features = | 59 | .driver_features = DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_LEGACY, |
60 | DRIVER_USE_AGP | | ||
61 | DRIVER_HAVE_DMA, | ||
62 | .dev_priv_size = sizeof(drm_i810_buf_priv_t), | 60 | .dev_priv_size = sizeof(drm_i810_buf_priv_t), |
63 | .load = i810_driver_load, | 61 | .load = i810_driver_load, |
64 | .lastclose = i810_driver_lastclose, | 62 | .lastclose = i810_driver_lastclose, |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 844fea795bae..9b03cb2813bd 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -3089,12 +3089,12 @@ static const char *plane_rotation(unsigned int rotation) | |||
3089 | */ | 3089 | */ |
3090 | snprintf(buf, sizeof(buf), | 3090 | snprintf(buf, sizeof(buf), |
3091 | "%s%s%s%s%s%s(0x%08x)", | 3091 | "%s%s%s%s%s%s(0x%08x)", |
3092 | (rotation & BIT(DRM_ROTATE_0)) ? "0 " : "", | 3092 | (rotation & DRM_ROTATE_0) ? "0 " : "", |
3093 | (rotation & BIT(DRM_ROTATE_90)) ? "90 " : "", | 3093 | (rotation & DRM_ROTATE_90) ? "90 " : "", |
3094 | (rotation & BIT(DRM_ROTATE_180)) ? "180 " : "", | 3094 | (rotation & DRM_ROTATE_180) ? "180 " : "", |
3095 | (rotation & BIT(DRM_ROTATE_270)) ? "270 " : "", | 3095 | (rotation & DRM_ROTATE_270) ? "270 " : "", |
3096 | (rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "", | 3096 | (rotation & DRM_REFLECT_X) ? "FLIPX " : "", |
3097 | (rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "", | 3097 | (rotation & DRM_REFLECT_Y) ? "FLIPY " : "", |
3098 | rotation); | 3098 | rotation); |
3099 | 3099 | ||
3100 | return buf; | 3100 | return buf; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 95ddd56b89f0..40cd16cf9772 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -706,7 +706,7 @@ static int i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) | |||
706 | primary = | 706 | primary = |
707 | pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 707 | pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
708 | 708 | ||
709 | ret = remove_conflicting_framebuffers(ap, "inteldrmfb", primary); | 709 | ret = drm_fb_helper_remove_conflicting_framebuffers(ap, "inteldrmfb", primary); |
710 | 710 | ||
711 | kfree(ap); | 711 | kfree(ap); |
712 | 712 | ||
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c index 7de7721f65bc..e06d1f5334cf 100644 --- a/drivers/gpu/drm/i915/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c | |||
@@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane) | |||
55 | return NULL; | 55 | return NULL; |
56 | 56 | ||
57 | state->base.plane = plane; | 57 | state->base.plane = plane; |
58 | state->base.rotation = BIT(DRM_ROTATE_0); | 58 | state->base.rotation = DRM_ROTATE_0; |
59 | state->ckey.flags = I915_SET_COLORKEY_NONE; | 59 | state->ckey.flags = I915_SET_COLORKEY_NONE; |
60 | 60 | ||
61 | return state; | 61 | return state; |
@@ -134,20 +134,6 @@ static int intel_plane_atomic_check(struct drm_plane *plane, | |||
134 | 134 | ||
135 | crtc_state = to_intel_crtc_state(drm_crtc_state); | 135 | crtc_state = to_intel_crtc_state(drm_crtc_state); |
136 | 136 | ||
137 | /* | ||
138 | * The original src/dest coordinates are stored in state->base, but | ||
139 | * we want to keep another copy internal to our driver that we can | ||
140 | * clip/modify ourselves. | ||
141 | */ | ||
142 | intel_state->src.x1 = state->src_x; | ||
143 | intel_state->src.y1 = state->src_y; | ||
144 | intel_state->src.x2 = state->src_x + state->src_w; | ||
145 | intel_state->src.y2 = state->src_y + state->src_h; | ||
146 | intel_state->dst.x1 = state->crtc_x; | ||
147 | intel_state->dst.y1 = state->crtc_y; | ||
148 | intel_state->dst.x2 = state->crtc_x + state->crtc_w; | ||
149 | intel_state->dst.y2 = state->crtc_y + state->crtc_h; | ||
150 | |||
151 | /* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */ | 137 | /* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */ |
152 | intel_state->clip.x1 = 0; | 138 | intel_state->clip.x1 = 0; |
153 | intel_state->clip.y1 = 0; | 139 | intel_state->clip.y1 = 0; |
@@ -180,7 +166,7 @@ static int intel_plane_atomic_check(struct drm_plane *plane, | |||
180 | } | 166 | } |
181 | } | 167 | } |
182 | 168 | ||
183 | intel_state->visible = false; | 169 | intel_state->base.visible = false; |
184 | ret = intel_plane->check_plane(plane, crtc_state, intel_state); | 170 | ret = intel_plane->check_plane(plane, crtc_state, intel_state); |
185 | if (ret) | 171 | if (ret) |
186 | return ret; | 172 | return ret; |
@@ -196,7 +182,7 @@ static void intel_plane_atomic_update(struct drm_plane *plane, | |||
196 | to_intel_plane_state(plane->state); | 182 | to_intel_plane_state(plane->state); |
197 | struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc; | 183 | struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc; |
198 | 184 | ||
199 | if (intel_state->visible) | 185 | if (intel_state->base.visible) |
200 | intel_plane->update_plane(plane, | 186 | intel_plane->update_plane(plane, |
201 | to_intel_crtc_state(crtc->state), | 187 | to_intel_crtc_state(crtc->state), |
202 | intel_state); | 188 | intel_state); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index dcf93b3d4fb6..8cc361114112 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2565,7 +2565,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, | |||
2565 | * simplest solution is to just disable the primary plane now and | 2565 | * simplest solution is to just disable the primary plane now and |
2566 | * pretend the BIOS never had it enabled. | 2566 | * pretend the BIOS never had it enabled. |
2567 | */ | 2567 | */ |
2568 | to_intel_plane_state(plane_state)->visible = false; | 2568 | to_intel_plane_state(plane_state)->base.visible = false; |
2569 | crtc_state->plane_mask &= ~(1 << drm_plane_index(primary)); | 2569 | crtc_state->plane_mask &= ~(1 << drm_plane_index(primary)); |
2570 | intel_pre_disable_primary_noatomic(&intel_crtc->base); | 2570 | intel_pre_disable_primary_noatomic(&intel_crtc->base); |
2571 | intel_plane->disable_plane(primary, &intel_crtc->base); | 2571 | intel_plane->disable_plane(primary, &intel_crtc->base); |
@@ -2583,14 +2583,14 @@ valid_fb: | |||
2583 | plane_state->crtc_w = fb->width; | 2583 | plane_state->crtc_w = fb->width; |
2584 | plane_state->crtc_h = fb->height; | 2584 | plane_state->crtc_h = fb->height; |
2585 | 2585 | ||
2586 | intel_state->src.x1 = plane_state->src_x; | 2586 | intel_state->base.src.x1 = plane_state->src_x; |
2587 | intel_state->src.y1 = plane_state->src_y; | 2587 | intel_state->base.src.y1 = plane_state->src_y; |
2588 | intel_state->src.x2 = plane_state->src_x + plane_state->src_w; | 2588 | intel_state->base.src.x2 = plane_state->src_x + plane_state->src_w; |
2589 | intel_state->src.y2 = plane_state->src_y + plane_state->src_h; | 2589 | intel_state->base.src.y2 = plane_state->src_y + plane_state->src_h; |
2590 | intel_state->dst.x1 = plane_state->crtc_x; | 2590 | intel_state->base.dst.x1 = plane_state->crtc_x; |
2591 | intel_state->dst.y1 = plane_state->crtc_y; | 2591 | intel_state->base.dst.y1 = plane_state->crtc_y; |
2592 | intel_state->dst.x2 = plane_state->crtc_x + plane_state->crtc_w; | 2592 | intel_state->base.dst.x2 = plane_state->crtc_x + plane_state->crtc_w; |
2593 | intel_state->dst.y2 = plane_state->crtc_y + plane_state->crtc_h; | 2593 | intel_state->base.dst.y2 = plane_state->crtc_y + plane_state->crtc_h; |
2594 | 2594 | ||
2595 | obj = intel_fb_obj(fb); | 2595 | obj = intel_fb_obj(fb); |
2596 | if (obj->tiling_mode != I915_TILING_NONE) | 2596 | if (obj->tiling_mode != I915_TILING_NONE) |
@@ -2618,8 +2618,8 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, | |||
2618 | i915_reg_t reg = DSPCNTR(plane); | 2618 | i915_reg_t reg = DSPCNTR(plane); |
2619 | unsigned int rotation = plane_state->base.rotation; | 2619 | unsigned int rotation = plane_state->base.rotation; |
2620 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); | 2620 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); |
2621 | int x = plane_state->src.x1 >> 16; | 2621 | int x = plane_state->base.src.x1 >> 16; |
2622 | int y = plane_state->src.y1 >> 16; | 2622 | int y = plane_state->base.src.y1 >> 16; |
2623 | 2623 | ||
2624 | dspcntr = DISPPLANE_GAMMA_ENABLE; | 2624 | dspcntr = DISPPLANE_GAMMA_ENABLE; |
2625 | 2625 | ||
@@ -2688,7 +2688,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, | |||
2688 | intel_crtc->dspaddr_offset = linear_offset; | 2688 | intel_crtc->dspaddr_offset = linear_offset; |
2689 | } | 2689 | } |
2690 | 2690 | ||
2691 | if (rotation == BIT(DRM_ROTATE_180)) { | 2691 | if (rotation == DRM_ROTATE_180) { |
2692 | dspcntr |= DISPPLANE_ROTATE_180; | 2692 | dspcntr |= DISPPLANE_ROTATE_180; |
2693 | 2693 | ||
2694 | x += (crtc_state->pipe_src_w - 1); | 2694 | x += (crtc_state->pipe_src_w - 1); |
@@ -2748,8 +2748,8 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, | |||
2748 | i915_reg_t reg = DSPCNTR(plane); | 2748 | i915_reg_t reg = DSPCNTR(plane); |
2749 | unsigned int rotation = plane_state->base.rotation; | 2749 | unsigned int rotation = plane_state->base.rotation; |
2750 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); | 2750 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); |
2751 | int x = plane_state->src.x1 >> 16; | 2751 | int x = plane_state->base.src.x1 >> 16; |
2752 | int y = plane_state->src.y1 >> 16; | 2752 | int y = plane_state->base.src.y1 >> 16; |
2753 | 2753 | ||
2754 | dspcntr = DISPPLANE_GAMMA_ENABLE; | 2754 | dspcntr = DISPPLANE_GAMMA_ENABLE; |
2755 | dspcntr |= DISPLAY_PLANE_ENABLE; | 2755 | dspcntr |= DISPLAY_PLANE_ENABLE; |
@@ -2791,7 +2791,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, | |||
2791 | intel_compute_tile_offset(&x, &y, fb, 0, | 2791 | intel_compute_tile_offset(&x, &y, fb, 0, |
2792 | fb->pitches[0], rotation); | 2792 | fb->pitches[0], rotation); |
2793 | linear_offset -= intel_crtc->dspaddr_offset; | 2793 | linear_offset -= intel_crtc->dspaddr_offset; |
2794 | if (rotation == BIT(DRM_ROTATE_180)) { | 2794 | if (rotation == DRM_ROTATE_180) { |
2795 | dspcntr |= DISPPLANE_ROTATE_180; | 2795 | dspcntr |= DISPPLANE_ROTATE_180; |
2796 | 2796 | ||
2797 | if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) { | 2797 | if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) { |
@@ -2952,17 +2952,17 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier) | |||
2952 | u32 skl_plane_ctl_rotation(unsigned int rotation) | 2952 | u32 skl_plane_ctl_rotation(unsigned int rotation) |
2953 | { | 2953 | { |
2954 | switch (rotation) { | 2954 | switch (rotation) { |
2955 | case BIT(DRM_ROTATE_0): | 2955 | case DRM_ROTATE_0: |
2956 | break; | 2956 | break; |
2957 | /* | 2957 | /* |
2958 | * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr | 2958 | * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr |
2959 | * while i915 HW rotation is clockwise, thats why this swapping. | 2959 | * while i915 HW rotation is clockwise, thats why this swapping. |
2960 | */ | 2960 | */ |
2961 | case BIT(DRM_ROTATE_90): | 2961 | case DRM_ROTATE_90: |
2962 | return PLANE_CTL_ROTATE_270; | 2962 | return PLANE_CTL_ROTATE_270; |
2963 | case BIT(DRM_ROTATE_180): | 2963 | case DRM_ROTATE_180: |
2964 | return PLANE_CTL_ROTATE_180; | 2964 | return PLANE_CTL_ROTATE_180; |
2965 | case BIT(DRM_ROTATE_270): | 2965 | case DRM_ROTATE_270: |
2966 | return PLANE_CTL_ROTATE_90; | 2966 | return PLANE_CTL_ROTATE_90; |
2967 | default: | 2967 | default: |
2968 | MISSING_CASE(rotation); | 2968 | MISSING_CASE(rotation); |
@@ -2987,14 +2987,14 @@ static void skylake_update_primary_plane(struct drm_plane *plane, | |||
2987 | int x_offset, y_offset; | 2987 | int x_offset, y_offset; |
2988 | u32 surf_addr; | 2988 | u32 surf_addr; |
2989 | int scaler_id = plane_state->scaler_id; | 2989 | int scaler_id = plane_state->scaler_id; |
2990 | int src_x = plane_state->src.x1 >> 16; | 2990 | int src_x = plane_state->base.src.x1 >> 16; |
2991 | int src_y = plane_state->src.y1 >> 16; | 2991 | int src_y = plane_state->base.src.y1 >> 16; |
2992 | int src_w = drm_rect_width(&plane_state->src) >> 16; | 2992 | int src_w = drm_rect_width(&plane_state->base.src) >> 16; |
2993 | int src_h = drm_rect_height(&plane_state->src) >> 16; | 2993 | int src_h = drm_rect_height(&plane_state->base.src) >> 16; |
2994 | int dst_x = plane_state->dst.x1; | 2994 | int dst_x = plane_state->base.dst.x1; |
2995 | int dst_y = plane_state->dst.y1; | 2995 | int dst_y = plane_state->base.dst.y1; |
2996 | int dst_w = drm_rect_width(&plane_state->dst); | 2996 | int dst_w = drm_rect_width(&plane_state->base.dst); |
2997 | int dst_h = drm_rect_height(&plane_state->dst); | 2997 | int dst_h = drm_rect_height(&plane_state->base.dst); |
2998 | 2998 | ||
2999 | plane_ctl = PLANE_CTL_ENABLE | | 2999 | plane_ctl = PLANE_CTL_ENABLE | |
3000 | PLANE_CTL_PIPE_GAMMA_ENABLE | | 3000 | PLANE_CTL_PIPE_GAMMA_ENABLE | |
@@ -3009,7 +3009,7 @@ static void skylake_update_primary_plane(struct drm_plane *plane, | |||
3009 | fb->pixel_format); | 3009 | fb->pixel_format); |
3010 | surf_addr = intel_plane_obj_offset(to_intel_plane(plane), obj, 0); | 3010 | surf_addr = intel_plane_obj_offset(to_intel_plane(plane), obj, 0); |
3011 | 3011 | ||
3012 | WARN_ON(drm_rect_width(&plane_state->src) == 0); | 3012 | WARN_ON(drm_rect_width(&plane_state->base.src) == 0); |
3013 | 3013 | ||
3014 | if (intel_rotation_90_or_270(rotation)) { | 3014 | if (intel_rotation_90_or_270(rotation)) { |
3015 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); | 3015 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); |
@@ -3098,7 +3098,7 @@ static void intel_update_primary_planes(struct drm_device *dev) | |||
3098 | drm_modeset_lock_crtc(crtc, &plane->base); | 3098 | drm_modeset_lock_crtc(crtc, &plane->base); |
3099 | plane_state = to_intel_plane_state(plane->base.state); | 3099 | plane_state = to_intel_plane_state(plane->base.state); |
3100 | 3100 | ||
3101 | if (plane_state->visible) | 3101 | if (plane_state->base.visible) |
3102 | plane->update_plane(&plane->base, | 3102 | plane->update_plane(&plane->base, |
3103 | to_intel_crtc_state(crtc->state), | 3103 | to_intel_crtc_state(crtc->state), |
3104 | plane_state); | 3104 | plane_state); |
@@ -4248,7 +4248,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state) | |||
4248 | intel_crtc->pipe, SKL_CRTC_INDEX); | 4248 | intel_crtc->pipe, SKL_CRTC_INDEX); |
4249 | 4249 | ||
4250 | return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX, | 4250 | return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX, |
4251 | &state->scaler_state.scaler_id, BIT(DRM_ROTATE_0), | 4251 | &state->scaler_state.scaler_id, DRM_ROTATE_0, |
4252 | state->pipe_src_w, state->pipe_src_h, | 4252 | state->pipe_src_w, state->pipe_src_h, |
4253 | adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay); | 4253 | adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay); |
4254 | } | 4254 | } |
@@ -4273,7 +4273,7 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, | |||
4273 | struct drm_framebuffer *fb = plane_state->base.fb; | 4273 | struct drm_framebuffer *fb = plane_state->base.fb; |
4274 | int ret; | 4274 | int ret; |
4275 | 4275 | ||
4276 | bool force_detach = !fb || !plane_state->visible; | 4276 | bool force_detach = !fb || !plane_state->base.visible; |
4277 | 4277 | ||
4278 | DRM_DEBUG_KMS("Updating scaler for [PLANE:%d:%s] scaler_user index %u.%u\n", | 4278 | DRM_DEBUG_KMS("Updating scaler for [PLANE:%d:%s] scaler_user index %u.%u\n", |
4279 | intel_plane->base.base.id, intel_plane->base.name, | 4279 | intel_plane->base.base.id, intel_plane->base.name, |
@@ -4283,10 +4283,10 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, | |||
4283 | drm_plane_index(&intel_plane->base), | 4283 | drm_plane_index(&intel_plane->base), |
4284 | &plane_state->scaler_id, | 4284 | &plane_state->scaler_id, |
4285 | plane_state->base.rotation, | 4285 | plane_state->base.rotation, |
4286 | drm_rect_width(&plane_state->src) >> 16, | 4286 | drm_rect_width(&plane_state->base.src) >> 16, |
4287 | drm_rect_height(&plane_state->src) >> 16, | 4287 | drm_rect_height(&plane_state->base.src) >> 16, |
4288 | drm_rect_width(&plane_state->dst), | 4288 | drm_rect_width(&plane_state->base.dst), |
4289 | drm_rect_height(&plane_state->dst)); | 4289 | drm_rect_height(&plane_state->base.dst)); |
4290 | 4290 | ||
4291 | if (ret || plane_state->scaler_id < 0) | 4291 | if (ret || plane_state->scaler_id < 0) |
4292 | return ret; | 4292 | return ret; |
@@ -4584,9 +4584,9 @@ static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state) | |||
4584 | 4584 | ||
4585 | intel_fbc_post_update(crtc); | 4585 | intel_fbc_post_update(crtc); |
4586 | 4586 | ||
4587 | if (primary_state->visible && | 4587 | if (primary_state->base.visible && |
4588 | (needs_modeset(&pipe_config->base) || | 4588 | (needs_modeset(&pipe_config->base) || |
4589 | !old_primary_state->visible)) | 4589 | !old_primary_state->base.visible)) |
4590 | intel_post_enable_primary(&crtc->base); | 4590 | intel_post_enable_primary(&crtc->base); |
4591 | } | 4591 | } |
4592 | } | 4592 | } |
@@ -4612,8 +4612,8 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state) | |||
4612 | 4612 | ||
4613 | intel_fbc_pre_update(crtc, pipe_config, primary_state); | 4613 | intel_fbc_pre_update(crtc, pipe_config, primary_state); |
4614 | 4614 | ||
4615 | if (old_primary_state->visible && | 4615 | if (old_primary_state->base.visible && |
4616 | (modeset || !primary_state->visible)) | 4616 | (modeset || !primary_state->base.visible)) |
4617 | intel_pre_disable_primary(&crtc->base); | 4617 | intel_pre_disable_primary(&crtc->base); |
4618 | } | 4618 | } |
4619 | 4619 | ||
@@ -6290,13 +6290,13 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc) | |||
6290 | if (!intel_crtc->active) | 6290 | if (!intel_crtc->active) |
6291 | return; | 6291 | return; |
6292 | 6292 | ||
6293 | if (to_intel_plane_state(crtc->primary->state)->visible) { | 6293 | if (to_intel_plane_state(crtc->primary->state)->base.visible) { |
6294 | WARN_ON(intel_crtc->flip_work); | 6294 | WARN_ON(intel_crtc->flip_work); |
6295 | 6295 | ||
6296 | intel_pre_disable_primary_noatomic(crtc); | 6296 | intel_pre_disable_primary_noatomic(crtc); |
6297 | 6297 | ||
6298 | intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc->primary)); | 6298 | intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc->primary)); |
6299 | to_intel_plane_state(crtc->primary->state)->visible = false; | 6299 | to_intel_plane_state(crtc->primary->state)->base.visible = false; |
6300 | } | 6300 | } |
6301 | 6301 | ||
6302 | dev_priv->display.crtc_disable(crtc); | 6302 | dev_priv->display.crtc_disable(crtc); |
@@ -10170,7 +10170,7 @@ static void i845_update_cursor(struct drm_crtc *crtc, u32 base, | |||
10170 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 10170 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
10171 | uint32_t cntl = 0, size = 0; | 10171 | uint32_t cntl = 0, size = 0; |
10172 | 10172 | ||
10173 | if (plane_state && plane_state->visible) { | 10173 | if (plane_state && plane_state->base.visible) { |
10174 | unsigned int width = plane_state->base.crtc_w; | 10174 | unsigned int width = plane_state->base.crtc_w; |
10175 | unsigned int height = plane_state->base.crtc_h; | 10175 | unsigned int height = plane_state->base.crtc_h; |
10176 | unsigned int stride = roundup_pow_of_two(width) * 4; | 10176 | unsigned int stride = roundup_pow_of_two(width) * 4; |
@@ -10234,7 +10234,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base, | |||
10234 | int pipe = intel_crtc->pipe; | 10234 | int pipe = intel_crtc->pipe; |
10235 | uint32_t cntl = 0; | 10235 | uint32_t cntl = 0; |
10236 | 10236 | ||
10237 | if (plane_state && plane_state->visible) { | 10237 | if (plane_state && plane_state->base.visible) { |
10238 | cntl = MCURSOR_GAMMA_ENABLE; | 10238 | cntl = MCURSOR_GAMMA_ENABLE; |
10239 | switch (plane_state->base.crtc_w) { | 10239 | switch (plane_state->base.crtc_w) { |
10240 | case 64: | 10240 | case 64: |
@@ -10255,7 +10255,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base, | |||
10255 | if (HAS_DDI(dev)) | 10255 | if (HAS_DDI(dev)) |
10256 | cntl |= CURSOR_PIPE_CSC_ENABLE; | 10256 | cntl |= CURSOR_PIPE_CSC_ENABLE; |
10257 | 10257 | ||
10258 | if (plane_state->base.rotation == BIT(DRM_ROTATE_180)) | 10258 | if (plane_state->base.rotation == DRM_ROTATE_180) |
10259 | cntl |= CURSOR_ROTATE_180; | 10259 | cntl |= CURSOR_ROTATE_180; |
10260 | } | 10260 | } |
10261 | 10261 | ||
@@ -10301,7 +10301,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc, | |||
10301 | 10301 | ||
10302 | /* ILK+ do this automagically */ | 10302 | /* ILK+ do this automagically */ |
10303 | if (HAS_GMCH_DISPLAY(dev) && | 10303 | if (HAS_GMCH_DISPLAY(dev) && |
10304 | plane_state->base.rotation == BIT(DRM_ROTATE_180)) { | 10304 | plane_state->base.rotation == DRM_ROTATE_180) { |
10305 | base += (plane_state->base.crtc_h * | 10305 | base += (plane_state->base.crtc_h * |
10306 | plane_state->base.crtc_w - 1) * 4; | 10306 | plane_state->base.crtc_w - 1) * 4; |
10307 | } | 10307 | } |
@@ -11818,7 +11818,7 @@ static bool intel_wm_need_update(struct drm_plane *plane, | |||
11818 | struct intel_plane_state *cur = to_intel_plane_state(plane->state); | 11818 | struct intel_plane_state *cur = to_intel_plane_state(plane->state); |
11819 | 11819 | ||
11820 | /* Update watermarks on tiling or size changes. */ | 11820 | /* Update watermarks on tiling or size changes. */ |
11821 | if (new->visible != cur->visible) | 11821 | if (new->base.visible != cur->base.visible) |
11822 | return true; | 11822 | return true; |
11823 | 11823 | ||
11824 | if (!cur->base.fb || !new->base.fb) | 11824 | if (!cur->base.fb || !new->base.fb) |
@@ -11826,10 +11826,10 @@ static bool intel_wm_need_update(struct drm_plane *plane, | |||
11826 | 11826 | ||
11827 | if (cur->base.fb->modifier[0] != new->base.fb->modifier[0] || | 11827 | if (cur->base.fb->modifier[0] != new->base.fb->modifier[0] || |
11828 | cur->base.rotation != new->base.rotation || | 11828 | cur->base.rotation != new->base.rotation || |
11829 | drm_rect_width(&new->src) != drm_rect_width(&cur->src) || | 11829 | drm_rect_width(&new->base.src) != drm_rect_width(&cur->base.src) || |
11830 | drm_rect_height(&new->src) != drm_rect_height(&cur->src) || | 11830 | drm_rect_height(&new->base.src) != drm_rect_height(&cur->base.src) || |
11831 | drm_rect_width(&new->dst) != drm_rect_width(&cur->dst) || | 11831 | drm_rect_width(&new->base.dst) != drm_rect_width(&cur->base.dst) || |
11832 | drm_rect_height(&new->dst) != drm_rect_height(&cur->dst)) | 11832 | drm_rect_height(&new->base.dst) != drm_rect_height(&cur->base.dst)) |
11833 | return true; | 11833 | return true; |
11834 | 11834 | ||
11835 | return false; | 11835 | return false; |
@@ -11837,10 +11837,10 @@ static bool intel_wm_need_update(struct drm_plane *plane, | |||
11837 | 11837 | ||
11838 | static bool needs_scaling(struct intel_plane_state *state) | 11838 | static bool needs_scaling(struct intel_plane_state *state) |
11839 | { | 11839 | { |
11840 | int src_w = drm_rect_width(&state->src) >> 16; | 11840 | int src_w = drm_rect_width(&state->base.src) >> 16; |
11841 | int src_h = drm_rect_height(&state->src) >> 16; | 11841 | int src_h = drm_rect_height(&state->base.src) >> 16; |
11842 | int dst_w = drm_rect_width(&state->dst); | 11842 | int dst_w = drm_rect_width(&state->base.dst); |
11843 | int dst_h = drm_rect_height(&state->dst); | 11843 | int dst_h = drm_rect_height(&state->base.dst); |
11844 | 11844 | ||
11845 | return (src_w != dst_w || src_h != dst_h); | 11845 | return (src_w != dst_w || src_h != dst_h); |
11846 | } | 11846 | } |
@@ -11871,8 +11871,8 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, | |||
11871 | return ret; | 11871 | return ret; |
11872 | } | 11872 | } |
11873 | 11873 | ||
11874 | was_visible = old_plane_state->visible; | 11874 | was_visible = old_plane_state->base.visible; |
11875 | visible = to_intel_plane_state(plane_state)->visible; | 11875 | visible = to_intel_plane_state(plane_state)->base.visible; |
11876 | 11876 | ||
11877 | if (!was_crtc_enabled && WARN_ON(was_visible)) | 11877 | if (!was_crtc_enabled && WARN_ON(was_visible)) |
11878 | was_visible = false; | 11878 | was_visible = false; |
@@ -11888,7 +11888,7 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, | |||
11888 | * only combine the results from all planes in the current place? | 11888 | * only combine the results from all planes in the current place? |
11889 | */ | 11889 | */ |
11890 | if (!is_crtc_enabled) | 11890 | if (!is_crtc_enabled) |
11891 | to_intel_plane_state(plane_state)->visible = visible = false; | 11891 | to_intel_plane_state(plane_state)->base.visible = visible = false; |
11892 | 11892 | ||
11893 | if (!was_visible && !visible) | 11893 | if (!was_visible && !visible) |
11894 | return 0; | 11894 | return 0; |
@@ -12283,12 +12283,13 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, | |||
12283 | drm_get_format_name(fb->pixel_format)); | 12283 | drm_get_format_name(fb->pixel_format)); |
12284 | DRM_DEBUG_KMS("\tscaler:%d src %dx%d+%d+%d dst %dx%d+%d+%d\n", | 12284 | DRM_DEBUG_KMS("\tscaler:%d src %dx%d+%d+%d dst %dx%d+%d+%d\n", |
12285 | state->scaler_id, | 12285 | state->scaler_id, |
12286 | state->src.x1 >> 16, state->src.y1 >> 16, | 12286 | state->base.src.x1 >> 16, |
12287 | drm_rect_width(&state->src) >> 16, | 12287 | state->base.src.y1 >> 16, |
12288 | drm_rect_height(&state->src) >> 16, | 12288 | drm_rect_width(&state->base.src) >> 16, |
12289 | state->dst.x1, state->dst.y1, | 12289 | drm_rect_height(&state->base.src) >> 16, |
12290 | drm_rect_width(&state->dst), | 12290 | state->base.dst.x1, state->base.dst.y1, |
12291 | drm_rect_height(&state->dst)); | 12291 | drm_rect_width(&state->base.dst), |
12292 | drm_rect_height(&state->base.dst)); | ||
12292 | } | 12293 | } |
12293 | } | 12294 | } |
12294 | 12295 | ||
@@ -14109,7 +14110,6 @@ intel_check_primary_plane(struct drm_plane *plane, | |||
14109 | struct intel_plane_state *state) | 14110 | struct intel_plane_state *state) |
14110 | { | 14111 | { |
14111 | struct drm_crtc *crtc = state->base.crtc; | 14112 | struct drm_crtc *crtc = state->base.crtc; |
14112 | struct drm_framebuffer *fb = state->base.fb; | ||
14113 | int min_scale = DRM_PLANE_HELPER_NO_SCALING; | 14113 | int min_scale = DRM_PLANE_HELPER_NO_SCALING; |
14114 | int max_scale = DRM_PLANE_HELPER_NO_SCALING; | 14114 | int max_scale = DRM_PLANE_HELPER_NO_SCALING; |
14115 | bool can_position = false; | 14115 | bool can_position = false; |
@@ -14123,12 +14123,10 @@ intel_check_primary_plane(struct drm_plane *plane, | |||
14123 | can_position = true; | 14123 | can_position = true; |
14124 | } | 14124 | } |
14125 | 14125 | ||
14126 | return drm_plane_helper_check_update(plane, crtc, fb, &state->src, | 14126 | return drm_plane_helper_check_state(&state->base, |
14127 | &state->dst, &state->clip, | 14127 | &state->clip, |
14128 | state->base.rotation, | 14128 | min_scale, max_scale, |
14129 | min_scale, max_scale, | 14129 | can_position, true); |
14130 | can_position, true, | ||
14131 | &state->visible); | ||
14132 | } | 14130 | } |
14133 | 14131 | ||
14134 | static void intel_begin_crtc_commit(struct drm_crtc *crtc, | 14132 | static void intel_begin_crtc_commit(struct drm_crtc *crtc, |
@@ -14288,11 +14286,11 @@ fail: | |||
14288 | void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane) | 14286 | void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane) |
14289 | { | 14287 | { |
14290 | if (!dev->mode_config.rotation_property) { | 14288 | if (!dev->mode_config.rotation_property) { |
14291 | unsigned long flags = BIT(DRM_ROTATE_0) | | 14289 | unsigned long flags = DRM_ROTATE_0 | |
14292 | BIT(DRM_ROTATE_180); | 14290 | DRM_ROTATE_180; |
14293 | 14291 | ||
14294 | if (INTEL_INFO(dev)->gen >= 9) | 14292 | if (INTEL_INFO(dev)->gen >= 9) |
14295 | flags |= BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270); | 14293 | flags |= DRM_ROTATE_90 | DRM_ROTATE_270; |
14296 | 14294 | ||
14297 | dev->mode_config.rotation_property = | 14295 | dev->mode_config.rotation_property = |
14298 | drm_mode_create_rotation_property(dev, flags); | 14296 | drm_mode_create_rotation_property(dev, flags); |
@@ -14308,19 +14306,17 @@ intel_check_cursor_plane(struct drm_plane *plane, | |||
14308 | struct intel_crtc_state *crtc_state, | 14306 | struct intel_crtc_state *crtc_state, |
14309 | struct intel_plane_state *state) | 14307 | struct intel_plane_state *state) |
14310 | { | 14308 | { |
14311 | struct drm_crtc *crtc = crtc_state->base.crtc; | ||
14312 | struct drm_framebuffer *fb = state->base.fb; | 14309 | struct drm_framebuffer *fb = state->base.fb; |
14313 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | 14310 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); |
14314 | enum pipe pipe = to_intel_plane(plane)->pipe; | 14311 | enum pipe pipe = to_intel_plane(plane)->pipe; |
14315 | unsigned stride; | 14312 | unsigned stride; |
14316 | int ret; | 14313 | int ret; |
14317 | 14314 | ||
14318 | ret = drm_plane_helper_check_update(plane, crtc, fb, &state->src, | 14315 | ret = drm_plane_helper_check_state(&state->base, |
14319 | &state->dst, &state->clip, | 14316 | &state->clip, |
14320 | state->base.rotation, | 14317 | DRM_PLANE_HELPER_NO_SCALING, |
14321 | DRM_PLANE_HELPER_NO_SCALING, | 14318 | DRM_PLANE_HELPER_NO_SCALING, |
14322 | DRM_PLANE_HELPER_NO_SCALING, | 14319 | true, true); |
14323 | true, true, &state->visible); | ||
14324 | if (ret) | 14320 | if (ret) |
14325 | return ret; | 14321 | return ret; |
14326 | 14322 | ||
@@ -14357,7 +14353,7 @@ intel_check_cursor_plane(struct drm_plane *plane, | |||
14357 | * Refuse the put the cursor into that compromised position. | 14353 | * Refuse the put the cursor into that compromised position. |
14358 | */ | 14354 | */ |
14359 | if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C && | 14355 | if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C && |
14360 | state->visible && state->base.crtc_x < 0) { | 14356 | state->base.visible && state->base.crtc_x < 0) { |
14361 | DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n"); | 14357 | DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n"); |
14362 | return -EINVAL; | 14358 | return -EINVAL; |
14363 | } | 14359 | } |
@@ -14435,8 +14431,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev, | |||
14435 | if (!dev->mode_config.rotation_property) | 14431 | if (!dev->mode_config.rotation_property) |
14436 | dev->mode_config.rotation_property = | 14432 | dev->mode_config.rotation_property = |
14437 | drm_mode_create_rotation_property(dev, | 14433 | drm_mode_create_rotation_property(dev, |
14438 | BIT(DRM_ROTATE_0) | | 14434 | DRM_ROTATE_0 | |
14439 | BIT(DRM_ROTATE_180)); | 14435 | DRM_ROTATE_180); |
14440 | if (dev->mode_config.rotation_property) | 14436 | if (dev->mode_config.rotation_property) |
14441 | drm_object_attach_property(&cursor->base.base, | 14437 | drm_object_attach_property(&cursor->base.base, |
14442 | dev->mode_config.rotation_property, | 14438 | dev->mode_config.rotation_property, |
@@ -15807,7 +15803,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) | |||
15807 | * Temporarily change the plane mapping and disable everything | 15803 | * Temporarily change the plane mapping and disable everything |
15808 | * ... */ | 15804 | * ... */ |
15809 | plane = crtc->plane; | 15805 | plane = crtc->plane; |
15810 | to_intel_plane_state(crtc->base.primary->state)->visible = true; | 15806 | to_intel_plane_state(crtc->base.primary->state)->base.visible = true; |
15811 | crtc->plane = !plane; | 15807 | crtc->plane = !plane; |
15812 | intel_crtc_disable_noatomic(&crtc->base); | 15808 | intel_crtc_disable_noatomic(&crtc->base); |
15813 | crtc->plane = plane; | 15809 | crtc->plane = plane; |
@@ -15934,10 +15930,10 @@ static void readout_plane_state(struct intel_crtc *crtc) | |||
15934 | struct intel_plane_state *plane_state = | 15930 | struct intel_plane_state *plane_state = |
15935 | to_intel_plane_state(primary->state); | 15931 | to_intel_plane_state(primary->state); |
15936 | 15932 | ||
15937 | plane_state->visible = crtc->active && | 15933 | plane_state->base.visible = crtc->active && |
15938 | primary_get_hw_state(to_intel_plane(primary)); | 15934 | primary_get_hw_state(to_intel_plane(primary)); |
15939 | 15935 | ||
15940 | if (plane_state->visible) | 15936 | if (plane_state->base.visible) |
15941 | crtc->base.state->plane_mask |= 1 << drm_plane_index(primary); | 15937 | crtc->base.state->plane_mask |= 1 << drm_plane_index(primary); |
15942 | } | 15938 | } |
15943 | 15939 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index cc937a19b1ba..9c59521afb18 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -338,10 +338,7 @@ struct intel_atomic_state { | |||
338 | 338 | ||
339 | struct intel_plane_state { | 339 | struct intel_plane_state { |
340 | struct drm_plane_state base; | 340 | struct drm_plane_state base; |
341 | struct drm_rect src; | ||
342 | struct drm_rect dst; | ||
343 | struct drm_rect clip; | 341 | struct drm_rect clip; |
344 | bool visible; | ||
345 | 342 | ||
346 | /* | 343 | /* |
347 | * scaler_id | 344 | * scaler_id |
@@ -1258,7 +1255,7 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv, | |||
1258 | static inline bool | 1255 | static inline bool |
1259 | intel_rotation_90_or_270(unsigned int rotation) | 1256 | intel_rotation_90_or_270(unsigned int rotation) |
1260 | { | 1257 | { |
1261 | return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)); | 1258 | return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270); |
1262 | } | 1259 | } |
1263 | 1260 | ||
1264 | void intel_create_rotation_property(struct drm_device *dev, | 1261 | void intel_create_rotation_property(struct drm_device *dev, |
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c index 6a7ad3ed1463..3f4e32f8baae 100644 --- a/drivers/gpu/drm/i915/intel_fbc.c +++ b/drivers/gpu/drm/i915/intel_fbc.c | |||
@@ -494,7 +494,7 @@ static bool multiple_pipes_ok(struct intel_crtc *crtc, | |||
494 | if (!no_fbc_on_multiple_pipes(dev_priv)) | 494 | if (!no_fbc_on_multiple_pipes(dev_priv)) |
495 | return true; | 495 | return true; |
496 | 496 | ||
497 | if (plane_state->visible) | 497 | if (plane_state->base.visible) |
498 | fbc->visible_pipes_mask |= (1 << pipe); | 498 | fbc->visible_pipes_mask |= (1 << pipe); |
499 | else | 499 | else |
500 | fbc->visible_pipes_mask &= ~(1 << pipe); | 500 | fbc->visible_pipes_mask &= ~(1 << pipe); |
@@ -725,9 +725,9 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, | |||
725 | ilk_pipe_pixel_rate(crtc_state); | 725 | ilk_pipe_pixel_rate(crtc_state); |
726 | 726 | ||
727 | cache->plane.rotation = plane_state->base.rotation; | 727 | cache->plane.rotation = plane_state->base.rotation; |
728 | cache->plane.src_w = drm_rect_width(&plane_state->src) >> 16; | 728 | cache->plane.src_w = drm_rect_width(&plane_state->base.src) >> 16; |
729 | cache->plane.src_h = drm_rect_height(&plane_state->src) >> 16; | 729 | cache->plane.src_h = drm_rect_height(&plane_state->base.src) >> 16; |
730 | cache->plane.visible = plane_state->visible; | 730 | cache->plane.visible = plane_state->base.visible; |
731 | 731 | ||
732 | if (!cache->plane.visible) | 732 | if (!cache->plane.visible) |
733 | return; | 733 | return; |
@@ -775,7 +775,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) | |||
775 | return false; | 775 | return false; |
776 | } | 776 | } |
777 | if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) && | 777 | if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) && |
778 | cache->plane.rotation != BIT(DRM_ROTATE_0)) { | 778 | cache->plane.rotation != DRM_ROTATE_0) { |
779 | fbc->no_fbc_reason = "rotation unsupported"; | 779 | fbc->no_fbc_reason = "rotation unsupported"; |
780 | return false; | 780 | return false; |
781 | } | 781 | } |
@@ -1050,7 +1050,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, | |||
1050 | struct intel_plane_state *intel_plane_state = | 1050 | struct intel_plane_state *intel_plane_state = |
1051 | to_intel_plane_state(plane_state); | 1051 | to_intel_plane_state(plane_state); |
1052 | 1052 | ||
1053 | if (!intel_plane_state->visible) | 1053 | if (!intel_plane_state->base.visible) |
1054 | continue; | 1054 | continue; |
1055 | 1055 | ||
1056 | for_each_crtc_in_state(state, crtc, crtc_state, j) { | 1056 | for_each_crtc_in_state(state, crtc, crtc_state, j) { |
@@ -1212,7 +1212,7 @@ void intel_fbc_init_pipe_state(struct drm_i915_private *dev_priv) | |||
1212 | 1212 | ||
1213 | for_each_intel_crtc(&dev_priv->drm, crtc) | 1213 | for_each_intel_crtc(&dev_priv->drm, crtc) |
1214 | if (intel_crtc_active(&crtc->base) && | 1214 | if (intel_crtc_active(&crtc->base) && |
1215 | to_intel_plane_state(crtc->base.primary->state)->visible) | 1215 | to_intel_plane_state(crtc->base.primary->state)->base.visible) |
1216 | dev_priv->fbc.visible_pipes_mask |= (1 << crtc->pipe); | 1216 | dev_priv->fbc.visible_pipes_mask |= (1 << crtc->pipe); |
1217 | } | 1217 | } |
1218 | 1218 | ||
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 3e3632c18733..69d7ea576baa 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/tty.h> | 34 | #include <linux/tty.h> |
35 | #include <linux/sysrq.h> | 35 | #include <linux/sysrq.h> |
36 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
37 | #include <linux/fb.h> | ||
38 | #include <linux/init.h> | 37 | #include <linux/init.h> |
39 | #include <linux/vga_switcheroo.h> | 38 | #include <linux/vga_switcheroo.h> |
40 | 39 | ||
@@ -223,7 +222,7 @@ static int intelfb_create(struct drm_fb_helper *helper, | |||
223 | * This also validates that any existing fb inherited from the | 222 | * This also validates that any existing fb inherited from the |
224 | * BIOS is suitable for own access. | 223 | * BIOS is suitable for own access. |
225 | */ | 224 | */ |
226 | ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0)); | 225 | ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); |
227 | if (ret) | 226 | if (ret) |
228 | goto out_unlock; | 227 | goto out_unlock; |
229 | 228 | ||
@@ -289,7 +288,7 @@ static int intelfb_create(struct drm_fb_helper *helper, | |||
289 | out_destroy_fbi: | 288 | out_destroy_fbi: |
290 | drm_fb_helper_release_fbi(helper); | 289 | drm_fb_helper_release_fbi(helper); |
291 | out_unpin: | 290 | out_unpin: |
292 | intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0)); | 291 | intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); |
293 | out_unlock: | 292 | out_unlock: |
294 | mutex_unlock(&dev->struct_mutex); | 293 | mutex_unlock(&dev->struct_mutex); |
295 | return ret; | 294 | return ret; |
@@ -554,7 +553,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev) | |||
554 | 553 | ||
555 | if (ifbdev->fb) { | 554 | if (ifbdev->fb) { |
556 | mutex_lock(&ifbdev->helper.dev->struct_mutex); | 555 | mutex_lock(&ifbdev->helper.dev->struct_mutex); |
557 | intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0)); | 556 | intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); |
558 | mutex_unlock(&ifbdev->helper.dev->struct_mutex); | 557 | mutex_unlock(&ifbdev->helper.dev->struct_mutex); |
559 | 558 | ||
560 | drm_framebuffer_remove(&ifbdev->fb->base); | 559 | drm_framebuffer_remove(&ifbdev->fb->base); |
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c index f2584d0a01ab..951e834dd274 100644 --- a/drivers/gpu/drm/i915/intel_modes.c +++ b/drivers/gpu/drm/i915/intel_modes.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
28 | #include <linux/fb.h> | ||
29 | #include <drm/drm_edid.h> | 28 | #include <drm/drm_edid.h> |
30 | #include <drm/drmP.h> | 29 | #include <drm/drmP.h> |
31 | #include "intel_drv.h" | 30 | #include "intel_drv.h" |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 97ba6c8cf907..ba062d70a548 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -960,7 +960,7 @@ static uint16_t vlv_compute_wm_level(struct intel_plane *plane, | |||
960 | if (dev_priv->wm.pri_latency[level] == 0) | 960 | if (dev_priv->wm.pri_latency[level] == 0) |
961 | return USHRT_MAX; | 961 | return USHRT_MAX; |
962 | 962 | ||
963 | if (!state->visible) | 963 | if (!state->base.visible) |
964 | return 0; | 964 | return 0; |
965 | 965 | ||
966 | cpp = drm_format_plane_cpp(state->base.fb->pixel_format, 0); | 966 | cpp = drm_format_plane_cpp(state->base.fb->pixel_format, 0); |
@@ -1002,7 +1002,7 @@ static void vlv_compute_fifo(struct intel_crtc *crtc) | |||
1002 | if (plane->base.type == DRM_PLANE_TYPE_CURSOR) | 1002 | if (plane->base.type == DRM_PLANE_TYPE_CURSOR) |
1003 | continue; | 1003 | continue; |
1004 | 1004 | ||
1005 | if (state->visible) { | 1005 | if (state->base.visible) { |
1006 | wm_state->num_active_planes++; | 1006 | wm_state->num_active_planes++; |
1007 | total_rate += drm_format_plane_cpp(state->base.fb->pixel_format, 0); | 1007 | total_rate += drm_format_plane_cpp(state->base.fb->pixel_format, 0); |
1008 | } | 1008 | } |
@@ -1018,7 +1018,7 @@ static void vlv_compute_fifo(struct intel_crtc *crtc) | |||
1018 | continue; | 1018 | continue; |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | if (!state->visible) { | 1021 | if (!state->base.visible) { |
1022 | plane->wm.fifo_size = 0; | 1022 | plane->wm.fifo_size = 0; |
1023 | continue; | 1023 | continue; |
1024 | } | 1024 | } |
@@ -1118,7 +1118,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc) | |||
1118 | struct intel_plane_state *state = | 1118 | struct intel_plane_state *state = |
1119 | to_intel_plane_state(plane->base.state); | 1119 | to_intel_plane_state(plane->base.state); |
1120 | 1120 | ||
1121 | if (!state->visible) | 1121 | if (!state->base.visible) |
1122 | continue; | 1122 | continue; |
1123 | 1123 | ||
1124 | /* normal watermarks */ | 1124 | /* normal watermarks */ |
@@ -1767,7 +1767,7 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate, | |||
1767 | drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0; | 1767 | drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0; |
1768 | uint32_t method1, method2; | 1768 | uint32_t method1, method2; |
1769 | 1769 | ||
1770 | if (!cstate->base.active || !pstate->visible) | 1770 | if (!cstate->base.active || !pstate->base.visible) |
1771 | return 0; | 1771 | return 0; |
1772 | 1772 | ||
1773 | method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value); | 1773 | method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value); |
@@ -1777,7 +1777,7 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate, | |||
1777 | 1777 | ||
1778 | method2 = ilk_wm_method2(ilk_pipe_pixel_rate(cstate), | 1778 | method2 = ilk_wm_method2(ilk_pipe_pixel_rate(cstate), |
1779 | cstate->base.adjusted_mode.crtc_htotal, | 1779 | cstate->base.adjusted_mode.crtc_htotal, |
1780 | drm_rect_width(&pstate->dst), | 1780 | drm_rect_width(&pstate->base.dst), |
1781 | cpp, mem_value); | 1781 | cpp, mem_value); |
1782 | 1782 | ||
1783 | return min(method1, method2); | 1783 | return min(method1, method2); |
@@ -1795,13 +1795,13 @@ static uint32_t ilk_compute_spr_wm(const struct intel_crtc_state *cstate, | |||
1795 | drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0; | 1795 | drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0; |
1796 | uint32_t method1, method2; | 1796 | uint32_t method1, method2; |
1797 | 1797 | ||
1798 | if (!cstate->base.active || !pstate->visible) | 1798 | if (!cstate->base.active || !pstate->base.visible) |
1799 | return 0; | 1799 | return 0; |
1800 | 1800 | ||
1801 | method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value); | 1801 | method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value); |
1802 | method2 = ilk_wm_method2(ilk_pipe_pixel_rate(cstate), | 1802 | method2 = ilk_wm_method2(ilk_pipe_pixel_rate(cstate), |
1803 | cstate->base.adjusted_mode.crtc_htotal, | 1803 | cstate->base.adjusted_mode.crtc_htotal, |
1804 | drm_rect_width(&pstate->dst), | 1804 | drm_rect_width(&pstate->base.dst), |
1805 | cpp, mem_value); | 1805 | cpp, mem_value); |
1806 | return min(method1, method2); | 1806 | return min(method1, method2); |
1807 | } | 1807 | } |
@@ -1820,7 +1820,7 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate, | |||
1820 | * this is necessary to avoid flickering. | 1820 | * this is necessary to avoid flickering. |
1821 | */ | 1821 | */ |
1822 | int cpp = 4; | 1822 | int cpp = 4; |
1823 | int width = pstate->visible ? pstate->base.crtc_w : 64; | 1823 | int width = pstate->base.visible ? pstate->base.crtc_w : 64; |
1824 | 1824 | ||
1825 | if (!cstate->base.active) | 1825 | if (!cstate->base.active) |
1826 | return 0; | 1826 | return 0; |
@@ -1838,10 +1838,10 @@ static uint32_t ilk_compute_fbc_wm(const struct intel_crtc_state *cstate, | |||
1838 | int cpp = pstate->base.fb ? | 1838 | int cpp = pstate->base.fb ? |
1839 | drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0; | 1839 | drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0; |
1840 | 1840 | ||
1841 | if (!cstate->base.active || !pstate->visible) | 1841 | if (!cstate->base.active || !pstate->base.visible) |
1842 | return 0; | 1842 | return 0; |
1843 | 1843 | ||
1844 | return ilk_wm_fbc(pri_val, drm_rect_width(&pstate->dst), cpp); | 1844 | return ilk_wm_fbc(pri_val, drm_rect_width(&pstate->base.dst), cpp); |
1845 | } | 1845 | } |
1846 | 1846 | ||
1847 | static unsigned int ilk_display_fifo_size(const struct drm_device *dev) | 1847 | static unsigned int ilk_display_fifo_size(const struct drm_device *dev) |
@@ -2358,10 +2358,10 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate) | |||
2358 | 2358 | ||
2359 | pipe_wm->pipe_enabled = cstate->base.active; | 2359 | pipe_wm->pipe_enabled = cstate->base.active; |
2360 | if (sprstate) { | 2360 | if (sprstate) { |
2361 | pipe_wm->sprites_enabled = sprstate->visible; | 2361 | pipe_wm->sprites_enabled = sprstate->base.visible; |
2362 | pipe_wm->sprites_scaled = sprstate->visible && | 2362 | pipe_wm->sprites_scaled = sprstate->base.visible && |
2363 | (drm_rect_width(&sprstate->dst) != drm_rect_width(&sprstate->src) >> 16 || | 2363 | (drm_rect_width(&sprstate->base.dst) != drm_rect_width(&sprstate->base.src) >> 16 || |
2364 | drm_rect_height(&sprstate->dst) != drm_rect_height(&sprstate->src) >> 16); | 2364 | drm_rect_height(&sprstate->base.dst) != drm_rect_height(&sprstate->base.src) >> 16); |
2365 | } | 2365 | } |
2366 | 2366 | ||
2367 | usable_level = max_level; | 2367 | usable_level = max_level; |
@@ -2996,14 +2996,14 @@ skl_plane_downscale_amount(const struct intel_plane_state *pstate) | |||
2996 | uint32_t downscale_h, downscale_w; | 2996 | uint32_t downscale_h, downscale_w; |
2997 | uint32_t src_w, src_h, dst_w, dst_h; | 2997 | uint32_t src_w, src_h, dst_w, dst_h; |
2998 | 2998 | ||
2999 | if (WARN_ON(!pstate->visible)) | 2999 | if (WARN_ON(!pstate->base.visible)) |
3000 | return DRM_PLANE_HELPER_NO_SCALING; | 3000 | return DRM_PLANE_HELPER_NO_SCALING; |
3001 | 3001 | ||
3002 | /* n.b., src is 16.16 fixed point, dst is whole integer */ | 3002 | /* n.b., src is 16.16 fixed point, dst is whole integer */ |
3003 | src_w = drm_rect_width(&pstate->src); | 3003 | src_w = drm_rect_width(&pstate->base.src); |
3004 | src_h = drm_rect_height(&pstate->src); | 3004 | src_h = drm_rect_height(&pstate->base.src); |
3005 | dst_w = drm_rect_width(&pstate->dst); | 3005 | dst_w = drm_rect_width(&pstate->base.dst); |
3006 | dst_h = drm_rect_height(&pstate->dst); | 3006 | dst_h = drm_rect_height(&pstate->base.dst); |
3007 | if (intel_rotation_90_or_270(pstate->base.rotation)) | 3007 | if (intel_rotation_90_or_270(pstate->base.rotation)) |
3008 | swap(dst_w, dst_h); | 3008 | swap(dst_w, dst_h); |
3009 | 3009 | ||
@@ -3025,15 +3025,15 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate, | |||
3025 | uint32_t width = 0, height = 0; | 3025 | uint32_t width = 0, height = 0; |
3026 | unsigned format = fb ? fb->pixel_format : DRM_FORMAT_XRGB8888; | 3026 | unsigned format = fb ? fb->pixel_format : DRM_FORMAT_XRGB8888; |
3027 | 3027 | ||
3028 | if (!intel_pstate->visible) | 3028 | if (!intel_pstate->base.visible) |
3029 | return 0; | 3029 | return 0; |
3030 | if (pstate->plane->type == DRM_PLANE_TYPE_CURSOR) | 3030 | if (pstate->plane->type == DRM_PLANE_TYPE_CURSOR) |
3031 | return 0; | 3031 | return 0; |
3032 | if (y && format != DRM_FORMAT_NV12) | 3032 | if (y && format != DRM_FORMAT_NV12) |
3033 | return 0; | 3033 | return 0; |
3034 | 3034 | ||
3035 | width = drm_rect_width(&intel_pstate->src) >> 16; | 3035 | width = drm_rect_width(&intel_pstate->base.src) >> 16; |
3036 | height = drm_rect_height(&intel_pstate->src) >> 16; | 3036 | height = drm_rect_height(&intel_pstate->base.src) >> 16; |
3037 | 3037 | ||
3038 | if (intel_rotation_90_or_270(pstate->rotation)) | 3038 | if (intel_rotation_90_or_270(pstate->rotation)) |
3039 | swap(width, height); | 3039 | swap(width, height); |
@@ -3134,8 +3134,8 @@ skl_ddb_min_alloc(const struct drm_plane_state *pstate, | |||
3134 | fb->modifier[0] != I915_FORMAT_MOD_Yf_TILED) | 3134 | fb->modifier[0] != I915_FORMAT_MOD_Yf_TILED) |
3135 | return 8; | 3135 | return 8; |
3136 | 3136 | ||
3137 | src_w = drm_rect_width(&intel_pstate->src) >> 16; | 3137 | src_w = drm_rect_width(&intel_pstate->base.src) >> 16; |
3138 | src_h = drm_rect_height(&intel_pstate->src) >> 16; | 3138 | src_h = drm_rect_height(&intel_pstate->base.src) >> 16; |
3139 | 3139 | ||
3140 | if (intel_rotation_90_or_270(pstate->rotation)) | 3140 | if (intel_rotation_90_or_270(pstate->rotation)) |
3141 | swap(src_w, src_h); | 3141 | swap(src_w, src_h); |
@@ -3226,7 +3226,7 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate, | |||
3226 | if (intel_plane->pipe != pipe) | 3226 | if (intel_plane->pipe != pipe) |
3227 | continue; | 3227 | continue; |
3228 | 3228 | ||
3229 | if (!to_intel_plane_state(pstate)->visible) { | 3229 | if (!to_intel_plane_state(pstate)->base.visible) { |
3230 | minimum[id] = 0; | 3230 | minimum[id] = 0; |
3231 | y_minimum[id] = 0; | 3231 | y_minimum[id] = 0; |
3232 | continue; | 3232 | continue; |
@@ -3363,7 +3363,7 @@ static uint32_t skl_adjusted_plane_pixel_rate(const struct intel_crtc_state *cst | |||
3363 | uint64_t pixel_rate; | 3363 | uint64_t pixel_rate; |
3364 | 3364 | ||
3365 | /* Shouldn't reach here on disabled planes... */ | 3365 | /* Shouldn't reach here on disabled planes... */ |
3366 | if (WARN_ON(!pstate->visible)) | 3366 | if (WARN_ON(!pstate->base.visible)) |
3367 | return 0; | 3367 | return 0; |
3368 | 3368 | ||
3369 | /* | 3369 | /* |
@@ -3399,13 +3399,13 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv, | |||
3399 | uint32_t width = 0, height = 0; | 3399 | uint32_t width = 0, height = 0; |
3400 | uint32_t plane_pixel_rate; | 3400 | uint32_t plane_pixel_rate; |
3401 | 3401 | ||
3402 | if (latency == 0 || !cstate->base.active || !intel_pstate->visible) { | 3402 | if (latency == 0 || !cstate->base.active || !intel_pstate->base.visible) { |
3403 | *enabled = false; | 3403 | *enabled = false; |
3404 | return 0; | 3404 | return 0; |
3405 | } | 3405 | } |
3406 | 3406 | ||
3407 | width = drm_rect_width(&intel_pstate->src) >> 16; | 3407 | width = drm_rect_width(&intel_pstate->base.src) >> 16; |
3408 | height = drm_rect_height(&intel_pstate->src) >> 16; | 3408 | height = drm_rect_height(&intel_pstate->base.src) >> 16; |
3409 | 3409 | ||
3410 | if (intel_rotation_90_or_270(pstate->rotation)) | 3410 | if (intel_rotation_90_or_270(pstate->rotation)) |
3411 | swap(width, height); | 3411 | swap(width, height); |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 7c08e4f29032..1d9736b0cced 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -211,14 +211,14 @@ skl_update_plane(struct drm_plane *drm_plane, | |||
211 | u32 tile_height, plane_offset, plane_size; | 211 | u32 tile_height, plane_offset, plane_size; |
212 | unsigned int rotation = plane_state->base.rotation; | 212 | unsigned int rotation = plane_state->base.rotation; |
213 | int x_offset, y_offset; | 213 | int x_offset, y_offset; |
214 | int crtc_x = plane_state->dst.x1; | 214 | int crtc_x = plane_state->base.dst.x1; |
215 | int crtc_y = plane_state->dst.y1; | 215 | int crtc_y = plane_state->base.dst.y1; |
216 | uint32_t crtc_w = drm_rect_width(&plane_state->dst); | 216 | uint32_t crtc_w = drm_rect_width(&plane_state->base.dst); |
217 | uint32_t crtc_h = drm_rect_height(&plane_state->dst); | 217 | uint32_t crtc_h = drm_rect_height(&plane_state->base.dst); |
218 | uint32_t x = plane_state->src.x1 >> 16; | 218 | uint32_t x = plane_state->base.src.x1 >> 16; |
219 | uint32_t y = plane_state->src.y1 >> 16; | 219 | uint32_t y = plane_state->base.src.y1 >> 16; |
220 | uint32_t src_w = drm_rect_width(&plane_state->src) >> 16; | 220 | uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16; |
221 | uint32_t src_h = drm_rect_height(&plane_state->src) >> 16; | 221 | uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16; |
222 | 222 | ||
223 | plane_ctl = PLANE_CTL_ENABLE | | 223 | plane_ctl = PLANE_CTL_ENABLE | |
224 | PLANE_CTL_PIPE_GAMMA_ENABLE | | 224 | PLANE_CTL_PIPE_GAMMA_ENABLE | |
@@ -370,14 +370,14 @@ vlv_update_plane(struct drm_plane *dplane, | |||
370 | unsigned int rotation = dplane->state->rotation; | 370 | unsigned int rotation = dplane->state->rotation; |
371 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); | 371 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); |
372 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; | 372 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; |
373 | int crtc_x = plane_state->dst.x1; | 373 | int crtc_x = plane_state->base.dst.x1; |
374 | int crtc_y = plane_state->dst.y1; | 374 | int crtc_y = plane_state->base.dst.y1; |
375 | uint32_t crtc_w = drm_rect_width(&plane_state->dst); | 375 | uint32_t crtc_w = drm_rect_width(&plane_state->base.dst); |
376 | uint32_t crtc_h = drm_rect_height(&plane_state->dst); | 376 | uint32_t crtc_h = drm_rect_height(&plane_state->base.dst); |
377 | uint32_t x = plane_state->src.x1 >> 16; | 377 | uint32_t x = plane_state->base.src.x1 >> 16; |
378 | uint32_t y = plane_state->src.y1 >> 16; | 378 | uint32_t y = plane_state->base.src.y1 >> 16; |
379 | uint32_t src_w = drm_rect_width(&plane_state->src) >> 16; | 379 | uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16; |
380 | uint32_t src_h = drm_rect_height(&plane_state->src) >> 16; | 380 | uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16; |
381 | 381 | ||
382 | sprctl = SP_ENABLE; | 382 | sprctl = SP_ENABLE; |
383 | 383 | ||
@@ -444,7 +444,7 @@ vlv_update_plane(struct drm_plane *dplane, | |||
444 | fb->pitches[0], rotation); | 444 | fb->pitches[0], rotation); |
445 | linear_offset -= sprsurf_offset; | 445 | linear_offset -= sprsurf_offset; |
446 | 446 | ||
447 | if (rotation == BIT(DRM_ROTATE_180)) { | 447 | if (rotation == DRM_ROTATE_180) { |
448 | sprctl |= SP_ROTATE_180; | 448 | sprctl |= SP_ROTATE_180; |
449 | 449 | ||
450 | x += src_w; | 450 | x += src_w; |
@@ -512,14 +512,14 @@ ivb_update_plane(struct drm_plane *plane, | |||
512 | unsigned int rotation = plane_state->base.rotation; | 512 | unsigned int rotation = plane_state->base.rotation; |
513 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); | 513 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); |
514 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; | 514 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; |
515 | int crtc_x = plane_state->dst.x1; | 515 | int crtc_x = plane_state->base.dst.x1; |
516 | int crtc_y = plane_state->dst.y1; | 516 | int crtc_y = plane_state->base.dst.y1; |
517 | uint32_t crtc_w = drm_rect_width(&plane_state->dst); | 517 | uint32_t crtc_w = drm_rect_width(&plane_state->base.dst); |
518 | uint32_t crtc_h = drm_rect_height(&plane_state->dst); | 518 | uint32_t crtc_h = drm_rect_height(&plane_state->base.dst); |
519 | uint32_t x = plane_state->src.x1 >> 16; | 519 | uint32_t x = plane_state->base.src.x1 >> 16; |
520 | uint32_t y = plane_state->src.y1 >> 16; | 520 | uint32_t y = plane_state->base.src.y1 >> 16; |
521 | uint32_t src_w = drm_rect_width(&plane_state->src) >> 16; | 521 | uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16; |
522 | uint32_t src_h = drm_rect_height(&plane_state->src) >> 16; | 522 | uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16; |
523 | 523 | ||
524 | sprctl = SPRITE_ENABLE; | 524 | sprctl = SPRITE_ENABLE; |
525 | 525 | ||
@@ -577,7 +577,7 @@ ivb_update_plane(struct drm_plane *plane, | |||
577 | fb->pitches[0], rotation); | 577 | fb->pitches[0], rotation); |
578 | linear_offset -= sprsurf_offset; | 578 | linear_offset -= sprsurf_offset; |
579 | 579 | ||
580 | if (rotation == BIT(DRM_ROTATE_180)) { | 580 | if (rotation == DRM_ROTATE_180) { |
581 | sprctl |= SPRITE_ROTATE_180; | 581 | sprctl |= SPRITE_ROTATE_180; |
582 | 582 | ||
583 | /* HSW and BDW does this automagically in hardware */ | 583 | /* HSW and BDW does this automagically in hardware */ |
@@ -653,14 +653,14 @@ ilk_update_plane(struct drm_plane *plane, | |||
653 | unsigned int rotation = plane_state->base.rotation; | 653 | unsigned int rotation = plane_state->base.rotation; |
654 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); | 654 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); |
655 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; | 655 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; |
656 | int crtc_x = plane_state->dst.x1; | 656 | int crtc_x = plane_state->base.dst.x1; |
657 | int crtc_y = plane_state->dst.y1; | 657 | int crtc_y = plane_state->base.dst.y1; |
658 | uint32_t crtc_w = drm_rect_width(&plane_state->dst); | 658 | uint32_t crtc_w = drm_rect_width(&plane_state->base.dst); |
659 | uint32_t crtc_h = drm_rect_height(&plane_state->dst); | 659 | uint32_t crtc_h = drm_rect_height(&plane_state->base.dst); |
660 | uint32_t x = plane_state->src.x1 >> 16; | 660 | uint32_t x = plane_state->base.src.x1 >> 16; |
661 | uint32_t y = plane_state->src.y1 >> 16; | 661 | uint32_t y = plane_state->base.src.y1 >> 16; |
662 | uint32_t src_w = drm_rect_width(&plane_state->src) >> 16; | 662 | uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16; |
663 | uint32_t src_h = drm_rect_height(&plane_state->src) >> 16; | 663 | uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16; |
664 | 664 | ||
665 | dvscntr = DVS_ENABLE; | 665 | dvscntr = DVS_ENABLE; |
666 | 666 | ||
@@ -714,7 +714,7 @@ ilk_update_plane(struct drm_plane *plane, | |||
714 | fb->pitches[0], rotation); | 714 | fb->pitches[0], rotation); |
715 | linear_offset -= dvssurf_offset; | 715 | linear_offset -= dvssurf_offset; |
716 | 716 | ||
717 | if (rotation == BIT(DRM_ROTATE_180)) { | 717 | if (rotation == DRM_ROTATE_180) { |
718 | dvscntr |= DVS_ROTATE_180; | 718 | dvscntr |= DVS_ROTATE_180; |
719 | 719 | ||
720 | x += src_w; | 720 | x += src_w; |
@@ -778,15 +778,25 @@ intel_check_sprite_plane(struct drm_plane *plane, | |||
778 | int crtc_x, crtc_y; | 778 | int crtc_x, crtc_y; |
779 | unsigned int crtc_w, crtc_h; | 779 | unsigned int crtc_w, crtc_h; |
780 | uint32_t src_x, src_y, src_w, src_h; | 780 | uint32_t src_x, src_y, src_w, src_h; |
781 | struct drm_rect *src = &state->src; | 781 | struct drm_rect *src = &state->base.src; |
782 | struct drm_rect *dst = &state->dst; | 782 | struct drm_rect *dst = &state->base.dst; |
783 | const struct drm_rect *clip = &state->clip; | 783 | const struct drm_rect *clip = &state->clip; |
784 | int hscale, vscale; | 784 | int hscale, vscale; |
785 | int max_scale, min_scale; | 785 | int max_scale, min_scale; |
786 | bool can_scale; | 786 | bool can_scale; |
787 | 787 | ||
788 | src->x1 = state->base.src_x; | ||
789 | src->y1 = state->base.src_y; | ||
790 | src->x2 = state->base.src_x + state->base.src_w; | ||
791 | src->y2 = state->base.src_y + state->base.src_h; | ||
792 | |||
793 | dst->x1 = state->base.crtc_x; | ||
794 | dst->y1 = state->base.crtc_y; | ||
795 | dst->x2 = state->base.crtc_x + state->base.crtc_w; | ||
796 | dst->y2 = state->base.crtc_y + state->base.crtc_h; | ||
797 | |||
788 | if (!fb) { | 798 | if (!fb) { |
789 | state->visible = false; | 799 | state->base.visible = false; |
790 | return 0; | 800 | return 0; |
791 | } | 801 | } |
792 | 802 | ||
@@ -834,14 +844,14 @@ intel_check_sprite_plane(struct drm_plane *plane, | |||
834 | vscale = drm_rect_calc_vscale_relaxed(src, dst, min_scale, max_scale); | 844 | vscale = drm_rect_calc_vscale_relaxed(src, dst, min_scale, max_scale); |
835 | BUG_ON(vscale < 0); | 845 | BUG_ON(vscale < 0); |
836 | 846 | ||
837 | state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale); | 847 | state->base.visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale); |
838 | 848 | ||
839 | crtc_x = dst->x1; | 849 | crtc_x = dst->x1; |
840 | crtc_y = dst->y1; | 850 | crtc_y = dst->y1; |
841 | crtc_w = drm_rect_width(dst); | 851 | crtc_w = drm_rect_width(dst); |
842 | crtc_h = drm_rect_height(dst); | 852 | crtc_h = drm_rect_height(dst); |
843 | 853 | ||
844 | if (state->visible) { | 854 | if (state->base.visible) { |
845 | /* check again in case clipping clamped the results */ | 855 | /* check again in case clipping clamped the results */ |
846 | hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale); | 856 | hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale); |
847 | if (hscale < 0) { | 857 | if (hscale < 0) { |
@@ -898,12 +908,12 @@ intel_check_sprite_plane(struct drm_plane *plane, | |||
898 | crtc_w &= ~1; | 908 | crtc_w &= ~1; |
899 | 909 | ||
900 | if (crtc_w == 0) | 910 | if (crtc_w == 0) |
901 | state->visible = false; | 911 | state->base.visible = false; |
902 | } | 912 | } |
903 | } | 913 | } |
904 | 914 | ||
905 | /* Check size restrictions when scaling */ | 915 | /* Check size restrictions when scaling */ |
906 | if (state->visible && (src_w != crtc_w || src_h != crtc_h)) { | 916 | if (state->base.visible && (src_w != crtc_w || src_h != crtc_h)) { |
907 | unsigned int width_bytes; | 917 | unsigned int width_bytes; |
908 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); | 918 | int cpp = drm_format_plane_cpp(fb->pixel_format, 0); |
909 | 919 | ||
@@ -912,10 +922,10 @@ intel_check_sprite_plane(struct drm_plane *plane, | |||
912 | /* FIXME interlacing min height is 6 */ | 922 | /* FIXME interlacing min height is 6 */ |
913 | 923 | ||
914 | if (crtc_w < 3 || crtc_h < 3) | 924 | if (crtc_w < 3 || crtc_h < 3) |
915 | state->visible = false; | 925 | state->base.visible = false; |
916 | 926 | ||
917 | if (src_w < 3 || src_h < 3) | 927 | if (src_w < 3 || src_h < 3) |
918 | state->visible = false; | 928 | state->base.visible = false; |
919 | 929 | ||
920 | width_bytes = ((src_x * cpp) & 63) + src_w * cpp; | 930 | width_bytes = ((src_x * cpp) & 63) + src_w * cpp; |
921 | 931 | ||
@@ -926,7 +936,7 @@ intel_check_sprite_plane(struct drm_plane *plane, | |||
926 | } | 936 | } |
927 | } | 937 | } |
928 | 938 | ||
929 | if (state->visible) { | 939 | if (state->base.visible) { |
930 | src->x1 = src_x << 16; | 940 | src->x1 = src_x << 16; |
931 | src->x2 = (src_x + src_w) << 16; | 941 | src->x2 = (src_x + src_w) << 16; |
932 | src->y1 = src_y << 16; | 942 | src->y1 = src_y << 16; |
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 6dc0ef4cc677..438bac8fbc2b 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/component.h> | 16 | #include <linux/component.h> |
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/dma-buf.h> | 18 | #include <linux/dma-buf.h> |
19 | #include <linux/fb.h> | ||
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
21 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
22 | #include <linux/reservation.h> | 21 | #include <linux/reservation.h> |
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c index 5950b12a15c8..6e1dc902522c 100644 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <drm/drm_atomic.h> | 21 | #include <drm/drm_atomic.h> |
22 | #include <drm/drm_atomic_helper.h> | 22 | #include <drm/drm_atomic_helper.h> |
23 | #include <drm/drm_crtc_helper.h> | 23 | #include <drm/drm_crtc_helper.h> |
24 | #include <linux/fb.h> | ||
25 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
26 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
27 | #include <drm/drm_gem_cma_helper.h> | 26 | #include <drm/drm_gem_cma_helper.h> |
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index 58725d34d411..01a21dd835b5 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c | |||
@@ -31,7 +31,7 @@ | |||
31 | * struct mtk_drm_crtc - MediaTek specific crtc structure. | 31 | * struct mtk_drm_crtc - MediaTek specific crtc structure. |
32 | * @base: crtc object. | 32 | * @base: crtc object. |
33 | * @enabled: records whether crtc_enable succeeded | 33 | * @enabled: records whether crtc_enable succeeded |
34 | * @planes: array of 4 mtk_drm_plane structures, one for each overlay plane | 34 | * @planes: array of 4 drm_plane structures, one for each overlay plane |
35 | * @pending_planes: whether any plane has pending changes to be applied | 35 | * @pending_planes: whether any plane has pending changes to be applied |
36 | * @config_regs: memory mapped mmsys configuration register space | 36 | * @config_regs: memory mapped mmsys configuration register space |
37 | * @mutex: handle to one of the ten disp_mutex streams | 37 | * @mutex: handle to one of the ten disp_mutex streams |
@@ -45,7 +45,7 @@ struct mtk_drm_crtc { | |||
45 | bool pending_needs_vblank; | 45 | bool pending_needs_vblank; |
46 | struct drm_pending_vblank_event *event; | 46 | struct drm_pending_vblank_event *event; |
47 | 47 | ||
48 | struct mtk_drm_plane planes[OVL_LAYER_NR]; | 48 | struct drm_plane planes[OVL_LAYER_NR]; |
49 | bool pending_planes; | 49 | bool pending_planes; |
50 | 50 | ||
51 | void __iomem *config_regs; | 51 | void __iomem *config_regs; |
@@ -112,8 +112,7 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc) | |||
112 | struct mtk_crtc_state *state; | 112 | struct mtk_crtc_state *state; |
113 | 113 | ||
114 | if (crtc->state) { | 114 | if (crtc->state) { |
115 | if (crtc->state->mode_blob) | 115 | __drm_atomic_helper_crtc_destroy_state(crtc->state); |
116 | drm_property_unreference_blob(crtc->state->mode_blob); | ||
117 | 116 | ||
118 | state = to_mtk_crtc_state(crtc->state); | 117 | state = to_mtk_crtc_state(crtc->state); |
119 | memset(state, 0, sizeof(*state)); | 118 | memset(state, 0, sizeof(*state)); |
@@ -287,7 +286,7 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc) | |||
287 | 286 | ||
288 | /* Initially configure all planes */ | 287 | /* Initially configure all planes */ |
289 | for (i = 0; i < OVL_LAYER_NR; i++) { | 288 | for (i = 0; i < OVL_LAYER_NR; i++) { |
290 | struct drm_plane *plane = &mtk_crtc->planes[i].base; | 289 | struct drm_plane *plane = &mtk_crtc->planes[i]; |
291 | struct mtk_plane_state *plane_state; | 290 | struct mtk_plane_state *plane_state; |
292 | 291 | ||
293 | plane_state = to_mtk_plane_state(plane->state); | 292 | plane_state = to_mtk_plane_state(plane->state); |
@@ -366,7 +365,7 @@ static void mtk_drm_crtc_disable(struct drm_crtc *crtc) | |||
366 | 365 | ||
367 | /* Set all pending plane state to disabled */ | 366 | /* Set all pending plane state to disabled */ |
368 | for (i = 0; i < OVL_LAYER_NR; i++) { | 367 | for (i = 0; i < OVL_LAYER_NR; i++) { |
369 | struct drm_plane *plane = &mtk_crtc->planes[i].base; | 368 | struct drm_plane *plane = &mtk_crtc->planes[i]; |
370 | struct mtk_plane_state *plane_state; | 369 | struct mtk_plane_state *plane_state; |
371 | 370 | ||
372 | plane_state = to_mtk_plane_state(plane->state); | 371 | plane_state = to_mtk_plane_state(plane->state); |
@@ -412,7 +411,7 @@ static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc, | |||
412 | if (mtk_crtc->event) | 411 | if (mtk_crtc->event) |
413 | mtk_crtc->pending_needs_vblank = true; | 412 | mtk_crtc->pending_needs_vblank = true; |
414 | for (i = 0; i < OVL_LAYER_NR; i++) { | 413 | for (i = 0; i < OVL_LAYER_NR; i++) { |
415 | struct drm_plane *plane = &mtk_crtc->planes[i].base; | 414 | struct drm_plane *plane = &mtk_crtc->planes[i]; |
416 | struct mtk_plane_state *plane_state; | 415 | struct mtk_plane_state *plane_state; |
417 | 416 | ||
418 | plane_state = to_mtk_plane_state(plane->state); | 417 | plane_state = to_mtk_plane_state(plane->state); |
@@ -490,7 +489,7 @@ void mtk_crtc_ddp_irq(struct drm_crtc *crtc, struct mtk_ddp_comp *ovl) | |||
490 | 489 | ||
491 | if (mtk_crtc->pending_planes) { | 490 | if (mtk_crtc->pending_planes) { |
492 | for (i = 0; i < OVL_LAYER_NR; i++) { | 491 | for (i = 0; i < OVL_LAYER_NR; i++) { |
493 | struct drm_plane *plane = &mtk_crtc->planes[i].base; | 492 | struct drm_plane *plane = &mtk_crtc->planes[i]; |
494 | struct mtk_plane_state *plane_state; | 493 | struct mtk_plane_state *plane_state; |
495 | 494 | ||
496 | plane_state = to_mtk_plane_state(plane->state); | 495 | plane_state = to_mtk_plane_state(plane->state); |
@@ -578,13 +577,13 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, | |||
578 | (zpos == 1) ? DRM_PLANE_TYPE_CURSOR : | 577 | (zpos == 1) ? DRM_PLANE_TYPE_CURSOR : |
579 | DRM_PLANE_TYPE_OVERLAY; | 578 | DRM_PLANE_TYPE_OVERLAY; |
580 | ret = mtk_plane_init(drm_dev, &mtk_crtc->planes[zpos], | 579 | ret = mtk_plane_init(drm_dev, &mtk_crtc->planes[zpos], |
581 | BIT(pipe), type, zpos); | 580 | BIT(pipe), type); |
582 | if (ret) | 581 | if (ret) |
583 | goto unprepare; | 582 | goto unprepare; |
584 | } | 583 | } |
585 | 584 | ||
586 | ret = mtk_drm_crtc_init(drm_dev, mtk_crtc, &mtk_crtc->planes[0].base, | 585 | ret = mtk_drm_crtc_init(drm_dev, mtk_crtc, &mtk_crtc->planes[0], |
587 | &mtk_crtc->planes[1].base, pipe); | 586 | &mtk_crtc->planes[1], pipe); |
588 | if (ret < 0) | 587 | if (ret < 0) |
589 | goto unprepare; | 588 | goto unprepare; |
590 | drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE); | 589 | drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE); |
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h index 33f6ab65eb59..a1550fa3c9d2 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe); | 26 | int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe); |
27 | void mtk_drm_crtc_disable_vblank(struct drm_device *drm, unsigned int pipe); | 27 | void mtk_drm_crtc_disable_vblank(struct drm_device *drm, unsigned int pipe); |
28 | void mtk_drm_crtc_check_flush(struct drm_crtc *crtc); | ||
29 | void mtk_drm_crtc_commit(struct drm_crtc *crtc); | 28 | void mtk_drm_crtc_commit(struct drm_crtc *crtc); |
30 | void mtk_crtc_ddp_irq(struct drm_crtc *crtc, struct mtk_ddp_comp *ovl); | 29 | void mtk_crtc_ddp_irq(struct drm_crtc *crtc, struct mtk_ddp_comp *ovl); |
31 | int mtk_drm_crtc_create(struct drm_device *drm_dev, | 30 | int mtk_drm_crtc_create(struct drm_device *drm_dev, |
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index eebb7d881c2b..0e769abd0c2c 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c | |||
@@ -61,10 +61,25 @@ static void mtk_atomic_complete(struct mtk_drm_private *private, | |||
61 | 61 | ||
62 | mtk_atomic_wait_for_fences(state); | 62 | mtk_atomic_wait_for_fences(state); |
63 | 63 | ||
64 | /* | ||
65 | * Mediatek drm supports runtime PM, so plane registers cannot be | ||
66 | * written when their crtc is disabled. | ||
67 | * | ||
68 | * The comment for drm_atomic_helper_commit states: | ||
69 | * For drivers supporting runtime PM the recommended sequence is | ||
70 | * | ||
71 | * drm_atomic_helper_commit_modeset_disables(dev, state); | ||
72 | * drm_atomic_helper_commit_modeset_enables(dev, state); | ||
73 | * drm_atomic_helper_commit_planes(dev, state, true); | ||
74 | * | ||
75 | * See the kerneldoc entries for these three functions for more details. | ||
76 | */ | ||
64 | drm_atomic_helper_commit_modeset_disables(drm, state); | 77 | drm_atomic_helper_commit_modeset_disables(drm, state); |
65 | drm_atomic_helper_commit_planes(drm, state, false); | ||
66 | drm_atomic_helper_commit_modeset_enables(drm, state); | 78 | drm_atomic_helper_commit_modeset_enables(drm, state); |
79 | drm_atomic_helper_commit_planes(drm, state, true); | ||
80 | |||
67 | drm_atomic_helper_wait_for_vblanks(drm, state); | 81 | drm_atomic_helper_wait_for_vblanks(drm, state); |
82 | |||
68 | drm_atomic_helper_cleanup_planes(drm, state); | 83 | drm_atomic_helper_cleanup_planes(drm, state); |
69 | drm_atomic_state_free(state); | 84 | drm_atomic_state_free(state); |
70 | } | 85 | } |
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c index 3995765a90dc..c461a232cbf5 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c | |||
@@ -30,57 +30,12 @@ static const u32 formats[] = { | |||
30 | DRM_FORMAT_RGB565, | 30 | DRM_FORMAT_RGB565, |
31 | }; | 31 | }; |
32 | 32 | ||
33 | static void mtk_plane_enable(struct mtk_drm_plane *mtk_plane, bool enable, | ||
34 | dma_addr_t addr, struct drm_rect *dest) | ||
35 | { | ||
36 | struct drm_plane *plane = &mtk_plane->base; | ||
37 | struct mtk_plane_state *state = to_mtk_plane_state(plane->state); | ||
38 | unsigned int pitch, format; | ||
39 | int x, y; | ||
40 | |||
41 | if (WARN_ON(!plane->state || (enable && !plane->state->fb))) | ||
42 | return; | ||
43 | |||
44 | if (plane->state->fb) { | ||
45 | pitch = plane->state->fb->pitches[0]; | ||
46 | format = plane->state->fb->pixel_format; | ||
47 | } else { | ||
48 | pitch = 0; | ||
49 | format = DRM_FORMAT_RGBA8888; | ||
50 | } | ||
51 | |||
52 | x = plane->state->crtc_x; | ||
53 | y = plane->state->crtc_y; | ||
54 | |||
55 | if (x < 0) { | ||
56 | addr -= x * 4; | ||
57 | x = 0; | ||
58 | } | ||
59 | |||
60 | if (y < 0) { | ||
61 | addr -= y * pitch; | ||
62 | y = 0; | ||
63 | } | ||
64 | |||
65 | state->pending.enable = enable; | ||
66 | state->pending.pitch = pitch; | ||
67 | state->pending.format = format; | ||
68 | state->pending.addr = addr; | ||
69 | state->pending.x = x; | ||
70 | state->pending.y = y; | ||
71 | state->pending.width = dest->x2 - dest->x1; | ||
72 | state->pending.height = dest->y2 - dest->y1; | ||
73 | wmb(); /* Make sure the above parameters are set before update */ | ||
74 | state->pending.dirty = true; | ||
75 | } | ||
76 | |||
77 | static void mtk_plane_reset(struct drm_plane *plane) | 33 | static void mtk_plane_reset(struct drm_plane *plane) |
78 | { | 34 | { |
79 | struct mtk_plane_state *state; | 35 | struct mtk_plane_state *state; |
80 | 36 | ||
81 | if (plane->state) { | 37 | if (plane->state) { |
82 | if (plane->state->fb) | 38 | __drm_atomic_helper_plane_destroy_state(plane->state); |
83 | drm_framebuffer_unreference(plane->state->fb); | ||
84 | 39 | ||
85 | state = to_mtk_plane_state(plane->state); | 40 | state = to_mtk_plane_state(plane->state); |
86 | memset(state, 0, sizeof(*state)); | 41 | memset(state, 0, sizeof(*state)); |
@@ -134,20 +89,6 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, | |||
134 | { | 89 | { |
135 | struct drm_framebuffer *fb = state->fb; | 90 | struct drm_framebuffer *fb = state->fb; |
136 | struct drm_crtc_state *crtc_state; | 91 | struct drm_crtc_state *crtc_state; |
137 | bool visible; | ||
138 | struct drm_rect dest = { | ||
139 | .x1 = state->crtc_x, | ||
140 | .y1 = state->crtc_y, | ||
141 | .x2 = state->crtc_x + state->crtc_w, | ||
142 | .y2 = state->crtc_y + state->crtc_h, | ||
143 | }; | ||
144 | struct drm_rect src = { | ||
145 | /* 16.16 fixed point */ | ||
146 | .x1 = state->src_x, | ||
147 | .y1 = state->src_y, | ||
148 | .x2 = state->src_x + state->src_w, | ||
149 | .y2 = state->src_y + state->src_h, | ||
150 | }; | ||
151 | struct drm_rect clip = { 0, }; | 92 | struct drm_rect clip = { 0, }; |
152 | 93 | ||
153 | if (!fb) | 94 | if (!fb) |
@@ -168,40 +109,45 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, | |||
168 | clip.x2 = crtc_state->mode.hdisplay; | 109 | clip.x2 = crtc_state->mode.hdisplay; |
169 | clip.y2 = crtc_state->mode.vdisplay; | 110 | clip.y2 = crtc_state->mode.vdisplay; |
170 | 111 | ||
171 | return drm_plane_helper_check_update(plane, state->crtc, fb, | 112 | return drm_plane_helper_check_state(state, &clip, |
172 | &src, &dest, &clip, | 113 | DRM_PLANE_HELPER_NO_SCALING, |
173 | state->rotation, | 114 | DRM_PLANE_HELPER_NO_SCALING, |
174 | DRM_PLANE_HELPER_NO_SCALING, | 115 | true, true); |
175 | DRM_PLANE_HELPER_NO_SCALING, | ||
176 | true, true, &visible); | ||
177 | } | 116 | } |
178 | 117 | ||
179 | static void mtk_plane_atomic_update(struct drm_plane *plane, | 118 | static void mtk_plane_atomic_update(struct drm_plane *plane, |
180 | struct drm_plane_state *old_state) | 119 | struct drm_plane_state *old_state) |
181 | { | 120 | { |
182 | struct mtk_plane_state *state = to_mtk_plane_state(plane->state); | 121 | struct mtk_plane_state *state = to_mtk_plane_state(plane->state); |
183 | struct drm_crtc *crtc = state->base.crtc; | 122 | struct drm_crtc *crtc = plane->state->crtc; |
123 | struct drm_framebuffer *fb = plane->state->fb; | ||
184 | struct drm_gem_object *gem; | 124 | struct drm_gem_object *gem; |
185 | struct mtk_drm_gem_obj *mtk_gem; | 125 | struct mtk_drm_gem_obj *mtk_gem; |
186 | struct mtk_drm_plane *mtk_plane = to_mtk_plane(plane); | 126 | unsigned int pitch, format; |
187 | struct drm_rect dest = { | 127 | dma_addr_t addr; |
188 | .x1 = state->base.crtc_x, | ||
189 | .y1 = state->base.crtc_y, | ||
190 | .x2 = state->base.crtc_x + state->base.crtc_w, | ||
191 | .y2 = state->base.crtc_y + state->base.crtc_h, | ||
192 | }; | ||
193 | struct drm_rect clip = { 0, }; | ||
194 | 128 | ||
195 | if (!crtc) | 129 | if (!crtc || WARN_ON(!fb)) |
196 | return; | 130 | return; |
197 | 131 | ||
198 | clip.x2 = state->base.crtc->state->mode.hdisplay; | 132 | gem = mtk_fb_get_gem_obj(fb); |
199 | clip.y2 = state->base.crtc->state->mode.vdisplay; | ||
200 | drm_rect_intersect(&dest, &clip); | ||
201 | |||
202 | gem = mtk_fb_get_gem_obj(state->base.fb); | ||
203 | mtk_gem = to_mtk_gem_obj(gem); | 133 | mtk_gem = to_mtk_gem_obj(gem); |
204 | mtk_plane_enable(mtk_plane, true, mtk_gem->dma_addr, &dest); | 134 | addr = mtk_gem->dma_addr; |
135 | pitch = fb->pitches[0]; | ||
136 | format = fb->pixel_format; | ||
137 | |||
138 | addr += (plane->state->src.x1 >> 16) * drm_format_plane_cpp(format, 0); | ||
139 | addr += (plane->state->src.y1 >> 16) * pitch; | ||
140 | |||
141 | state->pending.enable = true; | ||
142 | state->pending.pitch = pitch; | ||
143 | state->pending.format = format; | ||
144 | state->pending.addr = addr; | ||
145 | state->pending.x = plane->state->dst.x1; | ||
146 | state->pending.y = plane->state->dst.y1; | ||
147 | state->pending.width = drm_rect_width(&plane->state->dst); | ||
148 | state->pending.height = drm_rect_height(&plane->state->dst); | ||
149 | wmb(); /* Make sure the above parameters are set before update */ | ||
150 | state->pending.dirty = true; | ||
205 | } | 151 | } |
206 | 152 | ||
207 | static void mtk_plane_atomic_disable(struct drm_plane *plane, | 153 | static void mtk_plane_atomic_disable(struct drm_plane *plane, |
@@ -220,13 +166,12 @@ static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = { | |||
220 | .atomic_disable = mtk_plane_atomic_disable, | 166 | .atomic_disable = mtk_plane_atomic_disable, |
221 | }; | 167 | }; |
222 | 168 | ||
223 | int mtk_plane_init(struct drm_device *dev, struct mtk_drm_plane *mtk_plane, | 169 | int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, |
224 | unsigned long possible_crtcs, enum drm_plane_type type, | 170 | unsigned long possible_crtcs, enum drm_plane_type type) |
225 | unsigned int zpos) | ||
226 | { | 171 | { |
227 | int err; | 172 | int err; |
228 | 173 | ||
229 | err = drm_universal_plane_init(dev, &mtk_plane->base, possible_crtcs, | 174 | err = drm_universal_plane_init(dev, plane, possible_crtcs, |
230 | &mtk_plane_funcs, formats, | 175 | &mtk_plane_funcs, formats, |
231 | ARRAY_SIZE(formats), type, NULL); | 176 | ARRAY_SIZE(formats), type, NULL); |
232 | if (err) { | 177 | if (err) { |
@@ -234,8 +179,7 @@ int mtk_plane_init(struct drm_device *dev, struct mtk_drm_plane *mtk_plane, | |||
234 | return err; | 179 | return err; |
235 | } | 180 | } |
236 | 181 | ||
237 | drm_plane_helper_add(&mtk_plane->base, &mtk_plane_helper_funcs); | 182 | drm_plane_helper_add(plane, &mtk_plane_helper_funcs); |
238 | mtk_plane->idx = zpos; | ||
239 | 183 | ||
240 | return 0; | 184 | return 0; |
241 | } | 185 | } |
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.h b/drivers/gpu/drm/mediatek/mtk_drm_plane.h index 72a7b3e4c126..6a20b49e0f2f 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.h | |||
@@ -18,11 +18,6 @@ | |||
18 | #include <drm/drm_crtc.h> | 18 | #include <drm/drm_crtc.h> |
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | 20 | ||
21 | struct mtk_drm_plane { | ||
22 | struct drm_plane base; | ||
23 | unsigned int idx; | ||
24 | }; | ||
25 | |||
26 | struct mtk_plane_pending_state { | 21 | struct mtk_plane_pending_state { |
27 | bool config; | 22 | bool config; |
28 | bool enable; | 23 | bool enable; |
@@ -41,19 +36,13 @@ struct mtk_plane_state { | |||
41 | struct mtk_plane_pending_state pending; | 36 | struct mtk_plane_pending_state pending; |
42 | }; | 37 | }; |
43 | 38 | ||
44 | static inline struct mtk_drm_plane *to_mtk_plane(struct drm_plane *plane) | ||
45 | { | ||
46 | return container_of(plane, struct mtk_drm_plane, base); | ||
47 | } | ||
48 | |||
49 | static inline struct mtk_plane_state * | 39 | static inline struct mtk_plane_state * |
50 | to_mtk_plane_state(struct drm_plane_state *state) | 40 | to_mtk_plane_state(struct drm_plane_state *state) |
51 | { | 41 | { |
52 | return container_of(state, struct mtk_plane_state, base); | 42 | return container_of(state, struct mtk_plane_state, base); |
53 | } | 43 | } |
54 | 44 | ||
55 | int mtk_plane_init(struct drm_device *dev, struct mtk_drm_plane *mtk_plane, | 45 | int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, |
56 | unsigned long possible_crtcs, enum drm_plane_type type, | 46 | unsigned long possible_crtcs, enum drm_plane_type type); |
57 | unsigned int zpos); | ||
58 | 47 | ||
59 | #endif | 48 | #endif |
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c index 5e2f131a6a72..25b2a1a424e6 100644 --- a/drivers/gpu/drm/mga/mga_drv.c +++ b/drivers/gpu/drm/mga/mga_drv.c | |||
@@ -58,7 +58,7 @@ static const struct file_operations mga_driver_fops = { | |||
58 | 58 | ||
59 | static struct drm_driver driver = { | 59 | static struct drm_driver driver = { |
60 | .driver_features = | 60 | .driver_features = |
61 | DRIVER_USE_AGP | DRIVER_PCI_DMA | | 61 | DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_LEGACY | |
62 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, | 62 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, |
63 | .dev_priv_size = sizeof(drm_mga_buf_priv_t), | 63 | .dev_priv_size = sizeof(drm_mga_buf_priv_t), |
64 | .load = mga_driver_load, | 64 | .load = mga_driver_load, |
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 2b4b125eebc3..1443b3a34775 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c | |||
@@ -56,7 +56,7 @@ static void mgag200_kick_out_firmware_fb(struct pci_dev *pdev) | |||
56 | #ifdef CONFIG_X86 | 56 | #ifdef CONFIG_X86 |
57 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 57 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
58 | #endif | 58 | #endif |
59 | remove_conflicting_framebuffers(ap, "mgag200drmfb", primary); | 59 | drm_fb_helper_remove_conflicting_framebuffers(ap, "mgag200drmfb", primary); |
60 | kfree(ap); | 60 | kfree(ap); |
61 | } | 61 | } |
62 | 62 | ||
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c index d9b04b008feb..81325f64134f 100644 --- a/drivers/gpu/drm/mgag200/mgag200_fb.c +++ b/drivers/gpu/drm/mgag200/mgag200_fb.c | |||
@@ -15,8 +15,6 @@ | |||
15 | #include <drm/drm_fb_helper.h> | 15 | #include <drm/drm_fb_helper.h> |
16 | #include <drm/drm_crtc_helper.h> | 16 | #include <drm/drm_crtc_helper.h> |
17 | 17 | ||
18 | #include <linux/fb.h> | ||
19 | |||
20 | #include "mgag200_drv.h" | 18 | #include "mgag200_drv.h" |
21 | 19 | ||
22 | static void mga_dirty_update(struct mga_fbdev *mfbdev, | 20 | static void mga_dirty_update(struct mga_fbdev *mfbdev, |
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c index 13798b3e6beb..e79cbc25ae3c 100644 --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ b/drivers/gpu/drm/mgag200/mgag200_main.c | |||
@@ -135,7 +135,7 @@ static int mga_vram_init(struct mga_device *mdev) | |||
135 | aper->ranges[0].base = mdev->mc.vram_base; | 135 | aper->ranges[0].base = mdev->mc.vram_base; |
136 | aper->ranges[0].size = mdev->mc.vram_window; | 136 | aper->ranges[0].size = mdev->mc.vram_window; |
137 | 137 | ||
138 | remove_conflicting_framebuffers(aper, "mgafb", true); | 138 | drm_fb_helper_remove_conflicting_framebuffers(aper, "mgafb", true); |
139 | kfree(aper); | 139 | kfree(aper); |
140 | 140 | ||
141 | if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window, | 141 | if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window, |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 432c09836b0e..a02a24e75ba6 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | |||
@@ -78,7 +78,7 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev, | |||
78 | if (!dev->mode_config.rotation_property) | 78 | if (!dev->mode_config.rotation_property) |
79 | dev->mode_config.rotation_property = | 79 | dev->mode_config.rotation_property = |
80 | drm_mode_create_rotation_property(dev, | 80 | drm_mode_create_rotation_property(dev, |
81 | BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y)); | 81 | DRM_REFLECT_X | DRM_REFLECT_Y); |
82 | 82 | ||
83 | if (dev->mode_config.rotation_property) | 83 | if (dev->mode_config.rotation_property) |
84 | drm_object_attach_property(&plane->base, | 84 | drm_object_attach_property(&plane->base, |
@@ -309,8 +309,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane, | |||
309 | return -EINVAL; | 309 | return -EINVAL; |
310 | } | 310 | } |
311 | 311 | ||
312 | hflip = !!(state->rotation & BIT(DRM_REFLECT_X)); | 312 | hflip = !!(state->rotation & DRM_REFLECT_X); |
313 | vflip = !!(state->rotation & BIT(DRM_REFLECT_Y)); | 313 | vflip = !!(state->rotation & DRM_REFLECT_Y); |
314 | if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) || | 314 | if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) || |
315 | (hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) { | 315 | (hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) { |
316 | dev_err(plane->dev->dev, | 316 | dev_err(plane->dev->dev, |
@@ -743,8 +743,8 @@ static int mdp5_plane_mode_set(struct drm_plane *plane, | |||
743 | config |= get_scale_config(format, src_h, crtc_h, false); | 743 | config |= get_scale_config(format, src_h, crtc_h, false); |
744 | DBG("scale config = %x", config); | 744 | DBG("scale config = %x", config); |
745 | 745 | ||
746 | hflip = !!(pstate->rotation & BIT(DRM_REFLECT_X)); | 746 | hflip = !!(pstate->rotation & DRM_REFLECT_X); |
747 | vflip = !!(pstate->rotation & BIT(DRM_REFLECT_Y)); | 747 | vflip = !!(pstate->rotation & DRM_REFLECT_Y); |
748 | 748 | ||
749 | spin_lock_irqsave(&mdp5_plane->pipe_lock, flags); | 749 | spin_lock_irqsave(&mdp5_plane->pipe_lock, flags); |
750 | 750 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 66c1280c0f1f..652ab111dd74 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -351,7 +351,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev, | |||
351 | boot = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 351 | boot = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
352 | #endif | 352 | #endif |
353 | if (nouveau_modeset != 2) | 353 | if (nouveau_modeset != 2) |
354 | remove_conflicting_framebuffers(aper, "nouveaufb", boot); | 354 | drm_fb_helper_remove_conflicting_framebuffers(aper, "nouveaufb", boot); |
355 | kfree(aper); | 355 | kfree(aper); |
356 | 356 | ||
357 | ret = nvkm_device_pci_new(pdev, nouveau_config, nouveau_debug, | 357 | ret = nvkm_device_pci_new(pdev, nouveau_config, nouveau_debug, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index d1f248fd3506..9f5692726c16 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/tty.h> | 32 | #include <linux/tty.h> |
33 | #include <linux/sysrq.h> | 33 | #include <linux/sysrq.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/fb.h> | ||
36 | #include <linux/init.h> | 35 | #include <linux/init.h> |
37 | #include <linux/screen_info.h> | 36 | #include <linux/screen_info.h> |
38 | #include <linux/vga_switcheroo.h> | 37 | #include <linux/vga_switcheroo.h> |
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index 0eae8afaed90..b1f3b818edf4 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | #include <linux/backlight.h> | 14 | #include <linux/backlight.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/fb.h> | ||
17 | #include <linux/gpio/consumer.h> | 16 | #include <linux/gpio/consumer.h> |
18 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
19 | #include <linux/jiffies.h> | 18 | #include <linux/jiffies.h> |
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c index fc4c238c9583..9f3d6f48f3e1 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/spi/spi.h> | 16 | #include <linux/spi/spi.h> |
17 | #include <linux/fb.h> | ||
18 | #include <linux/gpio/consumer.h> | 17 | #include <linux/gpio/consumer.h> |
19 | #include <linux/of_gpio.h> | 18 | #include <linux/of_gpio.h> |
20 | 19 | ||
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c index 157c512205d1..3557a4c7dd7b 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/jiffies.h> | 28 | #include <linux/jiffies.h> |
29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
30 | #include <linux/backlight.h> | 30 | #include <linux/backlight.h> |
31 | #include <linux/fb.h> | ||
32 | #include <linux/gpio/consumer.h> | 31 | #include <linux/gpio/consumer.h> |
33 | #include <linux/of.h> | 32 | #include <linux/of.h> |
34 | #include <linux/of_gpio.h> | 33 | #include <linux/of_gpio.h> |
diff --git a/drivers/gpu/drm/omapdrm/dss/dss-of.c b/drivers/gpu/drm/omapdrm/dss/dss-of.c index e256d879b25c..dfd4e9621e3b 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss-of.c +++ b/drivers/gpu/drm/omapdrm/dss/dss-of.c | |||
@@ -125,16 +125,15 @@ u32 dss_of_port_get_port_number(struct device_node *port) | |||
125 | 125 | ||
126 | static struct device_node *omapdss_of_get_remote_port(const struct device_node *node) | 126 | static struct device_node *omapdss_of_get_remote_port(const struct device_node *node) |
127 | { | 127 | { |
128 | struct device_node *np, *np_parent; | 128 | struct device_node *np; |
129 | 129 | ||
130 | np = of_parse_phandle(node, "remote-endpoint", 0); | 130 | np = of_parse_phandle(node, "remote-endpoint", 0); |
131 | if (!np) | 131 | if (!np) |
132 | return NULL; | 132 | return NULL; |
133 | 133 | ||
134 | np_parent = of_get_next_parent(np); | 134 | np = of_get_next_parent(np); |
135 | of_node_put(np); | ||
136 | 135 | ||
137 | return np_parent; | 136 | return np; |
138 | } | 137 | } |
139 | 138 | ||
140 | struct device_node * | 139 | struct device_node * |
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 26c6134eb744..3dd78f2045f9 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c | |||
@@ -295,9 +295,9 @@ static int omap_modeset_init_properties(struct drm_device *dev) | |||
295 | if (priv->has_dmm) { | 295 | if (priv->has_dmm) { |
296 | dev->mode_config.rotation_property = | 296 | dev->mode_config.rotation_property = |
297 | drm_mode_create_rotation_property(dev, | 297 | drm_mode_create_rotation_property(dev, |
298 | BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) | | 298 | DRM_ROTATE_0 | DRM_ROTATE_90 | |
299 | BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) | | 299 | DRM_ROTATE_180 | DRM_ROTATE_270 | |
300 | BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y)); | 300 | DRM_REFLECT_X | DRM_REFLECT_Y); |
301 | if (!dev->mode_config.rotation_property) | 301 | if (!dev->mode_config.rotation_property) |
302 | return -ENOMEM; | 302 | return -ENOMEM; |
303 | } | 303 | } |
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c index 31f5178c22c7..5f3337f1e9aa 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c | |||
@@ -179,24 +179,24 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | |||
179 | (uint32_t)win->rotation); | 179 | (uint32_t)win->rotation); |
180 | /* fallthru to default to no rotation */ | 180 | /* fallthru to default to no rotation */ |
181 | case 0: | 181 | case 0: |
182 | case BIT(DRM_ROTATE_0): | 182 | case DRM_ROTATE_0: |
183 | orient = 0; | 183 | orient = 0; |
184 | break; | 184 | break; |
185 | case BIT(DRM_ROTATE_90): | 185 | case DRM_ROTATE_90: |
186 | orient = MASK_XY_FLIP | MASK_X_INVERT; | 186 | orient = MASK_XY_FLIP | MASK_X_INVERT; |
187 | break; | 187 | break; |
188 | case BIT(DRM_ROTATE_180): | 188 | case DRM_ROTATE_180: |
189 | orient = MASK_X_INVERT | MASK_Y_INVERT; | 189 | orient = MASK_X_INVERT | MASK_Y_INVERT; |
190 | break; | 190 | break; |
191 | case BIT(DRM_ROTATE_270): | 191 | case DRM_ROTATE_270: |
192 | orient = MASK_XY_FLIP | MASK_Y_INVERT; | 192 | orient = MASK_XY_FLIP | MASK_Y_INVERT; |
193 | break; | 193 | break; |
194 | } | 194 | } |
195 | 195 | ||
196 | if (win->rotation & BIT(DRM_REFLECT_X)) | 196 | if (win->rotation & DRM_REFLECT_X) |
197 | orient ^= MASK_X_INVERT; | 197 | orient ^= MASK_X_INVERT; |
198 | 198 | ||
199 | if (win->rotation & BIT(DRM_REFLECT_Y)) | 199 | if (win->rotation & DRM_REFLECT_Y) |
200 | orient ^= MASK_Y_INVERT; | 200 | orient ^= MASK_Y_INVERT; |
201 | 201 | ||
202 | /* adjust x,y offset for flip/invert: */ | 202 | /* adjust x,y offset for flip/invert: */ |
@@ -213,7 +213,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | |||
213 | } else { | 213 | } else { |
214 | switch (win->rotation & DRM_ROTATE_MASK) { | 214 | switch (win->rotation & DRM_ROTATE_MASK) { |
215 | case 0: | 215 | case 0: |
216 | case BIT(DRM_ROTATE_0): | 216 | case DRM_ROTATE_0: |
217 | /* OK */ | 217 | /* OK */ |
218 | break; | 218 | break; |
219 | 219 | ||
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 5252ab720e70..4c7727e6be7c 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c | |||
@@ -109,8 +109,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane, | |||
109 | win.src_y = state->src_y >> 16; | 109 | win.src_y = state->src_y >> 16; |
110 | 110 | ||
111 | switch (state->rotation & DRM_ROTATE_MASK) { | 111 | switch (state->rotation & DRM_ROTATE_MASK) { |
112 | case BIT(DRM_ROTATE_90): | 112 | case DRM_ROTATE_90: |
113 | case BIT(DRM_ROTATE_270): | 113 | case DRM_ROTATE_270: |
114 | win.src_w = state->src_h >> 16; | 114 | win.src_w = state->src_h >> 16; |
115 | win.src_h = state->src_w >> 16; | 115 | win.src_h = state->src_w >> 16; |
116 | break; | 116 | break; |
@@ -149,7 +149,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane, | |||
149 | struct omap_plane_state *omap_state = to_omap_plane_state(plane->state); | 149 | struct omap_plane_state *omap_state = to_omap_plane_state(plane->state); |
150 | struct omap_plane *omap_plane = to_omap_plane(plane); | 150 | struct omap_plane *omap_plane = to_omap_plane(plane); |
151 | 151 | ||
152 | plane->state->rotation = BIT(DRM_ROTATE_0); | 152 | plane->state->rotation = DRM_ROTATE_0; |
153 | omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY | 153 | omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY |
154 | ? 0 : omap_plane->id; | 154 | ? 0 : omap_plane->id; |
155 | 155 | ||
@@ -178,7 +178,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane, | |||
178 | return -EINVAL; | 178 | return -EINVAL; |
179 | 179 | ||
180 | if (state->fb) { | 180 | if (state->fb) { |
181 | if (state->rotation != BIT(DRM_ROTATE_0) && | 181 | if (state->rotation != DRM_ROTATE_0 && |
182 | !omap_framebuffer_supports_rotation(state->fb)) | 182 | !omap_framebuffer_supports_rotation(state->fb)) |
183 | return -EINVAL; | 183 | return -EINVAL; |
184 | } | 184 | } |
@@ -269,7 +269,7 @@ static void omap_plane_reset(struct drm_plane *plane) | |||
269 | */ | 269 | */ |
270 | omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY | 270 | omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY |
271 | ? 0 : omap_plane->id; | 271 | ? 0 : omap_plane->id; |
272 | omap_state->base.rotation = BIT(DRM_ROTATE_0); | 272 | omap_state->base.rotation = DRM_ROTATE_0; |
273 | 273 | ||
274 | plane->state = &omap_state->base; | 274 | plane->state = &omap_state->base; |
275 | plane->state->plane = plane; | 275 | plane->state->plane = plane; |
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c index df2657051afd..2cd879a4ae15 100644 --- a/drivers/gpu/drm/qxl/qxl_fb.c +++ b/drivers/gpu/drm/qxl/qxl_fb.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * David Airlie | 24 | * David Airlie |
25 | */ | 25 | */ |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/fb.h> | ||
28 | 27 | ||
29 | #include "drmP.h" | 28 | #include "drmP.h" |
30 | #include "drm/drm.h" | 29 | #include "drm/drm.h" |
@@ -73,10 +72,12 @@ static void qxl_fb_image_init(struct qxl_fb_image *qxl_fb_image, | |||
73 | } | 72 | } |
74 | } | 73 | } |
75 | 74 | ||
75 | #ifdef CONFIG_DRM_FBDEV_EMULATION | ||
76 | static struct fb_deferred_io qxl_defio = { | 76 | static struct fb_deferred_io qxl_defio = { |
77 | .delay = QXL_DIRTY_DELAY, | 77 | .delay = QXL_DIRTY_DELAY, |
78 | .deferred_io = drm_fb_helper_deferred_io, | 78 | .deferred_io = drm_fb_helper_deferred_io, |
79 | }; | 79 | }; |
80 | #endif | ||
80 | 81 | ||
81 | static struct fb_ops qxlfb_ops = { | 82 | static struct fb_ops qxlfb_ops = { |
82 | .owner = THIS_MODULE, | 83 | .owner = THIS_MODULE, |
@@ -313,8 +314,10 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev, | |||
313 | goto out_destroy_fbi; | 314 | goto out_destroy_fbi; |
314 | } | 315 | } |
315 | 316 | ||
317 | #ifdef CONFIG_DRM_FBDEV_EMULATION | ||
316 | info->fbdefio = &qxl_defio; | 318 | info->fbdefio = &qxl_defio; |
317 | fb_deferred_io_init(info); | 319 | fb_deferred_io_init(info); |
320 | #endif | ||
318 | 321 | ||
319 | qdev->fbdev_info = info; | 322 | qdev->fbdev_info = info; |
320 | qdev->fbdev_qfb = &qfbdev->qfb; | 323 | qdev->fbdev_qfb = &qfbdev->qfb; |
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c index c57b4de63caf..a982be57d1ef 100644 --- a/drivers/gpu/drm/r128/r128_drv.c +++ b/drivers/gpu/drm/r128/r128_drv.c | |||
@@ -56,7 +56,7 @@ static const struct file_operations r128_driver_fops = { | |||
56 | 56 | ||
57 | static struct drm_driver driver = { | 57 | static struct drm_driver driver = { |
58 | .driver_features = | 58 | .driver_features = |
59 | DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG | | 59 | DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_LEGACY | |
60 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, | 60 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, |
61 | .dev_priv_size = sizeof(drm_r128_buf_priv_t), | 61 | .dev_priv_size = sizeof(drm_r128_buf_priv_t), |
62 | .load = r128_driver_load, | 62 | .load = r128_driver_load, |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index c01a7c6abb49..90f2ff217b31 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/pm_runtime.h> | 39 | #include <linux/pm_runtime.h> |
40 | #include <linux/vga_switcheroo.h> | 40 | #include <linux/vga_switcheroo.h> |
41 | #include <drm/drm_gem.h> | 41 | #include <drm/drm_gem.h> |
42 | #include <drm/drm_fb_helper.h> | ||
42 | 43 | ||
43 | #include "drm_crtc_helper.h" | 44 | #include "drm_crtc_helper.h" |
44 | #include "radeon_kfd.h" | 45 | #include "radeon_kfd.h" |
@@ -324,7 +325,7 @@ static int radeon_kick_out_firmware_fb(struct pci_dev *pdev) | |||
324 | #ifdef CONFIG_X86 | 325 | #ifdef CONFIG_X86 |
325 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 326 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
326 | #endif | 327 | #endif |
327 | remove_conflicting_framebuffers(ap, "radeondrmfb", primary); | 328 | drm_fb_helper_remove_conflicting_framebuffers(ap, "radeondrmfb", primary); |
328 | kfree(ap); | 329 | kfree(ap); |
329 | 330 | ||
330 | return 0; | 331 | return 0; |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index 0e3143acb565..568e036d547e 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -25,7 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/fb.h> | ||
29 | 28 | ||
30 | #include <drm/drmP.h> | 29 | #include <drm/drmP.h> |
31 | #include <drm/drm_crtc.h> | 30 | #include <drm/drm_crtc.h> |
@@ -383,7 +382,7 @@ void radeon_fbdev_fini(struct radeon_device *rdev) | |||
383 | void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state) | 382 | void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state) |
384 | { | 383 | { |
385 | if (rdev->mode_info.rfbdev) | 384 | if (rdev->mode_info.rfbdev) |
386 | fb_set_suspend(rdev->mode_info.rfbdev->helper.fbdev, state); | 385 | drm_fb_helper_set_suspend(&rdev->mode_info.rfbdev->helper, state); |
387 | } | 386 | } |
388 | 387 | ||
389 | bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj) | 388 | bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj) |
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 91305eb7d312..31744fe99b38 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c | |||
@@ -87,8 +87,6 @@ | |||
87 | struct vop_plane_state { | 87 | struct vop_plane_state { |
88 | struct drm_plane_state base; | 88 | struct drm_plane_state base; |
89 | int format; | 89 | int format; |
90 | struct drm_rect src; | ||
91 | struct drm_rect dest; | ||
92 | dma_addr_t yrgb_mst; | 90 | dma_addr_t yrgb_mst; |
93 | bool enable; | 91 | bool enable; |
94 | }; | 92 | }; |
@@ -593,10 +591,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane, | |||
593 | struct vop_win *vop_win = to_vop_win(plane); | 591 | struct vop_win *vop_win = to_vop_win(plane); |
594 | struct vop_plane_state *vop_plane_state = to_vop_plane_state(state); | 592 | struct vop_plane_state *vop_plane_state = to_vop_plane_state(state); |
595 | const struct vop_win_data *win = vop_win->data; | 593 | const struct vop_win_data *win = vop_win->data; |
596 | bool visible; | ||
597 | int ret; | 594 | int ret; |
598 | struct drm_rect *dest = &vop_plane_state->dest; | ||
599 | struct drm_rect *src = &vop_plane_state->src; | ||
600 | struct drm_rect clip; | 595 | struct drm_rect clip; |
601 | int min_scale = win->phy->scl ? FRAC_16_16(1, 8) : | 596 | int min_scale = win->phy->scl ? FRAC_16_16(1, 8) : |
602 | DRM_PLANE_HELPER_NO_SCALING; | 597 | DRM_PLANE_HELPER_NO_SCALING; |
@@ -610,30 +605,18 @@ static int vop_plane_atomic_check(struct drm_plane *plane, | |||
610 | if (WARN_ON(!crtc_state)) | 605 | if (WARN_ON(!crtc_state)) |
611 | return -EINVAL; | 606 | return -EINVAL; |
612 | 607 | ||
613 | src->x1 = state->src_x; | ||
614 | src->y1 = state->src_y; | ||
615 | src->x2 = state->src_x + state->src_w; | ||
616 | src->y2 = state->src_y + state->src_h; | ||
617 | dest->x1 = state->crtc_x; | ||
618 | dest->y1 = state->crtc_y; | ||
619 | dest->x2 = state->crtc_x + state->crtc_w; | ||
620 | dest->y2 = state->crtc_y + state->crtc_h; | ||
621 | |||
622 | clip.x1 = 0; | 608 | clip.x1 = 0; |
623 | clip.y1 = 0; | 609 | clip.y1 = 0; |
624 | clip.x2 = crtc_state->adjusted_mode.hdisplay; | 610 | clip.x2 = crtc_state->adjusted_mode.hdisplay; |
625 | clip.y2 = crtc_state->adjusted_mode.vdisplay; | 611 | clip.y2 = crtc_state->adjusted_mode.vdisplay; |
626 | 612 | ||
627 | ret = drm_plane_helper_check_update(plane, crtc, state->fb, | 613 | ret = drm_plane_helper_check_state(state, &clip, |
628 | src, dest, &clip, | 614 | min_scale, max_scale, |
629 | state->rotation, | 615 | true, true); |
630 | min_scale, | ||
631 | max_scale, | ||
632 | true, true, &visible); | ||
633 | if (ret) | 616 | if (ret) |
634 | return ret; | 617 | return ret; |
635 | 618 | ||
636 | if (!visible) | 619 | if (!state->visible) |
637 | goto out_disable; | 620 | goto out_disable; |
638 | 621 | ||
639 | vop_plane_state->format = vop_convert_format(fb->pixel_format); | 622 | vop_plane_state->format = vop_convert_format(fb->pixel_format); |
@@ -644,7 +627,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane, | |||
644 | * Src.x1 can be odd when do clip, but yuv plane start point | 627 | * Src.x1 can be odd when do clip, but yuv plane start point |
645 | * need align with 2 pixel. | 628 | * need align with 2 pixel. |
646 | */ | 629 | */ |
647 | if (is_yuv_support(fb->pixel_format) && ((src->x1 >> 16) % 2)) | 630 | if (is_yuv_support(fb->pixel_format) && ((state->src.x1 >> 16) % 2)) |
648 | return -EINVAL; | 631 | return -EINVAL; |
649 | 632 | ||
650 | vop_plane_state->enable = true; | 633 | vop_plane_state->enable = true; |
@@ -694,8 +677,8 @@ static void vop_plane_atomic_update(struct drm_plane *plane, | |||
694 | unsigned int actual_w, actual_h; | 677 | unsigned int actual_w, actual_h; |
695 | unsigned int dsp_stx, dsp_sty; | 678 | unsigned int dsp_stx, dsp_sty; |
696 | uint32_t act_info, dsp_info, dsp_st; | 679 | uint32_t act_info, dsp_info, dsp_st; |
697 | struct drm_rect *src = &vop_plane_state->src; | 680 | struct drm_rect *src = &state->src; |
698 | struct drm_rect *dest = &vop_plane_state->dest; | 681 | struct drm_rect *dest = &state->dst; |
699 | struct drm_gem_object *obj, *uv_obj; | 682 | struct drm_gem_object *obj, *uv_obj; |
700 | struct rockchip_gem_object *rk_obj, *rk_uv_obj; | 683 | struct rockchip_gem_object *rk_obj, *rk_uv_obj; |
701 | unsigned long offset; | 684 | unsigned long offset; |
diff --git a/drivers/gpu/drm/savage/savage_drv.c b/drivers/gpu/drm/savage/savage_drv.c index 21aed1febeb4..3b807135a5cd 100644 --- a/drivers/gpu/drm/savage/savage_drv.c +++ b/drivers/gpu/drm/savage/savage_drv.c | |||
@@ -50,7 +50,7 @@ static const struct file_operations savage_driver_fops = { | |||
50 | 50 | ||
51 | static struct drm_driver driver = { | 51 | static struct drm_driver driver = { |
52 | .driver_features = | 52 | .driver_features = |
53 | DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_PCI_DMA, | 53 | DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_PCI_DMA | DRIVER_LEGACY, |
54 | .dev_priv_size = sizeof(drm_savage_buf_priv_t), | 54 | .dev_priv_size = sizeof(drm_savage_buf_priv_t), |
55 | .load = savage_driver_load, | 55 | .load = savage_driver_load, |
56 | .firstopen = savage_driver_firstopen, | 56 | .firstopen = savage_driver_firstopen, |
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c index 79bce76cb8f7..ae9839886c4d 100644 --- a/drivers/gpu/drm/sis/sis_drv.c +++ b/drivers/gpu/drm/sis/sis_drv.c | |||
@@ -102,7 +102,7 @@ static void sis_driver_postclose(struct drm_device *dev, struct drm_file *file) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | static struct drm_driver driver = { | 104 | static struct drm_driver driver = { |
105 | .driver_features = DRIVER_USE_AGP, | 105 | .driver_features = DRIVER_USE_AGP | DRIVER_LEGACY, |
106 | .load = sis_driver_load, | 106 | .load = sis_driver_load, |
107 | .unload = sis_driver_unload, | 107 | .unload = sis_driver_unload, |
108 | .open = sis_driver_open, | 108 | .open = sis_driver_open, |
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 7092daaf6c43..8913c151b37f 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <drm/drm_crtc_helper.h> | 17 | #include <drm/drm_crtc_helper.h> |
18 | #include <drm/drm_fb_cma_helper.h> | 18 | #include <drm/drm_fb_cma_helper.h> |
19 | #include <drm/drm_gem_cma_helper.h> | 19 | #include <drm/drm_gem_cma_helper.h> |
20 | #include <drm/drm_fb_helper.h> | ||
20 | 21 | ||
21 | #include "sun4i_crtc.h" | 22 | #include "sun4i_crtc.h" |
22 | #include "sun4i_drv.h" | 23 | #include "sun4i_drv.h" |
@@ -109,7 +110,7 @@ static void sun4i_remove_framebuffers(void) | |||
109 | ap->ranges[0].base = 0; | 110 | ap->ranges[0].base = 0; |
110 | ap->ranges[0].size = ~0; | 111 | ap->ranges[0].size = ~0; |
111 | 112 | ||
112 | remove_conflicting_framebuffers(ap, "sun4i-drm-fb", false); | 113 | drm_fb_helper_remove_conflicting_framebuffers(ap, "sun4i-drm-fb", false); |
113 | kfree(ap); | 114 | kfree(ap); |
114 | } | 115 | } |
115 | 116 | ||
diff --git a/drivers/gpu/drm/tdfx/tdfx_drv.c b/drivers/gpu/drm/tdfx/tdfx_drv.c index fab5ebcb0fef..f418892b0c71 100644 --- a/drivers/gpu/drm/tdfx/tdfx_drv.c +++ b/drivers/gpu/drm/tdfx/tdfx_drv.c | |||
@@ -56,6 +56,7 @@ static const struct file_operations tdfx_driver_fops = { | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | static struct drm_driver driver = { | 58 | static struct drm_driver driver = { |
59 | .driver_features = DRIVER_LEGACY, | ||
59 | .set_busid = drm_pci_set_busid, | 60 | .set_busid = drm_pci_set_busid, |
60 | .fops = &tdfx_driver_fops, | 61 | .fops = &tdfx_driver_fops, |
61 | .name = DRIVER_NAME, | 62 | .name = DRIVER_NAME, |
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c index d5df555aeba0..9688bfa92ccd 100644 --- a/drivers/gpu/drm/udl/udl_fb.c +++ b/drivers/gpu/drm/udl/udl_fb.c | |||
@@ -203,6 +203,7 @@ static int udl_fb_open(struct fb_info *info, int user) | |||
203 | 203 | ||
204 | ufbdev->fb_count++; | 204 | ufbdev->fb_count++; |
205 | 205 | ||
206 | #ifdef CONFIG_DRM_FBDEV_EMULATION | ||
206 | if (fb_defio && (info->fbdefio == NULL)) { | 207 | if (fb_defio && (info->fbdefio == NULL)) { |
207 | /* enable defio at last moment if not disabled by client */ | 208 | /* enable defio at last moment if not disabled by client */ |
208 | 209 | ||
@@ -218,6 +219,7 @@ static int udl_fb_open(struct fb_info *info, int user) | |||
218 | info->fbdefio = fbdefio; | 219 | info->fbdefio = fbdefio; |
219 | fb_deferred_io_init(info); | 220 | fb_deferred_io_init(info); |
220 | } | 221 | } |
222 | #endif | ||
221 | 223 | ||
222 | pr_notice("open /dev/fb%d user=%d fb_info=%p count=%d\n", | 224 | pr_notice("open /dev/fb%d user=%d fb_info=%p count=%d\n", |
223 | info->node, user, info, ufbdev->fb_count); | 225 | info->node, user, info, ufbdev->fb_count); |
@@ -235,12 +237,14 @@ static int udl_fb_release(struct fb_info *info, int user) | |||
235 | 237 | ||
236 | ufbdev->fb_count--; | 238 | ufbdev->fb_count--; |
237 | 239 | ||
240 | #ifdef CONFIG_DRM_FBDEV_EMULATION | ||
238 | if ((ufbdev->fb_count == 0) && (info->fbdefio)) { | 241 | if ((ufbdev->fb_count == 0) && (info->fbdefio)) { |
239 | fb_deferred_io_cleanup(info); | 242 | fb_deferred_io_cleanup(info); |
240 | kfree(info->fbdefio); | 243 | kfree(info->fbdefio); |
241 | info->fbdefio = NULL; | 244 | info->fbdefio = NULL; |
242 | info->fbops->fb_mmap = udl_fb_mmap; | 245 | info->fbops->fb_mmap = udl_fb_mmap; |
243 | } | 246 | } |
247 | #endif | ||
244 | 248 | ||
245 | pr_warn("released /dev/fb%d user=%d count=%d\n", | 249 | pr_warn("released /dev/fb%d user=%d count=%d\n", |
246 | info->node, user, ufbdev->fb_count); | 250 | info->node, user, ufbdev->fb_count); |
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 8b42d31a7f0e..deec53545bea 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/pm_runtime.h> | 17 | #include <linux/pm_runtime.h> |
18 | #include "drm_fb_cma_helper.h" | 18 | #include "drm_fb_cma_helper.h" |
19 | #include <drm/drm_fb_helper.h> | ||
19 | 20 | ||
20 | #include "uapi/drm/vc4_drm.h" | 21 | #include "uapi/drm/vc4_drm.h" |
21 | #include "vc4_drv.h" | 22 | #include "vc4_drv.h" |
@@ -214,7 +215,7 @@ static void vc4_kick_out_firmware_fb(void) | |||
214 | ap->ranges[0].base = 0; | 215 | ap->ranges[0].base = 0; |
215 | ap->ranges[0].size = ~0; | 216 | ap->ranges[0].size = ~0; |
216 | 217 | ||
217 | remove_conflicting_framebuffers(ap, "vc4drmfb", false); | 218 | drm_fb_helper_remove_conflicting_framebuffers(ap, "vc4drmfb", false); |
218 | kfree(ap); | 219 | kfree(ap); |
219 | } | 220 | } |
220 | 221 | ||
diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c index ed8aa8ff861a..e5582bab7e3c 100644 --- a/drivers/gpu/drm/via/via_drv.c +++ b/drivers/gpu/drm/via/via_drv.c | |||
@@ -72,7 +72,7 @@ static const struct file_operations via_driver_fops = { | |||
72 | 72 | ||
73 | static struct drm_driver driver = { | 73 | static struct drm_driver driver = { |
74 | .driver_features = | 74 | .driver_features = |
75 | DRIVER_USE_AGP | DRIVER_HAVE_IRQ | | 75 | DRIVER_USE_AGP | DRIVER_HAVE_IRQ | DRIVER_LEGACY | |
76 | DRIVER_IRQ_SHARED, | 76 | DRIVER_IRQ_SHARED, |
77 | .load = via_driver_load, | 77 | .load = via_driver_load, |
78 | .unload = via_driver_unload, | 78 | .unload = via_driver_unload, |
diff --git a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c index 7f0e93f87a55..a59d0e309bfc 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c +++ b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c | |||
@@ -24,6 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <drm/drm_fb_helper.h> | ||
27 | 28 | ||
28 | #include "virtgpu_drv.h" | 29 | #include "virtgpu_drv.h" |
29 | 30 | ||
@@ -42,7 +43,7 @@ static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev) | |||
42 | primary = pci_dev->resource[PCI_ROM_RESOURCE].flags | 43 | primary = pci_dev->resource[PCI_ROM_RESOURCE].flags |
43 | & IORESOURCE_ROM_SHADOW; | 44 | & IORESOURCE_ROM_SHADOW; |
44 | 45 | ||
45 | remove_conflicting_framebuffers(ap, "virtiodrmfb", primary); | 46 | drm_fb_helper_remove_conflicting_framebuffers(ap, "virtiodrmfb", primary); |
46 | 47 | ||
47 | kfree(ap); | 48 | kfree(ap); |
48 | } | 49 | } |
diff --git a/drivers/gpu/drm/vmwgfx/Kconfig b/drivers/gpu/drm/vmwgfx/Kconfig index b49445df8a7e..fb7b82aad763 100644 --- a/drivers/gpu/drm/vmwgfx/Kconfig +++ b/drivers/gpu/drm/vmwgfx/Kconfig | |||
@@ -6,6 +6,7 @@ config DRM_VMWGFX | |||
6 | select FB_CFB_COPYAREA | 6 | select FB_CFB_COPYAREA |
7 | select FB_CFB_IMAGEBLIT | 7 | select FB_CFB_IMAGEBLIT |
8 | select DRM_TTM | 8 | select DRM_TTM |
9 | select FB | ||
9 | # Only needed for the transitional use of drm_crtc_init - can be removed | 10 | # Only needed for the transitional use of drm_crtc_init - can be removed |
10 | # again once vmwgfx sets up the primary plane itself. | 11 | # again once vmwgfx sets up the primary plane itself. |
11 | select DRM_KMS_HELPER | 12 | select DRM_KMS_HELPER |
diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c index 4c5a85595a85..961a94bf156c 100644 --- a/drivers/staging/android/sync_debug.c +++ b/drivers/staging/android/sync_debug.c | |||
@@ -135,10 +135,16 @@ static void sync_print_sync_file(struct seq_file *s, | |||
135 | int i; | 135 | int i; |
136 | 136 | ||
137 | seq_printf(s, "[%p] %s: %s\n", sync_file, sync_file->name, | 137 | seq_printf(s, "[%p] %s: %s\n", sync_file, sync_file->name, |
138 | sync_status_str(atomic_read(&sync_file->status))); | 138 | sync_status_str(!fence_is_signaled(sync_file->fence))); |
139 | 139 | ||
140 | for (i = 0; i < sync_file->num_fences; ++i) | 140 | if (fence_is_array(sync_file->fence)) { |
141 | sync_print_fence(s, sync_file->cbs[i].fence, true); | 141 | struct fence_array *array = to_fence_array(sync_file->fence); |
142 | |||
143 | for (i = 0; i < array->num_fences; ++i) | ||
144 | sync_print_fence(s, array->fences[i], true); | ||
145 | } else { | ||
146 | sync_print_fence(s, sync_file->fence, true); | ||
147 | } | ||
142 | } | 148 | } |
143 | 149 | ||
144 | static int sync_debugfs_show(struct seq_file *s, void *unused) | 150 | static int sync_debugfs_show(struct seq_file *s, void *unused) |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index d3778652e462..f8e87fde611b 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -146,6 +146,7 @@ void drm_err(const char *format, ...); | |||
146 | 146 | ||
147 | /* driver capabilities and requirements mask */ | 147 | /* driver capabilities and requirements mask */ |
148 | #define DRIVER_USE_AGP 0x1 | 148 | #define DRIVER_USE_AGP 0x1 |
149 | #define DRIVER_LEGACY 0x2 | ||
149 | #define DRIVER_PCI_DMA 0x8 | 150 | #define DRIVER_PCI_DMA 0x8 |
150 | #define DRIVER_SG 0x10 | 151 | #define DRIVER_SG 0x10 |
151 | #define DRIVER_HAVE_DMA 0x20 | 152 | #define DRIVER_HAVE_DMA 0x20 |
@@ -231,6 +232,36 @@ void drm_err(const char *format, ...); | |||
231 | drm_ut_debug_printk(__func__, fmt, ##args); \ | 232 | drm_ut_debug_printk(__func__, fmt, ##args); \ |
232 | } while (0) | 233 | } while (0) |
233 | 234 | ||
235 | #define _DRM_DEFINE_DEBUG_RATELIMITED(level, fmt, args...) \ | ||
236 | do { \ | ||
237 | if (unlikely(drm_debug & DRM_UT_ ## level)) { \ | ||
238 | static DEFINE_RATELIMIT_STATE( \ | ||
239 | _rs, \ | ||
240 | DEFAULT_RATELIMIT_INTERVAL, \ | ||
241 | DEFAULT_RATELIMIT_BURST); \ | ||
242 | \ | ||
243 | if (__ratelimit(&_rs)) { \ | ||
244 | drm_ut_debug_printk(__func__, fmt, \ | ||
245 | ##args); \ | ||
246 | } \ | ||
247 | } \ | ||
248 | } while (0) | ||
249 | |||
250 | /** | ||
251 | * Rate limited debug output. Like DRM_DEBUG() but won't flood the log. | ||
252 | * | ||
253 | * \param fmt printf() like format string. | ||
254 | * \param arg arguments | ||
255 | */ | ||
256 | #define DRM_DEBUG_RATELIMITED(fmt, args...) \ | ||
257 | _DRM_DEFINE_DEBUG_RATELIMITED(CORE, fmt, ##args) | ||
258 | #define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...) \ | ||
259 | _DRM_DEFINE_DEBUG_RATELIMITED(DRIVER, fmt, ##args) | ||
260 | #define DRM_DEBUG_KMS_RATELIMITED(fmt, args...) \ | ||
261 | _DRM_DEFINE_DEBUG_RATELIMITED(KMS, fmt, ##args) | ||
262 | #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \ | ||
263 | _DRM_DEFINE_DEBUG_RATELIMITED(PRIME, fmt, ##args) | ||
264 | |||
234 | /*@}*/ | 265 | /*@}*/ |
235 | 266 | ||
236 | /***********************************************************************/ | 267 | /***********************************************************************/ |
@@ -642,7 +673,7 @@ struct drm_driver { | |||
642 | }; | 673 | }; |
643 | 674 | ||
644 | enum drm_minor_type { | 675 | enum drm_minor_type { |
645 | DRM_MINOR_LEGACY, | 676 | DRM_MINOR_PRIMARY, |
646 | DRM_MINOR_CONTROL, | 677 | DRM_MINOR_CONTROL, |
647 | DRM_MINOR_RENDER, | 678 | DRM_MINOR_RENDER, |
648 | DRM_MINOR_CNT, | 679 | DRM_MINOR_CNT, |
@@ -856,7 +887,7 @@ static inline bool drm_is_control_client(const struct drm_file *file_priv) | |||
856 | 887 | ||
857 | static inline bool drm_is_primary_client(const struct drm_file *file_priv) | 888 | static inline bool drm_is_primary_client(const struct drm_file *file_priv) |
858 | { | 889 | { |
859 | return file_priv->minor->type == DRM_MINOR_LEGACY; | 890 | return file_priv->minor->type == DRM_MINOR_PRIMARY; |
860 | } | 891 | } |
861 | 892 | ||
862 | /******************************************************************/ | 893 | /******************************************************************/ |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 44e070800b6d..b618b506b04d 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <uapi/drm/drm_mode.h> | 35 | #include <uapi/drm/drm_mode.h> |
36 | #include <uapi/drm/drm_fourcc.h> | 36 | #include <uapi/drm/drm_fourcc.h> |
37 | #include <drm/drm_modeset_lock.h> | 37 | #include <drm/drm_modeset_lock.h> |
38 | #include <drm/drm_rect.h> | ||
38 | 39 | ||
39 | struct drm_device; | 40 | struct drm_device; |
40 | struct drm_mode_set; | 41 | struct drm_mode_set; |
@@ -83,14 +84,15 @@ static inline uint64_t I642U64(int64_t val) | |||
83 | * specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and | 84 | * specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and |
84 | * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation | 85 | * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation |
85 | */ | 86 | */ |
86 | #define DRM_ROTATE_MASK 0x0f | 87 | #define DRM_ROTATE_0 BIT(0) |
87 | #define DRM_ROTATE_0 0 | 88 | #define DRM_ROTATE_90 BIT(1) |
88 | #define DRM_ROTATE_90 1 | 89 | #define DRM_ROTATE_180 BIT(2) |
89 | #define DRM_ROTATE_180 2 | 90 | #define DRM_ROTATE_270 BIT(3) |
90 | #define DRM_ROTATE_270 3 | 91 | #define DRM_ROTATE_MASK (DRM_ROTATE_0 | DRM_ROTATE_90 | \ |
91 | #define DRM_REFLECT_MASK (~DRM_ROTATE_MASK) | 92 | DRM_ROTATE_180 | DRM_ROTATE_270) |
92 | #define DRM_REFLECT_X 4 | 93 | #define DRM_REFLECT_X BIT(4) |
93 | #define DRM_REFLECT_Y 5 | 94 | #define DRM_REFLECT_Y BIT(5) |
95 | #define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y) | ||
94 | 96 | ||
95 | enum drm_connector_force { | 97 | enum drm_connector_force { |
96 | DRM_FORCE_UNSPECIFIED, | 98 | DRM_FORCE_UNSPECIFIED, |
@@ -1414,6 +1416,9 @@ struct drm_connector { | |||
1414 | * @zpos: priority of the given plane on crtc (optional) | 1416 | * @zpos: priority of the given plane on crtc (optional) |
1415 | * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1 | 1417 | * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1 |
1416 | * where N is the number of active planes for given crtc | 1418 | * where N is the number of active planes for given crtc |
1419 | * @src: clipped source coordinates of the plane (in 16.16) | ||
1420 | * @dst: clipped destination coordinates of the plane | ||
1421 | * @visible: visibility of the plane | ||
1417 | * @state: backpointer to global drm_atomic_state | 1422 | * @state: backpointer to global drm_atomic_state |
1418 | */ | 1423 | */ |
1419 | struct drm_plane_state { | 1424 | struct drm_plane_state { |
@@ -1438,6 +1443,15 @@ struct drm_plane_state { | |||
1438 | unsigned int zpos; | 1443 | unsigned int zpos; |
1439 | unsigned int normalized_zpos; | 1444 | unsigned int normalized_zpos; |
1440 | 1445 | ||
1446 | /* Clipped coordinates */ | ||
1447 | struct drm_rect src, dst; | ||
1448 | |||
1449 | /* | ||
1450 | * Is the plane actually visible? Can be false even | ||
1451 | * if fb!=NULL and crtc!=NULL, due to clipping. | ||
1452 | */ | ||
1453 | bool visible; | ||
1454 | |||
1441 | struct drm_atomic_state *state; | 1455 | struct drm_atomic_state *state; |
1442 | }; | 1456 | }; |
1443 | 1457 | ||
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index db8d4780eaa2..130c324f1aee 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | struct drm_fb_helper; | 33 | struct drm_fb_helper; |
34 | 34 | ||
35 | #include <drm/drm_crtc.h> | ||
35 | #include <linux/kgdb.h> | 36 | #include <linux/kgdb.h> |
36 | 37 | ||
37 | enum mode_set_atomic { | 38 | enum mode_set_atomic { |
@@ -282,6 +283,12 @@ drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, | |||
282 | int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); | 283 | int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); |
283 | int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | 284 | int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, |
284 | struct drm_connector *connector); | 285 | struct drm_connector *connector); |
286 | static inline int | ||
287 | drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, | ||
288 | const char *name, bool primary) | ||
289 | { | ||
290 | return remove_conflicting_framebuffers(a, name, primary); | ||
291 | } | ||
285 | #else | 292 | #else |
286 | static inline int drm_fb_helper_modinit(void) | 293 | static inline int drm_fb_helper_modinit(void) |
287 | { | 294 | { |
@@ -475,5 +482,12 @@ drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | |||
475 | { | 482 | { |
476 | return 0; | 483 | return 0; |
477 | } | 484 | } |
485 | |||
486 | static inline int | ||
487 | drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, | ||
488 | const char *name, bool primary) | ||
489 | { | ||
490 | return 0; | ||
491 | } | ||
478 | #endif | 492 | #endif |
479 | #endif | 493 | #endif |
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index fc65118e5077..205ddcf6d55d 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
@@ -37,6 +37,7 @@ | |||
37 | * Generic range manager structs | 37 | * Generic range manager structs |
38 | */ | 38 | */ |
39 | #include <linux/bug.h> | 39 | #include <linux/bug.h> |
40 | #include <linux/rbtree.h> | ||
40 | #include <linux/kernel.h> | 41 | #include <linux/kernel.h> |
41 | #include <linux/list.h> | 42 | #include <linux/list.h> |
42 | #include <linux/spinlock.h> | 43 | #include <linux/spinlock.h> |
@@ -61,6 +62,7 @@ enum drm_mm_allocator_flags { | |||
61 | struct drm_mm_node { | 62 | struct drm_mm_node { |
62 | struct list_head node_list; | 63 | struct list_head node_list; |
63 | struct list_head hole_stack; | 64 | struct list_head hole_stack; |
65 | struct rb_node rb; | ||
64 | unsigned hole_follows : 1; | 66 | unsigned hole_follows : 1; |
65 | unsigned scanned_block : 1; | 67 | unsigned scanned_block : 1; |
66 | unsigned scanned_prev_free : 1; | 68 | unsigned scanned_prev_free : 1; |
@@ -70,6 +72,7 @@ struct drm_mm_node { | |||
70 | unsigned long color; | 72 | unsigned long color; |
71 | u64 start; | 73 | u64 start; |
72 | u64 size; | 74 | u64 size; |
75 | u64 __subtree_last; | ||
73 | struct drm_mm *mm; | 76 | struct drm_mm *mm; |
74 | }; | 77 | }; |
75 | 78 | ||
@@ -79,6 +82,9 @@ struct drm_mm { | |||
79 | /* head_node.node_list is the list of all memory nodes, ordered | 82 | /* head_node.node_list is the list of all memory nodes, ordered |
80 | * according to the (increasing) start address of the memory node. */ | 83 | * according to the (increasing) start address of the memory node. */ |
81 | struct drm_mm_node head_node; | 84 | struct drm_mm_node head_node; |
85 | /* Keep an interval_tree for fast lookup of drm_mm_nodes by address. */ | ||
86 | struct rb_root interval_tree; | ||
87 | |||
82 | unsigned int scan_check_range : 1; | 88 | unsigned int scan_check_range : 1; |
83 | unsigned scan_alignment; | 89 | unsigned scan_alignment; |
84 | unsigned long scan_color; | 90 | unsigned long scan_color; |
@@ -295,6 +301,12 @@ void drm_mm_init(struct drm_mm *mm, | |||
295 | void drm_mm_takedown(struct drm_mm *mm); | 301 | void drm_mm_takedown(struct drm_mm *mm); |
296 | bool drm_mm_clean(struct drm_mm *mm); | 302 | bool drm_mm_clean(struct drm_mm *mm); |
297 | 303 | ||
304 | struct drm_mm_node * | ||
305 | drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last); | ||
306 | |||
307 | struct drm_mm_node * | ||
308 | drm_mm_interval_next(struct drm_mm_node *node, u64 start, u64 last); | ||
309 | |||
298 | void drm_mm_init_scan(struct drm_mm *mm, | 310 | void drm_mm_init_scan(struct drm_mm *mm, |
299 | u64 size, | 311 | u64 size, |
300 | unsigned alignment, | 312 | unsigned alignment, |
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h index 0e0c3573cce0..fbc8ecb3e5e8 100644 --- a/include/drm/drm_plane_helper.h +++ b/include/drm/drm_plane_helper.h | |||
@@ -40,6 +40,11 @@ | |||
40 | int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, | 40 | int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, |
41 | const struct drm_crtc_funcs *funcs); | 41 | const struct drm_crtc_funcs *funcs); |
42 | 42 | ||
43 | int drm_plane_helper_check_state(struct drm_plane_state *state, | ||
44 | const struct drm_rect *clip, | ||
45 | int min_scale, int max_scale, | ||
46 | bool can_position, | ||
47 | bool can_update_disabled); | ||
43 | int drm_plane_helper_check_update(struct drm_plane *plane, | 48 | int drm_plane_helper_check_update(struct drm_plane *plane, |
44 | struct drm_crtc *crtc, | 49 | struct drm_crtc *crtc, |
45 | struct drm_framebuffer *fb, | 50 | struct drm_framebuffer *fb, |
diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h index 06ea8e077ec2..afba6fcac853 100644 --- a/include/drm/drm_vma_manager.h +++ b/include/drm/drm_vma_manager.h | |||
@@ -40,13 +40,11 @@ struct drm_vma_offset_file { | |||
40 | struct drm_vma_offset_node { | 40 | struct drm_vma_offset_node { |
41 | rwlock_t vm_lock; | 41 | rwlock_t vm_lock; |
42 | struct drm_mm_node vm_node; | 42 | struct drm_mm_node vm_node; |
43 | struct rb_node vm_rb; | ||
44 | struct rb_root vm_files; | 43 | struct rb_root vm_files; |
45 | }; | 44 | }; |
46 | 45 | ||
47 | struct drm_vma_offset_manager { | 46 | struct drm_vma_offset_manager { |
48 | rwlock_t vm_lock; | 47 | rwlock_t vm_lock; |
49 | struct rb_root vm_addr_space_rb; | ||
50 | struct drm_mm vm_addr_space_mm; | 48 | struct drm_mm vm_addr_space_mm; |
51 | }; | 49 | }; |
52 | 50 | ||
diff --git a/include/linux/fence-array.h b/include/linux/fence-array.h index 86baaa45567c..a44794e508df 100644 --- a/include/linux/fence-array.h +++ b/include/linux/fence-array.h | |||
@@ -52,6 +52,16 @@ struct fence_array { | |||
52 | extern const struct fence_ops fence_array_ops; | 52 | extern const struct fence_ops fence_array_ops; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * fence_is_array - check if a fence is from the array subsclass | ||
56 | * | ||
57 | * Return true if it is a fence_array and false otherwise. | ||
58 | */ | ||
59 | static inline bool fence_is_array(struct fence *fence) | ||
60 | { | ||
61 | return fence->ops == &fence_array_ops; | ||
62 | } | ||
63 | |||
64 | /** | ||
55 | * to_fence_array - cast a fence to a fence_array | 65 | * to_fence_array - cast a fence to a fence_array |
56 | * @fence: fence to cast to a fence_array | 66 | * @fence: fence to cast to a fence_array |
57 | * | 67 | * |
diff --git a/include/linux/fence.h b/include/linux/fence.h index 8cc719a63728..0d763053f97a 100644 --- a/include/linux/fence.h +++ b/include/linux/fence.h | |||
@@ -49,8 +49,6 @@ struct fence_cb; | |||
49 | * @timestamp: Timestamp when the fence was signaled. | 49 | * @timestamp: Timestamp when the fence was signaled. |
50 | * @status: Optional, only valid if < 0, must be set before calling | 50 | * @status: Optional, only valid if < 0, must be set before calling |
51 | * fence_signal, indicates that the fence has completed with an error. | 51 | * fence_signal, indicates that the fence has completed with an error. |
52 | * @child_list: list of children fences | ||
53 | * @active_list: list of active fences | ||
54 | * | 52 | * |
55 | * the flags member must be manipulated and read using the appropriate | 53 | * the flags member must be manipulated and read using the appropriate |
56 | * atomic ops (bit_*), so taking the spinlock will not be needed most | 54 | * atomic ops (bit_*), so taking the spinlock will not be needed most |
@@ -62,7 +60,7 @@ struct fence_cb; | |||
62 | * implementer of the fence for its own purposes. Can be used in different | 60 | * implementer of the fence for its own purposes. Can be used in different |
63 | * ways by different fence implementers, so do not rely on this. | 61 | * ways by different fence implementers, so do not rely on this. |
64 | * | 62 | * |
65 | * *) Since atomic bitops are used, this is not guaranteed to be the case. | 63 | * Since atomic bitops are used, this is not guaranteed to be the case. |
66 | * Particularly, if the bit was set, but fence_signal was called right | 64 | * Particularly, if the bit was set, but fence_signal was called right |
67 | * before this bit was set, it would have been able to set the | 65 | * before this bit was set, it would have been able to set the |
68 | * FENCE_FLAG_SIGNALED_BIT, before enable_signaling was called. | 66 | * FENCE_FLAG_SIGNALED_BIT, before enable_signaling was called. |
diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h index c6ffe8b0725c..aa17ccfc2f57 100644 --- a/include/linux/sync_file.h +++ b/include/linux/sync_file.h | |||
@@ -19,12 +19,7 @@ | |||
19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
20 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
21 | #include <linux/fence.h> | 21 | #include <linux/fence.h> |
22 | 22 | #include <linux/fence-array.h> | |
23 | struct sync_file_cb { | ||
24 | struct fence_cb cb; | ||
25 | struct fence *fence; | ||
26 | struct sync_file *sync_file; | ||
27 | }; | ||
28 | 23 | ||
29 | /** | 24 | /** |
30 | * struct sync_file - sync file to export to the userspace | 25 | * struct sync_file - sync file to export to the userspace |
@@ -32,10 +27,9 @@ struct sync_file_cb { | |||
32 | * @kref: reference count on fence. | 27 | * @kref: reference count on fence. |
33 | * @name: name of sync_file. Useful for debugging | 28 | * @name: name of sync_file. Useful for debugging |
34 | * @sync_file_list: membership in global file list | 29 | * @sync_file_list: membership in global file list |
35 | * @num_fences: number of sync_pts in the fence | ||
36 | * @wq: wait queue for fence signaling | 30 | * @wq: wait queue for fence signaling |
37 | * @status: 0: signaled, >0:active, <0: error | 31 | * @fence: fence with the fences in the sync_file |
38 | * @cbs: sync_pts callback information | 32 | * @cb: fence callback information |
39 | */ | 33 | */ |
40 | struct sync_file { | 34 | struct sync_file { |
41 | struct file *file; | 35 | struct file *file; |
@@ -44,14 +38,16 @@ struct sync_file { | |||
44 | #ifdef CONFIG_DEBUG_FS | 38 | #ifdef CONFIG_DEBUG_FS |
45 | struct list_head sync_file_list; | 39 | struct list_head sync_file_list; |
46 | #endif | 40 | #endif |
47 | int num_fences; | ||
48 | 41 | ||
49 | wait_queue_head_t wq; | 42 | wait_queue_head_t wq; |
50 | atomic_t status; | ||
51 | 43 | ||
52 | struct sync_file_cb cbs[]; | 44 | struct fence *fence; |
45 | struct fence_cb cb; | ||
53 | }; | 46 | }; |
54 | 47 | ||
48 | #define POLL_ENABLED FENCE_FLAG_USER_BITS | ||
49 | |||
55 | struct sync_file *sync_file_create(struct fence *fence); | 50 | struct sync_file *sync_file_create(struct fence *fence); |
51 | struct fence *sync_file_get_fence(int fd); | ||
56 | 52 | ||
57 | #endif /* _LINUX_SYNC_H */ | 53 | #endif /* _LINUX_SYNC_H */ |