@ -487,29 +487,26 @@ bool drm_connector_supports_vrr(struct wlr_drm_connector *conn) {
return true ;
return true ;
}
}
static bool drm_connector_commit ( struct wlr_output * output ) {
static bool drm_connector_set_mode ( struct wlr_drm_connector * conn ,
struct wlr_drm_connector * conn = get_drm_connector_from_output ( output ) ;
const struct wlr_output_state * state ) ;
struct wlr_drm_backend * drm = conn - > backend ;
if ( ! drm_connector_test ( output ) ) {
bool drm_connector_commit_state ( struct wlr_drm_connector * conn ,
return false ;
const struct wlr_output_state * pending ) {
}
struct wlr_drm_backend * drm = conn - > backend ;
struct wlr_output_state state = * pending ;
if ( ! drm - > session - > active ) {
if ( ! drm - > session - > active ) {
return false ;
return false ;
}
}
if ( output - > pending . committed &
if ( state . committed & ( WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_ENABLED ) ) {
( WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_ENABLED ) ) {
struct wlr_output_state state = output - > pending ;
if ( ( state . committed & WLR_OUTPUT_STATE_MODE ) & &
if ( ( state . committed & WLR_OUTPUT_STATE_MODE ) & &
state . mode_type = = WLR_OUTPUT_STATE_MODE_CUSTOM ) {
state . mode_type = = WLR_OUTPUT_STATE_MODE_CUSTOM ) {
drmModeModeInfo mode = { 0 } ;
drmModeModeInfo mode = { 0 } ;
drm_connector_state_mode ( conn , & output- > pending , & mode ) ;
drm_connector_state_mode ( conn , & state , & mode ) ;
state . mode_type = WLR_OUTPUT_STATE_MODE_FIXED ;
state . mode_type = WLR_OUTPUT_STATE_MODE_FIXED ;
state . mode = wlr_drm_connector_add_mode ( output , & mode ) ;
state . mode = wlr_drm_connector_add_mode ( & conn - > output , & mode ) ;
if ( state . mode = = NULL ) {
if ( state . mode = = NULL ) {
return false ;
return false ;
}
}
@ -518,17 +515,16 @@ static bool drm_connector_commit(struct wlr_output *output) {
if ( ! drm_connector_set_mode ( conn , & state ) ) {
if ( ! drm_connector_set_mode ( conn , & state ) ) {
return false ;
return false ;
}
}
} else if ( output- > pending . committed & WLR_OUTPUT_STATE_BUFFER ) {
} else if ( state . committed & WLR_OUTPUT_STATE_BUFFER ) {
// TODO: support modesetting with a buffer
// TODO: support modesetting with a buffer
if ( ! drm_connector_commit_buffer ( conn , & output- > pending ) ) {
if ( ! drm_connector_commit_buffer ( conn , & state ) ) {
return false ;
return false ;
}
}
} else if ( output - > pending . committed &
} else if ( state . committed & ( WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED |
( WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED |
WLR_OUTPUT_STATE_GAMMA_LUT ) ) {
WLR_OUTPUT_STATE_GAMMA_LUT ) ) {
assert ( conn - > crtc ! = NULL ) ;
assert ( conn - > crtc ! = NULL ) ;
// TODO: maybe request a page-flip event here?
// TODO: maybe request a page-flip event here?
if ( ! drm_crtc_commit ( conn , & output- > pending , 0 ) ) {
if ( ! drm_crtc_commit ( conn , & state , 0 ) ) {
return false ;
return false ;
}
}
}
}
@ -536,6 +532,16 @@ static bool drm_connector_commit(struct wlr_output *output) {
return true ;
return true ;
}
}
static bool drm_connector_commit ( struct wlr_output * output ) {
struct wlr_drm_connector * conn = get_drm_connector_from_output ( output ) ;
if ( ! drm_connector_test ( output ) ) {
return false ;
}
return drm_connector_commit_state ( conn , & output - > pending ) ;
}
static void drm_connector_rollback_render ( struct wlr_output * output ) {
static void drm_connector_rollback_render ( struct wlr_output * output ) {
struct wlr_drm_connector * conn = get_drm_connector_from_output ( output ) ;
struct wlr_drm_connector * conn = get_drm_connector_from_output ( output ) ;
return drm_surface_unset_current ( & conn - > crtc - > primary - > surf ) ;
return drm_surface_unset_current ( & conn - > crtc - > primary - > surf ) ;
@ -712,12 +718,12 @@ static void attempt_enable_needs_modeset(struct wlr_drm_backend *drm) {
. mode_type = WLR_OUTPUT_STATE_MODE_FIXED ,
. mode_type = WLR_OUTPUT_STATE_MODE_FIXED ,
. mode = conn - > desired_mode ,
. mode = conn - > desired_mode ,
} ;
} ;
drm_connector_ set_mod e( conn , & state ) ;
drm_connector_ commit_stat e( conn , & state ) ;
}
}
}
}
}
}
bool drm_connector_set_mode ( struct wlr_drm_connector * conn ,
static bool drm_connector_set_mode ( struct wlr_drm_connector * conn ,
const struct wlr_output_state * state ) {
const struct wlr_output_state * state ) {
struct wlr_drm_backend * drm = conn - > backend ;
struct wlr_drm_backend * drm = conn - > backend ;