From ce3f4c3fe1ed3d99500acf4e41293eb6c55f9a4d Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 16 Jun 2019 12:35:40 +0300 Subject: [PATCH] output: remove wlr_output_impl.transform The backend doesn't need to handle transform changes, since everything is done in software. In fact, all of the implementations were all identical and just set the transform. We could add support for hardware transforms, but: - This would require a different field (something like hardware_transform) - Not all combinations are possible because there often are hardware limitations - The Wayland protocol isn't ready for this (in particular xdg-output, see [1]) This belongs to a different patch series anyway. [1]: https://patchwork.freedesktop.org/series/52324/ --- backend/drm/drm.c | 6 ------ backend/headless/output.c | 8 -------- backend/noop/output.c | 6 ------ backend/rdp/output.c | 8 -------- backend/wayland/output.c | 7 ------- backend/x11/output.c | 7 ------- include/wlr/interfaces/wlr_output.h | 2 -- types/wlr_output.c | 8 ++++++-- 8 files changed, 6 insertions(+), 46 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index f90890e7..47857df7 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -678,11 +678,6 @@ bool wlr_drm_connector_add_mode(struct wlr_output *output, return true; } -static void drm_connector_transform(struct wlr_output *output, - enum wl_output_transform transform) { - output->transform = transform; -} - static bool drm_connector_set_cursor(struct wlr_output *output, struct wlr_texture *texture, int32_t scale, enum wl_output_transform transform, @@ -963,7 +958,6 @@ static void drm_connector_destroy(struct wlr_output *output) { static const struct wlr_output_impl output_impl = { .enable = enable_drm_connector, .set_mode = drm_connector_set_mode, - .transform = drm_connector_transform, .set_cursor = drm_connector_set_cursor, .move_cursor = drm_connector_move_cursor, .destroy = drm_connector_destroy, diff --git a/backend/headless/output.c b/backend/headless/output.c index 0073cb33..992a4883 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -49,13 +49,6 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output, int32_t width, return true; } -static void output_transform(struct wlr_output *wlr_output, - enum wl_output_transform transform) { - struct wlr_headless_output *output = - headless_output_from_output(wlr_output); - output->wlr_output.transform = transform; -} - static bool output_attach_render(struct wlr_output *wlr_output, int *buffer_age) { struct wlr_headless_output *output = @@ -84,7 +77,6 @@ static void output_destroy(struct wlr_output *wlr_output) { static const struct wlr_output_impl output_impl = { .set_custom_mode = output_set_custom_mode, - .transform = output_transform, .destroy = output_destroy, .attach_render = output_attach_render, .commit = output_commit, diff --git a/backend/noop/output.c b/backend/noop/output.c index 88bd373b..1022ac6f 100644 --- a/backend/noop/output.c +++ b/backend/noop/output.c @@ -12,11 +12,6 @@ static struct wlr_noop_output *noop_output_from_output( return (struct wlr_noop_output *)wlr_output; } -static void output_transform(struct wlr_output *wlr_output, - enum wl_output_transform transform) { - // empty -} - static bool output_set_custom_mode(struct wlr_output *wlr_output, int32_t width, int32_t height, int32_t refresh) { wlr_output_update_custom_mode(wlr_output, width, height, refresh); @@ -42,7 +37,6 @@ static void output_destroy(struct wlr_output *wlr_output) { } static const struct wlr_output_impl output_impl = { - .transform = output_transform, .set_custom_mode = output_set_custom_mode, .destroy = output_destroy, .attach_render = output_attach_render, diff --git a/backend/rdp/output.c b/backend/rdp/output.c index 0ca886f0..6133b751 100644 --- a/backend/rdp/output.c +++ b/backend/rdp/output.c @@ -62,13 +62,6 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output, int32_t width, return true; } -static void output_transform(struct wlr_output *wlr_output, - enum wl_output_transform transform) { - struct wlr_rdp_output *output = - rdp_output_from_output(wlr_output); - output->wlr_output.transform = transform; -} - static bool output_attach_render(struct wlr_output *wlr_output, int *buffer_age) { struct wlr_rdp_output *output = @@ -242,7 +235,6 @@ static void output_destroy(struct wlr_output *wlr_output) { static const struct wlr_output_impl output_impl = { .set_custom_mode = output_set_custom_mode, - .transform = output_transform, .destroy = output_destroy, .attach_render = output_attach_render, .commit = output_commit, diff --git a/backend/wayland/output.c b/backend/wayland/output.c index d28e8c01..b179a5f6 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -86,12 +86,6 @@ static bool output_commit(struct wlr_output *wlr_output) { return true; } -static void output_transform(struct wlr_output *wlr_output, - enum wl_output_transform transform) { - struct wlr_wl_output *output = get_wl_output_from_output(wlr_output); - output->wlr_output.transform = transform; -} - static bool output_set_cursor(struct wlr_output *wlr_output, struct wlr_texture *texture, int32_t scale, enum wl_output_transform transform, @@ -226,7 +220,6 @@ static bool output_schedule_frame(struct wlr_output *wlr_output) { static const struct wlr_output_impl output_impl = { .set_custom_mode = output_set_custom_mode, - .transform = output_transform, .destroy = output_destroy, .attach_render = output_attach_render, .commit = output_commit, diff --git a/backend/x11/output.c b/backend/x11/output.c index 8ee15d51..2ce4b9b8 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -75,12 +75,6 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output, return true; } -static void output_transform(struct wlr_output *wlr_output, - enum wl_output_transform transform) { - struct wlr_x11_output *output = get_x11_output_from_output(wlr_output); - output->wlr_output.transform = transform; -} - static void output_destroy(struct wlr_output *wlr_output) { struct wlr_x11_output *output = get_x11_output_from_output(wlr_output); struct wlr_x11_backend *x11 = output->x11; @@ -122,7 +116,6 @@ static bool output_commit(struct wlr_output *wlr_output) { static const struct wlr_output_impl output_impl = { .set_custom_mode = output_set_custom_mode, - .transform = output_transform, .destroy = output_destroy, .attach_render = output_attach_render, .commit = output_commit, diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index dc7a76d2..a9a89c34 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -19,8 +19,6 @@ struct wlr_output_impl { bool (*set_mode)(struct wlr_output *output, struct wlr_output_mode *mode); bool (*set_custom_mode)(struct wlr_output *output, int32_t width, int32_t height, int32_t refresh); - void (*transform)(struct wlr_output *output, - enum wl_output_transform transform); bool (*set_cursor)(struct wlr_output *output, struct wlr_texture *texture, int32_t scale, enum wl_output_transform transform, int32_t hotspot_x, int32_t hotspot_y, bool update_texture); diff --git a/types/wlr_output.c b/types/wlr_output.c index 6926ab60..9d32855f 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -217,7 +217,11 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width, void wlr_output_set_transform(struct wlr_output *output, enum wl_output_transform transform) { - output->impl->transform(output, transform); + if (output->transform == transform) { + return; + } + + output->transform = transform; output_update_matrix(output); struct wl_resource *resource; @@ -291,7 +295,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) { void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, const struct wlr_output_impl *impl, struct wl_display *display) { - assert(impl->attach_render && impl->commit && impl->transform); + assert(impl->attach_render && impl->commit); if (impl->set_cursor || impl->move_cursor) { assert(impl->set_cursor && impl->move_cursor); }