On Sun, 2004-01-18 at 09:24, Jonathan Thambidurai wrote:
>
> Index: programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c
> ===================================================================
> RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v
> retrieving revision 1.59
> diff -u -r1.59 radeon_dri.c
> --- programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c 10 Jan 2004 19:03:27
> -0000 1.59
> +++ programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c 18 Jan 2004 08:00:03
> -0000
> @@ -165,7 +165,7 @@
> pConfigs[i].doubleBuffer = FALSE;
> pConfigs[i].stereo = FALSE;
> pConfigs[i].bufferSize = 16;
> - pConfigs[i].depthSize = 16;
> + pConfigs[i].depthSize = info->depthBpp;
> if (stencil)
> pConfigs[i].stencilSize = 8;
> else
> @@ -249,10 +249,10 @@
> pConfigs[i].stereo = FALSE;
> pConfigs[i].bufferSize = 32;
> if (stencil) {
> - pConfigs[i].depthSize = 24;
> + pConfigs[i].depthSize = info->depthBpp;
> pConfigs[i].stencilSize = 8;
> } else {
> - pConfigs[i].depthSize = 24;
> + pConfigs[i].depthSize = info->depthBpp;
> pConfigs[i].stencilSize = 0;
> }
> pConfigs[i].auxBuffers = 0;
Beware that HW stencil buffer is only possible with 24 bit depth buffer;
SW stencil buffer should probably be considered slow?
> @@ -498,7 +498,7 @@
> }
> break;
>
> - case 32:
> + case 24:
> for (x = xstart; x != xend; x += xdir) {
> for (y = ystart; y != yend; y += ydir) {
> READ_DEPTH32(d, xa+x, ya+y);
> @@ -1037,15 +1037,15 @@
> drmInfo.usec_timeout = info->CPusecTimeout;
>
> drmInfo.fb_bpp = info->CurrentLayout.pixel_code;
> - drmInfo.depth_bpp = info->CurrentLayout.pixel_code;
> + drmInfo.depth_bpp = (info->depthBpp == 24) ? 32 : 16;
>
> drmInfo.front_offset = info->frontOffset;
> drmInfo.front_pitch = info->frontPitch * cpp;
> drmInfo.back_offset = info->backOffset;
> drmInfo.back_pitch = info->backPitch * cpp;
> drmInfo.depth_offset = info->depthOffset;
> - drmInfo.depth_pitch = info->depthPitch * cpp;
> -
> + drmInfo.depth_pitch = (info->depthBpp == 24) ?
> + info->depthPitch * 4 : info->depthPitch * 2;
> drmInfo.fb_offset = info->fbHandle;
> drmInfo.mmio_offset = info->registerHandle;
> drmInfo.ring_offset = info->ringHandle;
[...]
> @@ -4356,6 +4358,31 @@
> pScrn->defaultVisual)) return FALSE;
> miSetPixmapDepths ();
>
> + {
> + int depthBits = 0;
> +
> + if (info->CurrentLayout.pixel_bytes == 2)
> + info->depthBpp = 16;
> + else if (info->CurrentLayout.pixel_bytes == 4)
> + info->depthBpp = 24;
> +
> + if (xf86GetOptValInteger(info->Options,
> + OPTION_DEPTHBITS, &depthBits))
> + {
> + if (depthBits == 16 || depthBits == 24)
> + {
> + xf86DrvMsg (pScrn->scrnIndex, X_CONFIG,
> + "Will use %d bit depth buffer\n", depthBits);
> + info->depthBpp = depthBits;
> + }
> + else
> + {
> + xf86DrvMsg (pScrn->scrnIndex, X_WARNING,
> + "Invalid specifed depth bpp (must be 16 or 24)\n");
> + }
> + }
> + }
> +
> #ifdef XF86DRI
> /* Setup DRI after visuals have been
> established, but before fbScreenInit is
> @@ -4482,6 +4509,18 @@
> int l;
> int scanlines;
>
> +
> +
> + /* account for DepthBits option */
> + if (info->CurrentLayout.pixel_bytes == 2 && info->depthBpp == 24)
> + depthSize = ((((pScrn->virtualY+15) & ~15) * width_bytes*2
> + + RADEON_BUFFER_ALIGN)
> + & ~RADEON_BUFFER_ALIGN);
> + else if (info->CurrentLayout.pixel_bytes == 4 && info->depthBpp == 16)
> + depthSize = ((((pScrn->virtualY+15) & ~15) * width_bytes/2
> + + RADEON_BUFFER_ALIGN)
> + & ~RADEON_BUFFER_ALIGN);
> +
> info->frontOffset = 0;
> info->frontPitch = pScrn->displayWidth;
>
(Why don't you remove the original depthSize assignment?)
If info->depthBpp was set to 32 instead of 24, these changes could be
simplified slightly.
--
Earthling Michel DÃnzer | Debian (powerpc), X and DRI developer
Libre software enthusiast | http://svcs.affero.net/rm.php?r=daenzer
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
--
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel