@@ -305,106 +305,6 @@ static void vc5_hvs_pv_muxing_commit(struct vc4_dev *vc4,
305305 }
306306}
307307
308- #define HVS_BUS_WIDTH 4
309-
310- /*
311- * On the BCM2711, the core clock needs to be raised depending on the
312- * rate of pixels being fetched from memory by the HVS and then the
313- * pixels being output to the PixelValves.
314- *
315- * Thus, we need to consider the mode on each CRTC to compute the output
316- * pixel rate, and all the planes attached to those CRTCs to compute the
317- * input rate, and take the highest of the two.
318- */
319- static unsigned long vc5_hvs_compute_core_rate (struct vc4_dev * vc4 ,
320- struct drm_atomic_state * state )
321- {
322- struct drm_crtc * crtc ;
323- unsigned long cob_rate = 0 ;
324- unsigned long pixel_rate = 0 ;
325- unsigned num_outputs = 0 ;
326-
327- drm_for_each_crtc (crtc , state -> dev ) {
328- const struct drm_display_mode * mode ;
329- struct drm_crtc_state * crtc_state ;
330- struct vc4_encoder * vc4_encoder ;
331- struct drm_encoder * encoder ;
332- struct drm_plane * plane ;
333- unsigned long min_rate ;
334- unsigned refresh ;
335-
336- crtc_state = drm_atomic_get_new_or_current_crtc_state (state , crtc );
337- if (!crtc_state )
338- continue ;
339-
340- if (!crtc_state -> active )
341- continue ;
342-
343- mode = & crtc_state -> adjusted_mode ;
344- encoder = vc4_get_crtc_encoder (crtc , state ,
345- drm_atomic_get_connector_state );
346- if (!encoder )
347- continue ;
348-
349- num_outputs ++ ;
350- vc4_encoder = to_vc4_encoder (encoder );
351-
352- /*
353- * The HVS only generates the active pixels and stores
354- * completed lines in the COB. However, pixel-valve
355- * consumes at the HDMI pixel clock rate which can be a
356- * lot higher than the number of active pixels e.g. 4K
357- * p60 is 594 MHz but active pixels would be 498 MHz.
358- * The COB output is one pixel per clock and runs of the
359- * the core clock and needs to run fast enough to send
360- * the active pixels minus the buffering in pixel-valve.
361- *
362- * For PV2 (HDMI0) there are 512 pixels and for PV4
363- * (HDMI1) there are 58. This means that for HDMI1 the
364- * core-clock needs to be the same as the pixel clock
365- * but for HDMI0 the core-clock can be a bit slower -
366- * experiments suggest that 90% is about right so long
367- * as the horizontal blanking period is at least 10% of
368- * the total horizonal time, this isn't always in the
369- * case.
370- */
371- if (vc4_encoder -> type == VC4_ENCODER_TYPE_HDMI0 ) {
372- min_rate = max (mode -> clock * mode -> hdisplay / mode -> htotal + 1000 ,
373- mode -> clock * 9 / 10 ) * 1000 ;
374- } else {
375- min_rate = mode -> clock * 1000 ;
376- }
377- cob_rate = max (cob_rate , min_rate );
378-
379- refresh = drm_mode_vrefresh (mode );
380- drm_for_each_plane_mask (plane , state -> dev , crtc_state -> plane_mask ) {
381- struct drm_plane_state * plane_state =
382- drm_atomic_get_plane_state (state , plane );
383- unsigned height , width ;
384-
385- if (!plane_state -> fb )
386- continue ;
387-
388- height = plane_state -> src_h >> 16 ;
389- width = plane_state -> src_w >> 16 ;
390-
391- pixel_rate += height * width * refresh ;
392- }
393- }
394-
395- /*
396- * We need to target a memory bus load of 60% if we have a
397- * single HVS channel enabled, and 40% otherwise.
398- */
399- if (num_outputs > 1 )
400- pixel_rate = pixel_rate / 40 ;
401- else
402- pixel_rate = pixel_rate / 60 ;
403- pixel_rate = pixel_rate * 100 ;
404-
405- return max (cob_rate , pixel_rate / HVS_BUS_WIDTH );
406- }
407-
408308static void
409309vc4_atomic_complete_commit (struct drm_atomic_state * state )
410310{
@@ -426,20 +326,9 @@ vc4_atomic_complete_commit(struct drm_atomic_state *state)
426326 vc4_hvs_mask_underrun (dev , vc4_crtc_state -> assigned_channel );
427327 }
428328
429- if (vc4 -> hvs && vc4 -> hvs -> hvs5 ) {
430- /*
431- * Do a temporary request on the core clock during the
432- * modeset.
433- */
329+ if (vc4 -> hvs && vc4 -> hvs -> hvs5 )
434330 core_req = clk_request_start (hvs -> core_clk , 500000000 );
435331
436- /*
437- * And remove the previous one based on the HVS
438- * requirements if any.
439- */
440- clk_request_done (hvs -> core_req );
441- }
442-
443332 drm_atomic_helper_wait_for_fences (dev , state , false);
444333
445334 drm_atomic_helper_wait_for_dependencies (state );
@@ -469,20 +358,8 @@ vc4_atomic_complete_commit(struct drm_atomic_state *state)
469358
470359 drm_atomic_helper_commit_cleanup_done (state );
471360
472- if (vc4 -> hvs && vc4 -> hvs -> hvs5 ) {
473- unsigned long core_rate = vc5_hvs_compute_core_rate (vc4 ,
474- state );
475-
476- /*
477- * Request a clock rate based on the current HVS
478- * requirements.
479- */
480- hvs -> core_req = clk_request_start (hvs -> core_clk ,
481- core_rate );
482-
483- /* And drop the temporary request */
361+ if (vc4 -> hvs && vc4 -> hvs -> hvs5 )
484362 clk_request_done (core_req );
485- }
486363
487364 drm_atomic_state_put (state );
488365
0 commit comments