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:
Derek Foreman 2022-05-20 07:35:14 -05:00
parent 572ad2d8a9
commit 2df71c6dd7
4 changed files with 17 additions and 33 deletions

View File

@ -4,10 +4,6 @@ endif
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)
if not dep_frdp.found()
error('RDP-backend requires freerdp >= 2.2.0 which was not found. Or, you can use \'-Dbackend-rdp=false\'.')

View File

@ -165,14 +165,6 @@ struct rdp_loop_task {
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, ...) \
rdp_debug_print(b->verbose, false, __VA_ARGS__)
#define rdp_debug_verbose_continue(b, ...) \
@ -201,13 +193,11 @@ rdp_wl_array_read_fd(struct wl_array *array, int fd);
void
convert_rdp_keyboard_to_xkb_rule_names(UINT32 KeyboardType, UINT32 KeyboardSubType, UINT32 KeyboardLayout, struct xkb_rule_names *xkbRuleNames);
#ifdef ENABLE_RDP_THREAD_CHECK
void
assert_compositor_thread(struct rdp_backend *b);
void
assert_not_compositor_thread(struct rdp_backend *b);
#endif /* ENABLE_RDP_THREAD_CHECK */
bool
rdp_event_loop_add_fd(struct wl_event_loop *loop,

View File

@ -661,7 +661,7 @@ clipboard_data_source_unref(struct rdp_clipboard_data_source *source)
struct rdp_backend *b = ctx->rdpBackend;
char **p;
ASSERT_COMPOSITOR_THREAD(b);
assert_compositor_thread(b);
assert(source->refcount);
source->refcount--;
@ -764,7 +764,7 @@ clipboard_data_source_read(int fd, uint32_t mask, void *arg)
__func__, 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->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__,
source, clipboard_data_source_state_to_string(source), fd);
ASSERT_COMPOSITOR_THREAD(b);
assert_compositor_thread(b);
assert(source->data_source_fd == fd);
/* 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),
fd);
ASSERT_COMPOSITOR_THREAD(b);
assert_compositor_thread(b);
assert(source->data_source_fd == fd);
/* 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),
fd, mime_type);
ASSERT_COMPOSITOR_THREAD(b);
assert_compositor_thread(b);
if (ctx->clipboard_inflight_client_data_source) {
/* Here means server side (Linux application) request clipboard data,
@ -1134,7 +1134,7 @@ clipboard_data_source_cancel(struct weston_data_source *base)
__func__, source,
clipboard_data_source_state_to_string(source));
ASSERT_COMPOSITOR_THREAD(b);
assert_compositor_thread(b);
if (source == ctx->clipboard_inflight_client_data_source) {
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",
__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,
unref it after selection */
@ -1225,7 +1225,7 @@ clipboard_data_source_request(bool freeOnly, void *arg)
bool found_requested_format;
bool ret;
ASSERT_COMPOSITOR_THREAD(b);
assert_compositor_thread(b);
if (freeOnly)
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);
ASSERT_COMPOSITOR_THREAD(b);
assert_compositor_thread(b);
if (selection_data_source == NULL) {
return;
@ -1450,7 +1450,7 @@ clipboard_client_format_list(CliprdrServerContext *context, const CLIPRDR_FORMAT
struct rdp_clipboard_data_source *source = NULL;
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);
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->dataLen);
ASSERT_NOT_COMPOSITOR_THREAD(b);
assert_not_compositor_thread(b);
if (!source) {
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;
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;
}
@ -1631,7 +1631,7 @@ clipboard_client_format_data_request(CliprdrServerContext *context,
__func__, formatDataRequest->requestedFormatId,
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 */
index = clipboard_find_supported_format_by_format_id(formatDataRequest->requestedFormatId);
@ -1671,7 +1671,7 @@ rdp_clipboard_init(freerdp_peer *client)
assert(seat);
ASSERT_COMPOSITOR_THREAD(b);
assert_compositor_thread(b);
ctx->clipboard_server_context = cliprdr_server_context_new(ctx->vcm);
if (!ctx->clipboard_server_context)
@ -1717,7 +1717,7 @@ rdp_clipboard_destroy(RdpPeerContext *ctx)
struct rdp_clipboard_data_source *data_source;
struct rdp_backend *b = ctx->rdpBackend;
ASSERT_COMPOSITOR_THREAD(b);
assert_compositor_thread(b);
if (ctx->clipboard_selection_listener.notify) {
wl_list_remove(&ctx->clipboard_selection_listener.link);

View File

@ -76,7 +76,6 @@ end:
va_end(ap);
}
#ifdef ENABLE_RDP_THREAD_CHECK
void
assert_compositor_thread(struct rdp_backend *b)
{
@ -88,7 +87,6 @@ assert_not_compositor_thread(struct rdp_backend *b)
{
assert(b->compositor_tid != gettid());
}
#endif /* ENABLE_RDP_THREAD_CHECK */
bool
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,
* 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->func = func;
@ -134,7 +132,7 @@ rdp_dispatch_task(int fd, uint32_t mask, void *arg)
eventfd_t dummy;
/* 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);