mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	backend/drm: take output state arg in drm_connector_commit_buffer
This will allow a whole state to be applied at once, instead of individually applying the buffer and the mode.
This commit is contained in:
		
							parent
							
								
									218955ce95
								
							
						
					
					
						commit
						e06c62af77
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
					@ -427,7 +427,8 @@ static bool drm_connector_test(struct wlr_output *output) {
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool drm_connector_commit_buffer(struct wlr_output *output) {
 | 
					static bool drm_connector_commit_buffer(struct wlr_output *output,
 | 
				
			||||||
 | 
							const struct wlr_output_state *state) {
 | 
				
			||||||
	struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
 | 
						struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
 | 
				
			||||||
	struct wlr_drm_backend *drm = conn->backend;
 | 
						struct wlr_drm_backend *drm = conn->backend;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -437,8 +438,8 @@ static bool drm_connector_commit_buffer(struct wlr_output *output) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	struct wlr_drm_plane *plane = crtc->primary;
 | 
						struct wlr_drm_plane *plane = crtc->primary;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert(output->pending.committed & WLR_OUTPUT_STATE_BUFFER);
 | 
						assert(state->committed & WLR_OUTPUT_STATE_BUFFER);
 | 
				
			||||||
	switch (output->pending.buffer_type) {
 | 
						switch (state->buffer_type) {
 | 
				
			||||||
	case WLR_OUTPUT_STATE_BUFFER_RENDER:
 | 
						case WLR_OUTPUT_STATE_BUFFER_RENDER:
 | 
				
			||||||
		if (!drm_plane_lock_surface(plane, drm)) {
 | 
							if (!drm_plane_lock_surface(plane, drm)) {
 | 
				
			||||||
			wlr_drm_conn_log(conn, WLR_ERROR, "drm_plane_lock_surface failed");
 | 
								wlr_drm_conn_log(conn, WLR_ERROR, "drm_plane_lock_surface failed");
 | 
				
			||||||
| 
						 | 
					@ -446,8 +447,7 @@ static bool drm_connector_commit_buffer(struct wlr_output *output) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case WLR_OUTPUT_STATE_BUFFER_SCANOUT:;
 | 
						case WLR_OUTPUT_STATE_BUFFER_SCANOUT:;
 | 
				
			||||||
		struct wlr_buffer *buffer = output->pending.buffer;
 | 
							if (!drm_fb_import(&plane->pending_fb, drm, state->buffer,
 | 
				
			||||||
		if (!drm_fb_import(&plane->pending_fb, drm, buffer,
 | 
					 | 
				
			||||||
				&crtc->primary->formats)) {
 | 
									&crtc->primary->formats)) {
 | 
				
			||||||
			wlr_log(WLR_ERROR, "Failed to import buffer");
 | 
								wlr_log(WLR_ERROR, "Failed to import buffer");
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
| 
						 | 
					@ -455,7 +455,7 @@ static bool drm_connector_commit_buffer(struct wlr_output *output) {
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!drm_crtc_page_flip(conn, &output->pending)) {
 | 
						if (!drm_crtc_page_flip(conn, state)) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -521,7 +521,7 @@ static bool drm_connector_commit(struct wlr_output *output) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
 | 
						} else if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
 | 
				
			||||||
		// TODO: support modesetting with a buffer
 | 
							// TODO: support modesetting with a buffer
 | 
				
			||||||
		if (!drm_connector_commit_buffer(output)) {
 | 
							if (!drm_connector_commit_buffer(output, &output->pending)) {
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (output->pending.committed &
 | 
						} else if (output->pending.committed &
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue