ACRN:DM:VGPU: Add some checks to ignore multi-thread op

Now all the 3D ops are handled in one dedicated thread. As 3D ops are
not safe in multi-thread env, some checks are added so that it can indicate
that it is not in the expected code path.

Tracked-On: #7296
Acked-by: Wang Yu1 <yu1.wang@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
This commit is contained in:
Zhao Yakui 2022-04-18 10:28:26 +08:00 committed by acrnsi-robot
parent a555658484
commit de3e0946bc
1 changed files with 18 additions and 0 deletions

View File

@ -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;