From c8366d7b457565a06acdf6b40c5448c7f13f1641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sun, 18 Jun 2006 14:24:14 +0200 Subject: Add Option "DepthBits". This allows getting higher depth buffer precision and stencil hardware acceleration in depth 16 or saving some video RAM at the cost of these features in depth 24. --- src/radeon_dri.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/radeon_dri.c') diff --git a/src/radeon_dri.c b/src/radeon_dri.c index bbc858a..1e0d544 100644 --- a/src/radeon_dri.c +++ b/src/radeon_dri.c @@ -162,14 +162,15 @@ static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) pConfigs[i].doubleBuffer = FALSE; pConfigs[i].stereo = FALSE; pConfigs[i].bufferSize = 16; - pConfigs[i].depthSize = 16; + pConfigs[i].depthSize = info->depthBits; if (stencil) pConfigs[i].stencilSize = 8; else pConfigs[i].stencilSize = 0; pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; - if (accum || stencil) { + if (accum || + (pConfigs[i].stencilSize && pConfigs[i].depthSize == 16)) { pConfigs[i].visualRating = GLX_SLOW_CONFIG; } else { pConfigs[i].visualRating = GLX_NONE; @@ -245,16 +246,16 @@ static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) pConfigs[i].doubleBuffer = FALSE; pConfigs[i].stereo = FALSE; pConfigs[i].bufferSize = 32; + pConfigs[i].depthSize = info->depthBits; if (stencil) { - pConfigs[i].depthSize = 24; pConfigs[i].stencilSize = 8; } else { - pConfigs[i].depthSize = 24; pConfigs[i].stencilSize = 0; } pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; - if (accum) { + if (accum || + (pConfigs[i].stencilSize && pConfigs[i].depthSize == 16)) { pConfigs[i].visualRating = GLX_SLOW_CONFIG; } else { pConfigs[i].visualRating = GLX_NONE; @@ -1061,14 +1062,14 @@ static int RADEONDRIKernelInit(RADEONInfoPtr info, ScreenPtr pScreen) drmInfo.usec_timeout = info->CPusecTimeout; drmInfo.fb_bpp = info->CurrentLayout.pixel_code; - drmInfo.depth_bpp = info->CurrentLayout.pixel_code; + drmInfo.depth_bpp = (info->depthBits - 8) * 2; 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->depthPitch * drmInfo.depth_bpp / 8; drmInfo.fb_offset = info->fbHandle; drmInfo.mmio_offset = info->registerHandle; -- cgit v1.2.3