mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Previously, we were copying wlr_output_state on the stack and patching it up to be guaranteed to have a proper drmModeModeInfo stored in it (and not a custom mode). Also, we had a bunch of helpers deriving DRM-specific information from the generic wlr_output_state. Copying the wlr_output_state worked fine so far, but with output layers we'll be getting a wl_list in there. An empty wl_list stores two pointers to itself, copying it on the stack blindly results in infinite loops in wl_list_for_each. To fix this, rework our DRM backend to stop copying wlr_output_state, instead add a new struct wlr_drm_connector_state which holds both the wlr_output_state and additional DRM-specific information.
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			737 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			737 B
		
	
	
	
		
			C
		
	
	
	
	
	
#ifndef BACKEND_DRM_IFACE_H
 | 
						|
#define BACKEND_DRM_IFACE_H
 | 
						|
 | 
						|
#include <stdbool.h>
 | 
						|
#include <stdint.h>
 | 
						|
#include <xf86drm.h>
 | 
						|
#include <xf86drmMode.h>
 | 
						|
 | 
						|
struct wlr_drm_backend;
 | 
						|
struct wlr_drm_connector;
 | 
						|
struct wlr_drm_crtc;
 | 
						|
struct wlr_drm_connector_state;
 | 
						|
 | 
						|
// Used to provide atomic or legacy DRM functions
 | 
						|
struct wlr_drm_interface {
 | 
						|
	// Commit all pending changes on a CRTC.
 | 
						|
	bool (*crtc_commit)(struct wlr_drm_connector *conn,
 | 
						|
		const struct wlr_drm_connector_state *state, uint32_t flags,
 | 
						|
		bool test_only);
 | 
						|
};
 | 
						|
 | 
						|
extern const struct wlr_drm_interface atomic_iface;
 | 
						|
extern const struct wlr_drm_interface legacy_iface;
 | 
						|
 | 
						|
bool drm_legacy_crtc_set_gamma(struct wlr_drm_backend *drm,
 | 
						|
	struct wlr_drm_crtc *crtc, size_t size, uint16_t *lut);
 | 
						|
 | 
						|
#endif
 |