mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-15 22:05:31 -05:00
Compare commits
No commits in common. "master" and "0.20.0-rc1" have entirely different histories.
master
...
0.20.0-rc1
30 changed files with 160 additions and 413 deletions
|
|
@ -249,15 +249,3 @@ void handle_libinput_event(struct wlr_libinput_backend *backend,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool button_state_from_libinput(enum libinput_button_state state, enum wlr_button_state *out) {
|
|
||||||
switch (state) {
|
|
||||||
case LIBINPUT_BUTTON_STATE_RELEASED:
|
|
||||||
*out = WLR_BUTTON_RELEASED;
|
|
||||||
return true;
|
|
||||||
case LIBINPUT_BUTTON_STATE_PRESSED:
|
|
||||||
*out = WLR_BUTTON_PRESSED;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
#include <libinput.h>
|
#include <libinput.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wlr/interfaces/wlr_keyboard.h>
|
#include <wlr/interfaces/wlr_keyboard.h>
|
||||||
#include <wlr/util/log.h>
|
|
||||||
#include "backend/libinput.h"
|
#include "backend/libinput.h"
|
||||||
|
|
||||||
struct wlr_libinput_input_device *device_from_keyboard(
|
struct wlr_libinput_input_device *device_from_keyboard(
|
||||||
|
|
@ -31,18 +30,6 @@ void init_device_keyboard(struct wlr_libinput_input_device *dev) {
|
||||||
libinput_device_led_update(dev->handle, 0);
|
libinput_device_led_update(dev->handle, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool key_state_from_libinput(enum libinput_key_state state, enum wl_keyboard_key_state *out) {
|
|
||||||
switch (state) {
|
|
||||||
case LIBINPUT_KEY_STATE_RELEASED:
|
|
||||||
*out = WL_KEYBOARD_KEY_STATE_RELEASED;
|
|
||||||
return true;
|
|
||||||
case LIBINPUT_KEY_STATE_PRESSED:
|
|
||||||
*out = WL_KEYBOARD_KEY_STATE_PRESSED;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle_keyboard_key(struct libinput_event *event,
|
void handle_keyboard_key(struct libinput_event *event,
|
||||||
struct wlr_keyboard *kb) {
|
struct wlr_keyboard *kb) {
|
||||||
struct libinput_event_keyboard *kbevent =
|
struct libinput_event_keyboard *kbevent =
|
||||||
|
|
@ -52,9 +39,13 @@ void handle_keyboard_key(struct libinput_event *event,
|
||||||
.keycode = libinput_event_keyboard_get_key(kbevent),
|
.keycode = libinput_event_keyboard_get_key(kbevent),
|
||||||
.update_state = true,
|
.update_state = true,
|
||||||
};
|
};
|
||||||
if (!key_state_from_libinput(libinput_event_keyboard_get_key_state(kbevent), &wlr_event.state)) {
|
switch (libinput_event_keyboard_get_key_state(kbevent)) {
|
||||||
wlr_log(WLR_DEBUG, "Unhandled libinput key state");
|
case LIBINPUT_KEY_STATE_RELEASED:
|
||||||
return;
|
wlr_event.state = WL_KEYBOARD_KEY_STATE_RELEASED;
|
||||||
|
break;
|
||||||
|
case LIBINPUT_KEY_STATE_PRESSED:
|
||||||
|
wlr_event.state = WL_KEYBOARD_KEY_STATE_PRESSED;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
wlr_keyboard_notify_key(kb, &wlr_event);
|
wlr_keyboard_notify_key(kb, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,3 @@ features += { 'libinput-backend': true }
|
||||||
wlr_deps += libinput
|
wlr_deps += libinput
|
||||||
|
|
||||||
internal_config.set10('HAVE_LIBINPUT_BUSTYPE', libinput.version().version_compare('>=1.26.0'))
|
internal_config.set10('HAVE_LIBINPUT_BUSTYPE', libinput.version().version_compare('>=1.26.0'))
|
||||||
internal_config.set10(
|
|
||||||
'HAVE_LIBINPUT_SWITCH_KEYPAD_SLIDE',
|
|
||||||
libinput.version().version_compare('>=1.30.901')
|
|
||||||
)
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <libinput.h>
|
#include <libinput.h>
|
||||||
#include <wlr/interfaces/wlr_pointer.h>
|
#include <wlr/interfaces/wlr_pointer.h>
|
||||||
#include <wlr/util/log.h>
|
|
||||||
#include "backend/libinput.h"
|
#include "backend/libinput.h"
|
||||||
|
|
||||||
const struct wlr_pointer_impl libinput_pointer_impl = {
|
const struct wlr_pointer_impl libinput_pointer_impl = {
|
||||||
|
|
@ -53,38 +52,6 @@ void handle_pointer_motion_abs(struct libinput_event *event,
|
||||||
wl_signal_emit_mutable(&pointer->events.frame, pointer);
|
wl_signal_emit_mutable(&pointer->events.frame, pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool pointer_button_state_from_libinput(enum libinput_button_state state,
|
|
||||||
enum wl_pointer_button_state *out) {
|
|
||||||
switch (state) {
|
|
||||||
case LIBINPUT_BUTTON_STATE_PRESSED:
|
|
||||||
*out = WL_POINTER_BUTTON_STATE_PRESSED;
|
|
||||||
return true;
|
|
||||||
case LIBINPUT_BUTTON_STATE_RELEASED:
|
|
||||||
*out = WL_POINTER_BUTTON_STATE_RELEASED;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool axis_source_from_libinput(enum libinput_pointer_axis_source source,
|
|
||||||
enum wl_pointer_axis_source *out) {
|
|
||||||
switch (source) {
|
|
||||||
case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
|
|
||||||
*out = WL_POINTER_AXIS_SOURCE_WHEEL;
|
|
||||||
return true;
|
|
||||||
case LIBINPUT_POINTER_AXIS_SOURCE_FINGER:
|
|
||||||
*out = WL_POINTER_AXIS_SOURCE_FINGER;
|
|
||||||
return true;
|
|
||||||
case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
|
|
||||||
*out = WL_POINTER_AXIS_SOURCE_CONTINUOUS;
|
|
||||||
return true;
|
|
||||||
case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT:
|
|
||||||
*out = WL_POINTER_AXIS_SOURCE_WHEEL_TILT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle_pointer_button(struct libinput_event *event,
|
void handle_pointer_button(struct libinput_event *event,
|
||||||
struct wlr_pointer *pointer) {
|
struct wlr_pointer *pointer) {
|
||||||
struct libinput_event_pointer *pevent =
|
struct libinput_event_pointer *pevent =
|
||||||
|
|
@ -94,10 +61,13 @@ void handle_pointer_button(struct libinput_event *event,
|
||||||
.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)),
|
.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)),
|
||||||
.button = libinput_event_pointer_get_button(pevent),
|
.button = libinput_event_pointer_get_button(pevent),
|
||||||
};
|
};
|
||||||
if (!pointer_button_state_from_libinput(libinput_event_pointer_get_button_state(pevent),
|
switch (libinput_event_pointer_get_button_state(pevent)) {
|
||||||
&wlr_event.state)) {
|
case LIBINPUT_BUTTON_STATE_PRESSED:
|
||||||
wlr_log(WLR_DEBUG, "Unhandled libinput button state");
|
wlr_event.state = WL_POINTER_BUTTON_STATE_PRESSED;
|
||||||
return;
|
break;
|
||||||
|
case LIBINPUT_BUTTON_STATE_RELEASED:
|
||||||
|
wlr_event.state = WL_POINTER_BUTTON_STATE_RELEASED;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
wlr_pointer_notify_button(pointer, &wlr_event);
|
wlr_pointer_notify_button(pointer, &wlr_event);
|
||||||
wl_signal_emit_mutable(&pointer->events.frame, pointer);
|
wl_signal_emit_mutable(&pointer->events.frame, pointer);
|
||||||
|
|
@ -111,9 +81,19 @@ void handle_pointer_axis(struct libinput_event *event,
|
||||||
.pointer = pointer,
|
.pointer = pointer,
|
||||||
.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)),
|
.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)),
|
||||||
};
|
};
|
||||||
if (!axis_source_from_libinput(libinput_event_pointer_get_axis_source(pevent), &wlr_event.source)) {
|
switch (libinput_event_pointer_get_axis_source(pevent)) {
|
||||||
wlr_log(WLR_DEBUG, "Unhandled libinput pointer axis source");
|
case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
|
||||||
return;
|
wlr_event.source = WL_POINTER_AXIS_SOURCE_WHEEL;
|
||||||
|
break;
|
||||||
|
case LIBINPUT_POINTER_AXIS_SOURCE_FINGER:
|
||||||
|
wlr_event.source = WL_POINTER_AXIS_SOURCE_FINGER;
|
||||||
|
break;
|
||||||
|
case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
|
||||||
|
wlr_event.source = WL_POINTER_AXIS_SOURCE_CONTINUOUS;
|
||||||
|
break;
|
||||||
|
case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT:
|
||||||
|
wlr_event.source = WL_POINTER_AXIS_SOURCE_WHEEL_TILT;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
const enum libinput_pointer_axis axes[] = {
|
const enum libinput_pointer_axis axes[] = {
|
||||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <libinput.h>
|
#include <libinput.h>
|
||||||
#include <wlr/interfaces/wlr_switch.h>
|
#include <wlr/interfaces/wlr_switch.h>
|
||||||
#include <wlr/util/log.h>
|
|
||||||
#include "backend/libinput.h"
|
#include "backend/libinput.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
const struct wlr_switch_impl libinput_switch_impl = {
|
const struct wlr_switch_impl libinput_switch_impl = {
|
||||||
.name = "libinput-switch",
|
.name = "libinput-switch",
|
||||||
|
|
@ -24,49 +22,28 @@ struct wlr_libinput_input_device *device_from_switch(
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool switch_type_from_libinput(enum libinput_switch type, enum wlr_switch_type *out) {
|
|
||||||
switch (type) {
|
|
||||||
case LIBINPUT_SWITCH_LID:
|
|
||||||
*out = WLR_SWITCH_TYPE_LID;
|
|
||||||
return true;
|
|
||||||
case LIBINPUT_SWITCH_TABLET_MODE:
|
|
||||||
*out = WLR_SWITCH_TYPE_TABLET_MODE;
|
|
||||||
return true;
|
|
||||||
#if HAVE_LIBINPUT_SWITCH_KEYPAD_SLIDE
|
|
||||||
case LIBINPUT_SWITCH_KEYPAD_SLIDE:
|
|
||||||
*out = WLR_SWITCH_TYPE_KEYPAD_SLIDE;
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool switch_state_from_libinput(enum libinput_switch_state state, enum wlr_switch_state *out) {
|
|
||||||
switch (state) {
|
|
||||||
case LIBINPUT_SWITCH_STATE_OFF:
|
|
||||||
*out = WLR_SWITCH_STATE_OFF;
|
|
||||||
return true;
|
|
||||||
case LIBINPUT_SWITCH_STATE_ON:
|
|
||||||
*out = WLR_SWITCH_STATE_ON;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle_switch_toggle(struct libinput_event *event,
|
void handle_switch_toggle(struct libinput_event *event,
|
||||||
struct wlr_switch *wlr_switch) {
|
struct wlr_switch *wlr_switch) {
|
||||||
struct libinput_event_switch *sevent =
|
struct libinput_event_switch *sevent =
|
||||||
libinput_event_get_switch_event(event);
|
libinput_event_get_switch_event (event);
|
||||||
struct wlr_switch_toggle_event wlr_event = {
|
struct wlr_switch_toggle_event wlr_event = {
|
||||||
.time_msec = usec_to_msec(libinput_event_switch_get_time_usec(sevent)),
|
.time_msec = usec_to_msec(libinput_event_switch_get_time_usec(sevent)),
|
||||||
};
|
};
|
||||||
if (!switch_type_from_libinput(libinput_event_switch_get_switch(sevent), &wlr_event.switch_type)) {
|
switch (libinput_event_switch_get_switch(sevent)) {
|
||||||
wlr_log(WLR_DEBUG, "Unhandled libinput switch type");
|
case LIBINPUT_SWITCH_LID:
|
||||||
return;
|
wlr_event.switch_type = WLR_SWITCH_TYPE_LID;
|
||||||
|
break;
|
||||||
|
case LIBINPUT_SWITCH_TABLET_MODE:
|
||||||
|
wlr_event.switch_type = WLR_SWITCH_TYPE_TABLET_MODE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (!switch_state_from_libinput(libinput_event_switch_get_switch_state(sevent), &wlr_event.switch_state)) {
|
switch (libinput_event_switch_get_switch_state(sevent)) {
|
||||||
wlr_log(WLR_DEBUG, "Unhandled libinput switch state");
|
case LIBINPUT_SWITCH_STATE_OFF:
|
||||||
return;
|
wlr_event.switch_state = WLR_SWITCH_STATE_OFF;
|
||||||
|
break;
|
||||||
|
case LIBINPUT_SWITCH_STATE_ON:
|
||||||
|
wlr_event.switch_state = WLR_SWITCH_STATE_ON;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
wl_signal_emit_mutable(&wlr_switch->events.toggle, &wlr_event);
|
wl_signal_emit_mutable(&wlr_switch->events.toggle, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,9 +148,13 @@ void handle_tablet_pad_button(struct libinput_event *event,
|
||||||
.group = libinput_tablet_pad_mode_group_get_index(
|
.group = libinput_tablet_pad_mode_group_get_index(
|
||||||
libinput_event_tablet_pad_get_mode_group(pevent)),
|
libinput_event_tablet_pad_get_mode_group(pevent)),
|
||||||
};
|
};
|
||||||
if (!button_state_from_libinput(libinput_event_tablet_pad_get_button_state(pevent), &wlr_event.state)) {
|
switch (libinput_event_tablet_pad_get_button_state(pevent)) {
|
||||||
wlr_log(WLR_DEBUG, "Unhandled libinput button state");
|
case LIBINPUT_BUTTON_STATE_PRESSED:
|
||||||
return;
|
wlr_event.state = WLR_BUTTON_PRESSED;
|
||||||
|
break;
|
||||||
|
case LIBINPUT_BUTTON_STATE_RELEASED:
|
||||||
|
wlr_event.state = WLR_BUTTON_RELEASED;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
wl_signal_emit_mutable(&tablet_pad->events.button, &wlr_event);
|
wl_signal_emit_mutable(&tablet_pad->events.button, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +168,6 @@ void handle_tablet_pad_ring(struct libinput_event *event,
|
||||||
.ring = libinput_event_tablet_pad_get_ring_number(pevent),
|
.ring = libinput_event_tablet_pad_get_ring_number(pevent),
|
||||||
.position = libinput_event_tablet_pad_get_ring_position(pevent),
|
.position = libinput_event_tablet_pad_get_ring_position(pevent),
|
||||||
.mode = libinput_event_tablet_pad_get_mode(pevent),
|
.mode = libinput_event_tablet_pad_get_mode(pevent),
|
||||||
.source = WLR_TABLET_PAD_RING_SOURCE_UNKNOWN,
|
|
||||||
};
|
};
|
||||||
switch (libinput_event_tablet_pad_get_ring_source(pevent)) {
|
switch (libinput_event_tablet_pad_get_ring_source(pevent)) {
|
||||||
case LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN:
|
case LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN:
|
||||||
|
|
@ -186,7 +189,6 @@ void handle_tablet_pad_strip(struct libinput_event *event,
|
||||||
.strip = libinput_event_tablet_pad_get_strip_number(pevent),
|
.strip = libinput_event_tablet_pad_get_strip_number(pevent),
|
||||||
.position = libinput_event_tablet_pad_get_strip_position(pevent),
|
.position = libinput_event_tablet_pad_get_strip_position(pevent),
|
||||||
.mode = libinput_event_tablet_pad_get_mode(pevent),
|
.mode = libinput_event_tablet_pad_get_mode(pevent),
|
||||||
.source = WLR_TABLET_PAD_STRIP_SOURCE_UNKNOWN,
|
|
||||||
};
|
};
|
||||||
switch (libinput_event_tablet_pad_get_strip_source(pevent)) {
|
switch (libinput_event_tablet_pad_get_strip_source(pevent)) {
|
||||||
case LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN:
|
case LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN:
|
||||||
|
|
|
||||||
|
|
@ -78,61 +78,27 @@ struct wlr_libinput_input_device *device_from_tablet(
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool type_from_libinput(enum libinput_tablet_tool_type type,
|
static enum wlr_tablet_tool_type wlr_type_from_libinput_type(
|
||||||
enum wlr_tablet_tool_type *out) {
|
enum libinput_tablet_tool_type value) {
|
||||||
switch (type) {
|
switch (value) {
|
||||||
case LIBINPUT_TABLET_TOOL_TYPE_PEN:
|
case LIBINPUT_TABLET_TOOL_TYPE_PEN:
|
||||||
*out = WLR_TABLET_TOOL_TYPE_PEN;
|
return WLR_TABLET_TOOL_TYPE_PEN;
|
||||||
return true;
|
|
||||||
case LIBINPUT_TABLET_TOOL_TYPE_ERASER:
|
case LIBINPUT_TABLET_TOOL_TYPE_ERASER:
|
||||||
*out = WLR_TABLET_TOOL_TYPE_ERASER;
|
return WLR_TABLET_TOOL_TYPE_ERASER;
|
||||||
return true;
|
|
||||||
case LIBINPUT_TABLET_TOOL_TYPE_BRUSH:
|
case LIBINPUT_TABLET_TOOL_TYPE_BRUSH:
|
||||||
*out = WLR_TABLET_TOOL_TYPE_BRUSH;
|
return WLR_TABLET_TOOL_TYPE_BRUSH;
|
||||||
return true;
|
|
||||||
case LIBINPUT_TABLET_TOOL_TYPE_PENCIL:
|
case LIBINPUT_TABLET_TOOL_TYPE_PENCIL:
|
||||||
*out = WLR_TABLET_TOOL_TYPE_PENCIL;
|
return WLR_TABLET_TOOL_TYPE_PENCIL;
|
||||||
return true;
|
|
||||||
case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH:
|
case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH:
|
||||||
*out = WLR_TABLET_TOOL_TYPE_AIRBRUSH;
|
return WLR_TABLET_TOOL_TYPE_AIRBRUSH;
|
||||||
return true;
|
|
||||||
case LIBINPUT_TABLET_TOOL_TYPE_MOUSE:
|
case LIBINPUT_TABLET_TOOL_TYPE_MOUSE:
|
||||||
*out = WLR_TABLET_TOOL_TYPE_MOUSE;
|
return WLR_TABLET_TOOL_TYPE_MOUSE;
|
||||||
return true;
|
|
||||||
case LIBINPUT_TABLET_TOOL_TYPE_LENS:
|
case LIBINPUT_TABLET_TOOL_TYPE_LENS:
|
||||||
*out = WLR_TABLET_TOOL_TYPE_LENS;
|
return WLR_TABLET_TOOL_TYPE_LENS;
|
||||||
return true;
|
|
||||||
case LIBINPUT_TABLET_TOOL_TYPE_TOTEM:
|
case LIBINPUT_TABLET_TOOL_TYPE_TOTEM:
|
||||||
*out = WLR_TABLET_TOOL_TYPE_TOTEM;
|
return WLR_TABLET_TOOL_TYPE_TOTEM;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
abort(); // unreachable
|
||||||
}
|
|
||||||
|
|
||||||
static bool proximity_state_from_libinput(enum libinput_tablet_tool_proximity_state state,
|
|
||||||
enum wlr_tablet_tool_proximity_state *out) {
|
|
||||||
switch (state) {
|
|
||||||
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT:
|
|
||||||
*out = WLR_TABLET_TOOL_PROXIMITY_OUT;
|
|
||||||
return true;
|
|
||||||
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN:
|
|
||||||
*out = WLR_TABLET_TOOL_PROXIMITY_IN;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool tip_state_from_libinput(enum libinput_tablet_tool_tip_state state,
|
|
||||||
enum wlr_tablet_tool_tip_state *out) {
|
|
||||||
switch (state) {
|
|
||||||
case LIBINPUT_TABLET_TOOL_TIP_UP:
|
|
||||||
*out = WLR_TABLET_TOOL_TIP_UP;
|
|
||||||
return true;
|
|
||||||
case LIBINPUT_TABLET_TOOL_TIP_DOWN:
|
|
||||||
*out = WLR_TABLET_TOOL_TIP_DOWN;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tablet_tool *get_tablet_tool(
|
static struct tablet_tool *get_tablet_tool(
|
||||||
|
|
@ -144,19 +110,14 @@ static struct tablet_tool *get_tablet_tool(
|
||||||
return tool;
|
return tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum wlr_tablet_tool_type type;
|
|
||||||
if (!type_from_libinput(libinput_tablet_tool_get_type(libinput_tool), &type)) {
|
|
||||||
wlr_log(WLR_DEBUG, "Unhandled libinput tablet tool type");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
tool = calloc(1, sizeof(*tool));
|
tool = calloc(1, sizeof(*tool));
|
||||||
if (tool == NULL) {
|
if (tool == NULL) {
|
||||||
wlr_log_errno(WLR_ERROR, "failed to allocate wlr_libinput_tablet_tool");
|
wlr_log_errno(WLR_ERROR, "failed to allocate wlr_libinput_tablet_tool");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tool->wlr_tool.type = type;
|
tool->wlr_tool.type = wlr_type_from_libinput_type(
|
||||||
|
libinput_tablet_tool_get_type(libinput_tool));
|
||||||
tool->wlr_tool.hardware_serial =
|
tool->wlr_tool.hardware_serial =
|
||||||
libinput_tablet_tool_get_serial(libinput_tool);
|
libinput_tablet_tool_get_serial(libinput_tool);
|
||||||
tool->wlr_tool.hardware_wacom =
|
tool->wlr_tool.hardware_wacom =
|
||||||
|
|
@ -248,12 +209,14 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
|
||||||
.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1),
|
.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!proximity_state_from_libinput(libinput_event_tablet_tool_get_proximity_state(tevent),
|
switch (libinput_event_tablet_tool_get_proximity_state(tevent)) {
|
||||||
&wlr_event.state)) {
|
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT:
|
||||||
wlr_log(WLR_DEBUG, "Unhandled libinput tablet tool proximity state");
|
wlr_event.state = WLR_TABLET_TOOL_PROXIMITY_OUT;
|
||||||
return;
|
break;
|
||||||
|
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN:
|
||||||
|
wlr_event.state = WLR_TABLET_TOOL_PROXIMITY_IN;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_emit_mutable(&wlr_tablet->events.proximity, &wlr_event);
|
wl_signal_emit_mutable(&wlr_tablet->events.proximity, &wlr_event);
|
||||||
|
|
||||||
if (libinput_event_tablet_tool_get_proximity_state(tevent) ==
|
if (libinput_event_tablet_tool_get_proximity_state(tevent) ==
|
||||||
|
|
@ -288,11 +251,14 @@ void handle_tablet_tool_tip(struct libinput_event *event,
|
||||||
.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1),
|
.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!tip_state_from_libinput(libinput_event_tablet_tool_get_tip_state(tevent), &wlr_event.state)) {
|
switch (libinput_event_tablet_tool_get_tip_state(tevent)) {
|
||||||
wlr_log(WLR_DEBUG, "Unhandled libinput tablet tool tip state");
|
case LIBINPUT_TABLET_TOOL_TIP_UP:
|
||||||
return;
|
wlr_event.state = WLR_TABLET_TOOL_TIP_UP;
|
||||||
|
break;
|
||||||
|
case LIBINPUT_TABLET_TOOL_TIP_DOWN:
|
||||||
|
wlr_event.state = WLR_TABLET_TOOL_TIP_DOWN;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_emit_mutable(&wlr_tablet->events.tip, &wlr_event);
|
wl_signal_emit_mutable(&wlr_tablet->events.tip, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,11 +277,13 @@ void handle_tablet_tool_button(struct libinput_event *event,
|
||||||
.time_msec = usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)),
|
.time_msec = usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)),
|
||||||
.button = libinput_event_tablet_tool_get_button(tevent),
|
.button = libinput_event_tablet_tool_get_button(tevent),
|
||||||
};
|
};
|
||||||
|
switch (libinput_event_tablet_tool_get_button_state(tevent)) {
|
||||||
if (!button_state_from_libinput(libinput_event_tablet_tool_get_button_state(tevent), &wlr_event.state)) {
|
case LIBINPUT_BUTTON_STATE_RELEASED:
|
||||||
wlr_log(WLR_DEBUG, "Unhandled libinput button state");
|
wlr_event.state = WLR_BUTTON_RELEASED;
|
||||||
return;
|
break;
|
||||||
|
case LIBINPUT_BUTTON_STATE_PRESSED:
|
||||||
|
wlr_event.state = WLR_BUTTON_PRESSED;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_emit_mutable(&wlr_tablet->events.button, &wlr_event);
|
wl_signal_emit_mutable(&wlr_tablet->events.button, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,7 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
#include "backend/x11.h"
|
#include "backend/x11.h"
|
||||||
#include "render/pixel_format.h"
|
|
||||||
#include "util/time.h"
|
#include "util/time.h"
|
||||||
#include "types/wlr_buffer.h"
|
|
||||||
#include "types/wlr_output.h"
|
#include "types/wlr_output.h"
|
||||||
|
|
||||||
static const uint32_t SUPPORTED_OUTPUT_STATE =
|
static const uint32_t SUPPORTED_OUTPUT_STATE =
|
||||||
|
|
@ -168,20 +166,18 @@ static bool output_test(struct wlr_output *wlr_output,
|
||||||
|
|
||||||
if (state->committed & WLR_OUTPUT_STATE_BUFFER) {
|
if (state->committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||||
struct wlr_buffer *buffer = state->buffer;
|
struct wlr_buffer *buffer = state->buffer;
|
||||||
uint32_t format = buffer_get_drm_format(buffer);
|
struct wlr_dmabuf_attributes dmabuf_attrs;
|
||||||
|
struct wlr_shm_attributes shm_attrs;
|
||||||
|
uint32_t format = DRM_FORMAT_INVALID;
|
||||||
|
if (wlr_buffer_get_dmabuf(buffer, &dmabuf_attrs)) {
|
||||||
|
format = dmabuf_attrs.format;
|
||||||
|
} else if (wlr_buffer_get_shm(buffer, &shm_attrs)) {
|
||||||
|
format = shm_attrs.format;
|
||||||
|
}
|
||||||
if (format != x11->x11_format->drm) {
|
if (format != x11->x11_format->drm) {
|
||||||
wlr_log(WLR_DEBUG, "Unsupported buffer format");
|
wlr_log(WLR_DEBUG, "Unsupported buffer format");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
struct wlr_shm_attributes shm;
|
|
||||||
if (wlr_buffer_get_shm(buffer, &shm)) {
|
|
||||||
const struct wlr_pixel_format_info *info = drm_get_pixel_format_info(format);
|
|
||||||
if (shm.stride != pixel_format_info_min_stride(info, shm.width)) {
|
|
||||||
// xcb_shm_create_pixmap() does not allow arbitrary strides.
|
|
||||||
wlr_log(WLR_DEBUG, "Unsupported shm buffer stride");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state->committed & WLR_OUTPUT_STATE_MODE) {
|
if (state->committed & WLR_OUTPUT_STATE_MODE) {
|
||||||
|
|
@ -271,12 +267,6 @@ static xcb_pixmap_t import_shm(struct wlr_x11_output *output,
|
||||||
return XCB_PIXMAP_NONE;
|
return XCB_PIXMAP_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct wlr_pixel_format_info *info = drm_get_pixel_format_info(shm->format);
|
|
||||||
if (shm->stride != pixel_format_info_min_stride(info, shm->width)) {
|
|
||||||
// xcb_shm_create_pixmap() does not allow arbitrary strides.
|
|
||||||
return XCB_PIXMAP_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// xcb closes the FD after sending it
|
// xcb closes the FD after sending it
|
||||||
int fd = fcntl(shm->fd, F_DUPFD_CLOEXEC, 0);
|
int fd = fcntl(shm->fd, F_DUPFD_CLOEXEC, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,4 @@ void handle_tablet_pad_ring(struct libinput_event *event,
|
||||||
void handle_tablet_pad_strip(struct libinput_event *event,
|
void handle_tablet_pad_strip(struct libinput_event *event,
|
||||||
struct wlr_tablet_pad *tablet_pad);
|
struct wlr_tablet_pad *tablet_pad);
|
||||||
|
|
||||||
bool button_state_from_libinput(enum libinput_button_state state, enum wlr_button_state *out);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,4 @@ enum wl_shm_format convert_drm_format_to_wl_shm(uint32_t fmt);
|
||||||
*/
|
*/
|
||||||
bool pixel_format_has_alpha(uint32_t fmt);
|
bool pixel_format_has_alpha(uint32_t fmt);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if the DRM FourCC fmt belongs to a YCbCr colorspace family, false otherwise.
|
|
||||||
*/
|
|
||||||
bool pixel_format_is_ycbcr(uint32_t fmt);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ struct wlr_vk_format {
|
||||||
uint32_t drm;
|
uint32_t drm;
|
||||||
VkFormat vk;
|
VkFormat vk;
|
||||||
VkFormat vk_srgb; // sRGB version of the format, or 0 if nonexistent
|
VkFormat vk_srgb; // sRGB version of the format, or 0 if nonexistent
|
||||||
|
bool is_ycbcr;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const VkImageUsageFlags vulkan_render_usage, vulkan_shm_tex_usage, vulkan_dma_tex_usage;
|
extern const VkImageUsageFlags vulkan_render_usage, vulkan_shm_tex_usage, vulkan_dma_tex_usage;
|
||||||
|
|
@ -124,7 +125,6 @@ void vulkan_format_props_query(struct wlr_vk_device *dev,
|
||||||
const struct wlr_vk_format_modifier_props *vulkan_format_props_find_modifier(
|
const struct wlr_vk_format_modifier_props *vulkan_format_props_find_modifier(
|
||||||
const struct wlr_vk_format_props *props, uint64_t mod, bool render);
|
const struct wlr_vk_format_props *props, uint64_t mod, bool render);
|
||||||
void vulkan_format_props_finish(struct wlr_vk_format_props *props);
|
void vulkan_format_props_finish(struct wlr_vk_format_props *props);
|
||||||
bool vulkan_format_is_ycbcr(const struct wlr_vk_format *format);
|
|
||||||
|
|
||||||
struct wlr_vk_pipeline_layout_key {
|
struct wlr_vk_pipeline_layout_key {
|
||||||
enum wlr_scale_filter_mode filter_mode;
|
enum wlr_scale_filter_mode filter_mode;
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,4 @@ struct wlr_client_buffer *wlr_client_buffer_create(struct wlr_buffer *buffer,
|
||||||
bool wlr_client_buffer_apply_damage(struct wlr_client_buffer *client_buffer,
|
bool wlr_client_buffer_apply_damage(struct wlr_client_buffer *client_buffer,
|
||||||
struct wlr_buffer *next, const pixman_region32_t *damage);
|
struct wlr_buffer *next, const pixman_region32_t *damage);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the DRM format of the buffer. If this buffer isn't shared
|
|
||||||
* memory or a DMA-BUF, returns DRM_FORMAT_INVALID.
|
|
||||||
*/
|
|
||||||
uint32_t buffer_get_drm_format(struct wlr_buffer *buffer);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -49,30 +49,30 @@ struct wlr_cursor {
|
||||||
* your responsibility.
|
* your responsibility.
|
||||||
*/
|
*/
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal motion; // struct wlr_pointer_motion_event
|
struct wl_signal motion;
|
||||||
struct wl_signal motion_absolute; // struct wlr_pointer_motion_absolute_event
|
struct wl_signal motion_absolute;
|
||||||
struct wl_signal button; // struct wlr_pointer_button_event
|
struct wl_signal button;
|
||||||
struct wl_signal axis; // struct wlr_pointer_axis_event
|
struct wl_signal axis;
|
||||||
struct wl_signal frame;
|
struct wl_signal frame;
|
||||||
struct wl_signal swipe_begin; // struct wlr_pointer_swipe_begin_event
|
struct wl_signal swipe_begin;
|
||||||
struct wl_signal swipe_update; // struct wlr_pointer_swipe_update_event
|
struct wl_signal swipe_update;
|
||||||
struct wl_signal swipe_end; // struct wlr_pointer_swipe_end_event
|
struct wl_signal swipe_end;
|
||||||
struct wl_signal pinch_begin; // struct wlr_pointer_pinch_begin_event
|
struct wl_signal pinch_begin;
|
||||||
struct wl_signal pinch_update; // struct wlr_pointer_pinch_update_event
|
struct wl_signal pinch_update;
|
||||||
struct wl_signal pinch_end; // struct wlr_pointer_pinch_end_event
|
struct wl_signal pinch_end;
|
||||||
struct wl_signal hold_begin; // struct wlr_pointer_hold_begin_event
|
struct wl_signal hold_begin;
|
||||||
struct wl_signal hold_end; // struct wlr_pointer_hold_end_event
|
struct wl_signal hold_end;
|
||||||
|
|
||||||
struct wl_signal touch_up; // struct wlr_touch_up_event
|
struct wl_signal touch_up;
|
||||||
struct wl_signal touch_down; // struct wlr_touch_down_event
|
struct wl_signal touch_down;
|
||||||
struct wl_signal touch_motion; // struct wlr_touch_motion_event
|
struct wl_signal touch_motion;
|
||||||
struct wl_signal touch_cancel; // struct wlr_touch_cancel_event
|
struct wl_signal touch_cancel;
|
||||||
struct wl_signal touch_frame;
|
struct wl_signal touch_frame;
|
||||||
|
|
||||||
struct wl_signal tablet_tool_axis; // struct wlr_tablet_tool_axis_event
|
struct wl_signal tablet_tool_axis;
|
||||||
struct wl_signal tablet_tool_proximity; // struct wlr_tablet_tool_proximity_event
|
struct wl_signal tablet_tool_proximity;
|
||||||
struct wl_signal tablet_tool_tip; // struct wlr_tablet_tool_tip_event
|
struct wl_signal tablet_tool_tip;
|
||||||
struct wl_signal tablet_tool_button; // struct wlr_tablet_tool_button_event
|
struct wl_signal tablet_tool_button;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ struct wlr_switch {
|
||||||
enum wlr_switch_type {
|
enum wlr_switch_type {
|
||||||
WLR_SWITCH_TYPE_LID,
|
WLR_SWITCH_TYPE_LID,
|
||||||
WLR_SWITCH_TYPE_TABLET_MODE,
|
WLR_SWITCH_TYPE_TABLET_MODE,
|
||||||
WLR_SWITCH_TYPE_KEYPAD_SLIDE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum wlr_switch_state {
|
enum wlr_switch_state {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
project(
|
project(
|
||||||
'wlroots',
|
'wlroots',
|
||||||
'c',
|
'c',
|
||||||
version: '0.20.0-rc2',
|
version: '0.20.0-rc1',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
meson_version: '>=1.3',
|
meson_version: '>=1.3',
|
||||||
default_options: [
|
default_options: [
|
||||||
|
|
|
||||||
|
|
@ -167,9 +167,10 @@ bool wlr_drm_syncobj_timeline_check(struct wlr_drm_syncobj_timeline *timeline,
|
||||||
etime = ETIME;
|
etime = ETIME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ret = drmSyncobjTimelineWait(timeline->drm_fd, &timeline->handle, &point, 1, 0, flags, NULL);
|
uint32_t signaled_point;
|
||||||
|
int ret = drmSyncobjTimelineWait(timeline->drm_fd, &timeline->handle, &point, 1, 0, flags, &signaled_point);
|
||||||
if (ret != 0 && ret != -etime) {
|
if (ret != 0 && ret != -etime) {
|
||||||
wlr_log_errno(WLR_ERROR, "drmSyncobjTimelineWait() failed");
|
wlr_log_errno(WLR_ERROR, "drmSyncobjWait() failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -307,68 +307,3 @@ bool pixel_format_has_alpha(uint32_t fmt) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pixel_format_is_ycbcr(uint32_t format) {
|
|
||||||
switch (format) {
|
|
||||||
case DRM_FORMAT_AYUV:
|
|
||||||
case DRM_FORMAT_NV12:
|
|
||||||
case DRM_FORMAT_NV15:
|
|
||||||
case DRM_FORMAT_NV16:
|
|
||||||
case DRM_FORMAT_NV20:
|
|
||||||
case DRM_FORMAT_NV21:
|
|
||||||
case DRM_FORMAT_NV24:
|
|
||||||
case DRM_FORMAT_NV30:
|
|
||||||
case DRM_FORMAT_NV42:
|
|
||||||
case DRM_FORMAT_NV61:
|
|
||||||
case DRM_FORMAT_P010:
|
|
||||||
case DRM_FORMAT_P012:
|
|
||||||
case DRM_FORMAT_P016:
|
|
||||||
case DRM_FORMAT_P030:
|
|
||||||
case DRM_FORMAT_P210:
|
|
||||||
case DRM_FORMAT_Q401:
|
|
||||||
case DRM_FORMAT_Q410:
|
|
||||||
case DRM_FORMAT_S010:
|
|
||||||
case DRM_FORMAT_S012:
|
|
||||||
case DRM_FORMAT_S016:
|
|
||||||
case DRM_FORMAT_S210:
|
|
||||||
case DRM_FORMAT_S212:
|
|
||||||
case DRM_FORMAT_S216:
|
|
||||||
case DRM_FORMAT_S410:
|
|
||||||
case DRM_FORMAT_S412:
|
|
||||||
case DRM_FORMAT_S416:
|
|
||||||
case DRM_FORMAT_UYVY:
|
|
||||||
case DRM_FORMAT_VUY101010:
|
|
||||||
case DRM_FORMAT_VUY888:
|
|
||||||
case DRM_FORMAT_VYUY:
|
|
||||||
case DRM_FORMAT_X0L0:
|
|
||||||
case DRM_FORMAT_X0L2:
|
|
||||||
case DRM_FORMAT_XVYU12_16161616:
|
|
||||||
case DRM_FORMAT_XVYU16161616:
|
|
||||||
case DRM_FORMAT_XVYU2101010:
|
|
||||||
case DRM_FORMAT_XYUV8888:
|
|
||||||
case DRM_FORMAT_Y0L0:
|
|
||||||
case DRM_FORMAT_Y0L2:
|
|
||||||
case DRM_FORMAT_Y210:
|
|
||||||
case DRM_FORMAT_Y212:
|
|
||||||
case DRM_FORMAT_Y216:
|
|
||||||
case DRM_FORMAT_Y410:
|
|
||||||
case DRM_FORMAT_Y412:
|
|
||||||
case DRM_FORMAT_Y416:
|
|
||||||
case DRM_FORMAT_YUV410:
|
|
||||||
case DRM_FORMAT_YUV411:
|
|
||||||
case DRM_FORMAT_YUV420:
|
|
||||||
case DRM_FORMAT_YUV420_10BIT:
|
|
||||||
case DRM_FORMAT_YUV420_8BIT:
|
|
||||||
case DRM_FORMAT_YUV422:
|
|
||||||
case DRM_FORMAT_YUV444:
|
|
||||||
case DRM_FORMAT_YUYV:
|
|
||||||
case DRM_FORMAT_YVU410:
|
|
||||||
case DRM_FORMAT_YVU411:
|
|
||||||
case DRM_FORMAT_YVU420:
|
|
||||||
case DRM_FORMAT_YVU422:
|
|
||||||
case DRM_FORMAT_YVU444:
|
|
||||||
case DRM_FORMAT_YVYU:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -822,13 +822,12 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum wlr_color_encoding color_encoding = options->color_encoding;
|
enum wlr_color_encoding color_encoding = options->color_encoding;
|
||||||
bool is_ycbcr = vulkan_format_is_ycbcr(texture->format);
|
if (texture->format->is_ycbcr && color_encoding == WLR_COLOR_ENCODING_NONE) {
|
||||||
if (is_ycbcr && color_encoding == WLR_COLOR_ENCODING_NONE) {
|
|
||||||
color_encoding = WLR_COLOR_ENCODING_BT601;
|
color_encoding = WLR_COLOR_ENCODING_BT601;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum wlr_color_range color_range = options->color_range;
|
enum wlr_color_range color_range = options->color_range;
|
||||||
if (is_ycbcr && color_range == WLR_COLOR_RANGE_NONE) {
|
if (texture->format->is_ycbcr && color_range == WLR_COLOR_RANGE_NONE) {
|
||||||
color_range = WLR_COLOR_RANGE_LIMITED;
|
color_range = WLR_COLOR_RANGE_LIMITED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -838,7 +837,7 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
|
||||||
.source = WLR_VK_SHADER_SOURCE_TEXTURE,
|
.source = WLR_VK_SHADER_SOURCE_TEXTURE,
|
||||||
.layout = {
|
.layout = {
|
||||||
.ycbcr = {
|
.ycbcr = {
|
||||||
.format = is_ycbcr ? texture->format : NULL,
|
.format = texture->format->is_ycbcr ? texture->format : NULL,
|
||||||
.encoding = color_encoding,
|
.encoding = color_encoding,
|
||||||
.range = color_range,
|
.range = color_range,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -182,30 +182,37 @@ static const struct wlr_vk_format formats[] = {
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_UYVY,
|
.drm = DRM_FORMAT_UYVY,
|
||||||
.vk = VK_FORMAT_B8G8R8G8_422_UNORM,
|
.vk = VK_FORMAT_B8G8R8G8_422_UNORM,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_YUYV,
|
.drm = DRM_FORMAT_YUYV,
|
||||||
.vk = VK_FORMAT_G8B8G8R8_422_UNORM,
|
.vk = VK_FORMAT_G8B8G8R8_422_UNORM,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_NV12,
|
.drm = DRM_FORMAT_NV12,
|
||||||
.vk = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM,
|
.vk = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_NV16,
|
.drm = DRM_FORMAT_NV16,
|
||||||
.vk = VK_FORMAT_G8_B8R8_2PLANE_422_UNORM,
|
.vk = VK_FORMAT_G8_B8R8_2PLANE_422_UNORM,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_YUV420,
|
.drm = DRM_FORMAT_YUV420,
|
||||||
.vk = VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM,
|
.vk = VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_YUV422,
|
.drm = DRM_FORMAT_YUV422,
|
||||||
.vk = VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM,
|
.vk = VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_YUV444,
|
.drm = DRM_FORMAT_YUV444,
|
||||||
.vk = VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM,
|
.vk = VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
// 3PACK16 formats split the memory in three 16-bit words, so they have an
|
// 3PACK16 formats split the memory in three 16-bit words, so they have an
|
||||||
// inverted channel order compared to DRM formats.
|
// inverted channel order compared to DRM formats.
|
||||||
|
|
@ -213,22 +220,27 @@ static const struct wlr_vk_format formats[] = {
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_P010,
|
.drm = DRM_FORMAT_P010,
|
||||||
.vk = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16,
|
.vk = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_P210,
|
.drm = DRM_FORMAT_P210,
|
||||||
.vk = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16,
|
.vk = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_P012,
|
.drm = DRM_FORMAT_P012,
|
||||||
.vk = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16,
|
.vk = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_P016,
|
.drm = DRM_FORMAT_P016,
|
||||||
.vk = VK_FORMAT_G16_B16R16_2PLANE_420_UNORM,
|
.vk = VK_FORMAT_G16_B16R16_2PLANE_420_UNORM,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.drm = DRM_FORMAT_Q410,
|
.drm = DRM_FORMAT_Q410,
|
||||||
.vk = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16,
|
.vk = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16,
|
||||||
|
.is_ycbcr = true,
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
// TODO: add DRM_FORMAT_NV24/VK_FORMAT_G8_B8R8_2PLANE_444_UNORM (requires
|
// TODO: add DRM_FORMAT_NV24/VK_FORMAT_G8_B8R8_2PLANE_444_UNORM (requires
|
||||||
|
|
@ -434,7 +446,7 @@ static bool query_modifier_support(struct wlr_vk_device *dev,
|
||||||
// check that specific modifier for render usage
|
// check that specific modifier for render usage
|
||||||
const char *errmsg = "unknown error";
|
const char *errmsg = "unknown error";
|
||||||
if ((m.drmFormatModifierTilingFeatures & render_features) == render_features &&
|
if ((m.drmFormatModifierTilingFeatures & render_features) == render_features &&
|
||||||
!vulkan_format_is_ycbcr(&props->format)) {
|
!props->format.is_ycbcr) {
|
||||||
struct wlr_vk_format_modifier_props p = {0};
|
struct wlr_vk_format_modifier_props p = {0};
|
||||||
bool supported = false;
|
bool supported = false;
|
||||||
if (query_modifier_usage_support(dev, props->format.vk,
|
if (query_modifier_usage_support(dev, props->format.vk,
|
||||||
|
|
@ -465,7 +477,7 @@ static bool query_modifier_support(struct wlr_vk_device *dev,
|
||||||
// check that specific modifier for texture usage
|
// check that specific modifier for texture usage
|
||||||
errmsg = "unknown error";
|
errmsg = "unknown error";
|
||||||
VkFormatFeatureFlags features = dma_tex_features;
|
VkFormatFeatureFlags features = dma_tex_features;
|
||||||
if (vulkan_format_is_ycbcr(&props->format)) {
|
if (props->format.is_ycbcr) {
|
||||||
features |= ycbcr_tex_features;
|
features |= ycbcr_tex_features;
|
||||||
}
|
}
|
||||||
if ((m.drmFormatModifierTilingFeatures & features) == features) {
|
if ((m.drmFormatModifierTilingFeatures & features) == features) {
|
||||||
|
|
@ -510,7 +522,7 @@ static bool query_modifier_support(struct wlr_vk_device *dev,
|
||||||
|
|
||||||
void vulkan_format_props_query(struct wlr_vk_device *dev,
|
void vulkan_format_props_query(struct wlr_vk_device *dev,
|
||||||
const struct wlr_vk_format *format) {
|
const struct wlr_vk_format *format) {
|
||||||
if (vulkan_format_is_ycbcr(format) && !dev->sampler_ycbcr_conversion) {
|
if (format->is_ycbcr && !dev->sampler_ycbcr_conversion) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -539,7 +551,7 @@ void vulkan_format_props_query(struct wlr_vk_device *dev,
|
||||||
char shm_texture_status[256];
|
char shm_texture_status[256];
|
||||||
const char *errmsg = "unknown error";
|
const char *errmsg = "unknown error";
|
||||||
if ((fmtp.formatProperties.optimalTilingFeatures & shm_tex_features) == shm_tex_features &&
|
if ((fmtp.formatProperties.optimalTilingFeatures & shm_tex_features) == shm_tex_features &&
|
||||||
!vulkan_format_is_ycbcr(format) && format_info != NULL) {
|
!format->is_ycbcr && format_info != NULL) {
|
||||||
VkImageFormatProperties ifmtp;
|
VkImageFormatProperties ifmtp;
|
||||||
bool supported = false, has_mutable_srgb = false;
|
bool supported = false, has_mutable_srgb = false;
|
||||||
if (query_shm_support(dev, format->vk, format->vk_srgb, &ifmtp, &errmsg)) {
|
if (query_shm_support(dev, format->vk, format->vk_srgb, &ifmtp, &errmsg)) {
|
||||||
|
|
@ -609,7 +621,3 @@ const struct wlr_vk_format_modifier_props *vulkan_format_props_find_modifier(
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool vulkan_format_is_ycbcr(const struct wlr_vk_format *format) {
|
|
||||||
return pixel_format_is_ycbcr(format->drm);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1630,8 +1630,8 @@ static bool init_blend_to_output_layouts(struct wlr_vk_renderer *renderer) {
|
||||||
static bool pipeline_layout_key_equals(
|
static bool pipeline_layout_key_equals(
|
||||||
const struct wlr_vk_pipeline_layout_key *a,
|
const struct wlr_vk_pipeline_layout_key *a,
|
||||||
const struct wlr_vk_pipeline_layout_key *b) {
|
const struct wlr_vk_pipeline_layout_key *b) {
|
||||||
assert(!a->ycbcr.format || vulkan_format_is_ycbcr(a->ycbcr.format));
|
assert(!a->ycbcr.format || a->ycbcr.format->is_ycbcr);
|
||||||
assert(!b->ycbcr.format || vulkan_format_is_ycbcr(b->ycbcr.format));
|
assert(!b->ycbcr.format || b->ycbcr.format->is_ycbcr);
|
||||||
|
|
||||||
if (a->filter_mode != b->filter_mode) {
|
if (a->filter_mode != b->filter_mode) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2039,8 +2039,8 @@ struct wlr_vk_pipeline_layout *get_or_create_pipeline_layout(
|
||||||
};
|
};
|
||||||
sampler_create_info.pNext = &conversion_info;
|
sampler_create_info.pNext = &conversion_info;
|
||||||
} else {
|
} else {
|
||||||
assert(key->ycbcr.encoding == WLR_COLOR_ENCODING_NONE || key->ycbcr.encoding == WLR_COLOR_ENCODING_IDENTITY);
|
assert(key->ycbcr.encoding == WLR_COLOR_ENCODING_NONE);
|
||||||
assert(key->ycbcr.range == WLR_COLOR_RANGE_NONE || key->ycbcr.range == WLR_COLOR_RANGE_FULL);
|
assert(key->ycbcr.range == WLR_COLOR_RANGE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = vkCreateSampler(renderer->dev->dev, &sampler_create_info, NULL, &pipeline_layout->sampler);
|
res = vkCreateSampler(renderer->dev->dev, &sampler_create_info, NULL, &pipeline_layout->sampler);
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ struct wlr_vk_texture_view *vulkan_texture_get_or_create_view(struct wlr_vk_text
|
||||||
.components.r = VK_COMPONENT_SWIZZLE_IDENTITY,
|
.components.r = VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||||
.components.g = VK_COMPONENT_SWIZZLE_IDENTITY,
|
.components.g = VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||||
.components.b = VK_COMPONENT_SWIZZLE_IDENTITY,
|
.components.b = VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||||
.components.a = texture->has_alpha || vulkan_format_is_ycbcr(texture->format)
|
.components.a = texture->has_alpha || texture->format->is_ycbcr
|
||||||
? VK_COMPONENT_SWIZZLE_IDENTITY
|
? VK_COMPONENT_SWIZZLE_IDENTITY
|
||||||
: VK_COMPONENT_SWIZZLE_ONE,
|
: VK_COMPONENT_SWIZZLE_ONE,
|
||||||
.subresourceRange = (VkImageSubresourceRange){
|
.subresourceRange = (VkImageSubresourceRange){
|
||||||
|
|
@ -311,7 +311,7 @@ struct wlr_vk_texture_view *vulkan_texture_get_or_create_view(struct wlr_vk_text
|
||||||
};
|
};
|
||||||
|
|
||||||
VkSamplerYcbcrConversionInfo ycbcr_conversion_info;
|
VkSamplerYcbcrConversionInfo ycbcr_conversion_info;
|
||||||
if (vulkan_format_is_ycbcr(texture->format)) {
|
if (texture->format->is_ycbcr) {
|
||||||
assert(pipeline_layout->ycbcr.conversion != VK_NULL_HANDLE);
|
assert(pipeline_layout->ycbcr.conversion != VK_NULL_HANDLE);
|
||||||
ycbcr_conversion_info = (VkSamplerYcbcrConversionInfo){
|
ycbcr_conversion_info = (VkSamplerYcbcrConversionInfo){
|
||||||
.sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO,
|
.sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO,
|
||||||
|
|
@ -355,7 +355,7 @@ struct wlr_vk_texture_view *vulkan_texture_get_or_create_view(struct wlr_vk_text
|
||||||
|
|
||||||
static void texture_set_format(struct wlr_vk_texture *texture,
|
static void texture_set_format(struct wlr_vk_texture *texture,
|
||||||
const struct wlr_vk_format *format, bool has_mutable_srgb) {
|
const struct wlr_vk_format *format, bool has_mutable_srgb) {
|
||||||
assert(!(vulkan_format_is_ycbcr(format) && has_mutable_srgb));
|
assert(!(format->is_ycbcr && has_mutable_srgb));
|
||||||
|
|
||||||
texture->format = format;
|
texture->format = format;
|
||||||
texture->using_mutable_srgb = has_mutable_srgb;
|
texture->using_mutable_srgb = has_mutable_srgb;
|
||||||
|
|
@ -366,7 +366,7 @@ static void texture_set_format(struct wlr_vk_texture *texture,
|
||||||
texture->has_alpha = pixel_format_has_alpha(format->drm);
|
texture->has_alpha = pixel_format_has_alpha(format->drm);
|
||||||
} else {
|
} else {
|
||||||
// We don't have format info for multi-planar formats
|
// We don't have format info for multi-planar formats
|
||||||
assert(vulkan_format_is_ycbcr(texture->format));
|
assert(texture->format->is_ycbcr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -378,7 +378,7 @@ static struct wlr_texture *vulkan_texture_from_pixels(
|
||||||
|
|
||||||
const struct wlr_vk_format_props *fmt =
|
const struct wlr_vk_format_props *fmt =
|
||||||
vulkan_format_props_from_drm(renderer->dev, drm_fmt);
|
vulkan_format_props_from_drm(renderer->dev, drm_fmt);
|
||||||
if (fmt == NULL || vulkan_format_is_ycbcr(&fmt->format)) {
|
if (fmt == NULL || fmt->format.is_ycbcr) {
|
||||||
char *format_name = drmGetFormatName(drm_fmt);
|
char *format_name = drmGetFormatName(drm_fmt);
|
||||||
wlr_log(WLR_ERROR, "Unsupported pixel format %s (0x%08"PRIX32")",
|
wlr_log(WLR_ERROR, "Unsupported pixel format %s (0x%08"PRIX32")",
|
||||||
format_name, drm_fmt);
|
format_name, drm_fmt);
|
||||||
|
|
|
||||||
|
|
@ -109,11 +109,14 @@ bool wlr_buffer_get_shm(struct wlr_buffer *buffer,
|
||||||
|
|
||||||
bool wlr_buffer_is_opaque(struct wlr_buffer *buffer) {
|
bool wlr_buffer_is_opaque(struct wlr_buffer *buffer) {
|
||||||
void *data;
|
void *data;
|
||||||
uint32_t format = buffer_get_drm_format(buffer);
|
uint32_t format;
|
||||||
size_t stride;
|
size_t stride;
|
||||||
|
struct wlr_dmabuf_attributes dmabuf;
|
||||||
if (format != DRM_FORMAT_INVALID) {
|
struct wlr_shm_attributes shm;
|
||||||
// pass
|
if (wlr_buffer_get_dmabuf(buffer, &dmabuf)) {
|
||||||
|
format = dmabuf.format;
|
||||||
|
} else if (wlr_buffer_get_shm(buffer, &shm)) {
|
||||||
|
format = shm.format;
|
||||||
} else if (wlr_buffer_begin_data_ptr_access(buffer,
|
} else if (wlr_buffer_begin_data_ptr_access(buffer,
|
||||||
WLR_BUFFER_DATA_PTR_ACCESS_READ, &data, &format, &stride)) {
|
WLR_BUFFER_DATA_PTR_ACCESS_READ, &data, &format, &stride)) {
|
||||||
bool opaque = false;
|
bool opaque = false;
|
||||||
|
|
@ -132,15 +135,3 @@ bool wlr_buffer_is_opaque(struct wlr_buffer *buffer) {
|
||||||
|
|
||||||
return !pixel_format_has_alpha(format);
|
return !pixel_format_has_alpha(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t buffer_get_drm_format(struct wlr_buffer *buffer) {
|
|
||||||
uint32_t format = DRM_FORMAT_INVALID;
|
|
||||||
struct wlr_dmabuf_attributes dmabuf;
|
|
||||||
struct wlr_shm_attributes shm;
|
|
||||||
if (wlr_buffer_get_dmabuf(buffer, &dmabuf)) {
|
|
||||||
format = dmabuf.format;
|
|
||||||
} else if (wlr_buffer_get_shm(buffer, &shm)) {
|
|
||||||
format = shm.format;
|
|
||||||
}
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,8 @@ static void source_update_buffer_constraints(struct scene_node_source *source,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool output_test(struct wlr_output *output, const struct wlr_output_state *state) {
|
static bool output_test(struct wlr_output *output, const struct wlr_output_state *state) {
|
||||||
|
struct scene_node_source *source = wl_container_of(output, source, output);
|
||||||
|
|
||||||
uint32_t supported =
|
uint32_t supported =
|
||||||
WLR_OUTPUT_STATE_BACKEND_OPTIONAL |
|
WLR_OUTPUT_STATE_BACKEND_OPTIONAL |
|
||||||
WLR_OUTPUT_STATE_BUFFER |
|
WLR_OUTPUT_STATE_BUFFER |
|
||||||
|
|
|
||||||
|
|
@ -2086,12 +2086,8 @@ static enum scene_direct_scanout_result scene_entry_try_direct_scanout(
|
||||||
return SCANOUT_INELIGIBLE;
|
return SCANOUT_INELIGIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_color_repr_none = buffer->color_encoding == WLR_COLOR_ENCODING_NONE &&
|
if (buffer->color_encoding != WLR_COLOR_ENCODING_NONE ||
|
||||||
buffer->color_range == WLR_COLOR_RANGE_NONE;
|
buffer->color_range != WLR_COLOR_RANGE_NONE) {
|
||||||
bool is_color_repr_identity_full = buffer->color_encoding == WLR_COLOR_ENCODING_IDENTITY &&
|
|
||||||
buffer->color_range == WLR_COLOR_RANGE_FULL;
|
|
||||||
|
|
||||||
if (!(is_color_repr_none || is_color_repr_identity_full)) {
|
|
||||||
return SCANOUT_INELIGIBLE;
|
return SCANOUT_INELIGIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <drm_fourcc.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
#include <wlr/types/wlr_buffer.h>
|
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
#include <wlr/types/wlr_color_representation_v1.h>
|
#include <wlr/types/wlr_color_representation_v1.h>
|
||||||
#include <wlr/util/addon.h>
|
#include <wlr/util/addon.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
#include "color-representation-v1-protocol.h"
|
#include "color-representation-v1-protocol.h"
|
||||||
#include "render/pixel_format.h"
|
|
||||||
#include "types/wlr_buffer.h"
|
|
||||||
#include "util/mem.h"
|
#include "util/mem.h"
|
||||||
|
|
||||||
#define WP_COLOR_REPRESENTATION_VERSION 1
|
#define WP_COLOR_REPRESENTATION_VERSION 1
|
||||||
|
|
@ -234,44 +230,8 @@ static void color_repr_manager_handle_destroy(struct wl_client *client,
|
||||||
wl_resource_destroy(resource);
|
wl_resource_destroy(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void surface_synced_commit(struct wlr_surface_synced *synced) {
|
|
||||||
struct wlr_color_representation_v1 *color_repr = wl_container_of(synced, color_repr, synced);
|
|
||||||
|
|
||||||
if (color_repr->current.coefficients == 0 && color_repr->current.range == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t drm_format = DRM_FORMAT_INVALID;
|
|
||||||
if (color_repr->surface->buffer){
|
|
||||||
drm_format = buffer_get_drm_format(&color_repr->surface->buffer->base);
|
|
||||||
}
|
|
||||||
if (drm_format == DRM_FORMAT_INVALID) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
bool is_ycbcr = pixel_format_is_ycbcr(drm_format);
|
|
||||||
|
|
||||||
bool is_identity_full =
|
|
||||||
color_repr->current.coefficients == WP_COLOR_REPRESENTATION_SURFACE_V1_COEFFICIENTS_IDENTITY &&
|
|
||||||
color_repr->current.range == WP_COLOR_REPRESENTATION_SURFACE_V1_RANGE_FULL;
|
|
||||||
|
|
||||||
if (is_ycbcr) {
|
|
||||||
if (is_identity_full) {
|
|
||||||
wl_resource_post_error(color_repr->resource,
|
|
||||||
WP_COLOR_REPRESENTATION_SURFACE_V1_ERROR_PIXEL_FORMAT,
|
|
||||||
"unexpected encoding/range for yuv");
|
|
||||||
}
|
|
||||||
} else /* rgb */ {
|
|
||||||
if (!is_identity_full) {
|
|
||||||
wl_resource_post_error(color_repr->resource,
|
|
||||||
WP_COLOR_REPRESENTATION_SURFACE_V1_ERROR_PIXEL_FORMAT,
|
|
||||||
"unexpected encoding/range for rgb");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct wlr_surface_synced_impl surface_synced_impl = {
|
static const struct wlr_surface_synced_impl surface_synced_impl = {
|
||||||
.state_size = sizeof(struct wlr_color_representation_v1_surface_state),
|
.state_size = sizeof(struct wlr_color_representation_v1_surface_state),
|
||||||
.commit = surface_synced_commit
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct wlr_color_representation_v1 *color_repr_from_surface(
|
static struct wlr_color_representation_v1 *color_repr_from_surface(
|
||||||
|
|
@ -316,7 +276,6 @@ static void color_repr_manager_handle_get_surface(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
color_repr->manager = manager_from_resource(manager_resource);
|
color_repr->manager = manager_from_resource(manager_resource);
|
||||||
color_repr->surface = surface;
|
|
||||||
|
|
||||||
if (!wlr_surface_synced_init(&color_repr->synced, surface,
|
if (!wlr_surface_synced_init(&color_repr->synced, surface,
|
||||||
&surface_synced_impl, &color_repr->pending, &color_repr->current)) {
|
&surface_synced_impl, &color_repr->pending, &color_repr->current)) {
|
||||||
|
|
@ -468,10 +427,6 @@ struct wlr_color_representation_manager_v1 *wlr_color_representation_manager_v1_
|
||||||
|
|
||||||
struct wlr_color_representation_v1_coeffs_and_range coeffs_and_ranges[COEFFICIENTS_LEN * RANGES_LEN];
|
struct wlr_color_representation_v1_coeffs_and_range coeffs_and_ranges[COEFFICIENTS_LEN * RANGES_LEN];
|
||||||
size_t coeffs_and_ranges_len = 0;
|
size_t coeffs_and_ranges_len = 0;
|
||||||
coeffs_and_ranges[coeffs_and_ranges_len++] = (struct wlr_color_representation_v1_coeffs_and_range){
|
|
||||||
.coeffs = WP_COLOR_REPRESENTATION_SURFACE_V1_COEFFICIENTS_IDENTITY,
|
|
||||||
.range = WP_COLOR_REPRESENTATION_SURFACE_V1_RANGE_FULL,
|
|
||||||
};
|
|
||||||
for (size_t i = 0; i < COEFFICIENTS_LEN; i++) {
|
for (size_t i = 0; i < COEFFICIENTS_LEN; i++) {
|
||||||
enum wp_color_representation_surface_v1_coefficients coeffs = coefficients[i];
|
enum wp_color_representation_surface_v1_coefficients coeffs = coefficients[i];
|
||||||
enum wlr_color_encoding enc = wlr_color_representation_v1_color_encoding_to_wlr(coeffs);
|
enum wlr_color_encoding enc = wlr_color_representation_v1_color_encoding_to_wlr(coeffs);
|
||||||
|
|
|
||||||
|
|
@ -956,7 +956,7 @@ static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
static void handle_tablet_tool_button(struct wl_listener *listener,
|
static void handle_tablet_tool_button(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_tablet_tool_button_event *event = data;
|
struct wlr_tablet_tool_button *event = data;
|
||||||
struct wlr_cursor_device *device;
|
struct wlr_cursor_device *device;
|
||||||
device = wl_container_of(listener, device, tablet_tool_button);
|
device = wl_container_of(listener, device, tablet_tool_button);
|
||||||
wl_signal_emit_mutable(&device->cursor->events.tablet_tool_button, event);
|
wl_signal_emit_mutable(&device->cursor->events.tablet_tool_button, event);
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ void wlr_keyboard_group_remove_keyboard(struct wlr_keyboard_group *group,
|
||||||
void wlr_keyboard_group_destroy(struct wlr_keyboard_group *group) {
|
void wlr_keyboard_group_destroy(struct wlr_keyboard_group *group) {
|
||||||
struct keyboard_group_device *device, *tmp_device;
|
struct keyboard_group_device *device, *tmp_device;
|
||||||
wl_list_for_each_safe(device, tmp_device, &group->devices, link) {
|
wl_list_for_each_safe(device, tmp_device, &group->devices, link) {
|
||||||
remove_keyboard_group_device(device);
|
wlr_keyboard_group_remove_keyboard(group, device->keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now group->keys might not be empty if a wlr_keyboard has emitted
|
// Now group->keys might not be empty if a wlr_keyboard has emitted
|
||||||
|
|
|
||||||
|
|
@ -381,15 +381,13 @@ static bool source_get_targets(struct wlr_xwm_selection *selection,
|
||||||
free(mime_type);
|
free(mime_type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*mime_type_ptr = mime_type;
|
||||||
|
|
||||||
xcb_atom_t *atom_ptr =
|
xcb_atom_t *atom_ptr =
|
||||||
wl_array_add(mime_types_atoms, sizeof(*atom_ptr));
|
wl_array_add(mime_types_atoms, sizeof(*atom_ptr));
|
||||||
if (atom_ptr == NULL) {
|
if (atom_ptr == NULL) {
|
||||||
mime_types->size -= sizeof(*mime_type_ptr);
|
|
||||||
free(mime_type);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*mime_type_ptr = mime_type;
|
|
||||||
*atom_ptr = value[i];
|
*atom_ptr = value[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <drm_fourcc.h>
|
#include <drm_fourcc.h>
|
||||||
#include <poll.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wlr/types/wlr_buffer.h>
|
#include <wlr/types/wlr_buffer.h>
|
||||||
|
|
@ -2882,20 +2881,5 @@ xcb_connection_t *wlr_xwayland_get_xwm_connection(
|
||||||
}
|
}
|
||||||
|
|
||||||
void xwm_schedule_flush(struct wlr_xwm *xwm) {
|
void xwm_schedule_flush(struct wlr_xwm *xwm) {
|
||||||
struct pollfd pollfd = {
|
|
||||||
.fd = xcb_get_file_descriptor(xwm->xcb_conn),
|
|
||||||
.events = POLLOUT,
|
|
||||||
};
|
|
||||||
if (poll(&pollfd, 1, 0) < 0) {
|
|
||||||
wlr_log(WLR_ERROR, "poll() failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we can write immediately, do so
|
|
||||||
if (pollfd.revents & POLLOUT) {
|
|
||||||
xcb_flush(xwm->xcb_conn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_event_source_fd_update(xwm->event_source, WL_EVENT_READABLE | WL_EVENT_WRITABLE);
|
wl_event_source_fd_update(xwm->event_source, WL_EVENT_READABLE | WL_EVENT_WRITABLE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue