mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-15 21:01:03 +00:00
rdp: Make thread checks unconfigurable
Instead of a meson option or hidden define, just run these checks always. It is not Weston's style to add build options for specific asserts, and currently weston's codebase is expected to always run with asserts enabled. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
572ad2d8a9
commit
2df71c6dd7
|
@ -4,10 +4,6 @@ endif
|
||||||
|
|
||||||
config_h.set('BUILD_RDP_COMPOSITOR', '1')
|
config_h.set('BUILD_RDP_COMPOSITOR', '1')
|
||||||
|
|
||||||
if get_option('rdp-thread-check')
|
|
||||||
config_h.set('ENABLE_RDP_THREAD_CHECK', '1')
|
|
||||||
endif
|
|
||||||
|
|
||||||
dep_frdp = dependency('freerdp2', version: '>= 2.2.0', required: false)
|
dep_frdp = dependency('freerdp2', version: '>= 2.2.0', required: false)
|
||||||
if not dep_frdp.found()
|
if not dep_frdp.found()
|
||||||
error('RDP-backend requires freerdp >= 2.2.0 which was not found. Or, you can use \'-Dbackend-rdp=false\'.')
|
error('RDP-backend requires freerdp >= 2.2.0 which was not found. Or, you can use \'-Dbackend-rdp=false\'.')
|
||||||
|
|
|
@ -165,14 +165,6 @@ struct rdp_loop_task {
|
||||||
rdp_loop_task_func_t func;
|
rdp_loop_task_func_t func;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_RDP_THREAD_CHECK
|
|
||||||
#define ASSERT_COMPOSITOR_THREAD(b) assert_compositor_thread(b)
|
|
||||||
#define ASSERT_NOT_COMPOSITOR_THREAD(b) assert_not_compositor_thread(b)
|
|
||||||
#else
|
|
||||||
#define ASSERT_COMPOSITOR_THREAD(b) (void)b
|
|
||||||
#define ASSERT_NOT_COMPOSITOR_THREAD(b) (void)b
|
|
||||||
#endif /* ENABLE_RDP_THREAD_CHECK */
|
|
||||||
|
|
||||||
#define rdp_debug_verbose(b, ...) \
|
#define rdp_debug_verbose(b, ...) \
|
||||||
rdp_debug_print(b->verbose, false, __VA_ARGS__)
|
rdp_debug_print(b->verbose, false, __VA_ARGS__)
|
||||||
#define rdp_debug_verbose_continue(b, ...) \
|
#define rdp_debug_verbose_continue(b, ...) \
|
||||||
|
@ -201,13 +193,11 @@ rdp_wl_array_read_fd(struct wl_array *array, int fd);
|
||||||
void
|
void
|
||||||
convert_rdp_keyboard_to_xkb_rule_names(UINT32 KeyboardType, UINT32 KeyboardSubType, UINT32 KeyboardLayout, struct xkb_rule_names *xkbRuleNames);
|
convert_rdp_keyboard_to_xkb_rule_names(UINT32 KeyboardType, UINT32 KeyboardSubType, UINT32 KeyboardLayout, struct xkb_rule_names *xkbRuleNames);
|
||||||
|
|
||||||
#ifdef ENABLE_RDP_THREAD_CHECK
|
|
||||||
void
|
void
|
||||||
assert_compositor_thread(struct rdp_backend *b);
|
assert_compositor_thread(struct rdp_backend *b);
|
||||||
|
|
||||||
void
|
void
|
||||||
assert_not_compositor_thread(struct rdp_backend *b);
|
assert_not_compositor_thread(struct rdp_backend *b);
|
||||||
#endif /* ENABLE_RDP_THREAD_CHECK */
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
rdp_event_loop_add_fd(struct wl_event_loop *loop,
|
rdp_event_loop_add_fd(struct wl_event_loop *loop,
|
||||||
|
|
|
@ -661,7 +661,7 @@ clipboard_data_source_unref(struct rdp_clipboard_data_source *source)
|
||||||
struct rdp_backend *b = ctx->rdpBackend;
|
struct rdp_backend *b = ctx->rdpBackend;
|
||||||
char **p;
|
char **p;
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
assert(source->refcount);
|
assert(source->refcount);
|
||||||
source->refcount--;
|
source->refcount--;
|
||||||
|
@ -764,7 +764,7 @@ clipboard_data_source_read(int fd, uint32_t mask, void *arg)
|
||||||
__func__, source,
|
__func__, source,
|
||||||
clipboard_data_source_state_to_string(source), fd);
|
clipboard_data_source_state_to_string(source), fd);
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
assert(source->data_source_fd == fd);
|
assert(source->data_source_fd == fd);
|
||||||
assert(source->refcount == 1);
|
assert(source->refcount == 1);
|
||||||
|
@ -832,7 +832,7 @@ clipboard_data_source_fail(int fd, uint32_t mask, void *arg)
|
||||||
rdp_debug_clipboard_verbose(b, "RDP %s (%p:%s) fd:%d\n", __func__,
|
rdp_debug_clipboard_verbose(b, "RDP %s (%p:%s) fd:%d\n", __func__,
|
||||||
source, clipboard_data_source_state_to_string(source), fd);
|
source, clipboard_data_source_state_to_string(source), fd);
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
assert(source->data_source_fd == fd);
|
assert(source->data_source_fd == fd);
|
||||||
/* this data source must be tracked as inflight */
|
/* this data source must be tracked as inflight */
|
||||||
|
@ -886,7 +886,7 @@ clipboard_data_source_write(int fd, uint32_t mask, void *arg)
|
||||||
clipboard_data_source_state_to_string(source),
|
clipboard_data_source_state_to_string(source),
|
||||||
fd);
|
fd);
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
assert(source->data_source_fd == fd);
|
assert(source->data_source_fd == fd);
|
||||||
/* this data source must be tracked as inflight */
|
/* this data source must be tracked as inflight */
|
||||||
|
@ -1018,7 +1018,7 @@ clipboard_data_source_send(struct weston_data_source *base,
|
||||||
clipboard_data_source_state_to_string(source),
|
clipboard_data_source_state_to_string(source),
|
||||||
fd, mime_type);
|
fd, mime_type);
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
if (ctx->clipboard_inflight_client_data_source) {
|
if (ctx->clipboard_inflight_client_data_source) {
|
||||||
/* Here means server side (Linux application) request clipboard data,
|
/* Here means server side (Linux application) request clipboard data,
|
||||||
|
@ -1134,7 +1134,7 @@ clipboard_data_source_cancel(struct weston_data_source *base)
|
||||||
__func__, source,
|
__func__, source,
|
||||||
clipboard_data_source_state_to_string(source));
|
clipboard_data_source_state_to_string(source));
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
if (source == ctx->clipboard_inflight_client_data_source) {
|
if (source == ctx->clipboard_inflight_client_data_source) {
|
||||||
source->is_canceled = true;
|
source->is_canceled = true;
|
||||||
|
@ -1185,7 +1185,7 @@ clipboard_data_source_publish(bool freeOnly, void *arg)
|
||||||
rdp_debug_clipboard(b, "RDP %s (%p:%s)\n",
|
rdp_debug_clipboard(b, "RDP %s (%p:%s)\n",
|
||||||
__func__, source, clipboard_data_source_state_to_string(source));
|
__func__, source, clipboard_data_source_state_to_string(source));
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
/* here is going to publish new data, if previous data from client is still referenced,
|
/* here is going to publish new data, if previous data from client is still referenced,
|
||||||
unref it after selection */
|
unref it after selection */
|
||||||
|
@ -1225,7 +1225,7 @@ clipboard_data_source_request(bool freeOnly, void *arg)
|
||||||
bool found_requested_format;
|
bool found_requested_format;
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
if (freeOnly)
|
if (freeOnly)
|
||||||
goto error_exit_free_request;
|
goto error_exit_free_request;
|
||||||
|
@ -1331,7 +1331,7 @@ clipboard_set_selection(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
rdp_debug_clipboard(b, "RDP %s (base:%p)\n", __func__, selection_data_source);
|
rdp_debug_clipboard(b, "RDP %s (base:%p)\n", __func__, selection_data_source);
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
if (selection_data_source == NULL) {
|
if (selection_data_source == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -1450,7 +1450,7 @@ clipboard_client_format_list(CliprdrServerContext *context, const CLIPRDR_FORMAT
|
||||||
struct rdp_clipboard_data_source *source = NULL;
|
struct rdp_clipboard_data_source *source = NULL;
|
||||||
char **p, *s;
|
char **p, *s;
|
||||||
|
|
||||||
ASSERT_NOT_COMPOSITOR_THREAD(b);
|
assert_not_compositor_thread(b);
|
||||||
|
|
||||||
rdp_debug_clipboard(b, "Client: %s clipboard format list: numFormats:%d\n", __func__, formatList->numFormats);
|
rdp_debug_clipboard(b, "Client: %s clipboard format list: numFormats:%d\n", __func__, formatList->numFormats);
|
||||||
for (uint32_t i = 0; i < formatList->numFormats; i++) {
|
for (uint32_t i = 0; i < formatList->numFormats; i++) {
|
||||||
|
@ -1548,7 +1548,7 @@ clipboard_client_format_data_response(CliprdrServerContext *context, const CLIPR
|
||||||
formatDataResponse->msgFlags,
|
formatDataResponse->msgFlags,
|
||||||
formatDataResponse->dataLen);
|
formatDataResponse->dataLen);
|
||||||
|
|
||||||
ASSERT_NOT_COMPOSITOR_THREAD(b);
|
assert_not_compositor_thread(b);
|
||||||
|
|
||||||
if (!source) {
|
if (!source) {
|
||||||
rdp_debug_clipboard(b, "Client: %s client send data without server asking. protocol error", __func__);
|
rdp_debug_clipboard(b, "Client: %s client send data without server asking. protocol error", __func__);
|
||||||
|
@ -1612,7 +1612,7 @@ clipboard_client_format_list_response(CliprdrServerContext *context,
|
||||||
struct rdp_backend *b = ctx->rdpBackend;
|
struct rdp_backend *b = ctx->rdpBackend;
|
||||||
|
|
||||||
rdp_debug_clipboard(b, "Client: %s msgFlags:0x%x\n", __func__, formatListResponse->msgFlags);
|
rdp_debug_clipboard(b, "Client: %s msgFlags:0x%x\n", __func__, formatListResponse->msgFlags);
|
||||||
ASSERT_NOT_COMPOSITOR_THREAD(b);
|
assert_not_compositor_thread(b);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1631,7 +1631,7 @@ clipboard_client_format_data_request(CliprdrServerContext *context,
|
||||||
__func__, formatDataRequest->requestedFormatId,
|
__func__, formatDataRequest->requestedFormatId,
|
||||||
clipboard_format_id_to_string(formatDataRequest->requestedFormatId, true));
|
clipboard_format_id_to_string(formatDataRequest->requestedFormatId, true));
|
||||||
|
|
||||||
ASSERT_NOT_COMPOSITOR_THREAD(b);
|
assert_not_compositor_thread(b);
|
||||||
|
|
||||||
/* Make sure clients requested the format we knew */
|
/* Make sure clients requested the format we knew */
|
||||||
index = clipboard_find_supported_format_by_format_id(formatDataRequest->requestedFormatId);
|
index = clipboard_find_supported_format_by_format_id(formatDataRequest->requestedFormatId);
|
||||||
|
@ -1671,7 +1671,7 @@ rdp_clipboard_init(freerdp_peer *client)
|
||||||
|
|
||||||
assert(seat);
|
assert(seat);
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
ctx->clipboard_server_context = cliprdr_server_context_new(ctx->vcm);
|
ctx->clipboard_server_context = cliprdr_server_context_new(ctx->vcm);
|
||||||
if (!ctx->clipboard_server_context)
|
if (!ctx->clipboard_server_context)
|
||||||
|
@ -1717,7 +1717,7 @@ rdp_clipboard_destroy(RdpPeerContext *ctx)
|
||||||
struct rdp_clipboard_data_source *data_source;
|
struct rdp_clipboard_data_source *data_source;
|
||||||
struct rdp_backend *b = ctx->rdpBackend;
|
struct rdp_backend *b = ctx->rdpBackend;
|
||||||
|
|
||||||
ASSERT_COMPOSITOR_THREAD(b);
|
assert_compositor_thread(b);
|
||||||
|
|
||||||
if (ctx->clipboard_selection_listener.notify) {
|
if (ctx->clipboard_selection_listener.notify) {
|
||||||
wl_list_remove(&ctx->clipboard_selection_listener.link);
|
wl_list_remove(&ctx->clipboard_selection_listener.link);
|
||||||
|
|
|
@ -76,7 +76,6 @@ end:
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_RDP_THREAD_CHECK
|
|
||||||
void
|
void
|
||||||
assert_compositor_thread(struct rdp_backend *b)
|
assert_compositor_thread(struct rdp_backend *b)
|
||||||
{
|
{
|
||||||
|
@ -88,7 +87,6 @@ assert_not_compositor_thread(struct rdp_backend *b)
|
||||||
{
|
{
|
||||||
assert(b->compositor_tid != gettid());
|
assert(b->compositor_tid != gettid());
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_RDP_THREAD_CHECK */
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
rdp_event_loop_add_fd(struct wl_event_loop *loop,
|
rdp_event_loop_add_fd(struct wl_event_loop *loop,
|
||||||
|
@ -113,7 +111,7 @@ rdp_dispatch_task_to_display_loop(RdpPeerContext *peerCtx,
|
||||||
{
|
{
|
||||||
/* this function is ONLY used to queue the task from FreeRDP thread,
|
/* this function is ONLY used to queue the task from FreeRDP thread,
|
||||||
* and the task to be processed at wayland display loop thread. */
|
* and the task to be processed at wayland display loop thread. */
|
||||||
ASSERT_NOT_COMPOSITOR_THREAD(peerCtx->rdpBackend);
|
assert_not_compositor_thread(peerCtx->rdpBackend);
|
||||||
|
|
||||||
task->peerCtx = peerCtx;
|
task->peerCtx = peerCtx;
|
||||||
task->func = func;
|
task->func = func;
|
||||||
|
@ -134,7 +132,7 @@ rdp_dispatch_task(int fd, uint32_t mask, void *arg)
|
||||||
eventfd_t dummy;
|
eventfd_t dummy;
|
||||||
|
|
||||||
/* this must be called back at wayland display loop thread */
|
/* this must be called back at wayland display loop thread */
|
||||||
ASSERT_COMPOSITOR_THREAD(peerCtx->rdpBackend);
|
assert_compositor_thread(peerCtx->rdpBackend);
|
||||||
|
|
||||||
eventfd_read(peerCtx->loop_task_event_source_fd, &dummy);
|
eventfd_read(peerCtx->loop_task_event_source_fd, &dummy);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue