summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-09-13 16:59:04 +0200
committerAlexander Larsson <alexl@redhat.com>2010-09-20 10:25:16 +0200
commit404251dd0f5001c68f2c0b3d7b84530f3e1b5a40 (patch)
tree90d5d7c0148e0a9854dfd6f91c9e8515d5941f58
parent587f9f9ebc6ce1ffac626bd5ce5841fd8038969a (diff)
Protect all references to cmd_ring with cmd_sem
-rw-r--r--display/res.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/display/res.c b/display/res.c
index 5dc72c5..a31832d 100644
--- a/display/res.c
+++ b/display/res.c
@@ -78,12 +78,10 @@ static BOOL SetClip(PDev *pdev, CLIPOBJ *clip, QXLDrawable *drawable);
#define PUSH_CMD(pdev) do { \
int notify; \
- EngAcquireSemaphore(pdev->Res->cmd_sem); \
SPICE_RING_PUSH(pdev->cmd_ring, notify); \
if (notify) { \
WRITE_PORT_UCHAR(pdev->notify_cmd_port, 0); \
} \
- EngReleaseSemaphore(pdev->Res->cmd_sem); \
} while (0);
#define PUSH_CURSOR_CMD(pdev) do { \
@@ -196,6 +194,7 @@ static void WaitForCursorRing(PDev* pdev)
}
}
+/* Called with cmd_sem held */
static void WaitForCmdRing(PDev* pdev)
{
int wait;
@@ -581,11 +580,13 @@ void PushDrawable(PDev *pdev, QXLDrawable *drawable)
{
QXLCommand *cmd;
+ EngAcquireSemaphore(pdev->Res->cmd_sem); \
WaitForCmdRing(pdev);
cmd = SPICE_RING_PROD_ITEM(pdev->cmd_ring);
cmd->type = QXL_CMD_DRAW;
cmd->data = PA(pdev, drawable, pdev->main_mem_slot);
PUSH_CMD(pdev);
+ EngReleaseSemaphore(pdev->Res->cmd_sem); \
}
static QXLSurfaceCmd *GetSurfaceCmd(PDev *pdev)
@@ -618,11 +619,13 @@ void PushSurfaceCmd(PDev *pdev, QXLSurfaceCmd *surface_cmd)
{
QXLCommand *cmd;
+ EngAcquireSemaphore(pdev->Res->cmd_sem); \
WaitForCmdRing(pdev);
cmd = SPICE_RING_PROD_ITEM(pdev->cmd_ring);
cmd->type = QXL_CMD_SURFACE;
cmd->data = PA(pdev, surface_cmd, pdev->main_mem_slot);
PUSH_CMD(pdev);
+ EngReleaseSemaphore(pdev->Res->cmd_sem); \
}
@@ -2426,11 +2429,13 @@ void UpdateArea(PDev *pdev, RECTL *area, UINT32 surface_id)
updat_cmd->update_id = ++pdev->Res->update_id;
updat_cmd->surface_id = surface_id;
+ EngAcquireSemaphore(pdev->Res->cmd_sem); \
WaitForCmdRing(pdev);
cmd = SPICE_RING_PROD_ITEM(pdev->cmd_ring);
cmd->type = QXL_CMD_UPDATE;
cmd->data = PA(pdev, updat_cmd, pdev->main_mem_slot);
PUSH_CMD(pdev);
+ EngReleaseSemaphore(pdev->Res->cmd_sem); \
do {
#ifdef DBG
{