backend/drm: make drm_connector_set_mode take a wlr_drm_connector

Since this is an internal DRM backend function, there's no reason we
need to take a generic wlr_output.
This commit is contained in:
Simon Ser 2020-05-18 12:19:53 +02:00 committed by Drew DeVault
parent 445750aa9a
commit 61095f4a12
3 changed files with 9 additions and 10 deletions

View File

@ -94,10 +94,9 @@ static void session_signal(struct wl_listener *listener, void *data) {
struct wlr_drm_connector *conn; struct wlr_drm_connector *conn;
wl_list_for_each(conn, &drm->outputs, link){ wl_list_for_each(conn, &drm->outputs, link){
if (conn->output.enabled && conn->output.current_mode != NULL) { if (conn->output.enabled && conn->output.current_mode != NULL) {
drm_connector_set_mode(&conn->output, drm_connector_set_mode(conn, conn->output.current_mode);
conn->output.current_mode);
} else { } else {
drm_connector_set_mode(&conn->output, NULL); drm_connector_set_mode(conn, NULL);
} }
} }
} else { } else {

View File

@ -564,7 +564,7 @@ static bool drm_connector_commit(struct wlr_output *output) {
} }
} }
if (!drm_connector_set_mode(output, wlr_mode)) { if (!drm_connector_set_mode(conn, wlr_mode)) {
return false; return false;
} }
} }
@ -770,17 +770,17 @@ static void attempt_enable_needs_modeset(struct wlr_drm_backend *drm) {
conn->desired_enabled) { conn->desired_enabled) {
wlr_log(WLR_DEBUG, "Output %s has a desired mode and a CRTC, " wlr_log(WLR_DEBUG, "Output %s has a desired mode and a CRTC, "
"attempting a modeset", conn->output.name); "attempting a modeset", conn->output.name);
drm_connector_set_mode(&conn->output, conn->desired_mode); drm_connector_set_mode(conn, conn->desired_mode);
} }
} }
} }
static void drm_connector_cleanup(struct wlr_drm_connector *conn); static void drm_connector_cleanup(struct wlr_drm_connector *conn);
bool drm_connector_set_mode(struct wlr_output *output, bool drm_connector_set_mode(struct wlr_drm_connector *conn,
struct wlr_output_mode *wlr_mode) { struct wlr_output_mode *wlr_mode) {
struct wlr_drm_connector *conn = get_drm_connector_from_output(output); struct wlr_drm_backend *drm =
struct wlr_drm_backend *drm = get_drm_backend_from_backend(output->backend); get_drm_backend_from_backend(conn->output.backend);
conn->desired_enabled = wlr_mode != NULL; conn->desired_enabled = wlr_mode != NULL;
conn->desired_mode = wlr_mode; conn->desired_mode = wlr_mode;
@ -1061,7 +1061,7 @@ static void dealloc_crtc(struct wlr_drm_connector *conn) {
wlr_log(WLR_DEBUG, "De-allocating CRTC %zu for output '%s'", wlr_log(WLR_DEBUG, "De-allocating CRTC %zu for output '%s'",
conn->crtc - drm->crtcs, conn->output.name); conn->crtc - drm->crtcs, conn->output.name);
drm_connector_set_mode(&conn->output, NULL); drm_connector_set_mode(conn, NULL);
drm_plane_finish_surface(conn->crtc->primary); drm_plane_finish_surface(conn->crtc->primary);
drm_plane_finish_surface(conn->crtc->cursor); drm_plane_finish_surface(conn->crtc->cursor);
if (conn->crtc->cursor != NULL) { if (conn->crtc->cursor != NULL) {

View File

@ -151,7 +151,7 @@ void finish_drm_resources(struct wlr_drm_backend *drm);
void restore_drm_outputs(struct wlr_drm_backend *drm); void restore_drm_outputs(struct wlr_drm_backend *drm);
void scan_drm_connectors(struct wlr_drm_backend *state); void scan_drm_connectors(struct wlr_drm_backend *state);
int handle_drm_event(int fd, uint32_t mask, void *data); int handle_drm_event(int fd, uint32_t mask, void *data);
bool drm_connector_set_mode(struct wlr_output *output, bool drm_connector_set_mode(struct wlr_drm_connector *conn,
struct wlr_output_mode *mode); struct wlr_output_mode *mode);
size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm, size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc); struct wlr_drm_crtc *crtc);