Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 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 | * |
Inki Dae | d81aecb | 2012-12-18 02:30:17 +0900 | [diff] [blame] | 9 | * This program is free software; you can redistribute it and/or modify it |
| 10 | * under the terms of the GNU General Public License as published by the |
| 11 | * Free Software Foundation; either version 2 of the License, or (at your |
| 12 | * option) any later version. |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 13 | */ |
| 14 | |
David Howells | 760285e | 2012-10-02 18:01:07 +0100 | [diff] [blame] | 15 | #include <drm/drmP.h> |
| 16 | #include <drm/drm_crtc_helper.h> |
Gustavo Padovan | 4ea9526 | 2015-06-01 12:04:44 -0300 | [diff] [blame] | 17 | #include <drm/drm_atomic.h> |
| 18 | #include <drm/drm_atomic_helper.h> |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 19 | |
Mark Brown | e30655d | 2013-08-13 00:46:40 +0100 | [diff] [blame] | 20 | #include "exynos_drm_crtc.h" |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 21 | #include "exynos_drm_drv.h" |
Joonyoung Shim | b5d2eb3 | 2012-06-27 14:27:04 +0900 | [diff] [blame] | 22 | #include "exynos_drm_plane.h" |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 23 | |
Gustavo Padovan | 63498e3 | 2015-06-01 12:04:53 -0300 | [diff] [blame] | 24 | static void exynos_drm_crtc_enable(struct drm_crtc *crtc) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 25 | { |
Joonyoung Shim | d2716c8 | 2011-11-04 17:04:45 +0900 | [diff] [blame] | 26 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 27 | |
Gustavo Padovan | 3cecda0 | 2015-06-01 12:04:55 -0300 | [diff] [blame] | 28 | if (exynos_crtc->ops->enable) |
| 29 | exynos_crtc->ops->enable(exynos_crtc); |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 30 | |
Gustavo Padovan | 63498e3 | 2015-06-01 12:04:53 -0300 | [diff] [blame] | 31 | drm_crtc_vblank_on(crtc); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 32 | } |
| 33 | |
Gustavo Padovan | 3fc4867 | 2015-06-01 12:04:51 -0300 | [diff] [blame] | 34 | static void exynos_drm_crtc_disable(struct drm_crtc *crtc) |
| 35 | { |
Gustavo Padovan | 63498e3 | 2015-06-01 12:04:53 -0300 | [diff] [blame] | 36 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
Gustavo Padovan | 3fc4867 | 2015-06-01 12:04:51 -0300 | [diff] [blame] | 37 | |
Gustavo Padovan | 63498e3 | 2015-06-01 12:04:53 -0300 | [diff] [blame] | 38 | /* wait for the completion of page flip. */ |
| 39 | if (!wait_event_timeout(exynos_crtc->pending_flip_queue, |
| 40 | (exynos_crtc->event == NULL), HZ/20)) |
| 41 | exynos_crtc->event = NULL; |
| 42 | |
| 43 | drm_crtc_vblank_off(crtc); |
| 44 | |
Gustavo Padovan | 3cecda0 | 2015-06-01 12:04:55 -0300 | [diff] [blame] | 45 | if (exynos_crtc->ops->disable) |
| 46 | exynos_crtc->ops->disable(exynos_crtc); |
Gustavo Padovan | 3fc4867 | 2015-06-01 12:04:51 -0300 | [diff] [blame] | 47 | } |
| 48 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 49 | static bool |
| 50 | exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc, |
Laurent Pinchart | e811f5a | 2012-07-17 17:56:50 +0200 | [diff] [blame] | 51 | const struct drm_display_mode *mode, |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 52 | struct drm_display_mode *adjusted_mode) |
| 53 | { |
Sean Paul | 4b40526 | 2014-01-30 16:19:19 -0500 | [diff] [blame] | 54 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
Sean Paul | 4b40526 | 2014-01-30 16:19:19 -0500 | [diff] [blame] | 55 | |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 56 | if (exynos_crtc->ops->mode_fixup) |
| 57 | return exynos_crtc->ops->mode_fixup(exynos_crtc, mode, |
| 58 | adjusted_mode); |
Sean Paul | 4b40526 | 2014-01-30 16:19:19 -0500 | [diff] [blame] | 59 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 60 | return true; |
| 61 | } |
| 62 | |
Gustavo Padovan | 199329c | 2015-06-01 12:04:43 -0300 | [diff] [blame] | 63 | static void |
| 64 | exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 65 | { |
Joonyoung Shim | 4070d21 | 2012-06-27 14:27:05 +0900 | [diff] [blame] | 66 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 67 | |
Gustavo Padovan | 199329c | 2015-06-01 12:04:43 -0300 | [diff] [blame] | 68 | if (exynos_crtc->ops->commit) |
| 69 | exynos_crtc->ops->commit(exynos_crtc); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 70 | } |
| 71 | |
Maarten Lankhorst | 613d2b2 | 2015-07-21 13:28:58 +0200 | [diff] [blame] | 72 | static void exynos_crtc_atomic_begin(struct drm_crtc *crtc, |
| 73 | struct drm_crtc_state *old_crtc_state) |
Gustavo Padovan | 9d5ab6a | 2015-06-01 12:04:48 -0300 | [diff] [blame] | 74 | { |
| 75 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
Gustavo Padovan | d9220d4 | 2015-08-24 20:36:59 +0900 | [diff] [blame] | 76 | struct drm_plane *plane; |
Gustavo Padovan | 9d5ab6a | 2015-06-01 12:04:48 -0300 | [diff] [blame] | 77 | |
Gustavo Padovan | c453366 | 2015-08-15 13:26:18 -0300 | [diff] [blame^] | 78 | exynos_crtc->event = crtc->state->event; |
Gustavo Padovan | d9220d4 | 2015-08-24 20:36:59 +0900 | [diff] [blame] | 79 | |
| 80 | drm_atomic_crtc_for_each_plane(plane, crtc) { |
| 81 | struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); |
| 82 | |
| 83 | if (exynos_crtc->ops->atomic_begin) |
| 84 | exynos_crtc->ops->atomic_begin(exynos_crtc, |
| 85 | exynos_plane); |
| 86 | } |
Gustavo Padovan | 9d5ab6a | 2015-06-01 12:04:48 -0300 | [diff] [blame] | 87 | } |
| 88 | |
Maarten Lankhorst | 613d2b2 | 2015-07-21 13:28:58 +0200 | [diff] [blame] | 89 | static void exynos_crtc_atomic_flush(struct drm_crtc *crtc, |
| 90 | struct drm_crtc_state *old_crtc_state) |
Gustavo Padovan | 9d5ab6a | 2015-06-01 12:04:48 -0300 | [diff] [blame] | 91 | { |
Gustavo Padovan | d9220d4 | 2015-08-24 20:36:59 +0900 | [diff] [blame] | 92 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
| 93 | struct drm_plane *plane; |
| 94 | |
| 95 | drm_atomic_crtc_for_each_plane(plane, crtc) { |
| 96 | struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); |
| 97 | |
| 98 | if (exynos_crtc->ops->atomic_flush) |
| 99 | exynos_crtc->ops->atomic_flush(exynos_crtc, |
| 100 | exynos_plane); |
| 101 | } |
Gustavo Padovan | 9d5ab6a | 2015-06-01 12:04:48 -0300 | [diff] [blame] | 102 | } |
| 103 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 104 | static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { |
Gustavo Padovan | 63498e3 | 2015-06-01 12:04:53 -0300 | [diff] [blame] | 105 | .enable = exynos_drm_crtc_enable, |
Gustavo Padovan | 3fc4867 | 2015-06-01 12:04:51 -0300 | [diff] [blame] | 106 | .disable = exynos_drm_crtc_disable, |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 107 | .mode_fixup = exynos_drm_crtc_mode_fixup, |
Gustavo Padovan | 199329c | 2015-06-01 12:04:43 -0300 | [diff] [blame] | 108 | .mode_set_nofb = exynos_drm_crtc_mode_set_nofb, |
Gustavo Padovan | 9d5ab6a | 2015-06-01 12:04:48 -0300 | [diff] [blame] | 109 | .atomic_begin = exynos_crtc_atomic_begin, |
| 110 | .atomic_flush = exynos_crtc_atomic_flush, |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 111 | }; |
| 112 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 113 | static void exynos_drm_crtc_destroy(struct drm_crtc *crtc) |
| 114 | { |
| 115 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
| 116 | struct exynos_drm_private *private = crtc->dev->dev_private; |
| 117 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 118 | private->crtc[exynos_crtc->pipe] = NULL; |
| 119 | |
| 120 | drm_crtc_cleanup(crtc); |
| 121 | kfree(exynos_crtc); |
| 122 | } |
| 123 | |
| 124 | static struct drm_crtc_funcs exynos_crtc_funcs = { |
Gustavo Padovan | 47a7def | 2015-06-01 12:04:47 -0300 | [diff] [blame] | 125 | .set_config = drm_atomic_helper_set_config, |
Gustavo Padovan | 9d5ab6a | 2015-06-01 12:04:48 -0300 | [diff] [blame] | 126 | .page_flip = drm_atomic_helper_page_flip, |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 127 | .destroy = exynos_drm_crtc_destroy, |
Gustavo Padovan | 4ea9526 | 2015-06-01 12:04:44 -0300 | [diff] [blame] | 128 | .reset = drm_atomic_helper_crtc_reset, |
| 129 | .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, |
| 130 | .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 131 | }; |
| 132 | |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 133 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, |
Krzysztof Kozlowski | f3aaf76 | 2015-05-07 09:04:45 +0900 | [diff] [blame] | 134 | struct drm_plane *plane, |
| 135 | int pipe, |
| 136 | enum exynos_drm_output_type type, |
| 137 | const struct exynos_drm_crtc_ops *ops, |
| 138 | void *ctx) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 139 | { |
| 140 | struct exynos_drm_crtc *exynos_crtc; |
Gustavo Padovan | eb88e42 | 2014-11-26 16:43:27 -0200 | [diff] [blame] | 141 | struct exynos_drm_private *private = drm_dev->dev_private; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 142 | struct drm_crtc *crtc; |
Andrzej Hajda | 72ed6cc | 2014-09-19 14:58:53 +0200 | [diff] [blame] | 143 | int ret; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 144 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 145 | exynos_crtc = kzalloc(sizeof(*exynos_crtc), GFP_KERNEL); |
Sachin Kamat | 38bb525 | 2013-08-19 19:04:55 +0900 | [diff] [blame] | 146 | if (!exynos_crtc) |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 147 | return ERR_PTR(-ENOMEM); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 148 | |
Inki Dae | 20cd264 | 2013-05-21 16:55:58 +0900 | [diff] [blame] | 149 | init_waitqueue_head(&exynos_crtc->pending_flip_queue); |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 150 | |
Gustavo Padovan | e09f2b0 | 2014-11-04 18:25:27 -0200 | [diff] [blame] | 151 | exynos_crtc->pipe = pipe; |
Gustavo Padovan | 5d1741a | 2014-11-05 19:51:35 -0200 | [diff] [blame] | 152 | exynos_crtc->type = type; |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 153 | exynos_crtc->ops = ops; |
| 154 | exynos_crtc->ctx = ctx; |
Joonyoung Shim | b5d2eb3 | 2012-06-27 14:27:04 +0900 | [diff] [blame] | 155 | |
Gustavo Padovan | c453366 | 2015-08-15 13:26:18 -0300 | [diff] [blame^] | 156 | init_waitqueue_head(&exynos_crtc->wait_update); |
| 157 | |
Gustavo Padovan | 357193c | 2014-11-03 18:20:29 -0200 | [diff] [blame] | 158 | crtc = &exynos_crtc->base; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 159 | |
Gustavo Padovan | e09f2b0 | 2014-11-04 18:25:27 -0200 | [diff] [blame] | 160 | private->crtc[pipe] = crtc; |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 161 | |
Gustavo Padovan | eb88e42 | 2014-11-26 16:43:27 -0200 | [diff] [blame] | 162 | ret = drm_crtc_init_with_planes(drm_dev, crtc, plane, NULL, |
Andrzej Hajda | 72ed6cc | 2014-09-19 14:58:53 +0200 | [diff] [blame] | 163 | &exynos_crtc_funcs); |
| 164 | if (ret < 0) |
| 165 | goto err_crtc; |
| 166 | |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 167 | drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs); |
| 168 | |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 169 | return exynos_crtc; |
Andrzej Hajda | 72ed6cc | 2014-09-19 14:58:53 +0200 | [diff] [blame] | 170 | |
| 171 | err_crtc: |
| 172 | plane->funcs->destroy(plane); |
Andrzej Hajda | 72ed6cc | 2014-09-19 14:58:53 +0200 | [diff] [blame] | 173 | kfree(exynos_crtc); |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 174 | return ERR_PTR(ret); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 175 | } |
| 176 | |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 177 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 178 | { |
| 179 | struct exynos_drm_private *private = dev->dev_private; |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 180 | struct exynos_drm_crtc *exynos_crtc = |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 181 | to_exynos_crtc(private->crtc[pipe]); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 182 | |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 183 | if (exynos_crtc->ops->enable_vblank) |
Gustavo Padovan | 08dd200 | 2015-07-16 12:23:39 -0300 | [diff] [blame] | 184 | return exynos_crtc->ops->enable_vblank(exynos_crtc); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 185 | |
| 186 | return 0; |
| 187 | } |
| 188 | |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 189 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe) |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 190 | { |
| 191 | struct exynos_drm_private *private = dev->dev_private; |
Inki Dae | ec05da9 | 2011-12-06 11:06:54 +0900 | [diff] [blame] | 192 | struct exynos_drm_crtc *exynos_crtc = |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 193 | to_exynos_crtc(private->crtc[pipe]); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 194 | |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 195 | if (exynos_crtc->ops->disable_vblank) |
| 196 | exynos_crtc->ops->disable_vblank(exynos_crtc); |
Inki Dae | 1c248b7 | 2011-10-04 19:19:01 +0900 | [diff] [blame] | 197 | } |
Rahul Sharma | 663d876 | 2013-01-03 05:44:04 -0500 | [diff] [blame] | 198 | |
Gustavo Padovan | c453366 | 2015-08-15 13:26:18 -0300 | [diff] [blame^] | 199 | void exynos_drm_crtc_wait_pending_update(struct exynos_drm_crtc *exynos_crtc) |
| 200 | { |
| 201 | wait_event_timeout(exynos_crtc->wait_update, |
| 202 | (atomic_read(&exynos_crtc->pending_update) == 0), |
| 203 | msecs_to_jiffies(50)); |
| 204 | } |
| 205 | |
Gustavo Padovan | 822f6df | 2015-08-15 13:26:14 -0300 | [diff] [blame] | 206 | void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc, |
| 207 | struct exynos_drm_plane *exynos_plane) |
Rahul Sharma | 663d876 | 2013-01-03 05:44:04 -0500 | [diff] [blame] | 208 | { |
Gustavo Padovan | eafd540 | 2015-07-16 12:23:32 -0300 | [diff] [blame] | 209 | struct drm_crtc *crtc = &exynos_crtc->base; |
Rahul Sharma | 663d876 | 2013-01-03 05:44:04 -0500 | [diff] [blame] | 210 | unsigned long flags; |
| 211 | |
Gustavo Padovan | 822f6df | 2015-08-15 13:26:14 -0300 | [diff] [blame] | 212 | exynos_plane->pending_fb = NULL; |
| 213 | |
Gustavo Padovan | c453366 | 2015-08-15 13:26:18 -0300 | [diff] [blame^] | 214 | if (atomic_dec_and_test(&exynos_crtc->pending_update)) |
| 215 | wake_up(&exynos_crtc->wait_update); |
| 216 | |
Gustavo Padovan | eafd540 | 2015-07-16 12:23:32 -0300 | [diff] [blame] | 217 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
Mandeep Singh Baines | e752747 | 2015-04-01 13:02:12 -0300 | [diff] [blame] | 218 | if (exynos_crtc->event) { |
Gustavo Padovan | eafd540 | 2015-07-16 12:23:32 -0300 | [diff] [blame] | 219 | drm_crtc_send_vblank_event(crtc, exynos_crtc->event); |
Inki Dae | 20cd264 | 2013-05-21 16:55:58 +0900 | [diff] [blame] | 220 | wake_up(&exynos_crtc->pending_flip_queue); |
Rahul Sharma | 663d876 | 2013-01-03 05:44:04 -0500 | [diff] [blame] | 221 | } |
| 222 | |
Mandeep Singh Baines | e752747 | 2015-04-01 13:02:12 -0300 | [diff] [blame] | 223 | exynos_crtc->event = NULL; |
Gustavo Padovan | eafd540 | 2015-07-16 12:23:32 -0300 | [diff] [blame] | 224 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
Rahul Sharma | 663d876 | 2013-01-03 05:44:04 -0500 | [diff] [blame] | 225 | } |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 226 | |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 227 | void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb) |
| 228 | { |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 229 | struct exynos_drm_crtc *exynos_crtc; |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 230 | struct drm_device *dev = fb->dev; |
| 231 | struct drm_crtc *crtc; |
| 232 | |
| 233 | /* |
| 234 | * make sure that overlay data are updated to real hardware |
| 235 | * for all encoders. |
| 236 | */ |
| 237 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 238 | exynos_crtc = to_exynos_crtc(crtc); |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 239 | |
| 240 | /* |
| 241 | * wait for vblank interrupt |
| 242 | * - this makes sure that overlay data are updated to |
| 243 | * real hardware. |
| 244 | */ |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 245 | if (exynos_crtc->ops->wait_for_vblank) |
| 246 | exynos_crtc->ops->wait_for_vblank(exynos_crtc); |
Sean Paul | 080be03d | 2014-02-19 21:02:55 +0900 | [diff] [blame] | 247 | } |
| 248 | } |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 249 | |
| 250 | int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev, |
Gustavo Padovan | cf67cc9 | 2015-08-11 17:38:06 +0900 | [diff] [blame] | 251 | enum exynos_drm_output_type out_type) |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 252 | { |
| 253 | struct drm_crtc *crtc; |
| 254 | |
| 255 | list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) { |
| 256 | struct exynos_drm_crtc *exynos_crtc; |
| 257 | |
| 258 | exynos_crtc = to_exynos_crtc(crtc); |
Gustavo Padovan | 5d1741a | 2014-11-05 19:51:35 -0200 | [diff] [blame] | 259 | if (exynos_crtc->type == out_type) |
Gustavo Padovan | 8a326ed | 2014-11-04 18:44:47 -0200 | [diff] [blame] | 260 | return exynos_crtc->pipe; |
Inki Dae | f37cd5e | 2014-05-09 14:25:20 +0900 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | return -EPERM; |
| 264 | } |
YoungJun Cho | 5595d4d | 2014-07-17 18:01:19 +0900 | [diff] [blame] | 265 | |
| 266 | void exynos_drm_crtc_te_handler(struct drm_crtc *crtc) |
| 267 | { |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 268 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
YoungJun Cho | 5595d4d | 2014-07-17 18:01:19 +0900 | [diff] [blame] | 269 | |
Gustavo Padovan | 93bca24 | 2015-01-18 18:16:23 +0900 | [diff] [blame] | 270 | if (exynos_crtc->ops->te_handler) |
| 271 | exynos_crtc->ops->te_handler(exynos_crtc); |
YoungJun Cho | 5595d4d | 2014-07-17 18:01:19 +0900 | [diff] [blame] | 272 | } |