CHROMIUM: drm/exynos: Remove vaddr from drm_overlay
[cascardo/linux.git] / drivers / gpu / drm / exynos / exynos_drm_crtc.c
1 /* exynos_drm_crtc.c
2  *
3  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4  * Authors:
5  *      Inki Dae <inki.dae@samsung.com>
6  *      Joonyoung Shim <jy0922.shim@samsung.com>
7  *      Seung-Woo Kim <sw0312.kim@samsung.com>
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice (including the next
17  * paragraph) shall be included in all copies or substantial portions of the
18  * Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  */
28
29 #include "drmP.h"
30 #include "drm_crtc_helper.h"
31
32 #include "exynos_drm_crtc.h"
33 #include "exynos_drm_drv.h"
34 #include "exynos_drm_fb.h"
35 #include "exynos_drm_encoder.h"
36 #include "exynos_drm_gem.h"
37 #include "exynos_trace.h"
38
39 static void exynos_drm_crtc_apply(struct drm_crtc *crtc)
40 {
41         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
42         struct exynos_drm_overlay *overlay = &exynos_crtc->overlay;
43
44         exynos_drm_fn_encoder(crtc, overlay,
45                         exynos_drm_encoder_crtc_mode_set);
46         exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe,
47                         exynos_drm_encoder_crtc_commit);
48 }
49
50 void exynos_drm_overlay_update(struct exynos_drm_overlay *overlay,
51                                struct drm_framebuffer *fb,
52                                struct drm_display_mode *mode,
53                                struct exynos_drm_crtc_pos *pos)
54 {
55         struct exynos_drm_gem_buf *buffer;
56         unsigned int actual_w;
57         unsigned int actual_h;
58         int nr = exynos_drm_format_num_buffers(fb->pixel_format);
59         int i;
60
61         for (i = 0; i < nr; i++) {
62                 buffer = exynos_drm_fb_buffer(fb, i);
63
64                 overlay->dma_addr[i] = buffer->dma_addr;
65
66                 DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n",
67                                 i, (unsigned long)overlay->dma_addr[i]);
68         }
69
70         actual_w = min((mode->hdisplay - pos->crtc_x), pos->crtc_w);
71         actual_h = min((mode->vdisplay - pos->crtc_y), pos->crtc_h);
72
73         /* set drm framebuffer data. */
74         overlay->fb_x = pos->fb_x;
75         overlay->fb_y = pos->fb_y;
76         overlay->fb_width = min(pos->fb_w, actual_w);
77         overlay->fb_height = min(pos->fb_h, actual_h);
78         overlay->fb_pitch = fb->pitches[0];
79         overlay->bpp = fb->bits_per_pixel;
80         overlay->pixel_format = fb->pixel_format;
81
82         /* set overlay range to be displayed. */
83         overlay->crtc_x = pos->crtc_x;
84         overlay->crtc_y = pos->crtc_y;
85         overlay->crtc_width = actual_w;
86         overlay->crtc_height = actual_h;
87         overlay->crtc_htotal = mode->crtc_htotal;
88         overlay->crtc_hsync_len = mode->hsync_end - mode->hsync_start;
89         overlay->crtc_vtotal = mode->crtc_vtotal;
90         overlay->crtc_vsync_len = mode->vsync_end - mode->vsync_start;
91
92         /* set drm mode data. */
93         overlay->mode_width = mode->hdisplay;
94         overlay->mode_height = mode->vdisplay;
95         overlay->refresh = mode->vrefresh;
96         overlay->scan_flag = mode->flags;
97
98         DRM_DEBUG_KMS("overlay : offset_x/y(%d,%d), width/height(%d,%d)",
99                         overlay->crtc_x, overlay->crtc_y,
100                         overlay->crtc_width, overlay->crtc_height);
101 }
102
103 static void exynos_drm_crtc_update(struct drm_crtc *crtc,
104                                    struct drm_framebuffer *fb)
105 {
106         struct exynos_drm_crtc *exynos_crtc;
107         struct exynos_drm_overlay *overlay;
108         struct exynos_drm_crtc_pos pos;
109         struct drm_display_mode *mode = &crtc->mode;
110
111         exynos_crtc = to_exynos_crtc(crtc);
112         overlay = &exynos_crtc->overlay;
113
114         memset(&pos, 0, sizeof(struct exynos_drm_crtc_pos));
115
116         /* it means the offset of framebuffer to be displayed. */
117         pos.fb_x = crtc->x;
118         pos.fb_y = crtc->y;
119         pos.fb_w = fb->width;
120         pos.fb_h = fb->height;
121
122         /* OSD position to be displayed. */
123         pos.crtc_x = 0;
124         pos.crtc_y = 0;
125         pos.crtc_w = fb->width - crtc->x;
126         pos.crtc_h = fb->height - crtc->y;
127
128         exynos_drm_overlay_update(overlay, fb, mode, &pos);
129 }
130
131 static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
132 {
133         struct drm_device *dev = crtc->dev;
134         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
135
136         DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
137
138         if (exynos_crtc->dpms == mode) {
139                 DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
140                 return;
141         }
142
143         mutex_lock(&dev->struct_mutex);
144
145         switch (mode) {
146         case DRM_MODE_DPMS_ON:
147                 exynos_drm_fn_encoder(crtc, &mode,
148                                 exynos_drm_encoder_crtc_dpms);
149                 exynos_crtc->dpms = mode;
150                 break;
151         case DRM_MODE_DPMS_STANDBY:
152         case DRM_MODE_DPMS_SUSPEND:
153         case DRM_MODE_DPMS_OFF:
154                 exynos_drm_fn_encoder(crtc, &mode,
155                                 exynos_drm_encoder_crtc_dpms);
156                 exynos_crtc->dpms = mode;
157                 break;
158         default:
159                 DRM_ERROR("unspecified mode %d\n", mode);
160                 break;
161         }
162
163         mutex_unlock(&dev->struct_mutex);
164 }
165
166 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
167 {
168         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
169         struct exynos_drm_overlay *overlay = &exynos_crtc->overlay;
170         int win = overlay->zpos;
171
172         exynos_drm_fn_encoder(crtc, &win,
173                 exynos_drm_encoder_crtc_disable);
174 }
175
176 static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
177 {
178         DRM_DEBUG_KMS("%s\n", __FILE__);
179
180         /* drm framework doesn't check NULL. */
181 }
182
183 static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
184                                      struct drm_framebuffer *fb,
185                                      struct drm_pending_vblank_event *event);
186
187 static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
188 {
189         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
190         int ret;
191
192         DRM_DEBUG_KMS("%s\n", __FILE__);
193
194         /*
195          * when set_crtc is requested from user or at booting time,
196          * crtc->commit would be called without dpms call so if dpms is
197          * no power on then crtc->dpms should be called
198          * with DRM_MODE_DPMS_ON for the hardware power to be on.
199          */
200         if (exynos_crtc->dpms != DRM_MODE_DPMS_ON) {
201                 int mode = DRM_MODE_DPMS_ON;
202
203                 /*
204                  * TODO(seanpaul): This has the nasty habit of calling the
205                  * underlying dpms/power callbacks twice on boot. This code
206                  * needs to be cleaned up so this doesn't happen.
207                  */
208
209                 /*
210                  * enable hardware(power on) to all encoders hdmi connected
211                  * to current crtc.
212                  */
213                 exynos_drm_crtc_dpms(crtc, mode);
214                 /*
215                  * enable dma to all encoders connected to current crtc and
216                  * lcd panel.
217                  */
218                 exynos_drm_fn_encoder(crtc, &mode,
219                                         exynos_drm_encoder_dpms_from_crtc);
220         }
221
222         ret = exynos_drm_crtc_page_flip(crtc, crtc->fb, NULL);
223         if (ret)
224                 DRM_ERROR("page_flip failed\n");
225 }
226
227 static bool
228 exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
229                             struct drm_display_mode *mode,
230                             struct drm_display_mode *adjusted_mode)
231 {
232         DRM_DEBUG_KMS("%s\n", __FILE__);
233
234         /* drm framework doesn't check NULL */
235         return true;
236 }
237
238 static int
239 exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
240                           struct drm_display_mode *adjusted_mode, int x, int y,
241                           struct drm_framebuffer *old_fb)
242 {
243         struct exynos_drm_private *dev_priv = crtc->dev->dev_private;
244         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
245         struct drm_framebuffer *fb = crtc->fb;
246         int ret;
247
248         DRM_DEBUG_KMS("%s\n", __FILE__);
249
250         if (!fb)
251                 return -EINVAL;
252
253         /*
254          * copy the mode data adjusted by mode_fixup() into crtc->mode
255          * so that hardware can be seet to proper mode.
256          */
257         memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode));
258
259         /* We should never timeout here. */
260         ret = wait_event_timeout(dev_priv->wait_vsync_queue,
261                                  !exynos_crtc->flip_in_flight,
262                                  DRM_HZ/20);
263         if (!ret)
264                 DRM_ERROR("Timed out waiting for flips to complete\n");
265
266         exynos_drm_crtc_update(crtc, fb);
267
268         return 0;
269 }
270
271 static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
272                                           struct drm_framebuffer *old_fb)
273 {
274         struct exynos_drm_private *dev_priv = crtc->dev->dev_private;
275         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
276         struct drm_framebuffer *fb = crtc->fb;
277         int ret;
278
279         DRM_DEBUG_KMS("%s\n", __FILE__);
280
281         if (!fb)
282                 return -EINVAL;
283
284         /* We should never timeout here. */
285         ret = wait_event_timeout(dev_priv->wait_vsync_queue,
286                                  !exynos_crtc->flip_in_flight,
287                                  DRM_HZ/20);
288         if (!ret)
289                 DRM_ERROR("Timed out waiting for flips to complete\n");
290
291
292         ret = exynos_drm_crtc_page_flip(crtc, fb, NULL);
293         if (ret)
294                 DRM_ERROR("page_flip failed\n");
295
296         return ret;
297 }
298
299 static void exynos_drm_crtc_load_lut(struct drm_crtc *crtc)
300 {
301         DRM_DEBUG_KMS("%s\n", __FILE__);
302         /* drm framework doesn't check NULL */
303 }
304
305 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
306         .dpms           = exynos_drm_crtc_dpms,
307         .disable        = exynos_drm_crtc_disable,
308         .prepare        = exynos_drm_crtc_prepare,
309         .commit         = exynos_drm_crtc_commit,
310         .mode_fixup     = exynos_drm_crtc_mode_fixup,
311         .mode_set       = exynos_drm_crtc_mode_set,
312         .mode_set_base  = exynos_drm_crtc_mode_set_base,
313         .load_lut       = exynos_drm_crtc_load_lut,
314 };
315
316 #ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
317 void exynos_drm_kds_callback(void *callback_parameter, void *callback_extra_parameter)
318 {
319         struct drm_framebuffer *fb = callback_parameter;
320         struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
321         struct drm_crtc *crtc =  exynos_fb->crtc;
322         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
323         struct drm_device *dev = crtc->dev;
324         struct kds_resource_set **pkds = callback_extra_parameter;
325         struct kds_resource_set *prev_kds;
326         struct drm_framebuffer *prev_fb;
327         unsigned long flags;
328
329         exynos_drm_crtc_update(crtc, fb);
330         exynos_drm_crtc_apply(crtc);
331
332         spin_lock_irqsave(&dev->event_lock, flags);
333         prev_kds = exynos_crtc->pending_kds;
334         prev_fb = exynos_crtc->pending_fb;
335         exynos_crtc->pending_kds = *pkds;
336         exynos_crtc->pending_fb = fb;
337         *pkds = NULL;
338         if (prev_fb)
339                 exynos_crtc->flip_in_flight--;
340         spin_unlock_irqrestore(&dev->event_lock, flags);
341
342         if (prev_fb) {
343                 DRM_ERROR("previous work detected\n");
344                 exynos_drm_fb_put(to_exynos_fb(prev_fb));
345                 if (prev_kds)
346                         kds_resource_set_release(&prev_kds);
347         } else {
348                 BUG_ON(atomic_read(&exynos_crtc->flip_pending));
349                 BUG_ON(prev_kds);
350                 atomic_set(&exynos_crtc->flip_pending, 1);
351         }
352 }
353 #endif
354
355 static void exynos_drm_crtc_flip_complete(struct drm_pending_vblank_event *e)
356 {
357         struct timeval now;
358
359         do_gettimeofday(&now);
360         e->event.sequence = 0;
361         e->event.tv_sec = now.tv_sec;
362         e->event.tv_usec = now.tv_usec;
363         list_add_tail(&e->base.link, &e->base.file_priv->event_list);
364         wake_up_interruptible(&e->base.file_priv->event_wait);
365         trace_exynos_fake_flip_complete(e->pipe);
366 }
367
368 static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
369                                      struct drm_framebuffer *fb,
370                                      struct drm_pending_vblank_event *event)
371 {
372         struct drm_device *dev = crtc->dev;
373         struct exynos_drm_private *dev_priv = dev->dev_private;
374         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
375         unsigned long flags;
376         int ret;
377 #ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
378         struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
379         struct exynos_drm_gem_obj *gem_ob = (struct exynos_drm_gem_obj *)exynos_fb->exynos_gem_obj[0];
380         struct kds_resource_set **pkds;
381         struct drm_pending_vblank_event *event_to_send;
382 #endif
383         DRM_DEBUG_KMS("%s\n", __FILE__);
384
385         /*
386          * the pipe from user always is 0 so we can set pipe number
387          * of current owner to event.
388          */
389         if (event)
390                 event->pipe = exynos_crtc->pipe;
391
392         ret = drm_vblank_get(dev, exynos_crtc->pipe);
393         if (ret) {
394                 DRM_ERROR("Unable to get vblank\n");
395                 return -EINVAL;
396         }
397
398 #ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
399         spin_lock_irqsave(&dev->event_lock, flags);
400         if (exynos_crtc->flip_in_flight > 1) {
401                 spin_unlock_irqrestore(&dev->event_lock, flags);
402                 DRM_DEBUG_DRIVER("flip queue: crtc already busy\n");
403                 ret = -EBUSY;
404                 goto fail_max_in_flight;
405         }
406         /* Signal previous flip event. Or if none in flight signal current. */
407         if (exynos_crtc->flip_in_flight) {
408                 event_to_send = exynos_crtc->event;
409                 exynos_crtc->event = event;
410         } else {
411                 event_to_send = event;
412                 exynos_crtc->event = NULL;
413         }
414         pkds = &exynos_crtc->future_kds;
415         if (*pkds)
416                 pkds = &exynos_crtc->future_kds_extra;
417         *pkds = ERR_PTR(-EINVAL); /* Make it non-NULL */
418         exynos_crtc->flip_in_flight++;
419         spin_unlock_irqrestore(&dev->event_lock, flags);
420 #endif
421
422         mutex_lock(&dev->struct_mutex);
423
424         crtc->fb = fb;
425
426         mutex_unlock(&dev->struct_mutex);
427
428 #ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
429         exynos_fb->crtc = crtc;
430         if (gem_ob->base.export_dma_buf) {
431                 struct dma_buf *buf = gem_ob->base.export_dma_buf;
432                 unsigned long shared = 0UL;
433                 struct kds_resource *res_list = get_dma_buf_kds_resource(buf);
434
435                 /*
436                  * If we don't already have a reference to the dma_buf,
437                  * grab one now. We'll release it in exynos_drm_fb_destory().
438                  */
439                 if (!exynos_fb->dma_buf) {
440                         get_dma_buf(buf);
441                         exynos_fb->dma_buf = buf;
442                 }
443                 BUG_ON(exynos_fb->dma_buf !=  buf);
444
445                 /* Waiting for the KDS resource*/
446                 ret = kds_async_waitall(pkds, KDS_FLAG_LOCKED_WAIT,
447                                         &dev_priv->kds_cb, fb, pkds, 1,
448                                         &shared, &res_list);
449                 if (ret) {
450                         DRM_ERROR("kds_async_waitall failed: %d\n", ret);
451                         goto fail_kds;
452                 }
453         } else {
454                 /*
455                  * For normal page-flip (i.e. non-modeset) we should
456                  * never be flipping a non-kds buffer.
457                  */
458                 if (event)
459                         DRM_ERROR("flipping a non-kds buffer\n");
460                 *pkds = NULL;
461                 exynos_drm_kds_callback(fb, pkds);
462         }
463
464         if (event_to_send) {
465                 spin_lock_irqsave(&dev->event_lock, flags);
466                 exynos_drm_crtc_flip_complete(event_to_send);
467                 spin_unlock_irqrestore(&dev->event_lock, flags);
468         }
469 #endif
470
471         exynos_drm_fb_get(exynos_fb);
472
473         trace_exynos_flip_request(exynos_crtc->pipe);
474
475         return 0;
476
477 fail_kds:
478         *pkds = NULL;
479         spin_lock_irqsave(&dev->event_lock, flags);
480         exynos_crtc->flip_in_flight--;
481         spin_unlock_irqrestore(&dev->event_lock, flags);
482 fail_max_in_flight:
483         drm_vblank_put(dev, exynos_crtc->pipe);
484         return ret;
485 }
486
487 void exynos_drm_crtc_finish_pageflip(struct drm_device *drm_dev, int crtc_idx)
488 {
489         struct exynos_drm_private *dev_priv = drm_dev->dev_private;
490         struct drm_crtc *crtc = dev_priv->crtc[crtc_idx];
491         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
492         struct kds_resource_set *kds;
493         struct drm_framebuffer *fb;
494         unsigned long flags;
495
496         /* set wait vsync wake up queue. */
497         DRM_WAKEUP(&dev_priv->wait_vsync_queue);
498
499         if (!atomic_cmpxchg(&exynos_crtc->flip_pending, 1, 0))
500                 return;
501
502         trace_exynos_flip_complete(crtc_idx);
503
504         spin_lock_irqsave(&drm_dev->event_lock, flags);
505         if (exynos_crtc->event) {
506                 exynos_drm_crtc_flip_complete(exynos_crtc->event);
507                 exynos_crtc->event = NULL;
508         }
509         kds = exynos_crtc->current_kds;
510         exynos_crtc->current_kds = exynos_crtc->pending_kds;
511         exynos_crtc->pending_kds = NULL;
512         fb = exynos_crtc->current_fb;
513         exynos_crtc->current_fb = exynos_crtc->pending_fb;
514         exynos_crtc->pending_fb = NULL;
515         exynos_crtc->flip_in_flight--;
516         spin_unlock_irqrestore(&drm_dev->event_lock, flags);
517
518         if (fb)
519                 exynos_drm_fb_put(to_exynos_fb(fb));
520         if (kds)
521                 kds_resource_set_release(&kds);
522
523         drm_vblank_put(drm_dev, crtc_idx);
524 }
525
526 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
527 {
528         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
529         struct exynos_drm_private *private = crtc->dev->dev_private;
530
531         DRM_DEBUG_KMS("%s\n", __FILE__);
532
533         private->crtc[exynos_crtc->pipe] = NULL;
534
535         drm_crtc_cleanup(crtc);
536         kfree(exynos_crtc);
537 }
538
539 static struct drm_crtc_funcs exynos_crtc_funcs = {
540         .set_config     = drm_crtc_helper_set_config,
541         .page_flip      = exynos_drm_crtc_page_flip,
542         .destroy        = exynos_drm_crtc_destroy,
543 };
544
545 struct exynos_drm_overlay *get_exynos_drm_overlay(struct drm_device *dev,
546                 struct drm_crtc *crtc)
547 {
548         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
549
550         return &exynos_crtc->overlay;
551 }
552
553 int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)
554 {
555         struct exynos_drm_crtc *exynos_crtc;
556         struct exynos_drm_private *private = dev->dev_private;
557         struct drm_crtc *crtc;
558
559         DRM_DEBUG_KMS("%s\n", __FILE__);
560
561         exynos_crtc = kzalloc(sizeof(*exynos_crtc), GFP_KERNEL);
562         if (!exynos_crtc) {
563                 DRM_ERROR("failed to allocate exynos crtc\n");
564                 return -ENOMEM;
565         }
566
567         exynos_crtc->pipe = nr;
568         exynos_crtc->dpms = DRM_MODE_DPMS_OFF;
569         exynos_crtc->overlay.zpos = DEFAULT_ZPOS;
570         crtc = &exynos_crtc->drm_crtc;
571
572         private->crtc[nr] = crtc;
573
574         drm_crtc_init(dev, crtc, &exynos_crtc_funcs);
575         drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs);
576
577         return 0;
578 }
579
580 int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc)
581 {
582         struct exynos_drm_private *private = dev->dev_private;
583         struct exynos_drm_crtc *exynos_crtc =
584                 to_exynos_crtc(private->crtc[crtc]);
585
586         DRM_DEBUG_KMS("%s\n", __FILE__);
587
588         if (exynos_crtc->dpms != DRM_MODE_DPMS_ON)
589                 return -EPERM;
590
591         exynos_drm_fn_encoder(private->crtc[crtc], &crtc,
592                         exynos_drm_enable_vblank);
593
594         return 0;
595 }
596
597 void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc)
598 {
599         struct exynos_drm_private *private = dev->dev_private;
600         struct exynos_drm_crtc *exynos_crtc =
601                 to_exynos_crtc(private->crtc[crtc]);
602
603         DRM_DEBUG_KMS("%s\n", __FILE__);
604
605         if (exynos_crtc->dpms != DRM_MODE_DPMS_ON)
606                 return;
607
608         exynos_drm_fn_encoder(private->crtc[crtc], &crtc,
609                         exynos_drm_disable_vblank);
610 }