mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	backend/drm: drop WLR_DRM_CONN_NEEDS_MODESET
- Add wlr_output.enabled checks to CONNECTED checks - Replace NEEDS_MODESET with CONNECTED
This commit is contained in:
		
							parent
							
								
									6a5fb22698
								
							
						
					
					
						commit
						08973d2430
					
				
					 2 changed files with 6 additions and 15 deletions
				
			
		| 
						 | 
					@ -707,8 +707,7 @@ static bool drm_connector_set_mode(struct wlr_drm_connector *conn,
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (conn->status != WLR_DRM_CONN_CONNECTED
 | 
						if (conn->status != WLR_DRM_CONN_CONNECTED) {
 | 
				
			||||||
			&& conn->status != WLR_DRM_CONN_NEEDS_MODESET) {
 | 
					 | 
				
			||||||
		wlr_drm_conn_log(conn, WLR_ERROR,
 | 
							wlr_drm_conn_log(conn, WLR_ERROR,
 | 
				
			||||||
			"Cannot modeset a disconnected output");
 | 
								"Cannot modeset a disconnected output");
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
| 
						 | 
					@ -735,7 +734,6 @@ static bool drm_connector_set_mode(struct wlr_drm_connector *conn,
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	conn->status = WLR_DRM_CONN_CONNECTED;
 | 
					 | 
				
			||||||
	wlr_output_update_mode(&conn->output, wlr_mode);
 | 
						wlr_output_update_mode(&conn->output, wlr_mode);
 | 
				
			||||||
	wlr_output_update_enabled(&conn->output, true);
 | 
						wlr_output_update_enabled(&conn->output, true);
 | 
				
			||||||
	conn->desired_enabled = true;
 | 
						conn->desired_enabled = true;
 | 
				
			||||||
| 
						 | 
					@ -1086,9 +1084,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Only search CRTCs for user-enabled outputs (that are already
 | 
							// Only search CRTCs for user-enabled outputs (that are already
 | 
				
			||||||
		// connected or in need of a modeset)
 | 
							// connected or in need of a modeset)
 | 
				
			||||||
		if ((conn->status == WLR_DRM_CONN_CONNECTED ||
 | 
							if (conn->status == WLR_DRM_CONN_CONNECTED && conn->desired_enabled) {
 | 
				
			||||||
				conn->status == WLR_DRM_CONN_NEEDS_MODESET) &&
 | 
					 | 
				
			||||||
				conn->desired_enabled) {
 | 
					 | 
				
			||||||
			connector_constraints[i] = conn->possible_crtcs;
 | 
								connector_constraints[i] = conn->possible_crtcs;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			// Will always fail to match anything
 | 
								// Will always fail to match anything
 | 
				
			||||||
| 
						 | 
					@ -1119,8 +1115,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm) {
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	for (size_t i = 0; i < num_outputs; ++i) {
 | 
						for (size_t i = 0; i < num_outputs; ++i) {
 | 
				
			||||||
		struct wlr_drm_connector *conn = connectors[i];
 | 
							struct wlr_drm_connector *conn = connectors[i];
 | 
				
			||||||
		if (conn->status == WLR_DRM_CONN_CONNECTED &&
 | 
							if (conn->status == WLR_DRM_CONN_CONNECTED && conn->output.enabled &&
 | 
				
			||||||
				conn->desired_enabled &&
 | 
					 | 
				
			||||||
				connector_match[i] == -1) {
 | 
									connector_match[i] == -1) {
 | 
				
			||||||
			wlr_log(WLR_DEBUG, "Could not match a CRTC for previously connected output; "
 | 
								wlr_log(WLR_DEBUG, "Could not match a CRTC for previously connected output; "
 | 
				
			||||||
					"keeping old configuration");
 | 
										"keeping old configuration");
 | 
				
			||||||
| 
						 | 
					@ -1147,7 +1142,6 @@ static void realloc_crtcs(struct wlr_drm_backend *drm) {
 | 
				
			||||||
		if (connector_match[i] == -1) {
 | 
							if (connector_match[i] == -1) {
 | 
				
			||||||
			if (prev_enabled) {
 | 
								if (prev_enabled) {
 | 
				
			||||||
				wlr_drm_conn_log(conn, WLR_DEBUG, "Output has lost its CRTC");
 | 
									wlr_drm_conn_log(conn, WLR_DEBUG, "Output has lost its CRTC");
 | 
				
			||||||
				conn->status = WLR_DRM_CONN_NEEDS_MODESET;
 | 
					 | 
				
			||||||
				wlr_output_update_enabled(&conn->output, false);
 | 
									wlr_output_update_enabled(&conn->output, false);
 | 
				
			||||||
				wlr_output_update_mode(&conn->output, NULL);
 | 
									wlr_output_update_mode(&conn->output, NULL);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -1157,7 +1151,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm) {
 | 
				
			||||||
		conn->crtc = &drm->crtcs[connector_match[i]];
 | 
							conn->crtc = &drm->crtcs[connector_match[i]];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Only realloc buffers if we have actually been modeset
 | 
							// Only realloc buffers if we have actually been modeset
 | 
				
			||||||
		if (conn->status != WLR_DRM_CONN_CONNECTED) {
 | 
							if (conn->status != WLR_DRM_CONN_CONNECTED || !conn->output.enabled) {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		wlr_output_damage_whole(&conn->output);
 | 
							wlr_output_damage_whole(&conn->output);
 | 
				
			||||||
| 
						 | 
					@ -1383,10 +1377,9 @@ void scan_drm_connectors(struct wlr_drm_backend *drm,
 | 
				
			||||||
			wlr_output_update_enabled(&wlr_conn->output, wlr_conn->crtc != NULL);
 | 
								wlr_output_update_enabled(&wlr_conn->output, wlr_conn->crtc != NULL);
 | 
				
			||||||
			wlr_conn->desired_enabled = true;
 | 
								wlr_conn->desired_enabled = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			wlr_conn->status = WLR_DRM_CONN_NEEDS_MODESET;
 | 
								wlr_conn->status = WLR_DRM_CONN_CONNECTED;
 | 
				
			||||||
			new_outputs[new_outputs_len++] = wlr_conn;
 | 
								new_outputs[new_outputs_len++] = wlr_conn;
 | 
				
			||||||
		} else if ((wlr_conn->status == WLR_DRM_CONN_CONNECTED ||
 | 
							} else if (wlr_conn->status == WLR_DRM_CONN_CONNECTED &&
 | 
				
			||||||
				wlr_conn->status == WLR_DRM_CONN_NEEDS_MODESET) &&
 | 
					 | 
				
			||||||
				drm_conn->connection != DRM_MODE_CONNECTED) {
 | 
									drm_conn->connection != DRM_MODE_CONNECTED) {
 | 
				
			||||||
			wlr_log(WLR_INFO, "'%s' disconnected", wlr_conn->name);
 | 
								wlr_log(WLR_INFO, "'%s' disconnected", wlr_conn->name);
 | 
				
			||||||
			disconnect_drm_connector(wlr_conn);
 | 
								disconnect_drm_connector(wlr_conn);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,8 +93,6 @@ struct wlr_drm_backend {
 | 
				
			||||||
enum wlr_drm_connector_status {
 | 
					enum wlr_drm_connector_status {
 | 
				
			||||||
	// Connector is available but no output is plugged in
 | 
						// Connector is available but no output is plugged in
 | 
				
			||||||
	WLR_DRM_CONN_DISCONNECTED,
 | 
						WLR_DRM_CONN_DISCONNECTED,
 | 
				
			||||||
	// An output just has been plugged in and is waiting for a modeset
 | 
					 | 
				
			||||||
	WLR_DRM_CONN_NEEDS_MODESET,
 | 
					 | 
				
			||||||
	WLR_DRM_CONN_CONNECTED,
 | 
						WLR_DRM_CONN_CONNECTED,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue