@@ -26,14 +26,6 @@ static inline bool reserved_by_other(uint32_t *res_map, int idx,
2626 return res_map [idx ] && res_map [idx ] != enc_id ;
2727}
2828
29- /**
30- * struct dpu_rm_requirements - Reservation requirements parameter bundle
31- * @topology: selected topology for the display
32- */
33- struct dpu_rm_requirements {
34- struct msm_display_topology topology ;
35- };
36-
3729/**
3830 * dpu_rm_init - Read hardware catalog and create reservation tracking objects
3931 * for all HW blocks.
@@ -241,14 +233,13 @@ static int _dpu_rm_get_lm_peer(struct dpu_rm *rm, int primary_idx)
241233 * mixer in rm->pingpong_blks[].
242234 * @dspp_idx: output parameter, index of dspp block attached to the layer
243235 * mixer in rm->dspp_blks[].
244- * @reqs: input parameter, rm requirements for HW blocks needed in the
245- * datapath.
236+ * @topology: selected topology for the display
246237 * Return: true if lm matches all requirements, false otherwise
247238 */
248239static bool _dpu_rm_check_lm_and_get_connected_blks (struct dpu_rm * rm ,
249240 struct dpu_global_state * global_state ,
250241 uint32_t enc_id , int lm_idx , int * pp_idx , int * dspp_idx ,
251- struct dpu_rm_requirements * reqs )
242+ struct msm_display_topology * topology )
252243{
253244 const struct dpu_lm_cfg * lm_cfg ;
254245 int idx ;
@@ -273,7 +264,7 @@ static bool _dpu_rm_check_lm_and_get_connected_blks(struct dpu_rm *rm,
273264 }
274265 * pp_idx = idx ;
275266
276- if (!reqs -> topology . num_dspp )
267+ if (!topology -> num_dspp )
277268 return true;
278269
279270 idx = lm_cfg -> dspp - DSPP_0 ;
@@ -295,22 +286,22 @@ static bool _dpu_rm_check_lm_and_get_connected_blks(struct dpu_rm *rm,
295286static int _dpu_rm_reserve_lms (struct dpu_rm * rm ,
296287 struct dpu_global_state * global_state ,
297288 uint32_t enc_id ,
298- struct dpu_rm_requirements * reqs )
289+ struct msm_display_topology * topology )
299290
300291{
301292 int lm_idx [MAX_BLOCKS ];
302293 int pp_idx [MAX_BLOCKS ];
303294 int dspp_idx [MAX_BLOCKS ] = {0 };
304295 int i , lm_count = 0 ;
305296
306- if (!reqs -> topology . num_lm ) {
307- DPU_ERROR ("invalid number of lm: %d\n" , reqs -> topology . num_lm );
297+ if (!topology -> num_lm ) {
298+ DPU_ERROR ("invalid number of lm: %d\n" , topology -> num_lm );
308299 return - EINVAL ;
309300 }
310301
311302 /* Find a primary mixer */
312303 for (i = 0 ; i < ARRAY_SIZE (rm -> mixer_blks ) &&
313- lm_count < reqs -> topology . num_lm ; i ++ ) {
304+ lm_count < topology -> num_lm ; i ++ ) {
314305 if (!rm -> mixer_blks [i ])
315306 continue ;
316307
@@ -319,14 +310,14 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm,
319310
320311 if (!_dpu_rm_check_lm_and_get_connected_blks (rm , global_state ,
321312 enc_id , i , & pp_idx [lm_count ],
322- & dspp_idx [lm_count ], reqs )) {
313+ & dspp_idx [lm_count ], topology )) {
323314 continue ;
324315 }
325316
326317 ++ lm_count ;
327318
328319 /* Valid primary mixer found, find matching peers */
329- if (lm_count < reqs -> topology . num_lm ) {
320+ if (lm_count < topology -> num_lm ) {
330321 int j = _dpu_rm_get_lm_peer (rm , i );
331322
332323 /* ignore the peer if there is an error or if the peer was already processed */
@@ -339,7 +330,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm,
339330 if (!_dpu_rm_check_lm_and_get_connected_blks (rm ,
340331 global_state , enc_id , j ,
341332 & pp_idx [lm_count ], & dspp_idx [lm_count ],
342- reqs )) {
333+ topology )) {
343334 continue ;
344335 }
345336
@@ -348,7 +339,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm,
348339 }
349340 }
350341
351- if (lm_count != reqs -> topology . num_lm ) {
342+ if (lm_count != topology -> num_lm ) {
352343 DPU_DEBUG ("unable to find appropriate mixers\n" );
353344 return - ENAVAIL ;
354345 }
@@ -357,7 +348,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm,
357348 global_state -> mixer_to_enc_id [lm_idx [i ]] = enc_id ;
358349 global_state -> pingpong_to_enc_id [pp_idx [i ]] = enc_id ;
359350 global_state -> dspp_to_enc_id [dspp_idx [i ]] =
360- reqs -> topology . num_dspp ? enc_id : 0 ;
351+ topology -> num_dspp ? enc_id : 0 ;
361352
362353 trace_dpu_rm_reserve_lms (lm_idx [i ] + LM_0 , enc_id ,
363354 pp_idx [i ] + PINGPONG_0 );
@@ -594,28 +585,28 @@ static int _dpu_rm_make_reservation(
594585 struct dpu_rm * rm ,
595586 struct dpu_global_state * global_state ,
596587 struct drm_encoder * enc ,
597- struct dpu_rm_requirements * reqs )
588+ struct msm_display_topology * topology )
598589{
599590 int ret ;
600591
601- ret = _dpu_rm_reserve_lms (rm , global_state , enc -> base .id , reqs );
592+ ret = _dpu_rm_reserve_lms (rm , global_state , enc -> base .id , topology );
602593 if (ret ) {
603594 DPU_ERROR ("unable to find appropriate mixers\n" );
604595 return ret ;
605596 }
606597
607598 ret = _dpu_rm_reserve_ctls (rm , global_state , enc -> base .id ,
608- & reqs -> topology );
599+ topology );
609600 if (ret ) {
610601 DPU_ERROR ("unable to find appropriate CTL\n" );
611602 return ret ;
612603 }
613604
614- ret = _dpu_rm_reserve_dsc (rm , global_state , enc , & reqs -> topology );
605+ ret = _dpu_rm_reserve_dsc (rm , global_state , enc , topology );
615606 if (ret )
616607 return ret ;
617608
618- if (reqs -> topology . needs_cdm ) {
609+ if (topology -> needs_cdm ) {
619610 ret = _dpu_rm_reserve_cdm (rm , global_state , enc );
620611 if (ret ) {
621612 DPU_ERROR ("unable to find CDM blk\n" );
@@ -626,20 +617,6 @@ static int _dpu_rm_make_reservation(
626617 return ret ;
627618}
628619
629- static int _dpu_rm_populate_requirements (
630- struct drm_encoder * enc ,
631- struct dpu_rm_requirements * reqs ,
632- struct msm_display_topology req_topology )
633- {
634- reqs -> topology = req_topology ;
635-
636- DRM_DEBUG_KMS ("num_lm: %d num_dsc: %d num_intf: %d cdm: %d\n" ,
637- reqs -> topology .num_lm , reqs -> topology .num_dsc ,
638- reqs -> topology .num_intf , reqs -> topology .needs_cdm );
639-
640- return 0 ;
641- }
642-
643620static void _dpu_rm_clear_mapping (uint32_t * res_mapping , int cnt ,
644621 uint32_t enc_id )
645622{
@@ -693,9 +670,8 @@ int dpu_rm_reserve(
693670 struct dpu_global_state * global_state ,
694671 struct drm_encoder * enc ,
695672 struct drm_crtc_state * crtc_state ,
696- struct msm_display_topology topology )
673+ struct msm_display_topology * topology )
697674{
698- struct dpu_rm_requirements reqs ;
699675 int ret ;
700676
701677 /* Check if this is just a page-flip */
@@ -710,13 +686,11 @@ int dpu_rm_reserve(
710686 DRM_DEBUG_KMS ("reserving hw for enc %d crtc %d\n" ,
711687 enc -> base .id , crtc_state -> crtc -> base .id );
712688
713- ret = _dpu_rm_populate_requirements (enc , & reqs , topology );
714- if (ret ) {
715- DPU_ERROR ("failed to populate hw requirements\n" );
716- return ret ;
717- }
689+ DRM_DEBUG_KMS ("num_lm: %d num_dsc: %d num_intf: %d\n" ,
690+ topology -> num_lm , topology -> num_dsc ,
691+ topology -> num_intf );
718692
719- ret = _dpu_rm_make_reservation (rm , global_state , enc , & reqs );
693+ ret = _dpu_rm_make_reservation (rm , global_state , enc , topology );
720694 if (ret )
721695 DPU_ERROR ("failed to reserve hw resources: %d\n" , ret );
722696
0 commit comments