summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJordan Crouse <jordan.crouse@amd.com>2007-08-02 10:45:14 -0600
committerJordan Crouse <jordan.crouse@amd.com>2007-08-02 10:46:04 -0600
commita6192811e21c9f8d17b409018f945adc2eea3594 (patch)
tree9b9b171eb32e39bffe626eee0c5bd4a3540cf276 /src
parent8ce4c5cc9650ddc81d9243bc416522800bce3afc (diff)
Fix the upload / composite mask race
We fix a race with the upload function when using a composite mask by using the exa core function exaGetPixmapFirstPixel, which does the right thing in X 1.4 and newer. For older versions, the fix is to stall the pipeine to ensure the upload is complete, so thats what we do.
Diffstat (limited to 'src')
-rw-r--r--src/amd_lx_exa.c53
1 files changed, 21 insertions, 32 deletions
diff --git a/src/amd_lx_exa.c b/src/amd_lx_exa.c
index 702a4a1..ea21413 100644
--- a/src/amd_lx_exa.c
+++ b/src/amd_lx_exa.c
@@ -35,6 +35,8 @@
#endif
#include "xf86.h"
+#include "exa.h"
+
#include "amd.h"
#include "cim_defs.h"
#include "cim_regs.h"
@@ -249,42 +251,27 @@ _GetRGBAFromPixel(CARD32 pixel,
return TRUE;
}
-static unsigned int lx_get_source_color(PicturePtr pSrc, int x, int y, int dstFormat)
+static unsigned int lx_get_source_color(PixmapPtr pSrc, int srcFormat,
+ int dstFormat)
{
- FbBits *bits;
- FbStride stride;
- int bpp, xoff, yoff;
-
- CARD32 in, out;
- CARD16 red, green, blue, alpha;
+ CARD32 in, out;
+ CARD16 red, green, blue, alpha;
- fbGetDrawable (pSrc->pDrawable, bits, stride, bpp, xoff, yoff);
-
- bits += (y * stride) + (x * (bpp >> 3));
+ /* Stall to avoid a race with the upload function */
+ /* for 1.4 and newer, the problem will be resolved within
+ * exaGetPixmapFirstPixel, so this should be adjusted so
+ * the stall isn't run needlessly
+ */
- /* Read the source value */
+ gp_wait_until_idle();
+ in = exaGetPixmapFirstPixel(pSrc);
- switch(bpp) {
- case 32:
- case 24:
- in = (CARD32) *((CARD32 *) bits);
- break;
-
- case 16:
- in = (CARD32) *((CARD16 *) bits);
- break;
+ _GetRGBAFromPixel(in, &red, &blue, &green, &alpha, srcFormat);
+ _GetPixelFromRGBA(&out, red, blue, green, alpha, dstFormat);
- case 8:
- in = (CARD32) *((CARD8 *) bits);
- break;
- }
-
- _GetRGBAFromPixel(in, &red, &blue, &green, &alpha, pSrc->format);
- _GetPixelFromRGBA(&out, red, blue, green, alpha, dstFormat);
-
- return out;
+ return out;
}
-
+
static Bool
lx_prepare_solid(PixmapPtr pxMap, int alu, Pixel planemask, Pixel fg)
{
@@ -577,9 +564,11 @@ static Bool lx_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMsk,
/* Get the source color */
if (direction == 0)
- exaScratch.srcColor = lx_get_source_color(pSrc, 0, 0, pDst->format);
+ exaScratch.srcColor = lx_get_source_color(pxSrc, pSrc->format,
+ pDst->format);
else
- exaScratch.srcColor = lx_get_source_color(pDst, 0, 0, pSrc->format);
+ exaScratch.srcColor = lx_get_source_color(pxDst, pDst->format,
+ pSrc->format);
/* FIXME: What to do here? */