diff --git a/src/radeon.h b/src/radeon.h index 6402e48..0b1f4bd 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -726,6 +726,8 @@ #endif /* XF86DRI */ /* Render */ Bool RenderAccel; + unsigned short texW[2]; + unsigned short texH[2]; #ifdef USE_XAA FBLinearPtr RenderTex; void (*RenderCallback)(ScrnInfoPtr); diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 98b8dfd..469816b 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -252,6 +252,9 @@ static Bool FUNC_NAME(R100TextureSetup)( txformat |= RADEON_TXFORMAT_NON_POWER2; txformat |= unit << 24; /* RADEON_TXFORMAT_ST_ROUTE_STQX */ + info->texW[unit] = w; + info->texH[unit] = h; + switch (pPict->filter) { case PictFilterNearest: txfilter = (RADEON_MAG_FILTER_NEAREST | RADEON_MIN_FILTER_NEAREST); @@ -505,6 +508,9 @@ static Bool FUNC_NAME(R200TextureSetup)( txformat |= R200_TXFORMAT_NON_POWER2; txformat |= unit << R200_TXFORMAT_ST_ROUTE_SHIFT; + info->texW[unit] = w; + info->texH[unit] = h; + switch (pPict->filter) { case PictFilterNearest: txfilter = (R200_MAG_FILTER_NEAREST | @@ -791,11 +797,6 @@ #ifdef ACCEL_CP (4 << RADEON_CP_VC_CNTL_NUM_SHIFT)); } - VTX_OUT(dstX, dstY, srcX, srcY, maskX, maskY); - VTX_OUT(dstX, dstY + h, srcX, srcYend, maskX, maskYend); - VTX_OUT(dstX + w, dstY + h, srcXend, srcYend, maskXend, maskYend); - VTX_OUT(dstX + w, dstY, srcXend, srcY, maskXend, maskY); - ADVANCE_RING(); #else /* ACCEL_CP */ BEGIN_ACCEL(1 + VTX_REG_COUNT * 4); if (info->ChipFamily < CHIP_FAMILY_R200) { @@ -808,11 +809,24 @@ #else /* ACCEL_CP */ RADEON_VF_PRIM_WALK_DATA | 4 << RADEON_VF_NUM_VERTICES_SHIFT)); } +#endif - VTX_OUT(dstX, dstY, srcX, srcY, maskX, maskY); - VTX_OUT(dstX, dstY + h, srcX, srcYend, maskX, maskYend); - VTX_OUT(dstX + w, dstY + h, srcXend, srcYend, maskXend, maskYend); - VTX_OUT(dstX + w, dstY, srcXend, srcY, maskXend, maskY); + VTX_OUT(dstX, dstY, + (float)srcX / info->texW[0], (float)srcY / info->texH[0], + (float)maskX / info->texW[1], (float)maskY / info->texH[1]); + VTX_OUT(dstX, dstY + h, + (float)srcX / info->texW[0], (float)srcYend / info->texH[0], + (float)maskX / info->texW[1], (float)maskYend / info->texH[1]); + VTX_OUT(dstX + w, dstY + h, + (float)srcXend / info->texW[0], (float)srcYend / info->texH[0], + (float)maskXend / info->texW[1], (float)maskYend / info->texH[1]); + VTX_OUT(dstX + w, dstY, + (float)srcXend / info->texW[0], (float)srcY / info->texH[0], + (float)maskXend / info->texW[1], (float)maskY / info->texH[1]); + +#ifdef ACCEL_CP + ADVANCE_RING(); +#else FINISH_ACCEL(); #endif /* !ACCEL_CP */ diff --git a/src/radeon_render.c b/src/radeon_render.c index 9e3529e..66be57d 100644 --- a/src/radeon_render.c +++ b/src/radeon_render.c @@ -424,6 +424,9 @@ #endif txformat |= RADEON_TXFORMAT_NON_POWER2; } + info->texW[0] = width; + info->texH[0] = height; + offset = info->RenderTex->offset * pScrn->bitsPerPixel / 8; dst = (CARD8*)(info->FB + offset); @@ -621,10 +624,10 @@ FUNC_NAME(R100SubsequentCPUToScreenTextu r = width + l; b = height + t; - fl = srcx; - fr = srcx + width; - ft = srcy; - fb = srcy + height; + fl = (float)srcx / info->texW[0]; + fr = (float)(srcx + width) / info->texW[0]; + ft = (float)srcy / info->texH[0]; + fb = (float)(srcy + height) / info->texH[0]; #ifdef ACCEL_CP BEGIN_RING(25); @@ -757,6 +760,9 @@ #endif txformat |= RADEON_TXFORMAT_NON_POWER2; } + info->texW[0] = width; + info->texH[0] = height; + offset = info->RenderTex->offset * pScrn->bitsPerPixel / 8; dst = (CARD8*)(info->FB + offset); @@ -956,10 +962,10 @@ FUNC_NAME(R200SubsequentCPUToScreenTextu r = width + l; b = height + t; - fl = srcx; - fr = srcx + width; - ft = srcy; - fb = srcy + height; + fl = (float)srcx / info->texW[0]; + fr = (float)(srcx + width) / info->texW[0]; + ft = (float)srcy / info->texH[0]; + fb = (float)(srcy + height) / info->texH[0]; #ifdef ACCEL_CP BEGIN_RING(24);