Skip to content

Commit

Permalink
feat: bump version to 0.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lichenggang authored and Zeno-sole committed Jan 3, 2025
1 parent ea138c3 commit 95c1494
Show file tree
Hide file tree
Showing 18 changed files with 162 additions and 36 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ indent_style = tab
indent_size = 4
max_line_length = 100

[/.git/**]
max_line_length = unset

[*.xml]
indent_style = space
indent_size = 2
14 changes: 8 additions & 6 deletions backend/drm/atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,20 @@ static bool create_gamma_lut_blob(struct wlr_drm_backend *drm,

bool create_fb_damage_clips_blob(struct wlr_drm_backend *drm,
int width, int height, const pixman_region32_t *damage, uint32_t *blob_id) {
if (!pixman_region32_not_empty(damage)) {
*blob_id = 0;
return true;
}

pixman_region32_t clipped;
pixman_region32_init(&clipped);
pixman_region32_intersect_rect(&clipped, damage, 0, 0, width, height);

int rects_len;
const pixman_box32_t *rects = pixman_region32_rectangles(&clipped, &rects_len);
int ret = drmModeCreatePropertyBlob(drm->fd, rects, sizeof(*rects) * rects_len, blob_id);

int ret;
if (rects_len > 0) {
ret = drmModeCreatePropertyBlob(drm->fd, rects, sizeof(*rects) * rects_len, blob_id);
} else {
ret = 0;
*blob_id = 0;
}
pixman_region32_fini(&clipped);
if (ret != 0) {
wlr_log_errno(WLR_ERROR, "Failed to create FB_DAMAGE_CLIPS property blob");
Expand Down
26 changes: 26 additions & 0 deletions backend/drm/drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,16 @@ static void drm_connector_apply_commit(const struct wlr_drm_connector_state *sta

conn->cursor_enabled = false;
conn->crtc = NULL;

// Legacy uAPI doesn't support requesting page-flip events when
// turning off a CRTC
if (page_flip != NULL && conn->backend->iface == &legacy_iface) {
drm_page_flip_pop(page_flip, crtc->id);
conn->pending_page_flip = NULL;
if (page_flip->connectors_len == 0) {
drm_page_flip_destroy(page_flip);
}
}
}
}

Expand Down Expand Up @@ -803,6 +813,22 @@ static bool drm_connector_prepare(struct wlr_drm_connector_state *conn_state, bo
return false;
}

if ((state->committed & WLR_OUTPUT_STATE_BUFFER) && conn->backend->mgpu_renderer.wlr_rend) {
struct wlr_dmabuf_attributes dmabuf;
if (!wlr_buffer_get_dmabuf(state->buffer, &dmabuf)) {
wlr_drm_conn_log(conn, WLR_DEBUG, "Buffer is not a DMA-BUF");
return false;
}

if (!wlr_drm_format_set_has(&conn->backend->mgpu_formats, dmabuf.format, dmabuf.modifier)) {
wlr_drm_conn_log(conn, WLR_DEBUG,
"Buffer format 0x%"PRIX32" with modifier 0x%"PRIX64" cannot be "
"imported into multi-GPU renderer",
dmabuf.format, dmabuf.modifier);
return false;
}
}

if (test_only && conn->backend->parent) {
// If we're running as a secondary GPU, we can't perform an atomic
// commit without blitting a buffer.
Expand Down
6 changes: 4 additions & 2 deletions backend/drm/legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static bool legacy_crtc_commit(const struct wlr_drm_connector_state *state,
state->base->adaptive_sync_enabled ? "enabled" : "disabled");
}

if (cursor != NULL && drm_connector_is_cursor_visible(conn)) {
if (cursor != NULL && state->active && drm_connector_is_cursor_visible(conn)) {
struct wlr_drm_fb *cursor_fb = state->cursor_fb;
if (cursor_fb == NULL) {
wlr_drm_conn_log(conn, WLR_DEBUG, "Failed to acquire cursor FB");
Expand Down Expand Up @@ -170,7 +170,9 @@ static bool legacy_crtc_commit(const struct wlr_drm_connector_state *state,
}
}

if (flags & DRM_MODE_PAGE_FLIP_EVENT) {
// Legacy uAPI doesn't support requesting page-flip events when
// turning off a CRTC
if (state->active && (flags & DRM_MODE_PAGE_FLIP_EVENT)) {
if (drmModePageFlip(drm->fd, crtc->id, fb_id, flags, page_flip)) {
wlr_drm_conn_log_errno(conn, WLR_ERROR, "drmModePageFlip failed");
return false;
Expand Down
1 change: 1 addition & 0 deletions backend/headless/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ static void output_destroy(struct wlr_output *wlr_output) {

static const struct wlr_output_impl output_impl = {
.destroy = output_destroy,
.test = output_test,
.commit = output_commit,
};

Expand Down
2 changes: 1 addition & 1 deletion backend/wayland/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static struct wl_buffer *import_shm(struct wlr_wl_backend *wl,
struct wlr_shm_attributes *shm) {
enum wl_shm_format wl_shm_format = convert_drm_format_to_wl_shm(shm->format);
uint32_t size = shm->stride * shm->height;
struct wl_shm_pool *pool = wl_shm_create_pool(wl->shm, shm->fd, size);
struct wl_shm_pool *pool = wl_shm_create_pool(wl->shm, shm->fd, shm->offset + size);
if (pool == NULL) {
return NULL;
}
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wlroots (0.18.2-1deepin1) unstable; urgency=medium

* update 0.18.2.

-- lichenggang <[email protected]> Tue, 31 Dec 2024 17:25:02 +0800

wlroots (0.18.1-1deepin3) unstable; urgency=medium

* data-device: fix dnd handling during popup interactions
Expand Down
2 changes: 1 addition & 1 deletion include/types/wlr_keyboard.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <wlr/types/wlr_keyboard.h>

void keyboard_key_update(struct wlr_keyboard *keyboard,
bool keyboard_key_update(struct wlr_keyboard *keyboard,
struct wlr_keyboard_key_event *event);

bool keyboard_modifier_update(struct wlr_keyboard *keyboard);
Expand Down
1 change: 1 addition & 0 deletions include/wlr/types/wlr_data_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ struct wlr_drag {

struct wl_listener source_destroy;
struct wl_listener seat_client_destroy;
struct wl_listener focus_destroy;
struct wl_listener icon_destroy;

void *data;
Expand Down
4 changes: 4 additions & 0 deletions include/xwayland/xwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ struct wlr_xwm {

struct wlr_drag *drag;
struct wlr_xwayland_surface *drag_focus;
struct wlr_xwayland_surface *drop_focus;

const xcb_query_extension_reply_t *xfixes;
const xcb_query_extension_reply_t *xres;
Expand All @@ -144,6 +145,8 @@ struct wlr_xwm {
struct wl_listener seat_drag_drop;
struct wl_listener seat_drag_destroy;
struct wl_listener seat_drag_source_destroy;
struct wl_listener drag_focus_destroy;
struct wl_listener drop_focus_destroy;
};

struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland, int wm_fd);
Expand All @@ -156,6 +159,7 @@ void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride,
int xwm_handle_selection_event(struct wlr_xwm *xwm, xcb_generic_event_t *event);
int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
xcb_client_message_event_t *ev);
void xwm_seat_unlink_drag_handlers(struct wlr_xwm *xwm);

void xwm_set_seat(struct wlr_xwm *xwm, struct wlr_seat *seat);

Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(
'wlroots',
'c',
version: '0.18.1',
version: '0.18.2',
license: 'MIT',
meson_version: '>=0.59.0',
default_options: [
Expand Down
2 changes: 2 additions & 0 deletions render/vulkan/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ struct wlr_vk_buffer_span vulkan_get_stage_span(struct wlr_vk_renderer *r,
goto error_alloc;
}

wl_list_init(&buf->link);

VkResult res;
VkBufferCreateInfo buf_info = {
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
Expand Down
18 changes: 17 additions & 1 deletion types/data_device/wlr_drag.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ static void drag_handle_seat_client_destroy(struct wl_listener *listener,
wl_list_remove(&drag->seat_client_destroy.link);
}

static void drag_set_focus(struct wlr_drag *drag,
struct wlr_surface *surface, double sx, double sy);

static void drag_handle_focus_destroy(struct wl_listener *listener, void *data) {
struct wlr_drag *drag = wl_container_of(listener, drag, focus_destroy);
drag_set_focus(drag, NULL, 0, 0);
}

static void drag_set_focus(struct wlr_drag *drag,
struct wlr_surface *surface, double sx, double sy) {
if (drag->focus == surface) {
Expand Down Expand Up @@ -48,9 +56,12 @@ static void drag_set_focus(struct wlr_drag *drag,
}

drag->focus_client = NULL;
drag->focus = NULL;
}

wl_list_remove(&drag->focus_destroy.link);
wl_list_init(&drag->focus_destroy.link);
drag->focus = NULL;

if (!surface) {
goto out;
}
Expand Down Expand Up @@ -99,6 +110,8 @@ static void drag_set_focus(struct wlr_drag *drag,

drag->focus = surface;
drag->focus_client = focus_client;
drag->focus_destroy.notify = drag_handle_focus_destroy;
wl_signal_add(&surface->events.destroy, &drag->focus_destroy);
drag->seat_client_destroy.notify = drag_handle_seat_client_destroy;
wl_signal_add(&focus_client->events.destroy, &drag->seat_client_destroy);

Expand Down Expand Up @@ -150,6 +163,7 @@ static void drag_destroy(struct wlr_drag *drag) {
if (drag->source) {
wl_list_remove(&drag->source_destroy.link);
}
wl_list_remove(&drag->focus_destroy.link);

if (drag->icon != NULL) {
drag_icon_destroy(drag->icon);
Expand Down Expand Up @@ -410,6 +424,8 @@ struct wlr_drag *wlr_drag_create(struct wlr_seat_client *seat_client,
wl_signal_init(&drag->events.drop);
wl_signal_init(&drag->events.destroy);

wl_list_init(&drag->focus_destroy.link);

drag->seat = seat_client->seat;
drag->seat_client = seat_client;

Expand Down
10 changes: 7 additions & 3 deletions types/wlr_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ bool keyboard_modifier_update(struct wlr_keyboard *keyboard) {
return true;
}

void keyboard_key_update(struct wlr_keyboard *keyboard,
bool keyboard_key_update(struct wlr_keyboard *keyboard,
struct wlr_keyboard_key_event *event) {
size_t old_num_keycodes = keyboard->num_keycodes;
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
set_add(keyboard->keycodes, &keyboard->num_keycodes,
WLR_KEYBOARD_KEYS_CAP, event->keycode);
Expand All @@ -77,6 +78,8 @@ void keyboard_key_update(struct wlr_keyboard *keyboard,
}

assert(keyboard->num_keycodes <= WLR_KEYBOARD_KEYS_CAP);

return old_num_keycodes != keyboard->num_keycodes;
}

void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
Expand All @@ -98,8 +101,9 @@ void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,

void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
struct wlr_keyboard_key_event *event) {
keyboard_key_update(keyboard, event);
wl_signal_emit_mutable(&keyboard->events.key, event);
if (keyboard_key_update(keyboard, event)) {
wl_signal_emit_mutable(&keyboard->events.key, event);
}

if (keyboard->xkb_state == NULL) {
return;
Expand Down
4 changes: 2 additions & 2 deletions types/wlr_output_management_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ static void manager_send_head(struct wlr_output_manager_v1 *manager,
head_send_mode(head, head_resource, mode);
}

if (output->current_mode == NULL) {
if (head->state.mode == NULL && head->state.enabled) {
// Output doesn't have a fixed mode set. Send a virtual one.
head_send_mode(head, head_resource, NULL);
}
Expand Down Expand Up @@ -927,7 +927,7 @@ static bool manager_update_head(struct wlr_output_manager_v1 *manager,
}
}

if (next->mode == NULL && !head_has_custom_mode_resources(head)) {
if (next->mode == NULL && next->enabled && !head_has_custom_mode_resources(head)) {
struct wl_resource *resource;
wl_resource_for_each(resource, &head->resources) {
head_send_mode(head, resource, NULL);
Expand Down
Loading

0 comments on commit 95c1494

Please sign in to comment.