summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-09-13 20:20:21 +0200
committerAlexander Larsson <alexl@redhat.com>2010-09-20 10:25:16 +0200
commit590559c13788e63dabce7bc825bb2aad756ccda2 (patch)
treee891ca0c80256a3ddd4393a3b08e91f3c4df3389
parentb12ee84241ee004fd540b3146f50ad786abf36a9 (diff)
Save FPU on stack, not in pdev
We can't use the global pdev FPUSave, because multiple processes could be calling the sse2 using code in parallel.
-rw-r--r--display/qxldd.h2
-rw-r--r--display/res.c31
2 files changed, 17 insertions, 16 deletions
diff --git a/display/qxldd.h b/display/qxldd.h
index 956f152..1cd6fc7 100644
--- a/display/qxldd.h
+++ b/display/qxldd.h
@@ -317,8 +317,6 @@ typedef struct PDev {
Ring update_trace;
UpdateTrace update_trace_items[NUM_UPDATE_TRACE_ITEMS];
- UINT8 FPUSave[16 * 4 + 15];
-
UINT32 n_surfaces;
SurfaceInfo surface0_info;
diff --git a/display/res.c b/display/res.c
index 33abd31..353c85b 100644
--- a/display/res.c
+++ b/display/res.c
@@ -1719,9 +1719,9 @@ static void FreeBitmapImage(PDev *pdev, Resource *res) // todo: defer
DEBUG_PRINT((pdev, 13, "%s: done\n", __FUNCTION__));
}
-static _inline void RestoreFPU(PDev *pdev)
+static _inline void RestoreFPU(PDev *pdev, UINT8 FPUSave[])
{
- void *align_addr = (void *)ALIGN((size_t)(&pdev->FPUSave), SSE_ALIGN);
+ void *align_addr = (void *)ALIGN((size_t)(FPUSave), SSE_ALIGN);
_asm
{
@@ -1734,9 +1734,9 @@ static _inline void RestoreFPU(PDev *pdev)
}
}
-static _inline void SaveFPU(PDev *pdev)
+static _inline void SaveFPU(PDev *pdev, UINT8 FPUSave[])
{
- void *align_addr = (void *)ALIGN((size_t)(&pdev->FPUSave), SSE_ALIGN);
+ void *align_addr = (void *)ALIGN((size_t)(FPUSave), SSE_ALIGN);
_asm
{
@@ -1771,7 +1771,6 @@ static _inline Resource *GetBitmapImage(PDev *pdev, SURFOBJ *surf, XLATEOBJ *col
UINT8 *src_end;
UINT8 *dest;
UINT8 *dest_end;
- BOOL use_sse = FALSE;
DEBUG_PRINT((pdev, 12, "%s\n", __FUNCTION__));
ASSERT(pdev, width > 0 && height > 0);
@@ -1805,17 +1804,21 @@ static _inline Resource *GetBitmapImage(PDev *pdev, SURFOBJ *surf, XLATEOBJ *col
alloc_size = height * line_size;
if (have_sse2 && alloc_size >= 1024) {
- use_sse = TRUE;
- SaveFPU(pdev);
- }
+ UINT8 FPUSave[16 * 4 + 15];
- for (; src != src_end; src -= surf->lDelta, alloc_size -= line_size) {
- PutBytesAlign(pdev, &chunk, &dest, &dest_end, src, line_size,
- &pdev->Res->num_bits_pages, alloc_size, line_size, TRUE);
- }
+ SaveFPU(pdev, FPUSave);
+
+ for (; src != src_end; src -= surf->lDelta, alloc_size -= line_size) {
+ PutBytesAlign(pdev, &chunk, &dest, &dest_end, src, line_size,
+ &pdev->Res->num_bits_pages, alloc_size, line_size, TRUE);
+ }
- if (use_sse) {
- RestoreFPU(pdev);
+ RestoreFPU(pdev, FPUSave);
+ } else {
+ for (; src != src_end; src -= surf->lDelta, alloc_size -= line_size) {
+ PutBytesAlign(pdev, &chunk, &dest, &dest_end, src, line_size,
+ &pdev->Res->num_bits_pages, alloc_size, line_size, FALSE);
+ }
}
GetPallette(pdev, &internal->image.bitmap, color_trans);