From: Alexander Larsson <al...@redhat.com> We can't use the global pdev FPUSave, because multiple processes could be calling the sse2 using code in parallel. --- display/qxldd.h | 2 -- display/res.c | 31 +++++++++++++++++-------------- 2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/display/qxldd.h b/display/qxldd.h index f09814f..7f254f8 100644 --- a/display/qxldd.h +++ b/display/qxldd.h @@ -313,8 +313,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 ceba034..4202daa 100644 --- a/display/res.c +++ b/display/res.c @@ -1715,9 +1715,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 { @@ -1730,9 +1730,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 { @@ -1767,7 +1767,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); @@ -1801,17 +1800,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); -- 1.7.2.2 _______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel