Skip to content

Commit 2388693

Browse files
thierryredingvinceab
authored andcommitted
drm/sti: Use drm_crtc_vblank_*() API
Non-legacy drivers should only use this API to allow per-CRTC data to be eventually moved into struct drm_crtc. Cc: Benjamin Gaignard <[email protected]> Cc: Vincent Abriou <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Reviewed-by: Vincent Abriou <[email protected]>
1 parent df00d02 commit 2388693

File tree

5 files changed

+32
-28
lines changed

5 files changed

+32
-28
lines changed

drivers/gpu/drm/sti/sti_crtc.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -254,46 +254,48 @@ static int sti_crtc_set_property(struct drm_crtc *crtc,
254254
int sti_crtc_vblank_cb(struct notifier_block *nb,
255255
unsigned long event, void *data)
256256
{
257-
struct drm_device *drm_dev;
258257
struct sti_compositor *compo =
259258
container_of(nb, struct sti_compositor, vtg_vblank_nb);
260-
int *crtc = data;
259+
struct drm_crtc *crtc = data;
260+
struct sti_mixer *mixer;
261261
unsigned long flags;
262262
struct sti_private *priv;
263+
unsigned int pipe;
263264

264-
drm_dev = compo->mixer[*crtc]->drm_crtc.dev;
265-
priv = drm_dev->dev_private;
265+
priv = crtc->dev->dev_private;
266+
pipe = drm_crtc_index(crtc);
267+
mixer = compo->mixer[pipe];
266268

267269
if ((event != VTG_TOP_FIELD_EVENT) &&
268270
(event != VTG_BOTTOM_FIELD_EVENT)) {
269271
DRM_ERROR("unknown event: %lu\n", event);
270272
return -EINVAL;
271273
}
272274

273-
drm_handle_vblank(drm_dev, *crtc);
275+
drm_crtc_handle_vblank(crtc);
274276

275-
spin_lock_irqsave(&drm_dev->event_lock, flags);
276-
if (compo->mixer[*crtc]->pending_event) {
277-
drm_send_vblank_event(drm_dev, *crtc,
278-
compo->mixer[*crtc]->pending_event);
279-
drm_vblank_put(drm_dev, *crtc);
280-
compo->mixer[*crtc]->pending_event = NULL;
277+
spin_lock_irqsave(&crtc->dev->event_lock, flags);
278+
if (mixer->pending_event) {
279+
drm_crtc_send_vblank_event(crtc, mixer->pending_event);
280+
drm_crtc_vblank_put(crtc);
281+
mixer->pending_event = NULL;
281282
}
282-
spin_unlock_irqrestore(&drm_dev->event_lock, flags);
283+
spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
283284

284-
if (compo->mixer[*crtc]->status == STI_MIXER_DISABLING) {
285+
if (mixer->status == STI_MIXER_DISABLING) {
285286
struct drm_plane *p;
286287

287288
/* Disable mixer only if all overlay planes (GDP and VDP)
288289
* are disabled */
289-
list_for_each_entry(p, &drm_dev->mode_config.plane_list, head) {
290+
list_for_each_entry(p, &crtc->dev->mode_config.plane_list,
291+
head) {
290292
struct sti_plane *plane = to_sti_plane(p);
291293

292294
if ((plane->desc & STI_PLANE_TYPE_MASK) <= STI_VDP)
293295
if (plane->status != STI_PLANE_DISABLED)
294296
return 0;
295297
}
296-
sti_crtc_disable(&compo->mixer[*crtc]->drm_crtc);
298+
sti_crtc_disable(crtc);
297299
}
298300

299301
return 0;
@@ -304,12 +306,13 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
304306
struct sti_private *dev_priv = dev->dev_private;
305307
struct sti_compositor *compo = dev_priv->compo;
306308
struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb;
309+
struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
307310

308311
DRM_DEBUG_DRIVER("\n");
309312

310313
if (sti_vtg_register_client(pipe == STI_MIXER_MAIN ?
311314
compo->vtg_main : compo->vtg_aux,
312-
vtg_vblank_nb, pipe)) {
315+
vtg_vblank_nb, crtc)) {
313316
DRM_ERROR("Cannot register VTG notifier\n");
314317
return -EINVAL;
315318
}
@@ -323,6 +326,7 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
323326
struct sti_private *priv = drm_dev->dev_private;
324327
struct sti_compositor *compo = priv->compo;
325328
struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb;
329+
struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
326330

327331
DRM_DEBUG_DRIVER("\n");
328332

@@ -332,7 +336,7 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
332336

333337
/* free the resources of the pending requests */
334338
if (compo->mixer[pipe]->pending_event) {
335-
drm_vblank_put(drm_dev, pipe);
339+
drm_crtc_vblank_put(crtc);
336340
compo->mixer[pipe]->pending_event = NULL;
337341
}
338342
}

drivers/gpu/drm/sti/sti_gdp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
492492
/* Register gdp callback */
493493
if (sti_vtg_register_client(mixer->id == STI_MIXER_MAIN ?
494494
compo->vtg_main : compo->vtg_aux,
495-
&gdp->vtg_field_nb, mixer->id)) {
495+
&gdp->vtg_field_nb, crtc)) {
496496
DRM_ERROR("Cannot register VTG notifier\n");
497497
return;
498498
}

drivers/gpu/drm/sti/sti_hqvdp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
763763
/* Register VTG Vsync callback to handle bottom fields */
764764
if (sti_vtg_register_client(hqvdp->vtg,
765765
&hqvdp->vtg_nb,
766-
mixer->id)) {
766+
crtc)) {
767767
DRM_ERROR("Cannot register VTG notifier\n");
768768
return;
769769
}

drivers/gpu/drm/sti/sti_vtg.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ LIST_HEAD(vtg_lookup);
7979
* @irq: VTG irq
8080
* @type: VTG type (main or aux)
8181
* @notifier_list: notifier callback
82-
* @crtc_id: the crtc id for vblank event
82+
* @crtc: the CRTC for vblank event
8383
* @slave: slave vtg
8484
* @link: List node to link the structure in lookup list
8585
*/
@@ -90,7 +90,7 @@ struct sti_vtg {
9090
int irq;
9191
u32 irq_status;
9292
struct raw_notifier_head notifier_list;
93-
int crtc_id;
93+
struct drm_crtc *crtc;
9494
struct sti_vtg *slave;
9595
struct list_head link;
9696
};
@@ -283,13 +283,13 @@ u32 sti_vtg_get_pixel_number(struct drm_display_mode mode, int x)
283283
}
284284
EXPORT_SYMBOL(sti_vtg_get_pixel_number);
285285

286-
int sti_vtg_register_client(struct sti_vtg *vtg,
287-
struct notifier_block *nb, int crtc_id)
286+
int sti_vtg_register_client(struct sti_vtg *vtg, struct notifier_block *nb,
287+
struct drm_crtc *crtc)
288288
{
289289
if (vtg->slave)
290-
return sti_vtg_register_client(vtg->slave, nb, crtc_id);
290+
return sti_vtg_register_client(vtg->slave, nb, crtc);
291291

292-
vtg->crtc_id = crtc_id;
292+
vtg->crtc = crtc;
293293
return raw_notifier_chain_register(&vtg->notifier_list, nb);
294294
}
295295
EXPORT_SYMBOL(sti_vtg_register_client);
@@ -311,7 +311,7 @@ static irqreturn_t vtg_irq_thread(int irq, void *arg)
311311
event = (vtg->irq_status & VTG_IRQ_TOP) ?
312312
VTG_TOP_FIELD_EVENT : VTG_BOTTOM_FIELD_EVENT;
313313

314-
raw_notifier_call_chain(&vtg->notifier_list, event, &vtg->crtc_id);
314+
raw_notifier_call_chain(&vtg->notifier_list, event, vtg->crtc);
315315

316316
return IRQ_HANDLED;
317317
}

drivers/gpu/drm/sti/sti_vtg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ struct notifier_block;
1717
struct sti_vtg *of_vtg_find(struct device_node *np);
1818
void sti_vtg_set_config(struct sti_vtg *vtg,
1919
const struct drm_display_mode *mode);
20-
int sti_vtg_register_client(struct sti_vtg *vtg,
21-
struct notifier_block *nb, int crtc_id);
20+
int sti_vtg_register_client(struct sti_vtg *vtg, struct notifier_block *nb,
21+
struct drm_crtc *crtc);
2222
int sti_vtg_unregister_client(struct sti_vtg *vtg,
2323
struct notifier_block *nb);
2424

0 commit comments

Comments
 (0)