summaryrefslogtreecommitdiff
path: root/display
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-09-13 16:47:23 +0200
committerAlexander Larsson <alexl@redhat.com>2010-09-20 10:25:16 +0200
commit587f9f9ebc6ce1ffac626bd5ce5841fd8038969a (patch)
tree4fcf923558b33d06df8a1ed7e5a13a43b65dc409 /display
parenta39d7a5ff58caa4404b27977bf05f3a25d7a2449 (diff)
Move cmd_sem and print_sem to global device info
The cmd and print semaphores protect hardware instances that exist one per device, so we can't really use per-pdev locks to protect them.
Diffstat (limited to 'display')
-rw-r--r--display/driver.c22
-rw-r--r--display/qxldd.h6
-rw-r--r--display/res.c20
3 files changed, 24 insertions, 24 deletions
diff --git a/display/driver.c b/display/driver.c
index 1ff8925..1d5576f 100644
--- a/display/driver.c
+++ b/display/driver.c
@@ -108,12 +108,12 @@ static CallCounterInfo counters_info[NUM_CALL_COUNTERS] = {
void DebugPrintV(PDev *pdev, const char *message, va_list ap)
{
if (pdev && pdev->log_buf) {
- EngAcquireSemaphore(pdev->print_sem);
+ EngAcquireSemaphore(pdev->Res->print_sem);
_snprintf(pdev->log_buf, QXL_LOG_BUF_SIZE, QXLDD_DEBUG_PREFIX);
_vsnprintf(pdev->log_buf + strlen(QXLDD_DEBUG_PREFIX),
QXL_LOG_BUF_SIZE - strlen(QXLDD_DEBUG_PREFIX), message, ap);
WRITE_PORT_UCHAR(pdev->log_port, 0);
- EngReleaseSemaphore(pdev->print_sem);
+ EngReleaseSemaphore(pdev->Res->print_sem);
} else {
EngDebugPrint(QXLDD_DEBUG_PREFIX, (PCHAR)message, ap);
}
@@ -509,19 +509,9 @@ DHPDEV DrvEnablePDEV(DEVMODEW *dev_mode, PWSTR ignore1, ULONG ignore2, HSURF *ig
goto err1;
}
- if (!(pdev->print_sem = EngCreateSemaphore())) {
- DEBUG_PRINT((NULL, 0, "%s: create print sem failed\n", __FUNCTION__));
- goto err2;
- }
-
- if (!(pdev->cmd_sem = EngCreateSemaphore())) {
- DEBUG_PRINT((NULL, 0, "%s: create cmd sem failed\n", __FUNCTION__));
- goto err3;
- }
-
if (!ResInit(pdev)) {
DEBUG_PRINT((NULL, 0, "%s: init res failed\n", __FUNCTION__));
- goto err4;
+ goto err2;
}
RtlCopyMemory(dev_caps, &gdi_info, dev_caps_size);
@@ -530,10 +520,6 @@ DHPDEV DrvEnablePDEV(DEVMODEW *dev_mode, PWSTR ignore1, ULONG ignore2, HSURF *ig
DEBUG_PRINT((NULL, 1, "%s: 0x%lx\n", __FUNCTION__, pdev));
return(DHPDEV)pdev;
-err4:
- EngDeleteSemaphore(pdev->cmd_sem);
-err3:
- EngDeleteSemaphore(pdev->print_sem);
err2:
DestroyPalette(pdev);
@@ -550,8 +536,6 @@ VOID DrvDisablePDEV(DHPDEV in_pdev)
DEBUG_PRINT((NULL, 1, "%s: 0x%lx\n", __FUNCTION__, pdev));
ResDestroy(pdev);
DestroyPalette(pdev);
- EngDeleteSemaphore(pdev->cmd_sem);
- EngDeleteSemaphore(pdev->print_sem);
EngFreeMem(pdev);
DEBUG_PRINT((NULL, 1, "%s: 0x%lx exit\n", __FUNCTION__, pdev));
}
diff --git a/display/qxldd.h b/display/qxldd.h
index 5588170..206b994 100644
--- a/display/qxldd.h
+++ b/display/qxldd.h
@@ -183,6 +183,9 @@ typedef struct DevRes {
UINT64 free_outputs;
UINT32 update_id;
+ HSEMAPHORE print_sem;
+ HSEMAPHORE cmd_sem;
+
CacheImage cache_image_pool[IMAGE_POOL_SIZE];
Ring cache_image_lru;
Ring cursors_lru;
@@ -263,9 +266,6 @@ typedef struct PDev {
UINT8 *log_buf;
UINT32 *log_level;
- HSEMAPHORE print_sem;
- HSEMAPHORE cmd_sem;
-
PMemSlot *mem_slots;
UINT8 num_mem_slot;
UINT8 main_mem_slot;
diff --git a/display/res.c b/display/res.c
index 7515424..5dc72c5 100644
--- a/display/res.c
+++ b/display/res.c
@@ -78,12 +78,12 @@ static BOOL SetClip(PDev *pdev, CLIPOBJ *clip, QXLDrawable *drawable);
#define PUSH_CMD(pdev) do { \
int notify; \
- EngAcquireSemaphore(pdev->cmd_sem); \
+ EngAcquireSemaphore(pdev->Res->cmd_sem); \
SPICE_RING_PUSH(pdev->cmd_ring, notify); \
if (notify) { \
WRITE_PORT_UCHAR(pdev->notify_cmd_port, 0); \
} \
- EngReleaseSemaphore(pdev->cmd_sem); \
+ EngReleaseSemaphore(pdev->Res->cmd_sem); \
} while (0);
#define PUSH_CURSOR_CMD(pdev) do { \
@@ -391,6 +391,14 @@ void CleanGlobalRes()
EngDeleteSemaphore(res->malloc_sem);
res->malloc_sem = NULL;
}
+ if (res->cmd_sem) {
+ EngDeleteSemaphore(res->cmd_sem);
+ res->cmd_sem = NULL;
+ }
+ if (res->print_sem) {
+ EngDeleteSemaphore(res->print_sem);
+ res->print_sem = NULL;
+ }
EngFreeMem(res);
}
}
@@ -440,6 +448,14 @@ static void InitRes(PDev *pdev)
if (!pdev->Res->malloc_sem) {
PANIC(pdev, "Res malloc sem creation failed\n");
}
+ pdev->Res->cmd_sem = EngCreateSemaphore();
+ if (!pdev->Res->cmd_sem) {
+ PANIC(pdev, "Res cmd sem creation failed\n");
+ }
+ pdev->Res->print_sem = EngCreateSemaphore();
+ if (!pdev->Res->print_sem) {
+ PANIC(pdev, "Res print sem creation failed\n");
+ }
InitMspace(pdev->Res, MSPACE_TYPE_DEVRAM, pdev->io_pages_virt, pdev->num_io_pages * PAGE_SIZE);
InitMspace(pdev->Res, MSPACE_TYPE_VRAM, pdev->fb, pdev->fb_size);