Merge pull request #1148 from emersion/rename-linux-dmabuf

linux-dmabuf: add v1 suffix
This commit is contained in:
Drew DeVault 2018-07-19 14:09:12 -07:00 committed by GitHub
commit 8d03bc9178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 56 additions and 56 deletions

View File

@ -8,7 +8,7 @@
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_input_inhibitor.h>
#include <wlr/types/wlr_layer_shell.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_list.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h>
@ -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;

View File

@ -5,7 +5,7 @@
#include <wayland-server-protocol.h>
#include <wlr/render/dmabuf.h>
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

View File

@ -6,7 +6,7 @@
#include <time.h>
#include <wayland-server.h>
#include <wayland-util.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/render/dmabuf.h>
struct wlr_output_mode {
uint32_t flags; // enum wl_output_mode

View File

@ -13,7 +13,7 @@
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_input_inhibitor.h>
#include <wlr/types/wlr_layer_shell.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_server_decoration.h>
@ -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(

View File

@ -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',

View File

@ -1,8 +1,8 @@
#include <assert.h>
#include <stdlib.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/util/log.h>
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

View File

@ -2,8 +2,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <wlr/interfaces/wlr_output.h>
#include <wlr/render/dmabuf.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_output.h>
#include "wlr-export-dmabuf-unstable-v1-protocol.h"
#include <wlr/util/log.h>

View File

@ -4,7 +4,7 @@
#include <unistd.h>
#include <wayland-server.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/util/log.h>
#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;