diff --git a/devicemodel/hw/vdisplay_sdl.c b/devicemodel/hw/vdisplay_sdl.c index d31c756e0..2d85fad6c 100644 --- a/devicemodel/hw/vdisplay_sdl.c +++ b/devicemodel/hw/vdisplay_sdl.c @@ -596,6 +596,12 @@ vdpy_surface_set(int handle, struct surface *surf) return; } + if (vdpy.tid != pthread_self()) { + pr_err("%s: unexpected code path as unsafe 3D ops in multi-threads env.\n", + __func__); + return; + } + if (surf == NULL ) { vdpy.surf.width = 0; vdpy.surf.height = 0; @@ -755,6 +761,12 @@ vdpy_surface_update(int handle, struct surface *surf) return; } + if (vdpy.tid != pthread_self()) { + pr_err("%s: unexpected code path as unsafe 3D ops in multi-threads env.\n", + __func__); + return; + } + if (!surf) { pr_err("Incorrect order of submitting Virtio-GPU cmd.\n"); return; @@ -790,6 +802,12 @@ vdpy_cursor_define(int handle, struct cursor *cur) return; } + if (vdpy.tid != pthread_self()) { + pr_err("%s: unexpected code path as unsafe 3D ops in multi-threads env.\n", + __func__); + return; + } + if (cur->data == NULL) return;