mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	output: drop front_buffer
This lets backends immediately release committed buffers if they want to.
This commit is contained in:
		
							parent
							
								
									45069fb623
								
							
						
					
					
						commit
						efeb8346cf
					
				
					 2 changed files with 5 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -188,7 +188,7 @@ struct wlr_output {
 | 
			
		|||
	struct wlr_allocator *allocator;
 | 
			
		||||
	struct wlr_renderer *renderer;
 | 
			
		||||
	struct wlr_swapchain *swapchain;
 | 
			
		||||
	struct wlr_buffer *back_buffer, *front_buffer;
 | 
			
		||||
	struct wlr_buffer *back_buffer;
 | 
			
		||||
 | 
			
		||||
	struct wl_listener display_destroy;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -393,9 +393,6 @@ void wlr_output_destroy(struct wlr_output *output) {
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	wlr_buffer_unlock(output->front_buffer);
 | 
			
		||||
	output->front_buffer = NULL;
 | 
			
		||||
 | 
			
		||||
	wl_list_remove(&output->display_destroy.link);
 | 
			
		||||
	wlr_output_destroy_global(output);
 | 
			
		||||
	output_clear_back_buffer(output);
 | 
			
		||||
| 
						 | 
				
			
			@ -716,15 +713,6 @@ bool wlr_output_commit(struct wlr_output *output) {
 | 
			
		|||
		output->cursor_swapchain = NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Unset the front-buffer when a new buffer will replace it or when the
 | 
			
		||||
	// output is getting disabled
 | 
			
		||||
	if ((output->pending.committed & WLR_OUTPUT_STATE_BUFFER) ||
 | 
			
		||||
			((output->pending.committed & WLR_OUTPUT_STATE_ENABLED) &&
 | 
			
		||||
				!output->pending.enabled)) {
 | 
			
		||||
		wlr_buffer_unlock(output->front_buffer);
 | 
			
		||||
		output->front_buffer = NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
 | 
			
		||||
		output->frame_pending = true;
 | 
			
		||||
		output->needs_frame = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -732,8 +720,6 @@ bool wlr_output_commit(struct wlr_output *output) {
 | 
			
		|||
 | 
			
		||||
	if (back_buffer != NULL) {
 | 
			
		||||
		wlr_swapchain_set_buffer_submitted(output->swapchain, back_buffer);
 | 
			
		||||
		wlr_buffer_unlock(output->front_buffer);
 | 
			
		||||
		output->front_buffer = back_buffer;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	uint32_t committed = output->pending.committed;
 | 
			
		||||
| 
						 | 
				
			
			@ -747,6 +733,10 @@ bool wlr_output_commit(struct wlr_output *output) {
 | 
			
		|||
	};
 | 
			
		||||
	wlr_signal_emit_safe(&output->events.commit, &event);
 | 
			
		||||
 | 
			
		||||
	if (back_buffer != NULL) {
 | 
			
		||||
		wlr_buffer_unlock(back_buffer);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue