@@ -55,6 +55,99 @@ void liftoff_output_set_composition_layer(struct liftoff_output *output,
5555 output -> composition_layer = layer ;
5656}
5757
58+ void output_log_planes (struct liftoff_output * output )
59+ {
60+ struct liftoff_device * device ;
61+ struct liftoff_plane * plane ;
62+ drmModeObjectProperties * drm_props ;
63+ drmModePropertyRes * drm_prop ;
64+ size_t i ;
65+ int per_line , max_per_line ;
66+
67+ device = output -> device ;
68+
69+ if (!log_has (LIFTOFF_DEBUG )) {
70+ return ;
71+ }
72+
73+ liftoff_log (LIFTOFF_DEBUG , "Planes on CRTC %" PRIu32 ":" , output -> crtc_id );
74+
75+ liftoff_list_for_each (plane , & device -> planes , link ) {
76+ bool active = false;
77+
78+ if ((plane -> possible_crtcs & (1 << output -> crtc_index )) == 0 ) {
79+ continue ;
80+ }
81+
82+
83+ drm_props = drmModeObjectGetProperties (device -> drm_fd ,
84+ plane -> id , DRM_MODE_OBJECT_PLANE );
85+ if (drm_props == NULL ) {
86+ liftoff_log_errno (LIFTOFF_ERROR , "drmModeObjectGetProperties" );
87+ continue ;
88+ }
89+
90+ for (i = 0 ; i < drm_props -> count_props ; i ++ ) {
91+ drm_prop = drmModeGetProperty (device -> drm_fd , drm_props -> props [i ]);
92+ if (drm_prop == NULL ) {
93+ liftoff_log_errno (LIFTOFF_ERROR , "drmModeObjectGetProperties" );
94+ continue ;
95+ }
96+
97+ if (strcmp (drm_prop -> name , "CRTC_ID" ) == 0
98+ && drm_props -> prop_values [i ] != 0 ) {
99+ active = true;
100+ break ;
101+ }
102+ }
103+
104+ struct liftoff_log_buffer log_buf = {0 };
105+ liftoff_log_buffer_append (& log_buf , " Plane %" PRIu32 "%s" , plane -> id ,
106+ active ? ":" : " (inactive):" );
107+
108+ max_per_line = active ? 1 : 4 ;
109+ per_line = max_per_line - 1 ;
110+ for (i = 0 ; i < drm_props -> count_props ; i ++ ) {
111+ uint64_t value = drm_props -> prop_values [i ];
112+ char * name ;
113+
114+ if (++ per_line == max_per_line ) {
115+ liftoff_log_buffer_append (& log_buf , "\n " );
116+ per_line = 0 ;
117+ }
118+
119+ drm_prop = drmModeGetProperty (device -> drm_fd ,
120+ drm_props -> props [i ]);
121+ if (drm_prop == NULL ) {
122+ liftoff_log_buffer_append (& log_buf , "ERR!" );
123+ continue ;
124+ }
125+
126+ name = drm_prop -> name ;
127+
128+ if (strcmp (name , "type" ) == 0 ) {
129+ liftoff_log_buffer_append (& log_buf , " %s: %s" , name ,
130+ value == DRM_PLANE_TYPE_PRIMARY ? "primary" :
131+ value == DRM_PLANE_TYPE_CURSOR ? "cursor" : "overlay" );
132+ continue ;
133+ }
134+
135+ if (strcmp (name , "CRTC_X" ) == 0 || strcmp (name , "CRTC_Y" ) == 0
136+ || strcmp (name , "IN_FENCE_FD" ) == 0 ) {
137+ liftoff_log_buffer_append (LIFTOFF_DEBUG , " %s: %" PRIi32 , name ,
138+ (int32_t )value );
139+ continue ;
140+ }
141+
142+ if (strcmp (name , "SRC_W" ) == 0 || strcmp (name , "SRC_H" ) == 0 ) {
143+ value = value >> 16 ;
144+ }
145+ liftoff_log_buffer_append (& log_buf , " %s: %" PRIu64 , name , value );
146+ }
147+ liftoff_log_buffer_flush (& log_buf , LIFTOFF_DEBUG );
148+ }
149+ }
150+
58151void output_log_layers (struct liftoff_output * output ) {
59152 struct liftoff_layer * layer ;
60153 size_t i ;
@@ -63,7 +156,7 @@ void output_log_layers(struct liftoff_output *output) {
63156 return ;
64157 }
65158
66- liftoff_log (LIFTOFF_DEBUG , "Layers on CRTC %" PRIu32 ":" , output -> crtc_id );
159+ liftoff_log (LIFTOFF_DEBUG , "Available layers:" );
67160 liftoff_list_for_each (layer , & output -> layers , link ) {
68161 if (layer -> force_composition ) {
69162 liftoff_log (LIFTOFF_DEBUG , " Layer %p "
0 commit comments