36 #define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc,\
71 DRM_DEBUG_KMS(
"crtc[%d] mode[%d]\n", crtc->
base.id, mode);
73 if (exynos_crtc->
dpms == mode) {
74 DRM_DEBUG_KMS(
"desired dpms mode is same as previous one.\n");
82 static void exynos_drm_crtc_prepare(
struct drm_crtc *
crtc)
84 DRM_DEBUG_KMS(
"%s\n", __FILE__);
89 static void exynos_drm_crtc_commit(
struct drm_crtc *
crtc)
93 DRM_DEBUG_KMS(
"%s\n", __FILE__);
105 DRM_DEBUG_KMS(
"%s\n", __FILE__);
123 DRM_DEBUG_KMS(
"%s\n", __FILE__);
129 memcpy(&crtc->
mode, adjusted_mode,
sizeof(*adjusted_mode));
131 crtc_w = crtc->
fb->width -
x;
132 crtc_h = crtc->
fb->height -
y;
135 x, y, crtc_w, crtc_h);
140 plane->
fb = crtc->
fb;
147 static int exynos_drm_crtc_mode_set_base(
struct drm_crtc *crtc,
int x,
int y,
156 DRM_DEBUG_KMS(
"%s\n", __FILE__);
160 DRM_ERROR(
"failed framebuffer changing request.\n");
164 crtc_w = crtc->
fb->width -
x;
165 crtc_h = crtc->
fb->height -
y;
168 x, y, crtc_w, crtc_h);
172 exynos_drm_crtc_commit(crtc);
177 static void exynos_drm_crtc_load_lut(
struct drm_crtc *crtc)
179 DRM_DEBUG_KMS(
"%s\n", __FILE__);
183 static void exynos_drm_crtc_disable(
struct drm_crtc *crtc)
187 DRM_DEBUG_KMS(
"%s\n", __FILE__);
194 .dpms = exynos_drm_crtc_dpms,
195 .prepare = exynos_drm_crtc_prepare,
196 .commit = exynos_drm_crtc_commit,
197 .mode_fixup = exynos_drm_crtc_mode_fixup,
198 .mode_set = exynos_drm_crtc_mode_set,
199 .mode_set_base = exynos_drm_crtc_mode_set_base,
200 .load_lut = exynos_drm_crtc_load_lut,
201 .disable = exynos_drm_crtc_disable,
204 static int exynos_drm_crtc_page_flip(
struct drm_crtc *crtc,
206 struct drm_pending_vblank_event *
event)
214 DRM_DEBUG_KMS(
"%s\n", __FILE__);
218 DRM_ERROR(
"failed page flip request.\n");
229 event->pipe = exynos_crtc->
pipe;
233 DRM_DEBUG(
"failed to acquire vblank counter\n");
243 ret = exynos_drm_crtc_mode_set_base(crtc, crtc->
x, crtc->
y,
258 static void exynos_drm_crtc_destroy(
struct drm_crtc *crtc)
263 DRM_DEBUG_KMS(
"%s\n", __FILE__);
265 private->crtc[exynos_crtc->
pipe] =
NULL;
271 static int exynos_drm_crtc_set_property(
struct drm_crtc *crtc,
279 DRM_DEBUG_KMS(
"%s\n", __func__);
284 if (mode == exynos_crtc->
mode)
291 exynos_drm_crtc_commit(crtc);
309 .page_flip = exynos_drm_crtc_page_flip,
310 .destroy = exynos_drm_crtc_destroy,
311 .set_property = exynos_drm_crtc_set_property,
319 static void exynos_drm_crtc_attach_mode_property(
struct drm_crtc *crtc)
325 DRM_DEBUG_KMS(
"%s\n", __func__);
346 DRM_DEBUG_KMS(
"%s\n", __FILE__);
348 exynos_crtc = kzalloc(
sizeof(*exynos_crtc),
GFP_KERNEL);
350 DRM_ERROR(
"failed to allocate exynos crtc\n");
357 if (!exynos_crtc->
plane) {
364 private->crtc[
nr] = crtc;
367 drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs);
369 exynos_drm_crtc_attach_mode_property(crtc);
380 DRM_DEBUG_KMS(
"%s\n", __FILE__);
397 DRM_DEBUG_KMS(
"%s\n", __FILE__);