From 5dbf0fe7f257edc3e96f3cf4ebf067f12c806419 Mon Sep 17 00:00:00 2001 From: emersion Date: Thu, 19 Jul 2018 21:50:00 +0100 Subject: [PATCH] linux-dmabuf: add v1 suffix This prevents some future conflicts with the stable version. Fixes #1133 --- include/rootston/desktop.h | 4 +- ...r_linux_dmabuf.h => wlr_linux_dmabuf_v1.h} | 16 ++--- include/wlr/types/wlr_output.h | 2 +- rootston/desktop.c | 4 +- types/meson.build | 2 +- types/wlr_buffer.c | 16 ++--- types/wlr_export_dmabuf_v1.c | 2 +- ...r_linux_dmabuf.c => wlr_linux_dmabuf_v1.c} | 66 +++++++++---------- 8 files changed, 56 insertions(+), 56 deletions(-) rename include/wlr/types/{wlr_linux_dmabuf.h => wlr_linux_dmabuf_v1.h} (71%) rename types/{wlr_linux_dmabuf.c => wlr_linux_dmabuf_v1.c} (88%) diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index d9add26a7..2d28fa105 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -52,7 +52,7 @@ struct roots_desktop { struct wlr_idle *idle; struct wlr_idle_inhibit_manager_v1 *idle_inhibit; struct wlr_input_inhibit_manager *input_inhibit; - struct wlr_linux_dmabuf *linux_dmabuf; + struct wlr_linux_dmabuf_v1 *linux_dmabuf; struct wlr_layer_shell *layer_shell; struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; struct wlr_screencopy_manager_v1 *screencopy; diff --git a/include/wlr/types/wlr_linux_dmabuf.h b/include/wlr/types/wlr_linux_dmabuf_v1.h similarity index 71% rename from include/wlr/types/wlr_linux_dmabuf.h rename to include/wlr/types/wlr_linux_dmabuf_v1.h index 4a03170cd..43bc83858 100644 --- a/include/wlr/types/wlr_linux_dmabuf.h +++ b/include/wlr/types/wlr_linux_dmabuf_v1.h @@ -5,7 +5,7 @@ #include #include -struct wlr_dmabuf_buffer { +struct wlr_dmabuf_v1_buffer { struct wlr_renderer *renderer; struct wl_resource *buffer_resource; struct wl_resource *params_resource; @@ -17,24 +17,24 @@ struct wlr_dmabuf_buffer { * Returns true if the given resource was created via the linux-dmabuf * buffer protocol, false otherwise */ -bool wlr_dmabuf_resource_is_buffer(struct wl_resource *buffer_resource); +bool wlr_dmabuf_v1_resource_is_buffer(struct wl_resource *buffer_resource); /** * Returns the wlr_dmabuf_buffer if the given resource was created * via the linux-dmabuf buffer protocol */ -struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_buffer_resource( +struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_buffer_resource( struct wl_resource *buffer_resource); /** * Returns the wlr_dmabuf_buffer if the given resource was created * via the linux-dmabuf params protocol */ -struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource( +struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_params_resource( struct wl_resource *params_resource); /* the protocol interface */ -struct wlr_linux_dmabuf { +struct wlr_linux_dmabuf_v1 { struct wl_global *global; struct wlr_renderer *renderer; struct wl_list resources; @@ -50,18 +50,18 @@ struct wlr_linux_dmabuf { /** * Create linux-dmabuf interface */ -struct wlr_linux_dmabuf *wlr_linux_dmabuf_create(struct wl_display *display, +struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display, struct wlr_renderer *renderer); /** * Destroy the linux-dmabuf interface */ -void wlr_linux_dmabuf_destroy(struct wlr_linux_dmabuf *linux_dmabuf); +void wlr_linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf); /** * Returns the wlr_linux_dmabuf if the given resource was created * via the linux_dmabuf protocol */ -struct wlr_linux_dmabuf *wlr_linux_dmabuf_from_resource( +struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_from_resource( struct wl_resource *resource); #endif diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 5084eb5a3..c93ed2ebb 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include struct wlr_output_mode { uint32_t flags; // enum wl_output_mode diff --git a/rootston/desktop.c b/rootston/desktop.c index 3f9faf242..5277dcc73 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -871,7 +871,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, wl_signal_add(&desktop->input_inhibit->events.deactivate, &desktop->input_inhibit_deactivate); - desktop->linux_dmabuf = wlr_linux_dmabuf_create(server->wl_display, + desktop->linux_dmabuf = wlr_linux_dmabuf_v1_create(server->wl_display, server->renderer); desktop->virtual_keyboard = wlr_virtual_keyboard_manager_v1_create( diff --git a/types/meson.build b/types/meson.build index 0b8584f89..55c0e3bad 100644 --- a/types/meson.build +++ b/types/meson.build @@ -31,7 +31,7 @@ lib_wlr_types = static_library( 'wlr_input_inhibitor.c', 'wlr_keyboard.c', 'wlr_layer_shell.c', - 'wlr_linux_dmabuf.c', + 'wlr_linux_dmabuf_v1.c', 'wlr_list.c', 'wlr_matrix.c', 'wlr_output_damage.c', diff --git a/types/wlr_buffer.c b/types/wlr_buffer.c index 5e4aedac6..55ed47921 100644 --- a/types/wlr_buffer.c +++ b/types/wlr_buffer.c @@ -1,8 +1,8 @@ #include #include -#include -#include #include +#include +#include #include bool wlr_resource_is_buffer(struct wl_resource *resource) { @@ -21,9 +21,9 @@ bool wlr_buffer_get_resource_size(struct wl_resource *resource, resource)) { wlr_renderer_wl_drm_buffer_get_size(renderer, resource, width, height); - } else if (wlr_dmabuf_resource_is_buffer(resource)) { - struct wlr_dmabuf_buffer *dmabuf = - wlr_dmabuf_buffer_from_buffer_resource(resource); + } else if (wlr_dmabuf_v1_resource_is_buffer(resource)) { + struct wlr_dmabuf_v1_buffer *dmabuf = + wlr_dmabuf_v1_buffer_from_buffer_resource(resource); *width = dmabuf->attributes.width; *height = dmabuf->attributes.height; } else { @@ -77,9 +77,9 @@ struct wlr_buffer *wlr_buffer_create(struct wlr_renderer *renderer, released = true; } else if (wlr_renderer_resource_is_wl_drm_buffer(renderer, resource)) { texture = wlr_texture_from_wl_drm(renderer, resource); - } else if (wlr_dmabuf_resource_is_buffer(resource)) { - struct wlr_dmabuf_buffer *dmabuf = - wlr_dmabuf_buffer_from_buffer_resource(resource); + } else if (wlr_dmabuf_v1_resource_is_buffer(resource)) { + struct wlr_dmabuf_v1_buffer *dmabuf = + wlr_dmabuf_v1_buffer_from_buffer_resource(resource); texture = wlr_texture_from_dmabuf(renderer, &dmabuf->attributes); // We have imported the DMA-BUF, but we need to prevent the client from diff --git a/types/wlr_export_dmabuf_v1.c b/types/wlr_export_dmabuf_v1.c index 060f4afaa..72c9bcecb 100644 --- a/types/wlr_export_dmabuf_v1.c +++ b/types/wlr_export_dmabuf_v1.c @@ -2,8 +2,8 @@ #include #include #include +#include #include -#include #include #include "wlr-export-dmabuf-unstable-v1-protocol.h" #include diff --git a/types/wlr_linux_dmabuf.c b/types/wlr_linux_dmabuf_v1.c similarity index 88% rename from types/wlr_linux_dmabuf.c rename to types/wlr_linux_dmabuf_v1.c index 2d5259d80..f72e7c070 100644 --- a/types/wlr_linux_dmabuf.c +++ b/types/wlr_linux_dmabuf_v1.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include "linux-dmabuf-unstable-v1-protocol.h" #include "util/signal.h" @@ -20,13 +20,13 @@ static const struct wl_buffer_interface buffer_impl = { .destroy = buffer_handle_destroy, }; -bool wlr_dmabuf_resource_is_buffer(struct wl_resource *buffer_resource) { +bool wlr_dmabuf_v1_resource_is_buffer(struct wl_resource *buffer_resource) { if (!wl_resource_instance_of(buffer_resource, &wl_buffer_interface, &buffer_impl)) { return false; } - struct wlr_dmabuf_buffer *buffer = + struct wlr_dmabuf_v1_buffer *buffer = wl_resource_get_user_data(buffer_resource); if (buffer && buffer->buffer_resource && !buffer->params_resource && buffer->buffer_resource == buffer_resource) { @@ -36,12 +36,12 @@ bool wlr_dmabuf_resource_is_buffer(struct wl_resource *buffer_resource) { return false; } -struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_buffer_resource( +struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_buffer_resource( struct wl_resource *buffer_resource) { assert(wl_resource_instance_of(buffer_resource, &wl_buffer_interface, &buffer_impl)); - struct wlr_dmabuf_buffer *buffer = + struct wlr_dmabuf_v1_buffer *buffer = wl_resource_get_user_data(buffer_resource); assert(buffer); assert(buffer->buffer_resource); @@ -51,7 +51,7 @@ struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_buffer_resource( return buffer; } -static void linux_dmabuf_buffer_destroy(struct wlr_dmabuf_buffer *buffer) { +static void linux_dmabuf_buffer_destroy(struct wlr_dmabuf_v1_buffer *buffer) { wlr_dmabuf_attributes_finish(&buffer->attributes); free(buffer); } @@ -65,8 +65,8 @@ static void params_add(struct wl_client *client, struct wl_resource *params_resource, int32_t fd, uint32_t plane_idx, uint32_t offset, uint32_t stride, uint32_t modifier_hi, uint32_t modifier_lo) { - struct wlr_dmabuf_buffer *buffer = - wlr_dmabuf_buffer_from_params_resource(params_resource); + struct wlr_dmabuf_v1_buffer *buffer = + wlr_dmabuf_v1_buffer_from_params_resource(params_resource); if (!buffer) { wl_resource_post_error(params_resource, @@ -113,12 +113,12 @@ static void params_add(struct wl_client *client, } static void buffer_handle_resource_destroy(struct wl_resource *buffer_resource) { - struct wlr_dmabuf_buffer *buffer = - wlr_dmabuf_buffer_from_buffer_resource(buffer_resource); + struct wlr_dmabuf_v1_buffer *buffer = + wlr_dmabuf_v1_buffer_from_buffer_resource(buffer_resource); linux_dmabuf_buffer_destroy(buffer); } -static bool check_import_dmabuf(struct wlr_dmabuf_buffer *buffer) { +static bool check_import_dmabuf(struct wlr_dmabuf_v1_buffer *buffer) { struct wlr_texture *texture = wlr_texture_from_dmabuf(buffer->renderer, &buffer->attributes); if (texture == NULL) { @@ -140,8 +140,8 @@ static void params_create_common(struct wl_client *client, "params was already used to create a wl_buffer"); return; } - struct wlr_dmabuf_buffer *buffer = - wlr_dmabuf_buffer_from_params_resource(params_resource); + struct wlr_dmabuf_v1_buffer *buffer = + wlr_dmabuf_v1_buffer_from_params_resource(params_resource); /* Switch the linux_dmabuf_buffer object from params resource to * eventually wl_buffer resource. */ @@ -302,13 +302,13 @@ static const struct zwp_linux_buffer_params_v1_interface .create_immed = params_create_immed, }; -struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource( +struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_params_resource( struct wl_resource *params_resource) { assert(wl_resource_instance_of(params_resource, &zwp_linux_buffer_params_v1_interface, &linux_buffer_params_impl)); - struct wlr_dmabuf_buffer *buffer = + struct wlr_dmabuf_v1_buffer *buffer = wl_resource_get_user_data(params_resource); assert(buffer); assert(buffer->params_resource); @@ -319,24 +319,24 @@ struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource( } static void handle_params_destroy(struct wl_resource *params_resource) { - /* Check for NULL since wlr_dmabuf_buffer_from_params_resource will choke */ + /* Check for NULL since wlr_dmabuf_v1_buffer_from_params_resource will choke */ if (!wl_resource_get_user_data(params_resource)) { return; } - struct wlr_dmabuf_buffer *buffer = - wlr_dmabuf_buffer_from_params_resource(params_resource); + struct wlr_dmabuf_v1_buffer *buffer = + wlr_dmabuf_v1_buffer_from_params_resource(params_resource); linux_dmabuf_buffer_destroy(buffer); } static void linux_dmabuf_create_params(struct wl_client *client, struct wl_resource *linux_dmabuf_resource, uint32_t params_id) { - struct wlr_linux_dmabuf *linux_dmabuf = - wlr_linux_dmabuf_from_resource(linux_dmabuf_resource); + struct wlr_linux_dmabuf_v1 *linux_dmabuf = + wlr_linux_dmabuf_v1_from_resource(linux_dmabuf_resource); uint32_t version = wl_resource_get_version(linux_dmabuf_resource); - struct wlr_dmabuf_buffer *buffer = calloc(1, sizeof *buffer); + struct wlr_dmabuf_v1_buffer *buffer = calloc(1, sizeof *buffer); if (!buffer) { goto err; } @@ -372,17 +372,17 @@ static const struct zwp_linux_dmabuf_v1_interface linux_dmabuf_impl = { .create_params = linux_dmabuf_create_params, }; -struct wlr_linux_dmabuf *wlr_linux_dmabuf_from_resource( +struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_from_resource( struct wl_resource *resource) { assert(wl_resource_instance_of(resource, &zwp_linux_dmabuf_v1_interface, &linux_dmabuf_impl)); - struct wlr_linux_dmabuf *dmabuf = wl_resource_get_user_data(resource); + struct wlr_linux_dmabuf_v1 *dmabuf = wl_resource_get_user_data(resource); assert(dmabuf); return dmabuf; } -static void linux_dmabuf_send_modifiers(struct wlr_linux_dmabuf *linux_dmabuf, +static void linux_dmabuf_send_modifiers(struct wlr_linux_dmabuf_v1 *linux_dmabuf, struct wl_resource *resource) { struct wlr_renderer *renderer = linux_dmabuf->renderer; /* @@ -428,7 +428,7 @@ static void linux_dmabuf_resource_destroy(struct wl_resource *resource) { static void linux_dmabuf_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id) { - struct wlr_linux_dmabuf *linux_dmabuf = data; + struct wlr_linux_dmabuf_v1 *linux_dmabuf = data; struct wl_resource *resource = wl_resource_create(client, &zwp_linux_dmabuf_v1_interface, version, id); @@ -445,7 +445,7 @@ static void linux_dmabuf_bind(struct wl_client *client, void *data, } } -void wlr_linux_dmabuf_destroy(struct wlr_linux_dmabuf *linux_dmabuf) { +void wlr_linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf) { if (!linux_dmabuf) { return; } @@ -465,21 +465,21 @@ void wlr_linux_dmabuf_destroy(struct wlr_linux_dmabuf *linux_dmabuf) { } static void handle_display_destroy(struct wl_listener *listener, void *data) { - struct wlr_linux_dmabuf *linux_dmabuf = + struct wlr_linux_dmabuf_v1 *linux_dmabuf = wl_container_of(listener, linux_dmabuf, display_destroy); - wlr_linux_dmabuf_destroy(linux_dmabuf); + wlr_linux_dmabuf_v1_destroy(linux_dmabuf); } static void handle_renderer_destroy(struct wl_listener *listener, void *data) { - struct wlr_linux_dmabuf *linux_dmabuf = + struct wlr_linux_dmabuf_v1 *linux_dmabuf = wl_container_of(listener, linux_dmabuf, renderer_destroy); - wlr_linux_dmabuf_destroy(linux_dmabuf); + wlr_linux_dmabuf_v1_destroy(linux_dmabuf); } -struct wlr_linux_dmabuf *wlr_linux_dmabuf_create(struct wl_display *display, +struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display, struct wlr_renderer *renderer) { - struct wlr_linux_dmabuf *linux_dmabuf = - calloc(1, sizeof(struct wlr_linux_dmabuf)); + struct wlr_linux_dmabuf_v1 *linux_dmabuf = + calloc(1, sizeof(struct wlr_linux_dmabuf_v1)); if (linux_dmabuf == NULL) { wlr_log(WLR_ERROR, "could not create simple dmabuf manager"); return NULL;