mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	backend/drm: save current refresh rate
wlr_output.refresh is populated by core wlr_output, and thus will
be zero for a custom mode with an unset refresh rate.
Save the refresh rate from the drmModeModeInfo in wlr_drm_connector
instead.
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3791
(cherry picked from commit f81c3d93cd)
			
			
This commit is contained in:
		
							parent
							
								
									d924d55fea
								
							
						
					
					
						commit
						f2ef71a83b
					
				
					 2 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -463,6 +463,10 @@ static bool drm_crtc_commit(struct wlr_drm_connector *conn,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		drm_connector_set_pending_page_flip(conn, page_flip);
 | 
							drm_connector_set_pending_page_flip(conn, page_flip);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (state->base->committed & WLR_OUTPUT_STATE_MODE) {
 | 
				
			||||||
 | 
								conn->refresh = calculate_refresh_rate(&state->mode);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// The set_cursor() hook is a bit special: it's not really synchronized
 | 
							// The set_cursor() hook is a bit special: it's not really synchronized
 | 
				
			||||||
		// to commit() or test(). Once set_cursor() returns true, the new
 | 
							// to commit() or test(). Once set_cursor() returns true, the new
 | 
				
			||||||
| 
						 | 
					@ -1454,6 +1458,7 @@ static bool connect_drm_connector(struct wlr_drm_connector *wlr_conn,
 | 
				
			||||||
				wlr_conn->crtc->props.mode_id, &mode_id);
 | 
									wlr_conn->crtc->props.mode_id, &mode_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			wlr_conn->crtc->mode_id = mode_id;
 | 
								wlr_conn->crtc->mode_id = mode_id;
 | 
				
			||||||
 | 
								wlr_conn->refresh = calculate_refresh_rate(current_modeinfo);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wlr_log(WLR_INFO, "  %"PRId32"x%"PRId32" @ %.3f Hz %s",
 | 
							wlr_log(WLR_INFO, "  %"PRId32"x%"PRId32" @ %.3f Hz %s",
 | 
				
			||||||
| 
						 | 
					@ -1753,7 +1758,7 @@ static void handle_page_flip(int fd, unsigned seq,
 | 
				
			||||||
		.presented = drm->session->active,
 | 
							.presented = drm->session->active,
 | 
				
			||||||
		.when = &present_time,
 | 
							.when = &present_time,
 | 
				
			||||||
		.seq = seq,
 | 
							.seq = seq,
 | 
				
			||||||
		.refresh = mhz_to_nsec(conn->output.refresh),
 | 
							.refresh = mhz_to_nsec(conn->refresh),
 | 
				
			||||||
		.flags = present_flags,
 | 
							.flags = present_flags,
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	wlr_output_send_present(&conn->output, &present_event);
 | 
						wlr_output_send_present(&conn->output, &present_event);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -175,6 +175,8 @@ struct wlr_drm_connector {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Last committed page-flip
 | 
						// Last committed page-flip
 | 
				
			||||||
	struct wlr_drm_page_flip *pending_page_flip;
 | 
						struct wlr_drm_page_flip *pending_page_flip;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int32_t refresh;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_drm_backend *get_drm_backend_from_backend(
 | 
					struct wlr_drm_backend *get_drm_backend_from_backend(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue