28 | 28 |
.destroy = frame_handle_destroy,
|
29 | 29 |
};
|
30 | 30 |
|
31 | |
static void frame_handle_resource_destroy(struct wl_resource *resource) {
|
32 | |
struct wlr_export_dmabuf_frame_v1 *frame = frame_from_resource(resource);
|
|
31 |
static void frame_destroy(struct wlr_export_dmabuf_frame_v1 *frame) {
|
|
32 |
if (frame == NULL) {
|
|
33 |
return;
|
|
34 |
}
|
|
35 |
if (frame->cursor_locked) {
|
|
36 |
wlr_output_lock_software_cursors(frame->output, false);
|
|
37 |
}
|
33 | 38 |
wl_list_remove(&frame->link);
|
34 | 39 |
wl_list_remove(&frame->output_swap_buffers.link);
|
35 | 40 |
wlr_dmabuf_attributes_finish(&frame->attribs);
|
|
41 |
// Make the frame resource inert
|
|
42 |
wl_resource_set_user_data(frame->resource, NULL);
|
36 | 43 |
free(frame);
|
|
44 |
}
|
|
45 |
|
|
46 |
static void frame_handle_resource_destroy(struct wl_resource *resource) {
|
|
47 |
struct wlr_export_dmabuf_frame_v1 *frame = frame_from_resource(resource);
|
|
48 |
frame_destroy(frame);
|
37 | 49 |
}
|
38 | 50 |
|
39 | 51 |
static void frame_output_handle_swap_buffers(struct wl_listener *listener,
|
|
50 | 62 |
uint32_t tv_sec_lo = tv_sec & 0xFFFFFFFF;
|
51 | 63 |
zwlr_export_dmabuf_frame_v1_send_ready(frame->resource,
|
52 | 64 |
tv_sec_hi, tv_sec_lo, event->when->tv_nsec);
|
|
65 |
frame_destroy(frame);
|
53 | 66 |
}
|
54 | 67 |
|
55 | 68 |
|
|
95 | 108 |
if (!output->impl->export_dmabuf) {
|
96 | 109 |
zwlr_export_dmabuf_frame_v1_send_cancel(frame->resource,
|
97 | 110 |
ZWLR_EXPORT_DMABUF_FRAME_V1_CANCEL_REASON_PERMANENT);
|
|
111 |
frame_destroy(frame);
|
98 | 112 |
return;
|
99 | 113 |
}
|
100 | 114 |
|
|
102 | 116 |
if (!wlr_output_export_dmabuf(output, attribs)) {
|
103 | 117 |
zwlr_export_dmabuf_frame_v1_send_cancel(frame->resource,
|
104 | 118 |
ZWLR_EXPORT_DMABUF_FRAME_V1_CANCEL_REASON_TEMPORARY);
|
105 | |
return;
|
|
119 |
frame_destroy(frame);
|
|
120 |
return;
|
|
121 |
}
|
|
122 |
|
|
123 |
if (overlay_cursor) {
|
|
124 |
wlr_output_lock_software_cursors(frame->output, true);
|
|
125 |
frame->cursor_locked = true;
|
106 | 126 |
}
|
107 | 127 |
|
108 | 128 |
uint32_t frame_flags = ZWLR_EXPORT_DMABUF_FRAME_V1_FLAGS_TRANSIENT;
|