Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/sti: Fix up crtc_state->event handling

Use drm-core to handle event.
This is required to be able to use the nonblocking helpers.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Vincent Abriou <vincent.abriou@st.com>

authored by

Fabien DESSENNE and committed by
Vincent Abriou
c62052d1 5e60f595

+14 -34
+14 -32
drivers/gpu/drm/sti/sti_crtc.c
··· 134 134 sti_crtc_mode_set(crtc, &crtc->state->adjusted_mode); 135 135 } 136 136 137 - static void sti_crtc_atomic_begin(struct drm_crtc *crtc, 138 - struct drm_crtc_state *old_crtc_state) 139 - { 140 - struct sti_mixer *mixer = to_sti_mixer(crtc); 141 - 142 - if (crtc->state->event) { 143 - crtc->state->event->pipe = drm_crtc_index(crtc); 144 - 145 - WARN_ON(drm_crtc_vblank_get(crtc) != 0); 146 - 147 - mixer->pending_event = crtc->state->event; 148 - crtc->state->event = NULL; 149 - } 150 - } 151 - 152 137 static void sti_crtc_atomic_flush(struct drm_crtc *crtc, 153 138 struct drm_crtc_state *old_crtc_state) 154 139 { ··· 141 156 struct sti_mixer *mixer = to_sti_mixer(crtc); 142 157 struct sti_compositor *compo = dev_get_drvdata(mixer->dev); 143 158 struct drm_plane *p; 159 + struct drm_pending_vblank_event *event; 160 + unsigned long flags; 144 161 145 162 DRM_DEBUG_DRIVER("\n"); 146 163 ··· 207 220 break; 208 221 } 209 222 } 223 + 224 + event = crtc->state->event; 225 + if (event) { 226 + crtc->state->event = NULL; 227 + 228 + spin_lock_irqsave(&crtc->dev->event_lock, flags); 229 + if (drm_crtc_vblank_get(crtc) == 0) 230 + drm_crtc_arm_vblank_event(crtc, event); 231 + else 232 + drm_crtc_send_vblank_event(crtc, event); 233 + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 234 + } 210 235 } 211 236 212 237 static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = { 213 238 .enable = sti_crtc_enable, 214 239 .disable = sti_crtc_disabling, 215 240 .mode_set_nofb = sti_crtc_mode_set_nofb, 216 - .atomic_begin = sti_crtc_atomic_begin, 217 241 .atomic_flush = sti_crtc_atomic_flush, 218 242 }; 219 243 ··· 248 250 struct sti_compositor *compo; 249 251 struct drm_crtc *crtc = data; 250 252 struct sti_mixer *mixer; 251 - unsigned long flags; 252 253 struct sti_private *priv; 253 254 unsigned int pipe; 254 255 ··· 263 266 } 264 267 265 268 drm_crtc_handle_vblank(crtc); 266 - 267 - spin_lock_irqsave(&crtc->dev->event_lock, flags); 268 - if (mixer->pending_event) { 269 - drm_crtc_send_vblank_event(crtc, mixer->pending_event); 270 - drm_crtc_vblank_put(crtc); 271 - mixer->pending_event = NULL; 272 - } 273 - spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 274 269 275 270 if (mixer->status == STI_MIXER_DISABLING) { 276 271 struct drm_plane *p; ··· 306 317 struct sti_private *priv = drm_dev->dev_private; 307 318 struct sti_compositor *compo = priv->compo; 308 319 struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe]; 309 - struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc; 310 320 struct sti_vtg *vtg = compo->vtg[pipe]; 311 321 312 322 DRM_DEBUG_DRIVER("\n"); 313 323 314 324 if (sti_vtg_unregister_client(vtg, vtg_vblank_nb)) 315 325 DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n"); 316 - 317 - /* free the resources of the pending requests */ 318 - if (compo->mixer[pipe]->pending_event) { 319 - drm_crtc_vblank_put(crtc); 320 - compo->mixer[pipe]->pending_event = NULL; 321 - } 322 326 } 323 327 324 328 static int sti_crtc_late_register(struct drm_crtc *crtc)
-2
drivers/gpu/drm/sti/sti_mixer.h
··· 28 28 * @regs: mixer registers 29 29 * @id: id of the mixer 30 30 * @drm_crtc: crtc object link to the mixer 31 - * @pending_event: set if a flip event is pending on crtc 32 31 * @status: to know the status of the mixer 33 32 */ 34 33 struct sti_mixer { ··· 35 36 void __iomem *regs; 36 37 int id; 37 38 struct drm_crtc drm_crtc; 38 - struct drm_pending_vblank_event *pending_event; 39 39 enum sti_mixer_status status; 40 40 }; 41 41