diff options
author | Francisco Jerez <currojerez@gmail.com> | 2008-12-21 16:02:57 +0100 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-12-21 18:50:59 -0200 |
commit | 068de9c0a302aba21e4d6a27eb6d330375ff2d2f (patch) | |
tree | 4475b33593ef230682888ff6fc38ff637d282e31 /src | |
parent | 373440667636d4e3214028710e33ac89d8f18ff1 (diff) |
Allocate crtc->funcs and output->funcs in the heap.
Diffstat (limited to 'src')
-rw-r--r-- | src/smi501_crtc.c | 61 | ||||
-rw-r--r-- | src/smi501_output.c | 44 | ||||
-rw-r--r-- | src/smi_crtc.c | 33 | ||||
-rw-r--r-- | src/smi_crtc.h | 4 | ||||
-rw-r--r-- | src/smi_output.c | 25 | ||||
-rw-r--r-- | src/smilynx_crtc.c | 96 | ||||
-rw-r--r-- | src/smilynx_output.c | 91 |
7 files changed, 165 insertions, 189 deletions
diff --git a/src/smi501_crtc.c b/src/smi501_crtc.c index 6175f62..d71d738 100644 --- a/src/smi501_crtc.c +++ b/src/smi501_crtc.c @@ -619,63 +619,58 @@ SMI501_CrtcLoadCursorArgb(xf86CrtcPtr crtc, CARD32 *image) } #endif -static xf86CrtcFuncsRec SMI501_Crtc0Funcs; -static SMICrtcPrivateRec SMI501_Crtc0Priv; -static xf86CrtcFuncsRec SMI501_Crtc1Funcs; -static SMICrtcPrivateRec SMI501_Crtc1Priv; - Bool SMI501_CrtcPreInit(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - xf86CrtcPtr crtc0, crtc1; + xf86CrtcPtr crtc; + xf86CrtcFuncsPtr crtcFuncs; + SMICrtcPrivatePtr crtcPriv; ENTER(); /* CRTC0 is LCD */ - SMI_CrtcFuncsInit_base(&SMI501_Crtc0Funcs, &SMI501_Crtc0Priv); - SMI501_Crtc0Funcs.mode_set = SMI501_CrtcModeSet_lcd; - SMI501_Crtc0Priv.adjust_frame = SMI501_CrtcAdjustFrame; - SMI501_Crtc0Priv.video_init = SMI501_CrtcVideoInit_lcd; - SMI501_Crtc0Priv.load_lut = SMI501_CrtcLoadLUT; + SMI_CrtcFuncsInit_base(&crtcFuncs, &crtcPriv); + crtcFuncs->mode_set = SMI501_CrtcModeSet_lcd; + crtcPriv->adjust_frame = SMI501_CrtcAdjustFrame; + crtcPriv->video_init = SMI501_CrtcVideoInit_lcd; + crtcPriv->load_lut = SMI501_CrtcLoadLUT; if (pSmi->HwCursor) { - SMI501_Crtc0Funcs.set_cursor_colors = SMI501_CrtcSetCursorColors; - SMI501_Crtc0Funcs.set_cursor_position = SMI501_CrtcSetCursorPosition; - SMI501_Crtc0Funcs.show_cursor = SMI501_CrtcShowCursor; - SMI501_Crtc0Funcs.hide_cursor = SMI501_CrtcHideCursor; - SMI501_Crtc0Funcs.load_cursor_image = SMI501_CrtcLoadCursorImage; + crtcFuncs->set_cursor_colors = SMI501_CrtcSetCursorColors; + crtcFuncs->set_cursor_position = SMI501_CrtcSetCursorPosition; + crtcFuncs->show_cursor = SMI501_CrtcShowCursor; + crtcFuncs->hide_cursor = SMI501_CrtcHideCursor; + crtcFuncs->load_cursor_image = SMI501_CrtcLoadCursorImage; #if SMI_CURSOR_ALPHA_PLANE if (!pSmi->Dualhead) - SMI501_Crtc0Funcs.load_cursor_argb = SMI501_CrtcLoadCursorArgb; + crtcFuncs->load_cursor_argb = SMI501_CrtcLoadCursorArgb; #endif } - crtc0 = xf86CrtcCreate(pScrn, &SMI501_Crtc0Funcs); - if (!crtc0) + if (! (crtc = xf86CrtcCreate(pScrn, crtcFuncs))) LEAVE(FALSE); - crtc0->driver_private = &SMI501_Crtc0Priv; + crtc->driver_private = crtcPriv; /* CRTC1 is CRT */ if (pSmi->Dualhead) { - SMI_CrtcFuncsInit_base(&SMI501_Crtc1Funcs, &SMI501_Crtc1Priv); - SMI501_Crtc1Funcs.mode_set = SMI501_CrtcModeSet_crt; - SMI501_Crtc1Priv.adjust_frame = SMI501_CrtcAdjustFrame; - SMI501_Crtc1Priv.video_init = SMI501_CrtcVideoInit_crt; - SMI501_Crtc1Priv.load_lut = SMI501_CrtcLoadLUT; + SMI_CrtcFuncsInit_base(&crtcFuncs, &crtcPriv); + crtcFuncs->mode_set = SMI501_CrtcModeSet_crt; + crtcPriv->adjust_frame = SMI501_CrtcAdjustFrame; + crtcPriv->video_init = SMI501_CrtcVideoInit_crt; + crtcPriv->load_lut = SMI501_CrtcLoadLUT; if (pSmi->HwCursor) { - SMI501_Crtc1Funcs.set_cursor_colors = SMI501_CrtcSetCursorColors; - SMI501_Crtc1Funcs.set_cursor_position = SMI501_CrtcSetCursorPosition; - SMI501_Crtc1Funcs.show_cursor = SMI501_CrtcShowCursor; - SMI501_Crtc1Funcs.hide_cursor = SMI501_CrtcHideCursor; - SMI501_Crtc1Funcs.load_cursor_image = SMI501_CrtcLoadCursorImage; + crtcFuncs->set_cursor_colors = SMI501_CrtcSetCursorColors; + crtcFuncs->set_cursor_position = SMI501_CrtcSetCursorPosition; + crtcFuncs->show_cursor = SMI501_CrtcShowCursor; + crtcFuncs->hide_cursor = SMI501_CrtcHideCursor; + crtcFuncs->load_cursor_image = SMI501_CrtcLoadCursorImage; } - crtc1 = xf86CrtcCreate(pScrn, &SMI501_Crtc1Funcs); - if (!crtc1) + if (! (crtc = xf86CrtcCreate(pScrn, crtcFuncs))) LEAVE(FALSE); - crtc1->driver_private = &SMI501_Crtc1Priv; + crtc->driver_private = crtcPriv; } LEAVE(TRUE); diff --git a/src/smi501_output.c b/src/smi501_output.c index 1d065fb..24aa5dc 100644 --- a/src/smi501_output.c +++ b/src/smi501_output.c @@ -128,49 +128,45 @@ SMI501_OutputDetect_crt(xf86OutputPtr output) } #endif -static xf86OutputFuncsRec SMI501_Output0Funcs; -static xf86OutputFuncsRec SMI501_Output1Funcs; - Bool SMI501_OutputPreInit(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - xf86OutputPtr output0, output1; + xf86OutputPtr output; + xf86OutputFuncsPtr outputFuncs; ENTER(); /* CRTC0 is LCD */ - SMI_OutputFuncsInit_base(&SMI501_Output0Funcs); - SMI501_Output0Funcs.dpms = SMI501_OutputDPMS_lcd; - SMI501_Output0Funcs.get_modes = SMI_OutputGetModes_native; - SMI501_Output0Funcs.detect = SMI_OutputDetect_lcd; + SMI_OutputFuncsInit_base(&outputFuncs); + outputFuncs->dpms = SMI501_OutputDPMS_lcd; + outputFuncs->get_modes = SMI_OutputGetModes_native; + outputFuncs->detect = SMI_OutputDetect_lcd; - output0 = xf86OutputCreate(pScrn, &SMI501_Output0Funcs, "LVDS"); - if (!output0) + if (! (output = xf86OutputCreate(pScrn, outputFuncs, "LVDS"))) LEAVE(FALSE); - output0->possible_crtcs = 1 << 0; - output0->possible_clones = 0; - output0->interlaceAllowed = FALSE; - output0->doubleScanAllowed = FALSE; + output->possible_crtcs = 1 << 0; + output->possible_clones = 0; + output->interlaceAllowed = FALSE; + output->doubleScanAllowed = FALSE; /* CRTC1 is CRT */ if (pSmi->Dualhead) { - SMI_OutputFuncsInit_base(&SMI501_Output1Funcs); - SMI501_Output1Funcs.dpms = SMI501_OutputDPMS_crt; - SMI501_Output1Funcs.get_modes = SMI_OutputGetModes_native; + SMI_OutputFuncsInit_base(&outputFuncs); + outputFuncs->dpms = SMI501_OutputDPMS_crt; + outputFuncs->get_modes = SMI_OutputGetModes_native; #ifdef USE_CRTC_DETECT - SMI501_Output1Funcs.detect = SMI501_OutputDetect_crt; + outputFuncs->detect = SMI501_OutputDetect_crt; #endif - output1 = xf86OutputCreate(pScrn, &SMI501_Output1Funcs, "VGA"); - if (!output1) + if (! (output = xf86OutputCreate(pScrn, outputFuncs, "VGA"))) LEAVE(FALSE); - output1->possible_crtcs = 1 << 1; - output1->possible_clones = 0; - output1->interlaceAllowed = FALSE; - output1->doubleScanAllowed = FALSE; + output->possible_crtcs = 1 << 1; + output->possible_clones = 0; + output->interlaceAllowed = FALSE; + output->doubleScanAllowed = FALSE; } LEAVE(TRUE); diff --git a/src/smi_crtc.c b/src/smi_crtc.c index 0ff4390..080473e 100644 --- a/src/smi_crtc.c +++ b/src/smi_crtc.c @@ -173,7 +173,8 @@ SMI_CrtcDestroy (xf86CrtcPtr crtc) { ENTER(); - /* Nothing */ + xfree(SMICRTC(crtc)); + xfree(crtc->funcs); LEAVE(); } @@ -240,21 +241,21 @@ SMI_CrtcConfigResize(ScrnInfoPtr pScrn, } void -SMI_CrtcFuncsInit_base(xf86CrtcFuncsPtr crtcFuncs, SMICrtcPrivatePtr crtcPriv){ - memset(crtcFuncs,0,sizeof(xf86CrtcFuncsRec)); - memset(crtcPriv,0,sizeof(SMICrtcPrivatePtr)); - - crtcFuncs->dpms = SMI_CrtcDPMS; - crtcFuncs->lock = SMI_CrtcLock; - crtcFuncs->unlock = SMI_CrtcUnlock; - crtcFuncs->mode_fixup = SMI_CrtcModeFixup; - crtcFuncs->prepare = SMI_CrtcPrepare; - crtcFuncs->commit = SMI_CrtcCommit; - crtcFuncs->gamma_set = SMI_CrtcGammaSet; - crtcFuncs->shadow_allocate = SMI_CrtcShadowAllocate; - crtcFuncs->shadow_create = SMI_CrtcShadowCreate; - crtcFuncs->shadow_destroy = SMI_CrtcShadowDestroy; - crtcFuncs->destroy = SMI_CrtcDestroy; +SMI_CrtcFuncsInit_base(xf86CrtcFuncsPtr* crtcFuncs, SMICrtcPrivatePtr* crtcPriv){ + *crtcFuncs = xnfcalloc(sizeof(xf86CrtcFuncsRec), 1); + *crtcPriv = xnfcalloc(sizeof(SMICrtcPrivateRec), 1); + + (*crtcFuncs)->dpms = SMI_CrtcDPMS; + (*crtcFuncs)->lock = SMI_CrtcLock; + (*crtcFuncs)->unlock = SMI_CrtcUnlock; + (*crtcFuncs)->mode_fixup = SMI_CrtcModeFixup; + (*crtcFuncs)->prepare = SMI_CrtcPrepare; + (*crtcFuncs)->commit = SMI_CrtcCommit; + (*crtcFuncs)->gamma_set = SMI_CrtcGammaSet; + (*crtcFuncs)->shadow_allocate = SMI_CrtcShadowAllocate; + (*crtcFuncs)->shadow_create = SMI_CrtcShadowCreate; + (*crtcFuncs)->shadow_destroy = SMI_CrtcShadowDestroy; + (*crtcFuncs)->destroy = SMI_CrtcDestroy; } static xf86CrtcConfigFuncsRec SMI_CrtcConfigFuncs = { diff --git a/src/smi_crtc.h b/src/smi_crtc.h index 951f78f..8744379 100644 --- a/src/smi_crtc.h +++ b/src/smi_crtc.h @@ -47,13 +47,13 @@ typedef struct { /* smi_crtc.c */ /* Initialize the xf86CrtcFuncsRec with functions common to all the hardware */ -void SMI_CrtcFuncsInit_base(xf86CrtcFuncsPtr crtcFuncs, SMICrtcPrivatePtr crtcPriv); +void SMI_CrtcFuncsInit_base(xf86CrtcFuncsPtr* crtcFuncs, SMICrtcPrivatePtr* crtcPriv); /* Create and initialize the display controllers. */ Bool SMI_CrtcPreInit(ScrnInfoPtr pScrn); /* smi_output.c */ /* Initialize the xf86OutputFuncsRec with functions common to all the hardware */ -void SMI_OutputFuncsInit_base(xf86OutputFuncsPtr outputFuncs); +void SMI_OutputFuncsInit_base(xf86OutputFuncsPtr* outputFuncs); /* Create and initialize the video outputs. */ Bool SMI_OutputPreInit(ScrnInfoPtr pScrn); diff --git a/src/smi_output.c b/src/smi_output.c index 5ddbcc8..bbc3f5c 100644 --- a/src/smi_output.c +++ b/src/smi_output.c @@ -151,30 +151,29 @@ SMI_OutputGetModes_native(xf86OutputPtr output) #endif } - - static void SMI_OutputDestroy(xf86OutputPtr output) { ENTER(); - /* Nothing */ + xfree(output->funcs); LEAVE(); } void -SMI_OutputFuncsInit_base(xf86OutputFuncsPtr outputFuncs) +SMI_OutputFuncsInit_base(xf86OutputFuncsPtr* outputFuncs) { - memset(outputFuncs,0,sizeof(outputFuncs)); - outputFuncs->create_resources = SMI_OutputCreateResources; - outputFuncs->mode_valid = SMI_OutputModeValid; - outputFuncs->mode_fixup = SMI_OutputModeFixup; - outputFuncs->prepare = SMI_OutputPrepare; - outputFuncs->commit = SMI_OutputCommit; - outputFuncs->mode_set = SMI_OutputModeSet; - outputFuncs->detect = SMI_OutputDetect; - outputFuncs->destroy = SMI_OutputDestroy; + *outputFuncs = xnfcalloc(sizeof(xf86OutputFuncsRec), 1); + + (*outputFuncs)->create_resources = SMI_OutputCreateResources; + (*outputFuncs)->mode_valid = SMI_OutputModeValid; + (*outputFuncs)->mode_fixup = SMI_OutputModeFixup; + (*outputFuncs)->prepare = SMI_OutputPrepare; + (*outputFuncs)->commit = SMI_OutputCommit; + (*outputFuncs)->mode_set = SMI_OutputModeSet; + (*outputFuncs)->detect = SMI_OutputDetect; + (*outputFuncs)->destroy = SMI_OutputDestroy; } Bool diff --git a/src/smilynx_crtc.c b/src/smilynx_crtc.c index 7fafea1..08d798e 100644 --- a/src/smilynx_crtc.c +++ b/src/smilynx_crtc.c @@ -738,17 +738,13 @@ SMILynx_CrtcLoadCursorImage_crt (xf86CrtcPtr crtc, CARD8 *image) LEAVE(); } -static xf86CrtcFuncsRec SMILynx_Crtc0Funcs; -static SMICrtcPrivateRec SMILynx_Crtc0Priv; -static xf86CrtcFuncsRec SMILynx_Crtc1Funcs; -static SMICrtcPrivateRec SMILynx_Crtc1Priv; - Bool SMILynx_CrtcPreInit(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - xf86CrtcPtr crtc0=NULL; - xf86CrtcPtr crtc1=NULL; + xf86CrtcPtr crtc; + xf86CrtcFuncsPtr crtcFuncs; + SMICrtcPrivatePtr crtcPriv; ENTER(); @@ -758,71 +754,67 @@ SMILynx_CrtcPreInit(ScrnInfoPtr pScrn) splitting the WRITE_FPR/WRITE_VPR calls in separate functions. Has someone access to this hardware? */ - SMI_CrtcFuncsInit_base(&SMILynx_Crtc0Funcs, &SMILynx_Crtc0Priv); - SMILynx_Crtc0Funcs.mode_set = SMILynx_CrtcModeSet_vga; - SMILynx_Crtc0Priv.adjust_frame = SMILynx_CrtcAdjustFrame; - SMILynx_Crtc0Priv.video_init = SMI730_CrtcVideoInit; - SMILynx_Crtc0Priv.load_lut = SMILynx_CrtcLoadLUT_crt; + SMI_CrtcFuncsInit_base(&crtcFuncs, &crtcPriv); + crtcFuncs->mode_set = SMILynx_CrtcModeSet_vga; + crtcPriv->adjust_frame = SMILynx_CrtcAdjustFrame; + crtcPriv->video_init = SMI730_CrtcVideoInit; + crtcPriv->load_lut = SMILynx_CrtcLoadLUT_crt; if(pSmi->HwCursor){ - SMILynx_Crtc0Funcs.set_cursor_colors = SMILynx_CrtcSetCursorColors_crt; - SMILynx_Crtc0Funcs.set_cursor_position = SMILynx_CrtcSetCursorPosition_crt; - SMILynx_Crtc0Funcs.show_cursor = SMILynx_CrtcShowCursor_crt; - SMILynx_Crtc0Funcs.hide_cursor = SMILynx_CrtcHideCursor_crt; - SMILynx_Crtc0Funcs.load_cursor_image = SMILynx_CrtcLoadCursorImage_crt; + crtcFuncs->set_cursor_colors = SMILynx_CrtcSetCursorColors_crt; + crtcFuncs->set_cursor_position = SMILynx_CrtcSetCursorPosition_crt; + crtcFuncs->show_cursor = SMILynx_CrtcShowCursor_crt; + crtcFuncs->hide_cursor = SMILynx_CrtcHideCursor_crt; + crtcFuncs->load_cursor_image = SMILynx_CrtcLoadCursorImage_crt; } - crtc0=xf86CrtcCreate(pScrn,&SMILynx_Crtc0Funcs); - if(!crtc0) + if(! (crtc = xf86CrtcCreate(pScrn,crtcFuncs))) LEAVE(FALSE); - crtc0->driver_private = &SMILynx_Crtc0Priv; + crtc->driver_private = crtcPriv; }else{ if(pSmi->Dualhead){ - /* CRTC0 is LCD*/ - SMI_CrtcFuncsInit_base(&SMILynx_Crtc0Funcs, &SMILynx_Crtc0Priv); - SMILynx_Crtc0Funcs.mode_set = SMILynx_CrtcModeSet_lcd; - SMILynx_Crtc0Priv.adjust_frame = SMILynx_CrtcAdjustFrame; - SMILynx_Crtc0Priv.video_init = SMILynx_CrtcVideoInit_lcd; - SMILynx_Crtc0Priv.load_lut = SMILynx_CrtcLoadLUT_lcd; - - crtc0=xf86CrtcCreate(pScrn,&SMILynx_Crtc0Funcs); - if(!crtc0) + /* CRTC is LCD*/ + SMI_CrtcFuncsInit_base(&crtcFuncs, &crtcPriv); + crtcFuncs->mode_set = SMILynx_CrtcModeSet_lcd; + crtcPriv->adjust_frame = SMILynx_CrtcAdjustFrame; + crtcPriv->video_init = SMILynx_CrtcVideoInit_lcd; + crtcPriv->load_lut = SMILynx_CrtcLoadLUT_lcd; + + if(! (crtc = xf86CrtcCreate(pScrn,crtcFuncs))) LEAVE(FALSE); - crtc0->driver_private = &SMILynx_Crtc0Priv; + crtc->driver_private = crtcPriv; /* CRTC1 is CRT */ - SMI_CrtcFuncsInit_base(&SMILynx_Crtc1Funcs, &SMILynx_Crtc1Priv); - SMILynx_Crtc1Funcs.mode_set = SMILynx_CrtcModeSet_crt; - SMILynx_Crtc1Priv.adjust_frame = SMILynx_CrtcAdjustFrame; - SMILynx_Crtc1Priv.video_init = SMILynx_CrtcVideoInit_crt; - SMILynx_Crtc1Priv.load_lut = SMILynx_CrtcLoadLUT_crt; - - crtc1=xf86CrtcCreate(pScrn,&SMILynx_Crtc1Funcs); - if(!crtc1) + SMI_CrtcFuncsInit_base(&crtcFuncs, &crtcPriv); + crtcFuncs->mode_set = SMILynx_CrtcModeSet_crt; + crtcPriv->adjust_frame = SMILynx_CrtcAdjustFrame; + crtcPriv->video_init = SMILynx_CrtcVideoInit_crt; + crtcPriv->load_lut = SMILynx_CrtcLoadLUT_crt; + + if(! (crtc = xf86CrtcCreate(pScrn,crtcFuncs))) LEAVE(FALSE); - crtc1->driver_private = &SMILynx_Crtc1Priv; + crtc->driver_private = crtcPriv; }else{ /* CRTC0 is LCD, but in standard refresh mode it is controlled through the primary VGA registers */ - SMI_CrtcFuncsInit_base(&SMILynx_Crtc0Funcs, &SMILynx_Crtc0Priv); - SMILynx_Crtc0Funcs.mode_set = SMILynx_CrtcModeSet_vga; - SMILynx_Crtc0Priv.adjust_frame = SMILynx_CrtcAdjustFrame; - SMILynx_Crtc0Priv.video_init = SMILynx_CrtcVideoInit_crt; - SMILynx_Crtc0Priv.load_lut = SMILynx_CrtcLoadLUT_crt; + SMI_CrtcFuncsInit_base(&crtcFuncs, &crtcPriv); + crtcFuncs->mode_set = SMILynx_CrtcModeSet_vga; + crtcPriv->adjust_frame = SMILynx_CrtcAdjustFrame; + crtcPriv->video_init = SMILynx_CrtcVideoInit_crt; + crtcPriv->load_lut = SMILynx_CrtcLoadLUT_crt; if(pSmi->HwCursor){ - SMILynx_Crtc0Funcs.set_cursor_colors = SMILynx_CrtcSetCursorColors_crt; - SMILynx_Crtc0Funcs.set_cursor_position = SMILynx_CrtcSetCursorPosition_crt; - SMILynx_Crtc0Funcs.show_cursor = SMILynx_CrtcShowCursor_crt; - SMILynx_Crtc0Funcs.hide_cursor = SMILynx_CrtcHideCursor_crt; - SMILynx_Crtc0Funcs.load_cursor_image = SMILynx_CrtcLoadCursorImage_crt; + crtcFuncs->set_cursor_colors = SMILynx_CrtcSetCursorColors_crt; + crtcFuncs->set_cursor_position = SMILynx_CrtcSetCursorPosition_crt; + crtcFuncs->show_cursor = SMILynx_CrtcShowCursor_crt; + crtcFuncs->hide_cursor = SMILynx_CrtcHideCursor_crt; + crtcFuncs->load_cursor_image = SMILynx_CrtcLoadCursorImage_crt; } - crtc0=xf86CrtcCreate(pScrn,&SMILynx_Crtc0Funcs); - if(!crtc0) + if(! (crtc = xf86CrtcCreate(pScrn,crtcFuncs))) LEAVE(FALSE); - crtc0->driver_private = &SMILynx_Crtc0Priv; + crtc->driver_private = crtcPriv; } } diff --git a/src/smilynx_output.c b/src/smilynx_output.c index f9bd79f..4647cdd 100644 --- a/src/smilynx_output.c +++ b/src/smilynx_output.c @@ -200,79 +200,72 @@ SMILynx_OutputDetect_crt(xf86OutputPtr output) LEAVE(XF86OutputStatusDisconnected); } -static xf86OutputFuncsRec SMILynx_Output0Funcs; -static xf86OutputFuncsRec SMILynx_Output1Funcs; - Bool SMILynx_OutputPreInit(ScrnInfoPtr pScrn) { SMIPtr pSmi = SMIPTR(pScrn); - xf86OutputPtr output0=NULL; - xf86OutputPtr output1=NULL; + xf86OutputPtr output; + xf86OutputFuncsPtr outputFuncs; ENTER(); if(pSmi->Chipset == SMI_COUGAR3DR){ - /* CRTC0 is LCD */ - SMI_OutputFuncsInit_base(&SMILynx_Output0Funcs); - SMILynx_Output0Funcs.dpms=SMILynx_OutputDPMS_lcd; - SMILynx_Output0Funcs.get_modes=SMI_OutputGetModes_native; - SMILynx_Output0Funcs.detect=SMI_OutputDetect_lcd; - - output0=xf86OutputCreate(pScrn,&SMILynx_Output0Funcs,"LVDS"); - if(!output0) - LEAVE(FALSE); - - output0->possible_crtcs = 1 << 0; - output0->possible_clones = 0; - output0->interlaceAllowed = FALSE; - output0->doubleScanAllowed = FALSE; + /* CRTC0 is LCD */ + SMI_OutputFuncsInit_base(&outputFuncs); + outputFuncs->dpms = SMILynx_OutputDPMS_lcd; + outputFuncs->get_modes = SMI_OutputGetModes_native; + outputFuncs->detect = SMI_OutputDetect_lcd; + + if(! (output = xf86OutputCreate(pScrn,outputFuncs,"LVDS"))) + LEAVE(FALSE); + + output->possible_crtcs = 1 << 0; + output->possible_clones = 0; + output->interlaceAllowed = FALSE; + output->doubleScanAllowed = FALSE; }else{ if(pSmi->Dualhead){ /* CRTC0 is LCD*/ - SMI_OutputFuncsInit_base(&SMILynx_Output0Funcs); - SMILynx_Output0Funcs.dpms=SMILynx_OutputDPMS_lcd; - SMILynx_Output0Funcs.get_modes=SMI_OutputGetModes_native; - SMILynx_Output0Funcs.detect=SMI_OutputDetect_lcd; + SMI_OutputFuncsInit_base(&outputFuncs); + outputFuncs->dpms = SMILynx_OutputDPMS_lcd; + outputFuncs->get_modes = SMI_OutputGetModes_native; + outputFuncs->detect = SMI_OutputDetect_lcd; - output0=xf86OutputCreate(pScrn,&SMILynx_Output0Funcs,"LVDS"); - if(!output0) + if(! (output = xf86OutputCreate(pScrn,outputFuncs,"LVDS"))) LEAVE(FALSE); - output0->possible_crtcs = 1 << 0; - output0->possible_clones = 0; - output0->interlaceAllowed = FALSE; - output0->doubleScanAllowed = FALSE; + output->possible_crtcs = 1 << 0; + output->possible_clones = 0; + output->interlaceAllowed = FALSE; + output->doubleScanAllowed = FALSE; /* CRTC1 is CRT*/ - SMI_OutputFuncsInit_base(&SMILynx_Output1Funcs); - SMILynx_Output1Funcs.dpms=SMILynx_OutputDPMS_crt; - SMILynx_Output1Funcs.get_modes=SMILynx_OutputGetModes_crt; - SMILynx_Output1Funcs.detect=SMILynx_OutputDetect_crt; + SMI_OutputFuncsInit_base(&outputFuncs); + outputFuncs->dpms = SMILynx_OutputDPMS_crt; + outputFuncs->get_modes = SMILynx_OutputGetModes_crt; + outputFuncs->detect = SMILynx_OutputDetect_crt; - output1=xf86OutputCreate(pScrn,&SMILynx_Output1Funcs,"VGA"); - if(!output1) + if(! (output = xf86OutputCreate(pScrn,outputFuncs,"VGA"))) LEAVE(FALSE); - output1->possible_crtcs = 1 << 1; - output1->possible_clones = 0; - output1->interlaceAllowed = FALSE; - output1->doubleScanAllowed = FALSE; + output->possible_crtcs = 1 << 1; + output->possible_clones = 0; + output->interlaceAllowed = FALSE; + output->doubleScanAllowed = FALSE; }else{ /* CRTC0 is LCD */ - SMI_OutputFuncsInit_base(&SMILynx_Output0Funcs); - SMILynx_Output0Funcs.dpms=SMILynx_OutputDPMS_lcd; - SMILynx_Output0Funcs.get_modes=SMI_OutputGetModes_native; - SMILynx_Output0Funcs.detect=SMI_OutputDetect_lcd; + SMI_OutputFuncsInit_base(&outputFuncs); + outputFuncs->dpms = SMILynx_OutputDPMS_lcd; + outputFuncs->get_modes = SMI_OutputGetModes_native; + outputFuncs->detect = SMI_OutputDetect_lcd; - output0=xf86OutputCreate(pScrn,&SMILynx_Output0Funcs,"LVDS"); - if(!output0) + if(! (output = xf86OutputCreate(pScrn,outputFuncs,"LVDS"))) LEAVE(FALSE); - output0->possible_crtcs = 1 << 0; - output0->possible_clones = 0; - output0->interlaceAllowed = FALSE; - output0->doubleScanAllowed = FALSE; + output->possible_crtcs = 1 << 0; + output->possible_clones = 0; + output->interlaceAllowed = FALSE; + output->doubleScanAllowed = FALSE; } } |