mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	backend/drm: rename crtc_pageflip to crtc_commit
Also add a flags argument. The commit function will also be used for disabling the CRTC.
This commit is contained in:
		
							parent
							
								
									70883fd10b
								
							
						
					
					
						commit
						c608fc89d8
					
				
					 4 changed files with 16 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -144,8 +144,8 @@ error:
 | 
			
		|||
	atom->failed = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm,
 | 
			
		||||
		struct wlr_drm_connector *conn) {
 | 
			
		||||
static bool atomic_crtc_commit(struct wlr_drm_backend *drm,
 | 
			
		||||
		struct wlr_drm_connector *conn, uint32_t flags) {
 | 
			
		||||
	struct wlr_drm_crtc *crtc = conn->crtc;
 | 
			
		||||
 | 
			
		||||
	bool modeset = crtc->pending & WLR_DRM_CRTC_MODE;
 | 
			
		||||
| 
						 | 
				
			
			@ -179,7 +179,6 @@ static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm,
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	uint32_t flags = DRM_MODE_PAGE_FLIP_EVENT;
 | 
			
		||||
	if (modeset) {
 | 
			
		||||
		flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
 | 
			
		||||
	} else {
 | 
			
		||||
| 
						 | 
				
			
			@ -267,7 +266,7 @@ static size_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm,
 | 
			
		|||
 | 
			
		||||
const struct wlr_drm_interface atomic_iface = {
 | 
			
		||||
	.conn_enable = atomic_conn_enable,
 | 
			
		||||
	.crtc_pageflip = atomic_crtc_pageflip,
 | 
			
		||||
	.crtc_commit = atomic_crtc_commit,
 | 
			
		||||
	.crtc_set_cursor = atomic_crtc_set_cursor,
 | 
			
		||||
	.crtc_get_gamma_size = atomic_crtc_get_gamma_size,
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -345,7 +345,7 @@ static bool drm_crtc_page_flip(struct wlr_drm_connector *conn) {
 | 
			
		|||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bool ok = drm->iface->crtc_pageflip(drm, conn);
 | 
			
		||||
	bool ok = drm->iface->crtc_commit(drm, conn, DRM_MODE_PAGE_FLIP_EVENT);
 | 
			
		||||
 | 
			
		||||
	crtc->pending = 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,8 +6,8 @@
 | 
			
		|||
#include "backend/drm/iface.h"
 | 
			
		||||
#include "backend/drm/util.h"
 | 
			
		||||
 | 
			
		||||
static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm,
 | 
			
		||||
		struct wlr_drm_connector *conn) {
 | 
			
		||||
static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
 | 
			
		||||
		struct wlr_drm_connector *conn, uint32_t flags) {
 | 
			
		||||
	struct wlr_drm_crtc *crtc = conn->crtc;
 | 
			
		||||
	struct wlr_drm_plane *cursor = crtc->cursor;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,10 +42,13 @@ static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm,
 | 
			
		|||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (drmModePageFlip(drm->fd, crtc->id, fb_id, DRM_MODE_PAGE_FLIP_EVENT, drm)) {
 | 
			
		||||
	if (flags & DRM_MODE_PAGE_FLIP_EVENT) {
 | 
			
		||||
		if (drmModePageFlip(drm->fd, crtc->id, fb_id,
 | 
			
		||||
				DRM_MODE_PAGE_FLIP_EVENT, drm)) {
 | 
			
		||||
			wlr_log_errno(WLR_ERROR, "%s: Failed to page flip", conn->output.name);
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -114,7 +117,7 @@ static size_t legacy_crtc_get_gamma_size(struct wlr_drm_backend *drm,
 | 
			
		|||
 | 
			
		||||
const struct wlr_drm_interface legacy_iface = {
 | 
			
		||||
	.conn_enable = legacy_conn_enable,
 | 
			
		||||
	.crtc_pageflip = legacy_crtc_pageflip,
 | 
			
		||||
	.crtc_commit = legacy_crtc_commit,
 | 
			
		||||
	.crtc_set_cursor = legacy_crtc_set_cursor,
 | 
			
		||||
	.crtc_get_gamma_size = legacy_crtc_get_gamma_size,
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,9 +16,9 @@ struct wlr_drm_interface {
 | 
			
		|||
	// Enable or disable DPMS for connector
 | 
			
		||||
	bool (*conn_enable)(struct wlr_drm_backend *drm,
 | 
			
		||||
		struct wlr_drm_connector *conn, bool enable);
 | 
			
		||||
	// Pageflip on crtc.
 | 
			
		||||
	bool (*crtc_pageflip)(struct wlr_drm_backend *drm,
 | 
			
		||||
		struct wlr_drm_connector *conn);
 | 
			
		||||
	// Commit al pending changes on a CRTC.
 | 
			
		||||
	bool (*crtc_commit)(struct wlr_drm_backend *drm,
 | 
			
		||||
		struct wlr_drm_connector *conn, uint32_t flags);
 | 
			
		||||
	// Enable the cursor buffer on crtc. Set bo to NULL to disable
 | 
			
		||||
	bool (*crtc_set_cursor)(struct wlr_drm_backend *drm,
 | 
			
		||||
		struct wlr_drm_crtc *crtc, struct gbm_bo *bo);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue