📄 gamma_inithw.c
字号:
/* * Copyright 2001 by Alan Hourihane. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Alan Hourihane not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Alan Hourihane makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Authors: Alan Hourihane, <alanh@tungstengraphics.com> * Kevin E. Martin <martin@valinux.com> * *//* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_inithw.c,v 1.9 2002/10/30 12:51:29 alanh Exp $ */#include "gamma_context.h"#include "glint_dri.h"void gammaInitHW( gammaContextPtr gmesa ){ GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)gmesa->driScreen->pDevPriv; int i; if (gDRIPriv->numMultiDevices == 2) { /* Set up each MX's ScanLineOwnership for OpenGL */ CHECK_DMA_BUFFER(gmesa, 5); WRITE(gmesa->buf, BroadcastMask, 1); WRITE(gmesa->buf, ScanLineOwnership, 5); /* Use bottom left as [0,0] */ WRITE(gmesa->buf, BroadcastMask, 2); WRITE(gmesa->buf, ScanLineOwnership, 1); /* Use bottom left as [0,0] */ /* Broadcast to both MX's */ WRITE(gmesa->buf, BroadcastMask, 3); FLUSH_DMA_BUFFER(gmesa); } gmesa->AlphaBlendMode = (AlphaBlendModeDisable | AB_Src_One | AB_Dst_Zero | AB_NoAlphaBufferPresent | AB_ColorFmt_8888 | AB_ColorOrder_RGB | AB_OpenGLType | AB_AlphaDst_FBData | AB_ColorConversionScale | AB_AlphaConversionScale); gmesa->DitherMode = DitherModeEnable | DM_ColorOrder_RGB; switch (gmesa->gammaScreen->cpp) { case 2: gmesa->DitherMode |= DM_ColorFmt_5555; gmesa->AlphaBlendMode |= AB_ColorFmt_5555; CHECK_DMA_BUFFER(gmesa, 1); WRITE(gmesa->buf, PixelSize, 1); break; case 4: gmesa->DitherMode |= DM_ColorFmt_8888; gmesa->AlphaBlendMode |= AB_ColorFmt_8888; WRITE(gmesa->buf, PixelSize, 0); break; } /* FIXME for stencil, gid, etc */ switch (gmesa->DepthSize) { case 16: gmesa->LBReadFormat = (LBRF_DepthWidth16 | LBRF_StencilWidth8 | LBRF_StencilPos16 | LBRF_FrameCount8 | LBRF_FrameCountPos24 | LBRF_GIDWidth4 | LBRF_GIDPos32 ); gmesa->LBWriteFormat = (LBRF_DepthWidth16 | LBRF_StencilWidth8 | LBRF_StencilPos16 | LBRF_FrameCount8 | LBRF_FrameCountPos24 | LBRF_GIDWidth4 | LBRF_GIDPos32 ); break; case 24: gmesa->LBReadFormat = (LBRF_DepthWidth24 | LBRF_StencilWidth8 | LBRF_StencilPos24 | LBRF_FrameCount8 | LBRF_FrameCountPos32 | LBRF_GIDWidth4 | LBRF_GIDPos36 ); gmesa->LBWriteFormat = (LBRF_DepthWidth24 | LBRF_StencilWidth8 | LBRF_StencilPos24 | LBRF_FrameCount8 | LBRF_FrameCountPos32 | LBRF_GIDWidth4 | LBRF_GIDPos36 ); break; case 32: gmesa->LBReadFormat = (LBRF_DepthWidth32 | LBRF_StencilWidth8 | LBRF_StencilPos32 | LBRF_FrameCount8 | LBRF_FrameCountPos40 | LBRF_GIDWidth4 | LBRF_GIDPos44 ); gmesa->LBWriteFormat = (LBRF_DepthWidth32 | LBRF_StencilWidth8 | LBRF_StencilPos32 | LBRF_FrameCount8 | LBRF_FrameCountPos40 | LBRF_GIDWidth4 | LBRF_GIDPos44 ); break; } gmesa->FBHardwareWriteMask = 0xffffffff; gmesa->FogMode = FogModeDisable; gmesa->ClearDepth = 0xffffffff; gmesa->AreaStippleMode = AreaStippleModeDisable; gmesa->x = 0; gmesa->y = 0; gmesa->w = 0; gmesa->h = 0; gmesa->FrameCount = 0; gmesa->MatrixMode = GL_MODELVIEW; gmesa->ModelViewCount = 0; gmesa->ProjCount = 0; gmesa->TextureCount = 0; gmesa->PointMode = PM_AntialiasQuality_4x4; gmesa->LineMode = LM_AntialiasQuality_4x4; gmesa->TriangleMode = TM_AntialiasQuality_4x4; gmesa->AntialiasMode = AntialiasModeDisable; for (i = 0; i < 16; i++) if (i % 5 == 0) gmesa->ModelView[i] = gmesa->Proj[i] = gmesa->ModelViewProj[i] = gmesa->Texture[i] = 1.0; else gmesa->ModelView[i] = gmesa->Proj[i] = gmesa->ModelViewProj[i] = gmesa->Texture[i] = 0.0; gmesa->LBReadMode = (LBReadSrcDisable | LBReadDstDisable | LBDataTypeDefault | LBWindowOriginBot | gDRIPriv->pprod); gmesa->FBReadMode = (FBReadSrcDisable | FBReadDstDisable | FBDataTypeDefault | FBWindowOriginBot | gDRIPriv->pprod); if (gDRIPriv->numMultiDevices == 2) { gmesa->LBReadMode |= LBScanLineInt2; gmesa->FBReadMode |= FBScanLineInt2; gmesa->LBWindowBase = gmesa->driScreen->fbWidth * (gmesa->driScreen->fbHeight/2 - 1); gmesa->FBWindowBase = gmesa->driScreen->fbWidth * (gmesa->driScreen->fbHeight/2 - 1); } else { gmesa->LBWindowBase = gmesa->driScreen->fbWidth * (gmesa->driScreen->fbHeight - 1); gmesa->FBWindowBase = gmesa->driScreen->fbWidth * (gmesa->driScreen->fbHeight - 1); } gmesa->Begin = (B_AreaStippleDisable | B_LineStippleDisable | B_AntiAliasDisable | B_TextureDisable | B_FogDisable | B_SubPixelCorrectEnable | B_PrimType_Null); gmesa->ColorDDAMode = (ColorDDAEnable | ColorDDAGouraud); gmesa->GeometryMode = (GM_TextureDisable | GM_FogDisable | GM_FogExp | GM_FrontPolyFill | GM_BackPolyFill | GM_FrontFaceCCW | GM_PolyCullDisable | GM_PolyCullBack | GM_ClipShortLinesDisable | GM_ClipSmallTrisDisable | GM_RenderMode | GM_Feedback2D | GM_CullFaceNormDisable | GM_AutoFaceNormDisable | GM_GouraudShading | GM_UserClipNone | GM_PolyOffsetPointDisable | GM_PolyOffsetLineDisable | GM_PolyOffsetFillDisable | GM_InvertFaceNormCullDisable); gmesa->AlphaTestMode = (AlphaTestModeDisable | AT_Always); gmesa->AB_FBReadMode_Save = gmesa->AB_FBReadMode = 0; gmesa->Window = (WindowEnable | /* For GID testing */ W_PassIfEqual | (0 << 5)); /* GID part is set from draw priv (below) */ gmesa->NotClipped = GL_FALSE; gmesa->WindowChanged = GL_TRUE; gmesa->Texture1DEnabled = GL_FALSE; gmesa->Texture2DEnabled = GL_FALSE; gmesa->DepthMode |= (DepthModeDisable | DM_WriteMask | DM_Less); gmesa->DeltaMode |= (DM_SubPixlCorrectionEnable | DM_SmoothShadingEnable | DM_Target500TXMX); gmesa->LightingMode = LightingModeDisable | LightingModeSpecularEnable; gmesa->Light0Mode = LNM_Off; gmesa->Light1Mode = LNM_Off; gmesa->Light2Mode = LNM_Off; gmesa->Light3Mode = LNM_Off; gmesa->Light4Mode = LNM_Off; gmesa->Light5Mode = LNM_Off; gmesa->Light6Mode = LNM_Off; gmesa->Light7Mode = LNM_Off; gmesa->Light8Mode = LNM_Off; gmesa->Light9Mode = LNM_Off; gmesa->Light10Mode = LNM_Off; gmesa->Light11Mode = LNM_Off; gmesa->Light12Mode = LNM_Off; gmesa->Light13Mode = LNM_Off; gmesa->Light14Mode = LNM_Off; gmesa->Light15Mode = LNM_Off; gmesa->LogicalOpMode = LogicalOpModeDisable; gmesa->MaterialMode = MaterialModeDisable; gmesa->ScissorMode = UserScissorDisable | ScreenScissorDisable; gmesa->TransformMode = XM_UseModelViewProjMatrix | XM_TexGenModeS_None | XM_TexGenModeT_None | XM_TexGenModeR_None | XM_TexGenModeQ_None; CHECK_DMA_BUFFER(gmesa, 20); WRITE(gmesa->buf, LineStippleMode, 0); WRITE(gmesa->buf, RouterMode, 0); WRITE(gmesa->buf, TextureAddressMode, 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -