@@ -70,6 +70,7 @@ static const struct debugfs_reg32 crtc_regs[] = {
7070static unsigned int
7171vc4_crtc_get_cob_allocation (struct vc4_dev * vc4 , unsigned int channel )
7272{
73+ struct vc4_hvs * hvs = vc4 -> hvs ;
7374 u32 dispbase = HVS_READ (SCALER_DISPBASEX (channel ));
7475 /* Top/base are supposed to be 4-pixel aligned, but the
7576 * Raspberry Pi firmware fills the low bits (which are
@@ -89,6 +90,7 @@ static bool vc4_crtc_get_scanout_position(struct drm_crtc *crtc,
8990{
9091 struct drm_device * dev = crtc -> dev ;
9192 struct vc4_dev * vc4 = to_vc4_dev (dev );
93+ struct vc4_hvs * hvs = vc4 -> hvs ;
9294 struct vc4_crtc * vc4_crtc = to_vc4_crtc (crtc );
9395 struct vc4_crtc_state * vc4_crtc_state = to_vc4_crtc_state (crtc -> state );
9496 unsigned int cob_size ;
@@ -123,7 +125,7 @@ static bool vc4_crtc_get_scanout_position(struct drm_crtc *crtc,
123125 * vpos /= 2 ;
124126
125127 /* Use hpos to correct for field offset in interlaced mode. */
126- if (vc4_hvs_get_fifo_frame_count (dev , vc4_crtc_state -> assigned_channel ) % 2 )
128+ if (vc4_hvs_get_fifo_frame_count (hvs , vc4_crtc_state -> assigned_channel ) % 2 )
127129 * hpos += mode -> crtc_htotal / 2 ;
128130 }
129131
@@ -449,6 +451,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, struct drm_encoder *encode
449451static void require_hvs_enabled (struct drm_device * dev )
450452{
451453 struct vc4_dev * vc4 = to_vc4_dev (dev );
454+ struct vc4_hvs * hvs = vc4 -> hvs ;
452455
453456 WARN_ON_ONCE ((HVS_READ (SCALER_DISPCTRL ) & SCALER_DISPCTRL_ENABLE ) !=
454457 SCALER_DISPCTRL_ENABLE );
@@ -462,6 +465,7 @@ static int vc4_crtc_disable(struct drm_crtc *crtc,
462465 struct vc4_encoder * vc4_encoder = to_vc4_encoder (encoder );
463466 struct vc4_crtc * vc4_crtc = to_vc4_crtc (crtc );
464467 struct drm_device * dev = crtc -> dev ;
468+ struct vc4_dev * vc4 = to_vc4_dev (dev );
465469 int ret ;
466470
467471 CRTC_WRITE (PV_V_CONTROL ,
@@ -491,7 +495,7 @@ static int vc4_crtc_disable(struct drm_crtc *crtc,
491495 vc4_encoder -> post_crtc_disable (encoder , state );
492496
493497 vc4_crtc_pixelvalve_reset (crtc );
494- vc4_hvs_stop_channel (dev , channel );
498+ vc4_hvs_stop_channel (vc4 -> hvs , channel );
495499
496500 if (vc4_encoder && vc4_encoder -> post_crtc_powerdown )
497501 vc4_encoder -> post_crtc_powerdown (encoder , state );
@@ -517,6 +521,7 @@ static struct drm_encoder *vc4_crtc_get_encoder_by_type(struct drm_crtc *crtc,
517521int vc4_crtc_disable_at_boot (struct drm_crtc * crtc )
518522{
519523 struct drm_device * drm = crtc -> dev ;
524+ struct vc4_dev * vc4 = to_vc4_dev (drm );
520525 struct vc4_crtc * vc4_crtc = to_vc4_crtc (crtc );
521526 enum vc4_encoder_type encoder_type ;
522527 const struct vc4_pv_data * pv_data ;
@@ -538,7 +543,7 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc)
538543 if (!(CRTC_READ (PV_V_CONTROL ) & PV_VCONTROL_VIDEN ))
539544 return 0 ;
540545
541- channel = vc4_hvs_get_fifo_from_output (drm , vc4_crtc -> data -> hvs_output );
546+ channel = vc4_hvs_get_fifo_from_output (vc4 -> hvs , vc4_crtc -> data -> hvs_output );
542547 if (channel < 0 )
543548 return 0 ;
544549
@@ -752,6 +757,7 @@ static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc)
752757 struct drm_crtc * crtc = & vc4_crtc -> base ;
753758 struct drm_device * dev = crtc -> dev ;
754759 struct vc4_dev * vc4 = to_vc4_dev (dev );
760+ struct vc4_hvs * hvs = vc4 -> hvs ;
755761 u32 chan = vc4_crtc -> current_hvs_channel ;
756762 unsigned long flags ;
757763
@@ -770,7 +776,7 @@ static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc)
770776 * the CRTC and encoder already reconfigured, leading to
771777 * underruns. This can be seen when reconfiguring the CRTC.
772778 */
773- vc4_hvs_unmask_underrun (dev , chan );
779+ vc4_hvs_unmask_underrun (hvs , chan );
774780 }
775781 spin_unlock (& vc4_crtc -> irq_lock );
776782 spin_unlock_irqrestore (& dev -> event_lock , flags );
0 commit comments