diff options
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_drm_crtc.c')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_crtc.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 9337e5e2dbb6..ee43cc220853 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
@@ -29,36 +29,17 @@ | |||
29 | #include "drmP.h" | 29 | #include "drmP.h" |
30 | #include "drm_crtc_helper.h" | 30 | #include "drm_crtc_helper.h" |
31 | 31 | ||
32 | #include "exynos_drm_crtc.h" | ||
32 | #include "exynos_drm_drv.h" | 33 | #include "exynos_drm_drv.h" |
33 | #include "exynos_drm_fb.h" | 34 | #include "exynos_drm_fb.h" |
34 | #include "exynos_drm_encoder.h" | 35 | #include "exynos_drm_encoder.h" |
36 | #include "exynos_drm_gem.h" | ||
35 | #include "exynos_drm_buf.h" | 37 | #include "exynos_drm_buf.h" |
36 | 38 | ||
37 | #define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc,\ | 39 | #define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc,\ |
38 | drm_crtc) | 40 | drm_crtc) |
39 | 41 | ||
40 | /* | 42 | /* |
41 | * Exynos specific crtc postion structure. | ||
42 | * | ||
43 | * @fb_x: offset x on a framebuffer to be displyed | ||
44 | * - the unit is screen coordinates. | ||
45 | * @fb_y: offset y on a framebuffer to be displayed | ||
46 | * - the unit is screen coordinates. | ||
47 | * @crtc_x: offset x on hardware screen. | ||
48 | * @crtc_y: offset y on hardware screen. | ||
49 | * @crtc_w: width of hardware screen. | ||
50 | * @crtc_h: height of hardware screen. | ||
51 | */ | ||
52 | struct exynos_drm_crtc_pos { | ||
53 | unsigned int fb_x; | ||
54 | unsigned int fb_y; | ||
55 | unsigned int crtc_x; | ||
56 | unsigned int crtc_y; | ||
57 | unsigned int crtc_w; | ||
58 | unsigned int crtc_h; | ||
59 | }; | ||
60 | |||
61 | /* | ||
62 | * Exynos specific crtc structure. | 43 | * Exynos specific crtc structure. |
63 | * | 44 | * |
64 | * @drm_crtc: crtc object. | 45 | * @drm_crtc: crtc object. |
@@ -85,30 +66,31 @@ static void exynos_drm_crtc_apply(struct drm_crtc *crtc) | |||
85 | 66 | ||
86 | exynos_drm_fn_encoder(crtc, overlay, | 67 | exynos_drm_fn_encoder(crtc, overlay, |
87 | exynos_drm_encoder_crtc_mode_set); | 68 | exynos_drm_encoder_crtc_mode_set); |
88 | exynos_drm_fn_encoder(crtc, NULL, exynos_drm_encoder_crtc_commit); | 69 | exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, |
70 | exynos_drm_encoder_crtc_commit); | ||
89 | } | 71 | } |
90 | 72 | ||
91 | static int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay, | 73 | int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay, |
92 | struct drm_framebuffer *fb, | 74 | struct drm_framebuffer *fb, |
93 | struct drm_display_mode *mode, | 75 | struct drm_display_mode *mode, |
94 | struct exynos_drm_crtc_pos *pos) | 76 | struct exynos_drm_crtc_pos *pos) |
95 | { | 77 | { |
96 | struct exynos_drm_buf_entry *entry; | 78 | struct exynos_drm_gem_buf *buffer; |
97 | unsigned int actual_w; | 79 | unsigned int actual_w; |
98 | unsigned int actual_h; | 80 | unsigned int actual_h; |
99 | 81 | ||
100 | entry = exynos_drm_fb_get_buf(fb); | 82 | buffer = exynos_drm_fb_get_buf(fb); |
101 | if (!entry) { | 83 | if (!buffer) { |
102 | DRM_LOG_KMS("entry is null.\n"); | 84 | DRM_LOG_KMS("buffer is null.\n"); |
103 | return -EFAULT; | 85 | return -EFAULT; |
104 | } | 86 | } |
105 | 87 | ||
106 | overlay->paddr = entry->paddr; | 88 | overlay->dma_addr = buffer->dma_addr; |
107 | overlay->vaddr = entry->vaddr; | 89 | overlay->vaddr = buffer->kvaddr; |
108 | 90 | ||
109 | DRM_DEBUG_KMS("vaddr = 0x%lx, paddr = 0x%lx\n", | 91 | DRM_DEBUG_KMS("vaddr = 0x%lx, dma_addr = 0x%lx\n", |
110 | (unsigned long)overlay->vaddr, | 92 | (unsigned long)overlay->vaddr, |
111 | (unsigned long)overlay->paddr); | 93 | (unsigned long)overlay->dma_addr); |
112 | 94 | ||
113 | actual_w = min((mode->hdisplay - pos->crtc_x), pos->crtc_w); | 95 | actual_w = min((mode->hdisplay - pos->crtc_x), pos->crtc_w); |
114 | actual_h = min((mode->vdisplay - pos->crtc_y), pos->crtc_h); | 96 | actual_h = min((mode->vdisplay - pos->crtc_y), pos->crtc_h); |
@@ -171,9 +153,26 @@ static int exynos_drm_crtc_update(struct drm_crtc *crtc) | |||
171 | 153 | ||
172 | static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) | 154 | static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) |
173 | { | 155 | { |
174 | DRM_DEBUG_KMS("%s\n", __FILE__); | 156 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
175 | 157 | ||
176 | /* TODO */ | 158 | DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode); |
159 | |||
160 | switch (mode) { | ||
161 | case DRM_MODE_DPMS_ON: | ||
162 | exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, | ||
163 | exynos_drm_encoder_crtc_commit); | ||
164 | break; | ||
165 | case DRM_MODE_DPMS_STANDBY: | ||
166 | case DRM_MODE_DPMS_SUSPEND: | ||
167 | case DRM_MODE_DPMS_OFF: | ||
168 | /* TODO */ | ||
169 | exynos_drm_fn_encoder(crtc, NULL, | ||
170 | exynos_drm_encoder_crtc_disable); | ||
171 | break; | ||
172 | default: | ||
173 | DRM_DEBUG_KMS("unspecified mode %d\n", mode); | ||
174 | break; | ||
175 | } | ||
177 | } | 176 | } |
178 | 177 | ||
179 | static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) | 178 | static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) |
@@ -185,9 +184,12 @@ static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) | |||
185 | 184 | ||
186 | static void exynos_drm_crtc_commit(struct drm_crtc *crtc) | 185 | static void exynos_drm_crtc_commit(struct drm_crtc *crtc) |
187 | { | 186 | { |
187 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); | ||
188 | |||
188 | DRM_DEBUG_KMS("%s\n", __FILE__); | 189 | DRM_DEBUG_KMS("%s\n", __FILE__); |
189 | 190 | ||
190 | /* drm framework doesn't check NULL. */ | 191 | exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, |
192 | exynos_drm_encoder_crtc_commit); | ||
191 | } | 193 | } |
192 | 194 | ||
193 | static bool | 195 | static bool |