mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	output_init_render: Allow re-initialization
This lets the compositor call this function after the fact to replace the renderer/allocator after a renderer context lost.
This commit is contained in:
		
							parent
							
								
									db0e962368
								
							
						
					
					
						commit
						fe891ebd4e
					
				
					 2 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
					@ -278,7 +278,8 @@ void wlr_output_create_global(struct wlr_output *output);
 | 
				
			||||||
void wlr_output_destroy_global(struct wlr_output *output);
 | 
					void wlr_output_destroy_global(struct wlr_output *output);
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Initialize the output's rendering subsystem with the provided allocator and
 | 
					 * Initialize the output's rendering subsystem with the provided allocator and
 | 
				
			||||||
 * renderer. Can only be called once.
 | 
					 * renderer. After initialization, this function may invoked again to reinitialize
 | 
				
			||||||
 | 
					 * the allocator and renderer to different values.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Call this function prior to any call to wlr_output_attach_render(),
 | 
					 * Call this function prior to any call to wlr_output_attach_render(),
 | 
				
			||||||
 * wlr_output_commit() or wlr_output_cursor_create().
 | 
					 * wlr_output_commit() or wlr_output_cursor_create().
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,8 +15,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_output_init_render(struct wlr_output *output,
 | 
					bool wlr_output_init_render(struct wlr_output *output,
 | 
				
			||||||
		struct wlr_allocator *allocator, struct wlr_renderer *renderer) {
 | 
							struct wlr_allocator *allocator, struct wlr_renderer *renderer) {
 | 
				
			||||||
	assert(output->allocator == NULL && allocator != NULL);
 | 
						assert(allocator != NULL && renderer != NULL);
 | 
				
			||||||
	assert(output->renderer == NULL && renderer != NULL);
 | 
						assert(output->back_buffer == NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t backend_caps = backend_get_buffer_caps(output->backend);
 | 
						uint32_t backend_caps = backend_get_buffer_caps(output->backend);
 | 
				
			||||||
	uint32_t renderer_caps = renderer_get_render_buffer_caps(renderer);
 | 
						uint32_t renderer_caps = renderer_get_render_buffer_caps(renderer);
 | 
				
			||||||
| 
						 | 
					@ -31,6 +31,12 @@ bool wlr_output_init_render(struct wlr_output *output,
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wlr_swapchain_destroy(output->swapchain);
 | 
				
			||||||
 | 
						output->swapchain = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wlr_swapchain_destroy(output->cursor_swapchain);
 | 
				
			||||||
 | 
						output->cursor_swapchain = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	output->allocator = allocator;
 | 
						output->allocator = allocator;
 | 
				
			||||||
	output->renderer = renderer;
 | 
						output->renderer = renderer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue