NV50: More patches to test
This is primarily targeted at Koala_BR, but if someone happens to have a a fully working nouveay g80 setup, then go ahead.
Maarten.
(this is attempt 2, as 100 KiB seems to be the maximum allowed size)
From a9de6322b8386d25bef50f79375821f3e52a8640 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sat, 15 Mar 2008 18:20:34 +0100
Subject: [PATCH] NV50: Merge crtc creation.
--- src/nv50_crtc.c | 18 ++---------------- src/nv50_display.h | 1 + src/nv_crtc.c | 7 ++++++- src/nv_driver.c | 4 +++- 4 files changed, 12 insertions(+), 18 deletions(-)
src/nv50_crtc.c +2 -16
@@ -99,22 +99,8 @@ static const xf86CrtcFuncsRec nv50_crtc_funcs = { .destroy = NULL, }; -void NV50DispCreateCrtcs (ScrnInfoPtr pScrn) +const xf86CrtcFuncsRec *nv50_get_crtc_funcs () { -NVPtr pNv =NVPTR (pScrn); -Head head; -xf86CrtcPtr crtc; -NVCrtcPrivatePtr nv50_crtc; - -/* Create a "crtc" object for each head */ -for (head =HEAD0 ; head <=HEAD1 ; head++) { - crtc =xf86CrtcCreate (pScrn, &nv50_crtc_funcs); -if (!crtc)return ; - - nv50_crtc =xnfcalloc (sizeof (*nv50_crtc),1 ); - nv50_crtc->head = head; - nv50_crtc->ditherEnabled = pNv->FPDither; - crtc->driver_private = nv50_crtc; - } +return &nv50_crtc_funcs; }
src/nv50_display.h +1 -0
@@ -19,5 +19,6 @@ void NV50CrtcSetDither(xf86CrtcPtr, Bool dither, Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn); +const xf86CrtcFuncsRec *nv50_get_crtc_funcs ();#endif
src/nv_crtc.c +6 -1
@@ -1744,7 +1744,9 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num)NVCrtcRegPtr regp = &pNv->ModeReg.crtc_reg[crtc_num];int i; -if (pNv->NVArch >=0x11 ) +if (pNv->Architecture ==NV_ARCH_50 ) + crtc =xf86CrtcCreate (pScrn,nv50_get_crtc_funcs ()); +else if (pNv->NVArch >=0x11 ) crtc =xf86CrtcCreate (pScrn, &nv11_crtc_funcs);else crtc =xf86CrtcCreate (pScrn, &nv_crtc_funcs);
@@ -1758,6 +1760,9 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num) crtc->driver_private = nv_crtc; +if (pNv->Architecture ==NV_ARCH_50 ) +return ; +/* Initialise the default LUT table. */ for (i =0 ; i <256 ; i++) { regp->DAC[i*3 ] = i;
src/nv_driver.c +3 -1
@@ -1438,7 +1438,9 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVPreInitFail ("\n" );if (!NV50CreateOutputs (pScrn))NVPreInitFail ("\n" ); -NV50DispCreateCrtcs (pScrn); +for (i =0 ; i <2 ; i++) { +nv_crtc_init (pScrn, i); + } }if (!xf86InitialConfiguration (pScrn, FALSE))
Signature · 1 line
1.5.4.3
From 38e3b17b1f8f3d0dfe1a4cf9967f4e1d19066f29 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sat, 15 Mar 2008 19:02:55 +0100
Subject: [PATCH] NV50: Merge output creation and i2c init.
--- src/nv50_dac.c | 21 +----- src/nv50_output.c | 206 ----------------------------------------------------- src/nv50_output.h | 5 +- src/nv50_sor.c | 64 +++-------------- src/nv_driver.c | 24 +++---- src/nv_i2c.c | 37 +++++++++- src/nv_output.c | 75 ++++++++++++++++---- 7 files changed, 122 insertions(+), 310 deletions(-)
src/nv50_dac.c +2 -19
@@ -191,25 +191,8 @@ static const xf86OutputFuncsRec NV50DacOutputFuncs = { .destroy = NV50DacDestroy, }; -xf86OutputPtr -NV50CreateDac (ScrnInfoPtr pScrn,ORNum or) +const xf86OutputFuncsRec *nv50_get_analog_output_funcs () { -NVOutputPrivatePtr nv_output =xnfcalloc (sizeof (*nv_output),1 ); -xf86OutputPtr output; -char orName[5 ]; - -if (!nv_output) -return NULL ; - -snprintf (orName,5 ,"VGA%i" , or); - output =xf86OutputCreate (pScrn, &NV50DacOutputFuncs, orName); - - nv_output->type =OUTPUT_ANALOG ; - nv_output->output_resource = or; - output->driver_private = nv_output; - output->interlaceAllowed = TRUE; - output->doubleScanAllowed = TRUE; - -return output; +return &NV50DacOutputFuncs; }
src/nv50_output.c +0 -206
215 lines not on this page · raw message
src/nv50_output.h +4 -1
@@ -10,15 +10,18 @@ void NV50OutputPrepare(xf86OutputPtr);void NV50OutputCommit (xf86OutputPtr );DisplayModePtr NV50OutputGetDDCModes (xf86OutputPtr );void NV50OutputDestroy (xf86OutputPtr ); -Bool NV50CreateOutputs (ScrnInfoPtr );/* nv50_dac.c */ xf86OutputPtr NV50CreateDac (ScrnInfoPtr ,ORNum );Bool NV50DacLoadDetect (xf86OutputPtr );void NV50DacSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_analog_output_funcs ();/* nv50_sor.c */ xf86OutputPtr NV50CreateSor (ScrnInfoPtr pScrn,ORNum or,NVOutputType type);void NV50SorSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_tmds_output_funcs (); +const xf86OutputFuncsRec *nv50_get_lvds_output_funcs (); +DisplayModePtr GetLVDSNativeMode (ScrnInfoPtr pScrn);#endif
src/nv50_sor.c +11 -53
79 lines not on this page · raw message
src/nv_driver.c +9 -15
@@ -1424,25 +1424,19 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVCommonSetup (pScrn);if (pNv->randr12_enable) { -if (pNv->Architecture <NV_ARCH_50 ) { -NVI2CInit (pScrn); - - num_crtc = pNv->twoHeads ?2 :1 ; -for (i =0 ; i < num_crtc; i++) { -nv_crtc_init (pScrn, i); - } - -NvSetupOutputs (pScrn); - }else { +if (pNv->Architecture ==NV_ARCH_50 )if (!NV50DispPreInit (pScrn))NVPreInitFail ("\n" ); -if (!NV50CreateOutputs (pScrn)) -NVPreInitFail ("\n" ); -for (i =0 ; i <2 ; i++) { -nv_crtc_init (pScrn, i); - } + +NVI2CInit (pScrn); + + num_crtc = pNv->twoHeads ?2 :1 ; +for (i =0 ; i < num_crtc; i++) { +nv_crtc_init (pScrn, i); } +NvSetupOutputs (pScrn); +if (!xf86InitialConfiguration (pScrn, FALSE))NVPreInitFail ("No valid modes.\n" ); }
src/nv_i2c.c +34 -3
@@ -46,10 +46,30 @@ NVI2CPutBits(I2CBusPtr b, int clock, int data)NVWriteVgaCrtc (pNv,0 , b->DriverPrivate.uval +1 , val |0x1 ); } +static void NV50_I2CPutBits (I2CBusPtr b,int clock,int data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; + +NVWrite (pNv, (0x0000E138 +off)/4 , (4 | clock | data <<1 )); +} + +static void NV50_I2CGetBits (I2CBusPtr b,int *clock,int *data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; +unsigned char val; + + val =NVRead (pNv, (0x0000E138 +off)/4 ); + *clock = !!(val &1 ); + *data = !!(val &2 ); +} +Bool NV_I2CInit (ScrnInfoPtr pScrn,I2CBusPtr *bus_ptr,int i2c_reg,char *name) {I2CBusPtr pI2CBus; +NVPtr pNv =NVPTR (pScrn); pI2CBus =xf86CreateI2CBusRec ();if (!pI2CBus)
@@ -57,9 +77,20 @@ NV_I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name) pI2CBus->BusName = name; pI2CBus->scrnIndex = pScrn->scrnIndex; - pI2CBus->I2CPutBits = NVI2CPutBits; - pI2CBus->I2CGetBits = NVI2CGetBits; - pI2CBus->AcknTimeout =5 ; +if (pNv->Architecture ==NV_ARCH_50 ) { + pI2CBus->I2CPutBits = NV50_I2CPutBits; + pI2CBus->I2CGetBits = NV50_I2CGetBits; +/* Could this be used for the rest as well? */ + pI2CBus->ByteTimeout =2200 ;/* VESA DDC spec 3 p. 43 (+10 %) */ + pI2CBus->StartTimeout =550 ; + pI2CBus->BitTimeout =40 ; + pI2CBus->ByteTimeout =40 ; + pI2CBus->AcknTimeout =40 ; + }else { + pI2CBus->I2CPutBits = NVI2CPutBits; + pI2CBus->I2CGetBits = NVI2CGetBits; + pI2CBus->AcknTimeout =5 ; + } pI2CBus->DriverPrivate.uval = i2c_reg;
src/nv_output.c +62 -13
122 lines not on this page · raw message
Signature · 1 line
1.5.4.3
From e0f793ec86f479acf525930645ccf70f90436170 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 00:27:41 +0100
Subject: [PATCH] randr12: Implement dithering output property.
--- src/nv_crtc.c | 11 ++++++++++- src/nv_output.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/nv_type.h | 1 + 3 files changed, 55 insertions(+), 1 deletions(-)
src/nv_crtc.c +10 -1
@@ -1228,7 +1228,8 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeP/* Flatpanel support needs at least a NV10 */ if (pNv->twoHeads) { -if (pNv->FPDither || (is_lvds && !pNv->VBIOS.fp.if_is_24bit)) { +/* Output property. */ +if (nv_output && nv_output->dithering) { nv_crtc->ditherEnabled = TRUE;if (pNv->NVArch ==0x11 ) regp->dither = savep->dither |0x00010000 ;
@@ -1241,6 +1242,14 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeP } } }else { +if (pNv->NVArch !=0x11 ) { +/* reset them */ +int i; +for (i =0 ; i <3 ; i++) { + regp->dither_regs[i] = savep->dither_regs[i]; + regp->dither_regs[i +3 ] = savep->dither_regs[i +3 ]; + } + } nv_crtc->ditherEnabled = FALSE; regp->dither = savep->dither; }
src/nv_output.c +44 -0
68 lines not on this page · raw message
src/nv_type.h +1 -0
@@ -213,6 +213,7 @@ typedef struct _NVOutputPrivateRec {uint32_t fpHeight;DisplayModePtr native_mode;uint8_t scaling_mode; +Bool dithering;NVOutputRegRec restore; } NVOutputPrivateRec, *NVOutputPrivatePtr;
Signature · 1 line
1.5.4.3
From ed569a367930bac12120408b41d28b590550857c Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 00:40:59 +0100
Subject: [PATCH] NV50: Share output properties.
--- src/nv50_display.c | 15 +++-- src/nv50_display.h | 2 +- src/nv50_sor.c | 152 ++-------------------------------------------------- src/nv_crtc.c | 5 +-- src/nv_output.c | 4 +- src/nv_proto.h | 3 + src/nv_type.h | 1 - 7 files changed, 20 insertions(+), 162 deletions(-)
src/nv50_display.c +9 -6
@@ -339,7 +339,7 @@ NV50CrtcModeSet(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mNV50CrtcCommand (crtc,NV50_CRTC0_DEPTH ,NV50_CRTC0_DEPTH_24BPP );break ; } -NV50CrtcSetDither (crtc, nv_crtc->ditherEnabled, FALSE); +NV50CrtcSetDither (crtc, FALSE);NV50CrtcCommand (crtc,0x8a8 ,0x40000 );NV50CrtcCommand (crtc,NV50_CRTC0_FB_POS , y <<16 | x);NV50CrtcCommand (crtc,NV50_CRTC0_SCRN_SIZE , VDisplay <<16 | HDisplay);
@@ -438,14 +438,17 @@ NV50CrtcSkipModeFixup(xf86CrtcPtr crtc) }void -NV50CrtcSetDither (xf86CrtcPtr crtc,Bool dither,Bool update) +NV50CrtcSetDither (xf86CrtcPtr crtc,Bool update) { -NVCrtcPrivatePtr nv_crtc = crtc->driver_private; +xf86OutputPtr output =NVGetOutputFromCRTC (crtc); + +if (!output) +return ; - nv_crtc->ditherEnabled = dither; +NVOutputPrivatePtr nv_output = output->driver_private; -NV50CrtcCommand (crtc,0x8a0 , dither ?0x11 :0 ); -if (update) +NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 ); +if (update)NV50CrtcCommand (crtc,0x80 ,0 ); }
src/nv50_display.h +1 -1
@@ -15,7 +15,7 @@ void NV50CrtcEnableCursor(xf86CrtcPtr, Bool update);void NV50CrtcDisableCursor (xf86CrtcPtr ,Bool update);void NV50CrtcSetCursorPosition (xf86CrtcPtr ,int x,int y);void NV50CrtcSkipModeFixup (xf86CrtcPtr ); -void NV50CrtcSetDither (xf86CrtcPtr ,Bool dither,Bool update); +void NV50CrtcSetDither (xf86CrtcPtr ,Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn);
src/nv50_sor.c +4 -148
170 lines not on this page · raw message
src/nv_crtc.c +1 -4
@@ -102,7 +102,7 @@ void NVCrtcLockUnlock(xf86CrtcPtr crtc, Bool lock)NVLockVgaCrtc (pNv, nv_crtc->head, lock); } -static xf86OutputPtr +xf86OutputPtr NVGetOutputFromCRTC (xf86CrtcPtr crtc) {ScrnInfoPtr pScrn = crtc->scrn;
@@ -1230,7 +1230,6 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePif (pNv->twoHeads) {/* Output property. */ if (nv_output && nv_output->dithering) { - nv_crtc->ditherEnabled = TRUE;if (pNv->NVArch ==0x11 ) regp->dither = savep->dither |0x00010000 ;else {
@@ -1250,7 +1249,6 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeP regp->dither_regs[i +3 ] = savep->dither_regs[i +3 ]; } } - nv_crtc->ditherEnabled = FALSE; regp->dither = savep->dither; } }
@@ -1765,7 +1763,6 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num) nv_crtc =xnfcalloc (sizeof (NVCrtcPrivateRec),1 ); nv_crtc->head = crtc_num; nv_crtc->last_dpms =NV_DPMS_CLEARED ; - nv_crtc->ditherEnabled = pNv->FPDither; crtc->driver_private = nv_crtc;
src/nv_output.c +2 -2
@@ -760,7 +760,7 @@ nv_scaling_mode_lookup(char *name, int size)return scaling_mode[i].mode; } -static void +void nv_digital_output_create_resources (xf86OutputPtr output) {NVOutputPrivatePtr nv_output = output->driver_private;
@@ -823,7 +823,7 @@ nv_digital_output_create_resources(xf86OutputPtr output) } } -static Bool +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value) {
src/nv_proto.h +3 -0
@@ -87,10 +87,13 @@ void nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num);void NVCrtcLockUnlock (xf86CrtcPtr crtc,Bool lock);void NVCrtcWriteCRTC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val);void NVCrtcWriteRAMDAC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val); +xf86OutputPtr NVGetOutputFromCRTC (xf86CrtcPtr crtc);/* nv_output.c */ void NvSetupOutputs (ScrnInfoPtr pScrn);uint32_t nv_get_clock_from_crtc (ScrnInfoPtr pScrn,RIVA_HW_STATE *state,uint8_t crtc); +void nv_digital_output_create_resources (xf86OutputPtr output); +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value);/* nv_hw.c */ uint32_t NVRead (NVPtr pNv,uint32_t reg);
src/nv_type.h +0 -1
@@ -187,7 +187,6 @@ typedef struct _NVCrtcPrivateRec {int head;uint8_t last_dpms;Bool cursorVisible; -Bool ditherEnabled;Bool skipModeFixup;/* NV50 only */ int pclk;/* Pixel clock in kHz */ /* NV50 only */ #if NOUVEAU_EXA_PIXMAPS
Signature · 1 line
1.5.4.3
From a8af69d54477bf064ffbfb830e39e36f68936474 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 01:05:03 +0100
Subject: [PATCH] NV50: Fix a potentional bug.
--- src/nv50_display.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
src/nv50_display.c +7 -4
@@ -391,12 +391,13 @@ NV50CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)static void NV50CrtcShowHideCursor (xf86CrtcPtr crtc,Bool show,Bool update) {NVCrtcPrivatePtr nv_crtc = crtc->driver_private; +ScrnInfoPtr pScrn = crtc->scrn;NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR0 , show ?NV50_CRTC0_CURSOR0_SHOW :NV50_CRTC0_CURSOR0_HIDE ); -if (update) { +if (update) { nv_crtc->cursorVisible = show; -NV50CrtcCommand (crtc,0x80 ,0 ); +NV50DisplayCommand (pScrn,0x80 ,0 ); } }
@@ -441,6 +442,7 @@ void NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update) {xf86OutputPtr output =NVGetOutputFromCRTC (crtc); +ScrnInfoPtr pScrn = crtc->scrn;if (!output)return ;
@@ -449,7 +451,7 @@ NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update)NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 );if (update) -NV50CrtcCommand (crtc,0x80 ,0 ); +NV50DisplayCommand (pScrn,0x80 ,0 ); }static void ComputeAspectScale (DisplayModePtr mode,int *outX,int *outY)
@@ -502,6 +504,7 @@ void NV50CrtcCommit(xf86CrtcPtr crtc) {xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (crtc->scrn); +ScrnInfoPtr pScrn = crtc->scrn;int i, crtc_mask =0 ;/* If any heads are unused, blank them */
@@ -520,6 +523,6 @@ NV50CrtcCommit(xf86CrtcPtr crtc) } } -NV50CrtcCommand (crtc,0x80 ,0 ); +NV50DisplayCommand (pScrn,0x80 ,0 ); }
Signature · 1 line
1.5.4.3
From dd9c490e42b3bb75a1539056be29e208ea0bf2a3 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 01:09:48 +0100
Subject: [PATCH] NV50: Another subtle difference.
--- src/nv50_display.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
src/nv50_display.c +3 -2
@@ -205,6 +205,7 @@ Bool NV50DispInit(ScrnInfoPtr pScrn) {NVPtr pNv =NVPTR (pScrn); +uint32_t val;if (NVRead (pNv,0x00610024 ) &0x100 ) {NVWrite (pNv,0x00610024 ,0x100 );NVWrite (pNv,0x006194e8 ,NVRead (pNv,0x006194e8 ) & ~1 );
@@ -214,13 +215,13 @@ NV50DispInit(ScrnInfoPtr pScrn)NVWrite (pNv,0x00610200 ,0x2b00 );/* A bugfix (#12637) from the nv driver, to unlock the driver if it's left in a poor state */ do { -CARD32 val =NVRead (pNv,0x00610200 ); + val =NVRead (pNv,0x00610200 );if ((val &0x9f0000 ) ==0x20000 )NVWrite (pNv,0x00610200 , val |0x800000 );if ((val &0x3f0000 ) ==0x30000 )NVWrite (pNv,0x00610200 , val |0x200000 ); - }while ((NVRead (pNv,0x00610200 ) &0x1e0000 ) !=0 ); + }while ((val &0x1e0000 ) !=0 );NVWrite (pNv,0x00610300 ,0x1 );NVWrite (pNv,0x00610200 ,0x1000b03 );while (!(NVRead (pNv,0x00610200 ) &0x40000000 ));
Signature · 1 line
1.5.4.3
From 3592dd7987736a7fda2a4e03ace5e2d6612e110b Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 12:33:19 +0100
Subject: [PATCH] NV50: Some more educated guesses at register names.
--- src/nv50_display.c | 23 ++++++++++--------- src/nv50reg.h | 58 +++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 60 insertions(+), 21 deletions(-)
src/nv50_display.c +12 -11
@@ -228,7 +228,8 @@ NV50DispInit(ScrnInfoPtr pScrn)NV50DisplayCommand (pScrn,0x84 ,0 );NV50DisplayCommand (pScrn,0x88 ,0 ); -NV50DisplayCommand (pScrn,0x874 ,0 ); +/* Does the bios always use crtc0? */ +NV50DisplayCommand (pScrn,NV50_CRTC0_BLANK_CTRL ,NV50_CRTC0_BLANK_CTRL_BLANK );NV50DisplayCommand (pScrn,0x800 ,0 );NV50DisplayCommand (pScrn,0x810 ,0 );NV50DisplayCommand (pScrn,0x82c ,0 );
@@ -249,7 +250,7 @@ NV50DispShutdown(ScrnInfoPtr pScrn)NV50CrtcBlankScreen (crtc, TRUE); } -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 );for (i =0 ; i < xf86_config->num_crtc; i++) {xf86CrtcPtr crtc = xf86_config->crtc[i];
@@ -362,10 +363,10 @@ NV50CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_MODE ,NV50_CRTC0_CLUT_MODE_BLANK );NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_OFFSET ,0 );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x85c ,0 ); -NV50CrtcCommand (crtc,0x874 ,0 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK1 ,NV84_CRTC0_BLANK_UNK1_BLANK ); +NV50CrtcCommand (crtc,NV50_CRTC0_BLANK_CTRL ,NV50_CRTC0_BLANK_CTRL_BLANK );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x89c ,0 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK2 ,NV84_CRTC0_BLANK_UNK2_BLANK ); }else {NV50CrtcCommand (crtc,NV50_CRTC0_FB_OFFSET , pNv->FB->offset >>8 );NV50CrtcCommand (crtc,0x864 ,0 );
@@ -376,15 +377,15 @@ NV50CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)NVWrite (pNv,0x0061038C ,0 );NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR_OFFSET , pNv->Cursor->offset >>8 );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x89c ,1 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK2 ,NV84_CRTC0_BLANK_UNK2_UNBLANK );if (nv_crtc->cursorVisible)NV50CrtcShowHideCursor (crtc, TRUE, FALSE);NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_MODE , pScrn->depth ==8 ?NV50_CRTC0_CLUT_MODE_OFF :NV50_CRTC0_CLUT_MODE_ON );NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_OFFSET , pNv->CLUT->offset >>8 );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x85c ,1 ); -NV50CrtcCommand (crtc,0x874 ,1 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK1 ,NV84_CRTC0_BLANK_UNK1_UNBLANK ); +NV50CrtcCommand (crtc,NV50_CRTC0_BLANK_CTRL_BLANK ,NV50_CRTC0_BLANK_CTRL_UNBLANK ); } }
@@ -398,7 +399,7 @@ static void NV50CrtcShowHideCursor(xf86CrtcPtr crtc, Bool show, Bool update) show ? NV50_CRTC0_CURSOR0_SHOW : NV50_CRTC0_CURSOR0_HIDE);if (update) { nv_crtc->cursorVisible = show; -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); } }
@@ -452,7 +453,7 @@ NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update)NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 );if (update) -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); }static void ComputeAspectScale (DisplayModePtr mode,int *outX,int *outY)
@@ -524,6 +525,6 @@ NV50CrtcCommit(xf86CrtcPtr crtc) } } -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); }
src/nv50reg.h +48 -10
87 lines not on this page · raw message
Signature · 1 line
1.5.4.3
From 260c70da677618c22514f2e2ea4d5d49aeb09d08 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 12:46:40 +0100
Subject: [PATCH] NV50: Mostly resorting regs.
- Also a dithering register define and rename cursor related reg.
--- src/nv50_display.c | 7 ++- src/nv50reg.h | 108 ++++++++++++++++++++++++++++----------------------- 2 files changed, 63 insertions(+), 52 deletions(-)
src/nv50_display.c +4 -3
@@ -395,8 +395,8 @@ static void NV50CrtcShowHideCursor(xf86CrtcPtr crtc, Bool show, Bool update)NVCrtcPrivatePtr nv_crtc = crtc->driver_private;ScrnInfoPtr pScrn = crtc->scrn; -NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR0 , - show ?NV50_CRTC0_CURSOR0_SHOW :NV50_CRTC0_CURSOR0_HIDE ); +NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR , + show ?NV50_CRTC0_CURSOR_SHOW :NV50_CRTC0_CURSOR_HIDE );if (update) { nv_crtc->cursorVisible = show;NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 );
@@ -451,7 +451,8 @@ NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update)NVOutputPrivatePtr nv_output = output->driver_private; -NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 ); +NV50CrtcCommand (crtc,NV50_CRTC0_DITHERING_CTRL , nv_output->dithering ? +NV50_CRTC0_DITHERING_CTRL_ON :NV50_CRTC0_DITHERING_CTRL_OFF );if (update)NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); }
src/nv50reg.h +59 -49
158 lines not on this page · raw message
Signature · 1 line
1.5.4.3
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 6d4bc9fc0803160525s10044362xd623826b3ac6cba6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 8 lines · Maarten Maathuis
This is primarily targeted at
Koala_BR, but if someone happens to have
a a fully working nouveay g80 setup, then go ahead.Maarten.
(this is attempt 2, as 100 KiB seems to be the maximum allowed size)
And a combined patch.
src/nv50_crtc.c +2 -16
@@ -99,22 +99,8 @@ static const xf86CrtcFuncsRec nv50_crtc_funcs = { .destroy = NULL, }; -void NV50DispCreateCrtcs (ScrnInfoPtr pScrn) +const xf86CrtcFuncsRec *nv50_get_crtc_funcs () { -NVPtr pNv =NVPTR (pScrn); -Head head; -xf86CrtcPtr crtc; -NVCrtcPrivatePtr nv50_crtc; - -/* Create a "crtc" object for each head */ -for (head =HEAD0 ; head <=HEAD1 ; head++) { - crtc =xf86CrtcCreate (pScrn, &nv50_crtc_funcs); -if (!crtc)return ; - - nv50_crtc =xnfcalloc (sizeof (*nv50_crtc),1 ); - nv50_crtc->head = head; - nv50_crtc->ditherEnabled = pNv->FPDither; - crtc->driver_private = nv50_crtc; - } +return &nv50_crtc_funcs; }
src/nv50_dac.c +2 -19
@@ -191,25 +191,8 @@ static const xf86OutputFuncsRec NV50DacOutputFuncs = { .destroy = NV50DacDestroy, }; -xf86OutputPtr -NV50CreateDac (ScrnInfoPtr pScrn,ORNum or) +const xf86OutputFuncsRec *nv50_get_analog_output_funcs () { -NVOutputPrivatePtr nv_output =xnfcalloc (sizeof (*nv_output),1 ); -xf86OutputPtr output; -char orName[5 ]; - -if (!nv_output) -return NULL ; - -snprintf (orName,5 ,"VGA%i" , or); - output =xf86OutputCreate (pScrn, &NV50DacOutputFuncs, orName); - - nv_output->type =OUTPUT_ANALOG ; - nv_output->output_resource = or; - output->driver_private = nv_output; - output->interlaceAllowed = TRUE; - output->doubleScanAllowed = TRUE; - -return output; +return &NV50DacOutputFuncs; }
src/nv50_display.c +31 -22
135 lines not on this page · raw message
src/nv50_display.h +2 -1
@@ -15,9 +15,10 @@ void NV50CrtcEnableCursor(xf86CrtcPtr, Bool update);void NV50CrtcDisableCursor (xf86CrtcPtr ,Bool update);void NV50CrtcSetCursorPosition (xf86CrtcPtr ,int x,int y);void NV50CrtcSkipModeFixup (xf86CrtcPtr ); -void NV50CrtcSetDither (xf86CrtcPtr ,Bool dither,Bool update); +void NV50CrtcSetDither (xf86CrtcPtr ,Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn); +const xf86CrtcFuncsRec *nv50_get_crtc_funcs ();#endif
src/nv50_output.c +0 -206
215 lines not on this page · raw message
src/nv50_output.h +4 -1
@@ -10,15 +10,18 @@ void NV50OutputPrepare(xf86OutputPtr);void NV50OutputCommit (xf86OutputPtr );DisplayModePtr NV50OutputGetDDCModes (xf86OutputPtr );void NV50OutputDestroy (xf86OutputPtr ); -Bool NV50CreateOutputs (ScrnInfoPtr );/* nv50_dac.c */ xf86OutputPtr NV50CreateDac (ScrnInfoPtr ,ORNum );Bool NV50DacLoadDetect (xf86OutputPtr );void NV50DacSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_analog_output_funcs ();/* nv50_sor.c */ xf86OutputPtr NV50CreateSor (ScrnInfoPtr pScrn,ORNum or,NVOutputType type);void NV50SorSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_tmds_output_funcs (); +const xf86OutputFuncsRec *nv50_get_lvds_output_funcs (); +DisplayModePtr GetLVDSNativeMode (ScrnInfoPtr pScrn);#endif
src/nv50_sor.c +15 -201
246 lines not on this page · raw message
src/nv50reg.h +87 -39
158 lines not on this page · raw message
src/nv_crtc.c +17 -6
@@ -102,7 +102,7 @@ void NVCrtcLockUnlock(xf86CrtcPtr crtc, Bool lock)NVLockVgaCrtc (pNv, nv_crtc->head, lock); } -static xf86OutputPtr +xf86OutputPtr NVGetOutputFromCRTC (xf86CrtcPtr crtc) {ScrnInfoPtr pScrn = crtc->scrn;
@@ -1228,8 +1228,8 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeP/* Flatpanel support needs at least a NV10 */ if (pNv->twoHeads) { -if (pNv->FPDither || (is_lvds && !pNv->VBIOS.fp.if_is_24bit)) { - nv_crtc->ditherEnabled = TRUE; +/* Output property. */ +if (nv_output && nv_output->dithering) {if (pNv->NVArch ==0x11 ) regp->dither = savep->dither |0x00010000 ;else {
@@ -1241,7 +1241,14 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeP } } }else { - nv_crtc->ditherEnabled = FALSE; +if (pNv->NVArch !=0x11 ) { +/* reset them */ +int i; +for (i =0 ; i <3 ; i++) { + regp->dither_regs[i] = savep->dither_regs[i]; + regp->dither_regs[i +3 ] = savep->dither_regs[i +3 ]; + } + } regp->dither = savep->dither; } }
@@ -1744,7 +1751,9 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num)NVCrtcRegPtr regp = &pNv->ModeReg.crtc_reg[crtc_num];int i; -if (pNv->NVArch >=0x11 ) +if (pNv->Architecture ==NV_ARCH_50 ) + crtc =xf86CrtcCreate (pScrn,nv50_get_crtc_funcs ()); +else if (pNv->NVArch >=0x11 ) crtc =xf86CrtcCreate (pScrn, &nv11_crtc_funcs);else crtc =xf86CrtcCreate (pScrn, &nv_crtc_funcs);
@@ -1754,10 +1763,12 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num) nv_crtc =xnfcalloc (sizeof (NVCrtcPrivateRec),1 ); nv_crtc->head = crtc_num; nv_crtc->last_dpms =NV_DPMS_CLEARED ; - nv_crtc->ditherEnabled = pNv->FPDither; crtc->driver_private = nv_crtc; +if (pNv->Architecture ==NV_ARCH_50 ) +return ; +/* Initialise the default LUT table. */ for (i =0 ; i <256 ; i++) { regp->DAC[i*3 ] = i;
src/nv_driver.c +9 -13
@@ -1424,23 +1424,19 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVCommonSetup (pScrn);if (pNv->randr12_enable) { -if (pNv->Architecture <NV_ARCH_50 ) { -NVI2CInit (pScrn); - - num_crtc = pNv->twoHeads ?2 :1 ; -for (i =0 ; i < num_crtc; i++) { -nv_crtc_init (pScrn, i); - } - -NvSetupOutputs (pScrn); - }else { +if (pNv->Architecture ==NV_ARCH_50 )if (!NV50DispPreInit (pScrn))NVPreInitFail ("\n" ); -if (!NV50CreateOutputs (pScrn)) -NVPreInitFail ("\n" ); -NV50DispCreateCrtcs (pScrn); + +NVI2CInit (pScrn); + + num_crtc = pNv->twoHeads ?2 :1 ; +for (i =0 ; i < num_crtc; i++) { +nv_crtc_init (pScrn, i); } +NvSetupOutputs (pScrn); +if (!xf86InitialConfiguration (pScrn, FALSE))NVPreInitFail ("No valid modes.\n" ); }
src/nv_i2c.c +34 -3
@@ -46,10 +46,30 @@ NVI2CPutBits(I2CBusPtr b, int clock, int data)NVWriteVgaCrtc (pNv,0 , b->DriverPrivate.uval +1 , val |0x1 ); } +static void NV50_I2CPutBits (I2CBusPtr b,int clock,int data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; + +NVWrite (pNv, (0x0000E138 +off)/4 , (4 | clock | data <<1 )); +} + +static void NV50_I2CGetBits (I2CBusPtr b,int *clock,int *data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; +unsigned char val; + + val =NVRead (pNv, (0x0000E138 +off)/4 ); + *clock = !!(val &1 ); + *data = !!(val &2 ); +} +Bool NV_I2CInit (ScrnInfoPtr pScrn,I2CBusPtr *bus_ptr,int i2c_reg,char *name) {I2CBusPtr pI2CBus; +NVPtr pNv =NVPTR (pScrn); pI2CBus =xf86CreateI2CBusRec ();if (!pI2CBus)
@@ -57,9 +77,20 @@ NV_I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name) pI2CBus->BusName = name; pI2CBus->scrnIndex = pScrn->scrnIndex; - pI2CBus->I2CPutBits = NVI2CPutBits; - pI2CBus->I2CGetBits = NVI2CGetBits; - pI2CBus->AcknTimeout =5 ; +if (pNv->Architecture ==NV_ARCH_50 ) { + pI2CBus->I2CPutBits = NV50_I2CPutBits; + pI2CBus->I2CGetBits = NV50_I2CGetBits; +/* Could this be used for the rest as well? */ + pI2CBus->ByteTimeout =2200 ;/* VESA DDC spec 3 p. 43 (+10 %) */ + pI2CBus->StartTimeout =550 ; + pI2CBus->BitTimeout =40 ; + pI2CBus->ByteTimeout =40 ; + pI2CBus->AcknTimeout =40 ; + }else { + pI2CBus->I2CPutBits = NVI2CPutBits; + pI2CBus->I2CGetBits = NVI2CGetBits; + pI2CBus->AcknTimeout =5 ; + } pI2CBus->DriverPrivate.uval = i2c_reg;
src/nv_output.c +108 -15
196 lines not on this page · raw message
src/nv_proto.h +3 -0
@@ -87,10 +87,13 @@ void nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num);void NVCrtcLockUnlock (xf86CrtcPtr crtc,Bool lock);void NVCrtcWriteCRTC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val);void NVCrtcWriteRAMDAC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val); +xf86OutputPtr NVGetOutputFromCRTC (xf86CrtcPtr crtc);/* nv_output.c */ void NvSetupOutputs (ScrnInfoPtr pScrn);uint32_t nv_get_clock_from_crtc (ScrnInfoPtr pScrn,RIVA_HW_STATE *state,uint8_t crtc); +void nv_digital_output_create_resources (xf86OutputPtr output); +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value);/* nv_hw.c */ uint32_t NVRead (NVPtr pNv,uint32_t reg);
src/nv_type.h +1 -1
@@ -187,7 +187,6 @@ typedef struct _NVCrtcPrivateRec {int head;uint8_t last_dpms;Bool cursorVisible; -Bool ditherEnabled;Bool skipModeFixup;/* NV50 only */ int pclk;/* Pixel clock in kHz */ /* NV50 only */ #if NOUVEAU_EXA_PIXMAPS
@@ -213,6 +212,7 @@ typedef struct _NVOutputPrivateRec {uint32_t fpHeight;DisplayModePtr native_mode;uint8_t scaling_mode; +Bool dithering;NVOutputRegRec restore; } NVOutputPrivateRec, *NVOutputPrivatePtr;
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 6d4bc9fc0803160526gc457e1ua3460703fd6b9d1b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 4 lines · Maarten Maathuis
Quoted 3 lines · Maarten Maathuis
This is primarily targeted at
Koala_BR, but if someone happens to have
a a fully working nouveay g80 setup, then go ahead.
Quoted 10 lines
Quoted 5 lines
Maarten.
(this is attempt 2, as 100 KiB seems to be the maximum allowed size)
And a combined patch.
New patches that apply against current git head.
From 9601a9c2899ba16377b0f5099ab934ef1fff5f92 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sat, 15 Mar 2008 18:20:34 +0100
Subject: [PATCH] NV50: Merge crtc creation.
--- src/nv50_crtc.c | 18 ++---------------- src/nv50_display.h | 1 + src/nv_crtc.c | 7 ++++++- src/nv_driver.c | 4 +++- 4 files changed, 12 insertions(+), 18 deletions(-)
src/nv50_crtc.c +2 -16
@@ -99,22 +99,8 @@ static const xf86CrtcFuncsRec nv50_crtc_funcs = { .destroy = NULL, }; -void NV50DispCreateCrtcs (ScrnInfoPtr pScrn) +const xf86CrtcFuncsRec *nv50_get_crtc_funcs () { -NVPtr pNv =NVPTR (pScrn); -Head head; -xf86CrtcPtr crtc; -NVCrtcPrivatePtr nv50_crtc; - -/* Create a "crtc" object for each head */ -for (head =HEAD0 ; head <=HEAD1 ; head++) { - crtc =xf86CrtcCreate (pScrn, &nv50_crtc_funcs); -if (!crtc)return ; - - nv50_crtc =xnfcalloc (sizeof (*nv50_crtc),1 ); - nv50_crtc->head = head; - nv50_crtc->ditherEnabled = pNv->FPDither; - crtc->driver_private = nv50_crtc; - } +return &nv50_crtc_funcs; }
src/nv50_display.h +1 -0
@@ -19,5 +19,6 @@ void NV50CrtcSetDither(xf86CrtcPtr, Bool dither, Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn); +const xf86CrtcFuncsRec *nv50_get_crtc_funcs ();#endif
src/nv_crtc.c +6 -1
@@ -1745,7 +1745,9 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num)NVCrtcRegPtr regp = &pNv->ModeReg.crtc_reg[crtc_num];int i; -if (pNv->NVArch >=0x11 ) +if (pNv->Architecture ==NV_ARCH_50 ) + crtc =xf86CrtcCreate (pScrn,nv50_get_crtc_funcs ()); +else if (pNv->NVArch >=0x11 ) crtc =xf86CrtcCreate (pScrn, &nv11_crtc_funcs);else crtc =xf86CrtcCreate (pScrn, &nv_crtc_funcs);
@@ -1759,6 +1761,9 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num) crtc->driver_private = nv_crtc; +if (pNv->Architecture ==NV_ARCH_50 ) +return ; +/* Initialise the default LUT table. */ for (i =0 ; i <256 ; i++) { regp->DAC[i*3 ] = i;
src/nv_driver.c +3 -1
@@ -1438,7 +1438,9 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVPreInitFail ("\n" );if (!NV50CreateOutputs (pScrn))NVPreInitFail ("\n" ); -NV50DispCreateCrtcs (pScrn); +for (i =0 ; i <2 ; i++) { +nv_crtc_init (pScrn, i); + } }if (!xf86InitialConfiguration (pScrn, FALSE))
Signature · 1 line
1.5.4.3
From a6eb2559903e954a3bd2a8e56e2c8e62f34d94f0 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sat, 15 Mar 2008 19:02:55 +0100
Subject: [PATCH] NV50: Merge output creation and i2c init.
--- src/nv50_dac.c | 21 +----- src/nv50_output.c | 206 ----------------------------------------------------- src/nv50_output.h | 5 +- src/nv50_sor.c | 64 +++-------------- src/nv_driver.c | 24 +++---- src/nv_i2c.c | 37 +++++++++- src/nv_output.c | 64 +++++++++++++++- 7 files changed, 120 insertions(+), 301 deletions(-)
src/nv50_dac.c +2 -19
@@ -191,25 +191,8 @@ static const xf86OutputFuncsRec NV50DacOutputFuncs = { .destroy = NV50DacDestroy, }; -xf86OutputPtr -NV50CreateDac (ScrnInfoPtr pScrn,ORNum or) +const xf86OutputFuncsRec *nv50_get_analog_output_funcs () { -NVOutputPrivatePtr nv_output =xnfcalloc (sizeof (*nv_output),1 ); -xf86OutputPtr output; -char orName[5 ]; - -if (!nv_output) -return NULL ; - -snprintf (orName,5 ,"VGA%i" , or); - output =xf86OutputCreate (pScrn, &NV50DacOutputFuncs, orName); - - nv_output->type =OUTPUT_ANALOG ; - nv_output->output_resource = or; - output->driver_private = nv_output; - output->interlaceAllowed = TRUE; - output->doubleScanAllowed = TRUE; - -return output; +return &NV50DacOutputFuncs; }
src/nv50_output.c +0 -206
215 lines not on this page · raw message
src/nv50_output.h +4 -1
@@ -10,15 +10,18 @@ void NV50OutputPrepare(xf86OutputPtr);void NV50OutputCommit (xf86OutputPtr );DisplayModePtr NV50OutputGetDDCModes (xf86OutputPtr );void NV50OutputDestroy (xf86OutputPtr ); -Bool NV50CreateOutputs (ScrnInfoPtr );/* nv50_dac.c */ xf86OutputPtr NV50CreateDac (ScrnInfoPtr ,ORNum );Bool NV50DacLoadDetect (xf86OutputPtr );void NV50DacSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_analog_output_funcs ();/* nv50_sor.c */ xf86OutputPtr NV50CreateSor (ScrnInfoPtr pScrn,ORNum or,NVOutputType type);void NV50SorSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_tmds_output_funcs (); +const xf86OutputFuncsRec *nv50_get_lvds_output_funcs (); +DisplayModePtr GetLVDSNativeMode (ScrnInfoPtr pScrn);#endif
src/nv50_sor.c +11 -53
79 lines not on this page · raw message
src/nv_driver.c +9 -15
@@ -1424,25 +1424,19 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVCommonSetup (pScrn);if (pNv->randr12_enable) { -if (pNv->Architecture <NV_ARCH_50 ) { -NVI2CInit (pScrn); - - num_crtc = pNv->twoHeads ?2 :1 ; -for (i =0 ; i < num_crtc; i++) { -nv_crtc_init (pScrn, i); - } - -NvSetupOutputs (pScrn); - }else { +if (pNv->Architecture ==NV_ARCH_50 )if (!NV50DispPreInit (pScrn))NVPreInitFail ("\n" ); -if (!NV50CreateOutputs (pScrn)) -NVPreInitFail ("\n" ); -for (i =0 ; i <2 ; i++) { -nv_crtc_init (pScrn, i); - } + +NVI2CInit (pScrn); + + num_crtc = pNv->twoHeads ?2 :1 ; +for (i =0 ; i < num_crtc; i++) { +nv_crtc_init (pScrn, i); } +NvSetupOutputs (pScrn); +if (!xf86InitialConfiguration (pScrn, FALSE))NVPreInitFail ("No valid modes.\n" ); }
src/nv_i2c.c +34 -3
@@ -46,10 +46,30 @@ NVI2CPutBits(I2CBusPtr b, int clock, int data)NVWriteVgaCrtc (pNv,0 , b->DriverPrivate.uval +1 , val |0x1 ); } +static void NV50_I2CPutBits (I2CBusPtr b,int clock,int data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; + +NVWrite (pNv, (0x0000E138 +off)/4 , (4 | clock | data <<1 )); +} + +static void NV50_I2CGetBits (I2CBusPtr b,int *clock,int *data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; +unsigned char val; + + val =NVRead (pNv, (0x0000E138 +off)/4 ); + *clock = !!(val &1 ); + *data = !!(val &2 ); +} +Bool NV_I2CInit (ScrnInfoPtr pScrn,I2CBusPtr *bus_ptr,int i2c_reg,char *name) {I2CBusPtr pI2CBus; +NVPtr pNv =NVPTR (pScrn); pI2CBus =xf86CreateI2CBusRec ();if (!pI2CBus)
@@ -57,9 +77,20 @@ NV_I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name) pI2CBus->BusName = name; pI2CBus->scrnIndex = pScrn->scrnIndex; - pI2CBus->I2CPutBits = NVI2CPutBits; - pI2CBus->I2CGetBits = NVI2CGetBits; - pI2CBus->AcknTimeout =5 ; +if (pNv->Architecture ==NV_ARCH_50 ) { + pI2CBus->I2CPutBits = NV50_I2CPutBits; + pI2CBus->I2CGetBits = NV50_I2CGetBits; +/* Could this be used for the rest as well? */ + pI2CBus->ByteTimeout =2200 ;/* VESA DDC spec 3 p. 43 (+10 %) */ + pI2CBus->StartTimeout =550 ; + pI2CBus->BitTimeout =40 ; + pI2CBus->ByteTimeout =40 ; + pI2CBus->AcknTimeout =40 ; + }else { + pI2CBus->I2CPutBits = NVI2CPutBits; + pI2CBus->I2CGetBits = NVI2CGetBits; + pI2CBus->AcknTimeout =5 ; + } pI2CBus->DriverPrivate.uval = i2c_reg;
src/nv_output.c +60 -4
106 lines not on this page · raw message
Signature · 1 line
1.5.4.3
From 29606a026b87fcf3acde1577e11d46ec2cafb8ec Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 00:27:41 +0100
Subject: [PATCH] randr12: Implement dithering output property.
--- src/nv_crtc.c | 11 ++++++++++- src/nv_output.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/nv_type.h | 1 + 3 files changed, 55 insertions(+), 1 deletions(-)
src/nv_crtc.c +10 -1
@@ -1225,7 +1225,8 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeP/* Flatpanel support needs at least a NV10 */ if (pNv->twoHeads) { -if (pNv->FPDither || (is_lvds && !pNv->VBIOS.fp.if_is_24bit)) { +/* Output property. */ +if (nv_output && nv_output->dithering) { nv_crtc->ditherEnabled = TRUE;if (pNv->NVArch ==0x11 ) regp->dither = savep->dither |0x00010000 ;
@@ -1238,6 +1239,14 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeP } } }else { +if (pNv->NVArch !=0x11 ) { +/* reset them */ +int i; +for (i =0 ; i <3 ; i++) { + regp->dither_regs[i] = savep->dither_regs[i]; + regp->dither_regs[i +3 ] = savep->dither_regs[i +3 ]; + } + } nv_crtc->ditherEnabled = FALSE; regp->dither = savep->dither; }
src/nv_output.c +44 -0
68 lines not on this page · raw message
src/nv_type.h +1 -0
@@ -214,6 +214,7 @@ typedef struct _NVOutputPrivateRec {uint32_t fpHeight;DisplayModePtr native_mode;uint8_t scaling_mode; +Bool dithering;NVOutputRegRec restore; } NVOutputPrivateRec, *NVOutputPrivatePtr;
Signature · 1 line
1.5.4.3
From dd3c1bff3ab73ab7ce07ba2bee326e1f629436a1 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 00:40:59 +0100
Subject: [PATCH] NV50: Share output properties.
--- src/nv50_display.c | 15 +++-- src/nv50_display.h | 2 +- src/nv50_sor.c | 152 ++-------------------------------------------------- src/nv_crtc.c | 5 +-- src/nv_output.c | 4 +- src/nv_proto.h | 3 + src/nv_type.h | 1 - 7 files changed, 20 insertions(+), 162 deletions(-)
src/nv50_display.c +9 -6
@@ -339,7 +339,7 @@ NV50CrtcModeSet(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mNV50CrtcCommand (crtc,NV50_CRTC0_DEPTH ,NV50_CRTC0_DEPTH_24BPP );break ; } -NV50CrtcSetDither (crtc, nv_crtc->ditherEnabled, FALSE); +NV50CrtcSetDither (crtc, FALSE);NV50CrtcCommand (crtc,0x8a8 ,0x40000 );NV50CrtcCommand (crtc,NV50_CRTC0_FB_POS , y <<16 | x);NV50CrtcCommand (crtc,NV50_CRTC0_SCRN_SIZE , VDisplay <<16 | HDisplay);
@@ -438,14 +438,17 @@ NV50CrtcSkipModeFixup(xf86CrtcPtr crtc) }void -NV50CrtcSetDither (xf86CrtcPtr crtc,Bool dither,Bool update) +NV50CrtcSetDither (xf86CrtcPtr crtc,Bool update) { -NVCrtcPrivatePtr nv_crtc = crtc->driver_private; +xf86OutputPtr output =NVGetOutputFromCRTC (crtc); + +if (!output) +return ; - nv_crtc->ditherEnabled = dither; +NVOutputPrivatePtr nv_output = output->driver_private; -NV50CrtcCommand (crtc,0x8a0 , dither ?0x11 :0 ); -if (update) +NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 ); +if (update)NV50CrtcCommand (crtc,0x80 ,0 ); }
src/nv50_display.h +1 -1
@@ -15,7 +15,7 @@ void NV50CrtcEnableCursor(xf86CrtcPtr, Bool update);void NV50CrtcDisableCursor (xf86CrtcPtr ,Bool update);void NV50CrtcSetCursorPosition (xf86CrtcPtr ,int x,int y);void NV50CrtcSkipModeFixup (xf86CrtcPtr ); -void NV50CrtcSetDither (xf86CrtcPtr ,Bool dither,Bool update); +void NV50CrtcSetDither (xf86CrtcPtr ,Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn);
src/nv50_sor.c +4 -148
170 lines not on this page · raw message
src/nv_crtc.c +1 -4
@@ -102,7 +102,7 @@ void NVCrtcLockUnlock(xf86CrtcPtr crtc, Bool lock)NVLockVgaCrtc (pNv, nv_crtc->head, lock); } -static xf86OutputPtr +xf86OutputPtr NVGetOutputFromCRTC (xf86CrtcPtr crtc) {ScrnInfoPtr pScrn = crtc->scrn;
@@ -1227,7 +1227,6 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePif (pNv->twoHeads) {/* Output property. */ if (nv_output && nv_output->dithering) { - nv_crtc->ditherEnabled = TRUE;if (pNv->NVArch ==0x11 ) regp->dither = savep->dither |0x00010000 ;else {
@@ -1247,7 +1246,6 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeP regp->dither_regs[i +3 ] = savep->dither_regs[i +3 ]; } } - nv_crtc->ditherEnabled = FALSE; regp->dither = savep->dither; } }
@@ -1766,7 +1764,6 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num) nv_crtc =xnfcalloc (sizeof (NVCrtcPrivateRec),1 ); nv_crtc->head = crtc_num; nv_crtc->last_dpms =NV_DPMS_CLEARED ; - nv_crtc->ditherEnabled = pNv->FPDither; crtc->driver_private = nv_crtc;
src/nv_output.c +2 -2
@@ -752,7 +752,7 @@ nv_scaling_mode_lookup(char *name, int size)return scaling_mode[i].mode; } -static void +void nv_digital_output_create_resources (xf86OutputPtr output) {NVOutputPrivatePtr nv_output = output->driver_private;
@@ -815,7 +815,7 @@ nv_digital_output_create_resources(xf86OutputPtr output) } } -static Bool +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value) {
src/nv_proto.h +3 -0
@@ -87,10 +87,13 @@ void nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num);void NVCrtcLockUnlock (xf86CrtcPtr crtc,Bool lock);void NVCrtcWriteCRTC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val);void NVCrtcWriteRAMDAC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val); +xf86OutputPtr NVGetOutputFromCRTC (xf86CrtcPtr crtc);/* nv_output.c */ void NvSetupOutputs (ScrnInfoPtr pScrn);uint32_t nv_get_clock_from_crtc (ScrnInfoPtr pScrn,RIVA_HW_STATE *state,uint8_t crtc); +void nv_digital_output_create_resources (xf86OutputPtr output); +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value);/* nv_hw.c */ uint32_t NVRead (NVPtr pNv,uint32_t reg);
src/nv_type.h +0 -1
@@ -187,7 +187,6 @@ typedef struct _NVCrtcPrivateRec {int head;uint8_t last_dpms;Bool cursorVisible; -Bool ditherEnabled;Bool skipModeFixup;/* NV50 only */ int pclk;/* Pixel clock in kHz */ /* NV50 only */ #if NOUVEAU_EXA_PIXMAPS
Signature · 1 line
1.5.4.3
From 1e5d2f6a04de80aa472c71f128ba6ae993d114f1 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 01:05:03 +0100
Subject: [PATCH] NV50: Fix a potentional bug.
--- src/nv50_display.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
src/nv50_display.c +7 -4
@@ -391,12 +391,13 @@ NV50CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)static void NV50CrtcShowHideCursor (xf86CrtcPtr crtc,Bool show,Bool update) {NVCrtcPrivatePtr nv_crtc = crtc->driver_private; +ScrnInfoPtr pScrn = crtc->scrn;NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR0 , show ?NV50_CRTC0_CURSOR0_SHOW :NV50_CRTC0_CURSOR0_HIDE ); -if (update) { +if (update) { nv_crtc->cursorVisible = show; -NV50CrtcCommand (crtc,0x80 ,0 ); +NV50DisplayCommand (pScrn,0x80 ,0 ); } }
@@ -441,6 +442,7 @@ void NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update) {xf86OutputPtr output =NVGetOutputFromCRTC (crtc); +ScrnInfoPtr pScrn = crtc->scrn;if (!output)return ;
@@ -449,7 +451,7 @@ NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update)NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 );if (update) -NV50CrtcCommand (crtc,0x80 ,0 ); +NV50DisplayCommand (pScrn,0x80 ,0 ); }static void ComputeAspectScale (DisplayModePtr mode,int *outX,int *outY)
@@ -502,6 +504,7 @@ void NV50CrtcCommit(xf86CrtcPtr crtc) {xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (crtc->scrn); +ScrnInfoPtr pScrn = crtc->scrn;int i, crtc_mask =0 ;/* If any heads are unused, blank them */
@@ -520,6 +523,6 @@ NV50CrtcCommit(xf86CrtcPtr crtc) } } -NV50CrtcCommand (crtc,0x80 ,0 ); +NV50DisplayCommand (pScrn,0x80 ,0 ); }
Signature · 1 line
1.5.4.3
From ff8d721d842e153f870fb4b8a5395c6dc4eed668 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 01:09:48 +0100
Subject: [PATCH] NV50: Another subtle difference.
--- src/nv50_display.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
src/nv50_display.c +3 -2
@@ -205,6 +205,7 @@ Bool NV50DispInit(ScrnInfoPtr pScrn) {NVPtr pNv =NVPTR (pScrn); +uint32_t val;if (NVRead (pNv,0x00610024 ) &0x100 ) {NVWrite (pNv,0x00610024 ,0x100 );NVWrite (pNv,0x006194e8 ,NVRead (pNv,0x006194e8 ) & ~1 );
@@ -214,13 +215,13 @@ NV50DispInit(ScrnInfoPtr pScrn)NVWrite (pNv,0x00610200 ,0x2b00 );/* A bugfix (#12637) from the nv driver, to unlock the driver if it's left in a poor state */ do { -CARD32 val =NVRead (pNv,0x00610200 ); + val =NVRead (pNv,0x00610200 );if ((val &0x9f0000 ) ==0x20000 )NVWrite (pNv,0x00610200 , val |0x800000 );if ((val &0x3f0000 ) ==0x30000 )NVWrite (pNv,0x00610200 , val |0x200000 ); - }while ((NVRead (pNv,0x00610200 ) &0x1e0000 ) !=0 ); + }while ((val &0x1e0000 ) !=0 );NVWrite (pNv,0x00610300 ,0x1 );NVWrite (pNv,0x00610200 ,0x1000b03 );while (!(NVRead (pNv,0x00610200 ) &0x40000000 ));
Signature · 1 line
1.5.4.3
From 2532b013c8f24466cc77c42278325343c1dae443 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 12:33:19 +0100
Subject: [PATCH] NV50: Some more educated guesses at register names.
--- src/nv50_display.c | 23 ++++++++++--------- src/nv50reg.h | 58 +++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 60 insertions(+), 21 deletions(-)
src/nv50_display.c +12 -11
@@ -228,7 +228,8 @@ NV50DispInit(ScrnInfoPtr pScrn)NV50DisplayCommand (pScrn,0x84 ,0 );NV50DisplayCommand (pScrn,0x88 ,0 ); -NV50DisplayCommand (pScrn,0x874 ,0 ); +/* Does the bios always use crtc0? */ +NV50DisplayCommand (pScrn,NV50_CRTC0_BLANK_CTRL ,NV50_CRTC0_BLANK_CTRL_BLANK );NV50DisplayCommand (pScrn,0x800 ,0 );NV50DisplayCommand (pScrn,0x810 ,0 );NV50DisplayCommand (pScrn,0x82c ,0 );
@@ -249,7 +250,7 @@ NV50DispShutdown(ScrnInfoPtr pScrn)NV50CrtcBlankScreen (crtc, TRUE); } -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 );for (i =0 ; i < xf86_config->num_crtc; i++) {xf86CrtcPtr crtc = xf86_config->crtc[i];
@@ -362,10 +363,10 @@ NV50CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_MODE ,NV50_CRTC0_CLUT_MODE_BLANK );NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_OFFSET ,0 );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x85c ,0 ); -NV50CrtcCommand (crtc,0x874 ,0 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK1 ,NV84_CRTC0_BLANK_UNK1_BLANK ); +NV50CrtcCommand (crtc,NV50_CRTC0_BLANK_CTRL ,NV50_CRTC0_BLANK_CTRL_BLANK );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x89c ,0 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK2 ,NV84_CRTC0_BLANK_UNK2_BLANK ); }else {NV50CrtcCommand (crtc,NV50_CRTC0_FB_OFFSET , pNv->FB->offset >>8 );NV50CrtcCommand (crtc,0x864 ,0 );
@@ -376,15 +377,15 @@ NV50CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)NVWrite (pNv,0x0061038C ,0 );NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR_OFFSET , pNv->Cursor->offset >>8 );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x89c ,1 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK2 ,NV84_CRTC0_BLANK_UNK2_UNBLANK );if (nv_crtc->cursorVisible)NV50CrtcShowHideCursor (crtc, TRUE, FALSE);NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_MODE , pScrn->depth ==8 ?NV50_CRTC0_CLUT_MODE_OFF :NV50_CRTC0_CLUT_MODE_ON );NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_OFFSET , pNv->CLUT->offset >>8 );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x85c ,1 ); -NV50CrtcCommand (crtc,0x874 ,1 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK1 ,NV84_CRTC0_BLANK_UNK1_UNBLANK ); +NV50CrtcCommand (crtc,NV50_CRTC0_BLANK_CTRL_BLANK ,NV50_CRTC0_BLANK_CTRL_UNBLANK ); } }
@@ -398,7 +399,7 @@ static void NV50CrtcShowHideCursor(xf86CrtcPtr crtc, Bool show, Bool update) show ? NV50_CRTC0_CURSOR0_SHOW : NV50_CRTC0_CURSOR0_HIDE);if (update) { nv_crtc->cursorVisible = show; -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); } }
@@ -452,7 +453,7 @@ NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update)NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 );if (update) -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); }static void ComputeAspectScale (DisplayModePtr mode,int *outX,int *outY)
@@ -524,6 +525,6 @@ NV50CrtcCommit(xf86CrtcPtr crtc) } } -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); }
src/nv50reg.h +48 -10
87 lines not on this page · raw message
Signature · 1 line
1.5.4.3
From 25c771361235d45e747c3e1a38b7bbc8ae8b6d1e Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 12:46:40 +0100
Subject: [PATCH] NV50: Mostly resorting regs.
- Also a dithering register define and rename cursor related reg.
--- src/nv50_display.c | 7 ++- src/nv50reg.h | 108 ++++++++++++++++++++++++++++----------------------- 2 files changed, 63 insertions(+), 52 deletions(-)
src/nv50_display.c +4 -3
@@ -395,8 +395,8 @@ static void NV50CrtcShowHideCursor(xf86CrtcPtr crtc, Bool show, Bool update)NVCrtcPrivatePtr nv_crtc = crtc->driver_private;ScrnInfoPtr pScrn = crtc->scrn; -NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR0 , - show ?NV50_CRTC0_CURSOR0_SHOW :NV50_CRTC0_CURSOR0_HIDE ); +NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR , + show ?NV50_CRTC0_CURSOR_SHOW :NV50_CRTC0_CURSOR_HIDE );if (update) { nv_crtc->cursorVisible = show;NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 );
@@ -451,7 +451,8 @@ NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update)NVOutputPrivatePtr nv_output = output->driver_private; -NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 ); +NV50CrtcCommand (crtc,NV50_CRTC0_DITHERING_CTRL , nv_output->dithering ? +NV50_CRTC0_DITHERING_CTRL_ON :NV50_CRTC0_DITHERING_CTRL_OFF );if (update)NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); }
src/nv50reg.h +59 -49
158 lines not on this page · raw message
Signature · 1 line
1.5.4.3
From 2bfbb9b43f4e97723ffd818114c2e80682801a82 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 16:09:11 +0100
Subject: [PATCH] NV50: kill output_resource and use or directly.
--- src/nv50_dac.c | 28 ++++++++++++++-------------- src/nv50_sor.c | 12 ++++++------ src/nv_output.c | 11 ++++------- src/nv_type.h | 1 - 4 files changed, 24 insertions(+), 28 deletions(-)
src/nv50_dac.c +14 -14
@@ -36,7 +36,7 @@ NV50DacSetPClk(xf86OutputPtr output, int pclk)NVOutputPrivatePtr nv_output = output->driver_private;ScrnInfoPtr pScrn = output->scrn;NVPtr pNv =NVPTR (pScrn); -NVWrite (pNv,0x00614280 + nv_output->output_resource *0x800 ,0 ); +NVWrite (pNv,0x00614280 +ffs (nv_output->or) *0x800 ,0 ); } static void
@@ -53,9 +53,9 @@ NV50DacDPMSSet(xf86OutputPtr output, int mode)* DPMSModeSuspend hsync enabled, vsync disabled * DPMSModeOff sync disabled */ -while (NVRead (pNv,0x0061a004 + nv_output->output_resource *0x800 ) &0x80000000 ); +while (NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ) &0x80000000 ); - tmp =NVRead (pNv,0x0061a004 + nv_output->output_resource *0x800 ); + tmp =NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ); tmp &= ~0x7f ; tmp |=0x80000000 ;
@@ -68,7 +68,7 @@ NV50DacDPMSSet(xf86OutputPtr output, int mode)if (mode == DPMSModeOff) tmp |=0x40 ; -NVWrite (pNv,0x0061a004 + nv_output->output_resource *0x800 , tmp); +NVWrite (pNv,0x0061a004 +ffs (nv_output->or) *0x800 , tmp); } Bool
@@ -84,7 +84,7 @@ NV50DacModeSet(xf86OutputPtr output, DisplayModePtr mode, {ScrnInfoPtr pScrn = output->scrn;NVOutputPrivatePtr nv_output = output->driver_private; -const int dacOff =0x80 * nv_output->output_resource; +const int dacOff =0x80 *ffs (nv_output->or);if (!adjusted_mode) {NV50DisplayCommand (pScrn,0x400 + dacOff,0 );
@@ -142,21 +142,21 @@ NV50DacLoadDetect(xf86OutputPtr output)CARD32 load, tmp, tmp2;xf86DrvMsg (scrnIndex,X_PROBED ,"Trying load detection on VGA%i ... " , - nv_output->output_resource); +ffs (nv_output->or)); -NVWrite (pNv,0x0061a010 + nv_output->output_resource *0x800 ,0x00000001 ); - tmp2 =NVRead (pNv,0x0061a004 + nv_output->output_resource *0x800 ); +NVWrite (pNv,0x0061a010 +ffs (nv_output->or) *0x800 ,0x00000001 ); + tmp2 =NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ); -NVWrite (pNv,0x0061a004 + nv_output->output_resource *0x800 ,0x80150000 ); -while (NVRead (pNv,0x0061a004 + nv_output->output_resource *0x800 ) &0x80000000 ); +NVWrite (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ,0x80150000 ); +while (NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ) &0x80000000 ); tmp = (pNv->NVArch ==0x50 ) ?420 :340 ; -NVWrite (pNv,0x0061a00c + nv_output->output_resource *0x800 , tmp |0x100000 ); +NVWrite (pNv,0x0061a00c +ffs (nv_output->or) *0x800 , tmp |0x100000 ); sigstate =xf86BlockSIGIO ();usleep (45000 );xf86UnblockSIGIO (sigstate); - load =NVRead (pNv,0x0061a00c + nv_output->output_resource *0x800 ); -NVWrite (pNv,0x0061a00c + nv_output->output_resource *0x800 ,0 ); -NVWrite (pNv,0x0061a004 + nv_output->output_resource *0x800 ,0x80000000 | tmp2); + load =NVRead (pNv,0x0061a00c +ffs (nv_output->or) *0x800 ); +NVWrite (pNv,0x0061a00c +ffs (nv_output->or) *0x800 ,0 ); +NVWrite (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ,0x80000000 | tmp2);// Use this DAC if all three channels show load. if ((load &0x38000000 ) ==0x38000000 ) {
src/nv50_sor.c +6 -6
@@ -38,7 +38,7 @@ NV50SorSetPClk(xf86OutputPtr output, int pclk)NVPtr pNv =NVPTR (pScrn);const int limit =165000 ; -NVWrite (pNv,0x00614300 + nv_output->output_resource *0x800 , (pclk > limit) ?0x101 :0 ); +NVWrite (pNv,0x00614300 +ffs (nv_output->or) *0x800 , (pclk > limit) ?0x101 :0 ); } static void
@@ -49,9 +49,9 @@ NV50SorDPMSSet(xf86OutputPtr output, int mode)NVPtr pNv =NVPTR (pScrn);CARD32 tmp; -while ((NVRead (pNv,0x0061c004 + nv_output->output_resource *0x800 ) &0x80000000 )); +while ((NVRead (pNv,0x0061c004 +ffs (nv_output->or) *0x800 ) &0x80000000 )); - tmp =NVRead (pNv,0x0061c004 + nv_output->output_resource *0x800 ); + tmp =NVRead (pNv,0x0061c004 +ffs (nv_output->or) *0x800 ); tmp |=0x80000000 ;if (mode == DPMSModeOn)
@@ -59,8 +59,8 @@ NV50SorDPMSSet(xf86OutputPtr output, int mode)else tmp &= ~1 ; -NVWrite (pNv,0x0061c004 + nv_output->output_resource *0x800 , tmp); -while ((NVRead (pNv,0x0061c030 + nv_output->output_resource *0x800 ) &0x10000000 )); +NVWrite (pNv,0x0061c004 +ffs (nv_output->or) *0x800 , tmp); +while ((NVRead (pNv,0x0061c030 +ffs (nv_output->or) *0x800 ) &0x10000000 )); } static int
@@ -93,7 +93,7 @@ NV50SorModeSet(xf86OutputPtr output, DisplayModePtr mode, {ScrnInfoPtr pScrn = output->scrn;NVOutputPrivatePtr nv_output = output->driver_private; -const int sorOff =0x40 * nv_output->output_resource; +const int sorOff =0x40 *ffs (nv_output->or);CARD32 type;if (!adjusted_mode) {
src/nv_output.c +4 -7
@@ -997,9 +997,6 @@ static void nv_add_output(ScrnInfoPtr pScrn, int dcb_entry, const xf86OutputFunc output->driver_private = nv_output; -/* needed for NV5x, used by pre-NV5x as well. */ - nv_output->output_resource =ffs (pNv->dcb_table.entry[dcb_entry].or); - nv_output->pDDCBus = pNv->pI2CBus[i2c_index]; nv_output->dcb_entry = dcb_entry; nv_output->type = pNv->dcb_table.entry[dcb_entry].type;
@@ -1037,10 +1034,10 @@ static void nv_add_output(ScrnInfoPtr pScrn, int dcb_entry, const xf86OutputFuncif (pNv->Architecture ==NV_ARCH_50 ) {if (nv_output->type ==OUTPUT_TMDS ) { -NVWrite (pNv,0x0061c00c + nv_output->output_resource *0x800 ,0x03010700 ); -NVWrite (pNv,0x0061c010 + nv_output->output_resource *0x800 ,0x0000152f ); -NVWrite (pNv,0x0061c014 + nv_output->output_resource *0x800 ,0x00000000 ); -NVWrite (pNv,0x0061c018 + nv_output->output_resource *0x800 ,0x00245af8 ); +NVWrite (pNv,0x0061c00c +ffs (nv_output->or) *0x800 ,0x03010700 ); +NVWrite (pNv,0x0061c010 +ffs (nv_output->or) *0x800 ,0x0000152f ); +NVWrite (pNv,0x0061c014 +ffs (nv_output->or) *0x800 ,0x00000000 ); +NVWrite (pNv,0x0061c018 +ffs (nv_output->or) *0x800 ,0x00245af8 ); }/* This needs to be handled in the same way as pre-NV5x on the long run. */
src/nv_type.h +0 -1
@@ -204,7 +204,6 @@ typedef enum { typedef struct _NVOutputPrivateRec { uint8_t or; - uint8_t output_resource; uint8_t last_dpms; I2CBusPtr pDDCBus; NVOutputType type;
Signature · 1 line
1.5.4.3
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 6d4bc9fc0803160812q38747c9bg5cf183207f901801-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 12 lines · Maarten Maathuis
Quoted 11 lines · Maarten Maathuis
Quoted 8 lines · Maarten Maathuis
This is primarily targeted at
Koala_BR, but if someone happens to have
a a fully working nouveay g80 setup, then go ahead.Maarten.
(this is attempt 2, as 100 KiB seems to be the maximum allowed size)
Quoted 8 lines
Quoted 3 lines
And a combined patch.
New patches that apply against current git head.
src/nv50_crtc.c +2 -16
@@ -99,22 +99,8 @@ static const xf86CrtcFuncsRec nv50_crtc_funcs = { .destroy = NULL, }; -void NV50DispCreateCrtcs (ScrnInfoPtr pScrn) +const xf86CrtcFuncsRec *nv50_get_crtc_funcs () { -NVPtr pNv =NVPTR (pScrn); -Head head; -xf86CrtcPtr crtc; -NVCrtcPrivatePtr nv50_crtc; - -/* Create a "crtc" object for each head */ -for (head =HEAD0 ; head <=HEAD1 ; head++) { - crtc =xf86CrtcCreate (pScrn, &nv50_crtc_funcs); -if (!crtc)return ; - - nv50_crtc =xnfcalloc (sizeof (*nv50_crtc),1 ); - nv50_crtc->head = head; - nv50_crtc->ditherEnabled = pNv->FPDither; - crtc->driver_private = nv50_crtc; - } +return &nv50_crtc_funcs; }
src/nv50_dac.c +16 -33
92 lines not on this page · raw message
src/nv50_display.c +31 -22
135 lines not on this page · raw message
src/nv50_display.h +2 -1
@@ -15,9 +15,10 @@ void NV50CrtcEnableCursor(xf86CrtcPtr, Bool update);void NV50CrtcDisableCursor (xf86CrtcPtr ,Bool update);void NV50CrtcSetCursorPosition (xf86CrtcPtr ,int x,int y);void NV50CrtcSkipModeFixup (xf86CrtcPtr ); -void NV50CrtcSetDither (xf86CrtcPtr ,Bool dither,Bool update); +void NV50CrtcSetDither (xf86CrtcPtr ,Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn); +const xf86CrtcFuncsRec *nv50_get_crtc_funcs ();#endif
src/nv50_output.c +0 -206
215 lines not on this page · raw message
src/nv50_output.h +4 -1
@@ -10,15 +10,18 @@ void NV50OutputPrepare(xf86OutputPtr);void NV50OutputCommit (xf86OutputPtr );DisplayModePtr NV50OutputGetDDCModes (xf86OutputPtr );void NV50OutputDestroy (xf86OutputPtr ); -Bool NV50CreateOutputs (ScrnInfoPtr );/* nv50_dac.c */ xf86OutputPtr NV50CreateDac (ScrnInfoPtr ,ORNum );Bool NV50DacLoadDetect (xf86OutputPtr );void NV50DacSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_analog_output_funcs ();/* nv50_sor.c */ xf86OutputPtr NV50CreateSor (ScrnInfoPtr pScrn,ORNum or,NVOutputType type);void NV50SorSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_tmds_output_funcs (); +const xf86OutputFuncsRec *nv50_get_lvds_output_funcs (); +DisplayModePtr GetLVDSNativeMode (ScrnInfoPtr pScrn);#endif
src/nv50_sor.c +21 -207
283 lines not on this page · raw message
src/nv50reg.h +87 -39
158 lines not on this page · raw message
src/nv_crtc.c +17 -6
@@ -102,7 +102,7 @@ void NVCrtcLockUnlock(xf86CrtcPtr crtc, Bool lock)NVLockVgaCrtc (pNv, nv_crtc->head, lock); } -static xf86OutputPtr +xf86OutputPtr NVGetOutputFromCRTC (xf86CrtcPtr crtc) {ScrnInfoPtr pScrn = crtc->scrn;
@@ -1225,8 +1225,8 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeP/* Flatpanel support needs at least a NV10 */ if (pNv->twoHeads) { -if (pNv->FPDither || (is_lvds && !pNv->VBIOS.fp.if_is_24bit)) { - nv_crtc->ditherEnabled = TRUE; +/* Output property. */ +if (nv_output && nv_output->dithering) {if (pNv->NVArch ==0x11 ) regp->dither = savep->dither |0x00010000 ;else {
@@ -1238,7 +1238,14 @@ nv_crtc_mode_set_ramdac_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModeP } } }else { - nv_crtc->ditherEnabled = FALSE; +if (pNv->NVArch !=0x11 ) { +/* reset them */ +int i; +for (i =0 ; i <3 ; i++) { + regp->dither_regs[i] = savep->dither_regs[i]; + regp->dither_regs[i +3 ] = savep->dither_regs[i +3 ]; + } + } regp->dither = savep->dither; } }
@@ -1745,7 +1752,9 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num)NVCrtcRegPtr regp = &pNv->ModeReg.crtc_reg[crtc_num];int i; -if (pNv->NVArch >=0x11 ) +if (pNv->Architecture ==NV_ARCH_50 ) + crtc =xf86CrtcCreate (pScrn,nv50_get_crtc_funcs ()); +else if (pNv->NVArch >=0x11 ) crtc =xf86CrtcCreate (pScrn, &nv11_crtc_funcs);else crtc =xf86CrtcCreate (pScrn, &nv_crtc_funcs);
@@ -1755,10 +1764,12 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num) nv_crtc =xnfcalloc (sizeof (NVCrtcPrivateRec),1 ); nv_crtc->head = crtc_num; nv_crtc->last_dpms =NV_DPMS_CLEARED ; - nv_crtc->ditherEnabled = pNv->FPDither; crtc->driver_private = nv_crtc; +if (pNv->Architecture ==NV_ARCH_50 ) +return ; +/* Initialise the default LUT table. */ for (i =0 ; i <256 ; i++) { regp->DAC[i*3 ] = i;
src/nv_driver.c +9 -13
@@ -1424,23 +1424,19 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVCommonSetup (pScrn);if (pNv->randr12_enable) { -if (pNv->Architecture <NV_ARCH_50 ) { -NVI2CInit (pScrn); - - num_crtc = pNv->twoHeads ?2 :1 ; -for (i =0 ; i < num_crtc; i++) { -nv_crtc_init (pScrn, i); - } - -NvSetupOutputs (pScrn); - }else { +if (pNv->Architecture ==NV_ARCH_50 )if (!NV50DispPreInit (pScrn))NVPreInitFail ("\n" ); -if (!NV50CreateOutputs (pScrn)) -NVPreInitFail ("\n" ); -NV50DispCreateCrtcs (pScrn); + +NVI2CInit (pScrn); + + num_crtc = pNv->twoHeads ?2 :1 ; +for (i =0 ; i < num_crtc; i++) { +nv_crtc_init (pScrn, i); } +NvSetupOutputs (pScrn); +if (!xf86InitialConfiguration (pScrn, FALSE))NVPreInitFail ("No valid modes.\n" ); }
src/nv_i2c.c +34 -3
@@ -46,10 +46,30 @@ NVI2CPutBits(I2CBusPtr b, int clock, int data)NVWriteVgaCrtc (pNv,0 , b->DriverPrivate.uval +1 , val |0x1 ); } +static void NV50_I2CPutBits (I2CBusPtr b,int clock,int data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; + +NVWrite (pNv, (0x0000E138 +off)/4 , (4 | clock | data <<1 )); +} + +static void NV50_I2CGetBits (I2CBusPtr b,int *clock,int *data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; +unsigned char val; + + val =NVRead (pNv, (0x0000E138 +off)/4 ); + *clock = !!(val &1 ); + *data = !!(val &2 ); +} +Bool NV_I2CInit (ScrnInfoPtr pScrn,I2CBusPtr *bus_ptr,int i2c_reg,char *name) {I2CBusPtr pI2CBus; +NVPtr pNv =NVPTR (pScrn); pI2CBus =xf86CreateI2CBusRec ();if (!pI2CBus)
@@ -57,9 +77,20 @@ NV_I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name) pI2CBus->BusName = name; pI2CBus->scrnIndex = pScrn->scrnIndex; - pI2CBus->I2CPutBits = NVI2CPutBits; - pI2CBus->I2CGetBits = NVI2CGetBits; - pI2CBus->AcknTimeout =5 ; +if (pNv->Architecture ==NV_ARCH_50 ) { + pI2CBus->I2CPutBits = NV50_I2CPutBits; + pI2CBus->I2CGetBits = NV50_I2CGetBits; +/* Could this be used for the rest as well? */ + pI2CBus->ByteTimeout =2200 ;/* VESA DDC spec 3 p. 43 (+10 %) */ + pI2CBus->StartTimeout =550 ; + pI2CBus->BitTimeout =40 ; + pI2CBus->ByteTimeout =40 ; + pI2CBus->AcknTimeout =40 ; + }else { + pI2CBus->I2CPutBits = NVI2CPutBits; + pI2CBus->I2CGetBits = NVI2CGetBits; + pI2CBus->AcknTimeout =5 ; + } pI2CBus->DriverPrivate.uval = i2c_reg;
src/nv_output.c +103 -6
177 lines not on this page · raw message
src/nv_proto.h +3 -0
@@ -87,10 +87,13 @@ void nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num);void NVCrtcLockUnlock (xf86CrtcPtr crtc,Bool lock);void NVCrtcWriteCRTC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val);void NVCrtcWriteRAMDAC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val); +xf86OutputPtr NVGetOutputFromCRTC (xf86CrtcPtr crtc);/* nv_output.c */ void NvSetupOutputs (ScrnInfoPtr pScrn);uint32_t nv_get_clock_from_crtc (ScrnInfoPtr pScrn,RIVA_HW_STATE *state,uint8_t crtc); +void nv_digital_output_create_resources (xf86OutputPtr output); +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value);/* nv_hw.c */ uint32_t NVRead (NVPtr pNv,uint32_t reg);
src/nv_type.h +1 -2
@@ -187,7 +187,6 @@ typedef struct _NVCrtcPrivateRec {int head;uint8_t last_dpms;Bool cursorVisible; -Bool ditherEnabled;Bool skipModeFixup;/* NV50 only */ int pclk;/* Pixel clock in kHz */ /* NV50 only */ #if NOUVEAU_EXA_PIXMAPS
@@ -205,7 +204,6 @@ typedef enum { typedef struct _NVOutputPrivateRec { uint8_t or; - uint8_t output_resource; uint8_t last_dpms; I2CBusPtr pDDCBus; NVOutputType type;
@@ -214,6 +212,7 @@ typedef struct _NVOutputPrivateRec {uint32_t fpHeight;DisplayModePtr native_mode;uint8_t scaling_mode; +Bool dithering;NVOutputRegRec restore; } NVOutputPrivateRec, *NVOutputPrivatePtr;
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 12 lines · Maarten Maathuis
Quoted 11 lines · Maarten Maathuis
Quoted 8 lines · Maarten Maathuis
This is primarily targeted at
Koala_BR, but if someone happens to have
a a fully working nouveay g80 setup, then go ahead.Maarten.
(this is attempt 2, as 100 KiB seems to be the maximum allowed size)
Quoted 8 lines
Quoted 3 lines
And a combined patch.
New patches that apply against current git head.
New patches against current git head.
If you need to do them seperately, then 3, 4 and 10 are (probably) required together.
But i haven't tested if 10 applies cleanly on top of 4.
From 63090055a1d7dc24781ffaa7c114af3120e4285c Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sat, 15 Mar 2008 18:20:34 +0100
Subject: [PATCH] NV50: Merge crtc creation.
--- src/nv50_crtc.c | 18 ++---------------- src/nv50_display.h | 1 + src/nv_crtc.c | 7 ++++++- src/nv_driver.c | 4 +++- 4 files changed, 12 insertions(+), 18 deletions(-)
src/nv50_crtc.c +2 -16
@@ -99,22 +99,8 @@ static const xf86CrtcFuncsRec nv50_crtc_funcs = { .destroy = NULL, }; -void NV50DispCreateCrtcs (ScrnInfoPtr pScrn) +const xf86CrtcFuncsRec *nv50_get_crtc_funcs () { -NVPtr pNv =NVPTR (pScrn); -Head head; -xf86CrtcPtr crtc; -NVCrtcPrivatePtr nv50_crtc; - -/* Create a "crtc" object for each head */ -for (head =HEAD0 ; head <=HEAD1 ; head++) { - crtc =xf86CrtcCreate (pScrn, &nv50_crtc_funcs); -if (!crtc)return ; - - nv50_crtc =xnfcalloc (sizeof (*nv50_crtc),1 ); - nv50_crtc->head = head; - nv50_crtc->ditherEnabled = pNv->FPDither; - crtc->driver_private = nv50_crtc; - } +return &nv50_crtc_funcs; }
src/nv50_display.h +1 -0
@@ -19,5 +19,6 @@ void NV50CrtcSetDither(xf86CrtcPtr, Bool dither, Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn); +const xf86CrtcFuncsRec *nv50_get_crtc_funcs ();#endif
src/nv_crtc.c +6 -1
@@ -1649,7 +1649,9 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num)NVCrtcRegPtr regp = &pNv->ModeReg.crtc_reg[crtc_num];int i; -if (pNv->NVArch >=0x11 ) +if (pNv->Architecture ==NV_ARCH_50 ) + crtc =xf86CrtcCreate (pScrn,nv50_get_crtc_funcs ()); +else if (pNv->NVArch >=0x11 ) crtc =xf86CrtcCreate (pScrn, &nv11_crtc_funcs);else crtc =xf86CrtcCreate (pScrn, &nv_crtc_funcs);
@@ -1663,6 +1665,9 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num) crtc->driver_private = nv_crtc; +if (pNv->Architecture ==NV_ARCH_50 ) +return ; +/* Initialise the default LUT table. */ for (i =0 ; i <256 ; i++) { regp->DAC[i*3 ] = i;
src/nv_driver.c +3 -1
@@ -1438,7 +1438,9 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVPreInitFail ("\n" );if (!NV50CreateOutputs (pScrn))NVPreInitFail ("\n" ); -NV50DispCreateCrtcs (pScrn); +for (i =0 ; i <2 ; i++) { +nv_crtc_init (pScrn, i); + } }if (!xf86InitialConfiguration (pScrn, FALSE))
Signature · 1 line
1.5.4.3
From 6e59eea9edfd7c5197b43b2a4ced6788184a97ab Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sat, 15 Mar 2008 19:02:55 +0100
Subject: [PATCH] NV50: Merge output creation and i2c init.
--- src/nv50_dac.c | 21 +----- src/nv50_output.c | 206 ----------------------------------------------------- src/nv50_output.h | 5 +- src/nv50_sor.c | 64 +++-------------- src/nv_driver.c | 24 +++---- src/nv_i2c.c | 37 +++++++++- src/nv_output.c | 64 +++++++++++++++- 7 files changed, 120 insertions(+), 301 deletions(-)
src/nv50_dac.c +2 -19
@@ -191,25 +191,8 @@ static const xf86OutputFuncsRec NV50DacOutputFuncs = { .destroy = NV50DacDestroy, }; -xf86OutputPtr -NV50CreateDac (ScrnInfoPtr pScrn,ORNum or) +const xf86OutputFuncsRec *nv50_get_analog_output_funcs () { -NVOutputPrivatePtr nv_output =xnfcalloc (sizeof (*nv_output),1 ); -xf86OutputPtr output; -char orName[5 ]; - -if (!nv_output) -return NULL ; - -snprintf (orName,5 ,"VGA%i" , or); - output =xf86OutputCreate (pScrn, &NV50DacOutputFuncs, orName); - - nv_output->type =OUTPUT_ANALOG ; - nv_output->output_resource = or; - output->driver_private = nv_output; - output->interlaceAllowed = TRUE; - output->doubleScanAllowed = TRUE; - -return output; +return &NV50DacOutputFuncs; }
src/nv50_output.c +0 -206
215 lines not on this page · raw message
src/nv50_output.h +4 -1
@@ -10,15 +10,18 @@ void NV50OutputPrepare(xf86OutputPtr);void NV50OutputCommit (xf86OutputPtr );DisplayModePtr NV50OutputGetDDCModes (xf86OutputPtr );void NV50OutputDestroy (xf86OutputPtr ); -Bool NV50CreateOutputs (ScrnInfoPtr );/* nv50_dac.c */ xf86OutputPtr NV50CreateDac (ScrnInfoPtr ,ORNum );Bool NV50DacLoadDetect (xf86OutputPtr );void NV50DacSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_analog_output_funcs ();/* nv50_sor.c */ xf86OutputPtr NV50CreateSor (ScrnInfoPtr pScrn,ORNum or,NVOutputType type);void NV50SorSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_tmds_output_funcs (); +const xf86OutputFuncsRec *nv50_get_lvds_output_funcs (); +DisplayModePtr GetLVDSNativeMode (ScrnInfoPtr pScrn);#endif
src/nv50_sor.c +11 -53
79 lines not on this page · raw message
src/nv_driver.c +9 -15
@@ -1424,25 +1424,19 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVCommonSetup (pScrn);if (pNv->randr12_enable) { -if (pNv->Architecture <NV_ARCH_50 ) { -NVI2CInit (pScrn); - - num_crtc = pNv->twoHeads ?2 :1 ; -for (i =0 ; i < num_crtc; i++) { -nv_crtc_init (pScrn, i); - } - -NvSetupOutputs (pScrn); - }else { +if (pNv->Architecture ==NV_ARCH_50 )if (!NV50DispPreInit (pScrn))NVPreInitFail ("\n" ); -if (!NV50CreateOutputs (pScrn)) -NVPreInitFail ("\n" ); -for (i =0 ; i <2 ; i++) { -nv_crtc_init (pScrn, i); - } + +NVI2CInit (pScrn); + + num_crtc = pNv->twoHeads ?2 :1 ; +for (i =0 ; i < num_crtc; i++) { +nv_crtc_init (pScrn, i); } +NvSetupOutputs (pScrn); +if (!xf86InitialConfiguration (pScrn, FALSE))NVPreInitFail ("No valid modes.\n" ); }
src/nv_i2c.c +34 -3
@@ -46,10 +46,30 @@ NVI2CPutBits(I2CBusPtr b, int clock, int data)NVWriteVgaCrtc (pNv,0 , b->DriverPrivate.uval +1 , val |0x1 ); } +static void NV50_I2CPutBits (I2CBusPtr b,int clock,int data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; + +NVWrite (pNv, (0x0000E138 +off)/4 , (4 | clock | data <<1 )); +} + +static void NV50_I2CGetBits (I2CBusPtr b,int *clock,int *data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; +unsigned char val; + + val =NVRead (pNv, (0x0000E138 +off)/4 ); + *clock = !!(val &1 ); + *data = !!(val &2 ); +} +Bool NV_I2CInit (ScrnInfoPtr pScrn,I2CBusPtr *bus_ptr,int i2c_reg,char *name) {I2CBusPtr pI2CBus; +NVPtr pNv =NVPTR (pScrn); pI2CBus =xf86CreateI2CBusRec ();if (!pI2CBus)
@@ -57,9 +77,20 @@ NV_I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name) pI2CBus->BusName = name; pI2CBus->scrnIndex = pScrn->scrnIndex; - pI2CBus->I2CPutBits = NVI2CPutBits; - pI2CBus->I2CGetBits = NVI2CGetBits; - pI2CBus->AcknTimeout =5 ; +if (pNv->Architecture ==NV_ARCH_50 ) { + pI2CBus->I2CPutBits = NV50_I2CPutBits; + pI2CBus->I2CGetBits = NV50_I2CGetBits; +/* Could this be used for the rest as well? */ + pI2CBus->ByteTimeout =2200 ;/* VESA DDC spec 3 p. 43 (+10 %) */ + pI2CBus->StartTimeout =550 ; + pI2CBus->BitTimeout =40 ; + pI2CBus->ByteTimeout =40 ; + pI2CBus->AcknTimeout =40 ; + }else { + pI2CBus->I2CPutBits = NVI2CPutBits; + pI2CBus->I2CGetBits = NVI2CGetBits; + pI2CBus->AcknTimeout =5 ; + } pI2CBus->DriverPrivate.uval = i2c_reg;
src/nv_output.c +60 -4
106 lines not on this page · raw message
Signature · 1 line
1.5.4.3
From a2615efe44899b18a57529333b9cf890cdd228b5 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 00:27:41 +0100
Subject: [PATCH] randr12: Implement dithering output property.
--- src/nv_crtc.c | 34 ++++++++++++++++++++++++---------- src/nv_output.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/nv_type.h | 1 + 3 files changed, 69 insertions(+), 10 deletions(-)
src/nv_crtc.c +24 -10
@@ -1169,17 +1169,31 @@ nv_crtc_mode_set_fp_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr a }/* Flatpanel support needs at least a NV10 */ -if (pNv->twoHeads && (pNv->FPDither || (is_lvds && !pNv->VBIOS.fp.if_is_24bit))) { - nv_crtc->ditherEnabled = TRUE; -if (pNv->NVArch ==0x11 ) - regp->dither = savep->dither |0x00010000 ; -else { -int i; - regp->dither = savep->dither |0x00000001 ; -for (i =0 ; i <3 ; i++) { - regp->dither_regs[i] =0xe4e4e4e4 ; - regp->dither_regs[i +3 ] =0x44444444 ; +if (pNv->twoHeads) { +/* Output property. */ +if (nv_output && nv_output->dithering) { + nv_crtc->ditherEnabled = TRUE; +if (pNv->NVArch ==0x11 ) + regp->dither = savep->dither |0x00010000 ; +else { +int i; + regp->dither = savep->dither |0x00000001 ; +for (i =0 ; i <3 ; i++) { + regp->dither_regs[i] =0xe4e4e4e4 ; + regp->dither_regs[i +3 ] =0x44444444 ; + } + } + }else { +if (pNv->NVArch !=0x11 ) { +/* reset them */ +int i; +for (i =0 ; i <3 ; i++) { + regp->dither_regs[i] = savep->dither_regs[i]; + regp->dither_regs[i +3 ] = savep->dither_regs[i +3 ]; + } } + nv_crtc->ditherEnabled = FALSE; + regp->dither = savep->dither; } }else { nv_crtc->ditherEnabled = FALSE;
src/nv_output.c +44 -0
68 lines not on this page · raw message
src/nv_type.h +1 -0
@@ -208,6 +208,7 @@ typedef struct _NVOutputPrivateRec {uint32_t fpHeight;DisplayModePtr native_mode;uint8_t scaling_mode; +Bool dithering;NVOutputRegRec restore; } NVOutputPrivateRec, *NVOutputPrivatePtr;
Signature · 1 line
1.5.4.3
From fc671e8a613c7cae124758c062ff5afd1c244f45 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 00:40:59 +0100
Subject: [PATCH] NV50: Share output properties.
--- src/nv50_display.c | 15 +++-- src/nv50_display.h | 2 +- src/nv50_sor.c | 152 ++-------------------------------------------------- src/nv_crtc.c | 4 -- src/nv_output.c | 4 +- src/nv_proto.h | 3 + src/nv_type.h | 1 - 7 files changed, 19 insertions(+), 162 deletions(-)
src/nv50_display.c +9 -6
@@ -339,7 +339,7 @@ NV50CrtcModeSet(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mNV50CrtcCommand (crtc,NV50_CRTC0_DEPTH ,NV50_CRTC0_DEPTH_24BPP );break ; } -NV50CrtcSetDither (crtc, nv_crtc->ditherEnabled, FALSE); +NV50CrtcSetDither (crtc, FALSE);NV50CrtcCommand (crtc,0x8a8 ,0x40000 );NV50CrtcCommand (crtc,NV50_CRTC0_FB_POS , y <<16 | x);NV50CrtcCommand (crtc,NV50_CRTC0_SCRN_SIZE , VDisplay <<16 | HDisplay);
@@ -438,14 +438,17 @@ NV50CrtcSkipModeFixup(xf86CrtcPtr crtc) }void -NV50CrtcSetDither (xf86CrtcPtr crtc,Bool dither,Bool update) +NV50CrtcSetDither (xf86CrtcPtr crtc,Bool update) { -NVCrtcPrivatePtr nv_crtc = crtc->driver_private; +xf86OutputPtr output =NVGetOutputFromCRTC (crtc); + +if (!output) +return ; - nv_crtc->ditherEnabled = dither; +NVOutputPrivatePtr nv_output = output->driver_private; -NV50CrtcCommand (crtc,0x8a0 , dither ?0x11 :0 ); -if (update) +NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 ); +if (update)NV50CrtcCommand (crtc,0x80 ,0 ); }
src/nv50_display.h +1 -1
@@ -15,7 +15,7 @@ void NV50CrtcEnableCursor(xf86CrtcPtr, Bool update);void NV50CrtcDisableCursor (xf86CrtcPtr ,Bool update);void NV50CrtcSetCursorPosition (xf86CrtcPtr ,int x,int y);void NV50CrtcSkipModeFixup (xf86CrtcPtr ); -void NV50CrtcSetDither (xf86CrtcPtr ,Bool dither,Bool update); +void NV50CrtcSetDither (xf86CrtcPtr ,Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn);
src/nv50_sor.c +4 -148
170 lines not on this page · raw message
src/nv_crtc.c +0 -4
@@ -1172,7 +1172,6 @@ nv_crtc_mode_set_fp_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr aif (pNv->twoHeads) {/* Output property. */ if (nv_output && nv_output->dithering) { - nv_crtc->ditherEnabled = TRUE;if (pNv->NVArch ==0x11 ) regp->dither = savep->dither |0x00010000 ;else {
@@ -1192,11 +1191,9 @@ nv_crtc_mode_set_fp_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr a regp->dither_regs[i +3 ] = savep->dither_regs[i +3 ]; } } - nv_crtc->ditherEnabled = FALSE; regp->dither = savep->dither; } }else { - nv_crtc->ditherEnabled = FALSE; regp->dither = savep->dither; } }
@@ -1675,7 +1672,6 @@ nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num) nv_crtc =xnfcalloc (sizeof (NVCrtcPrivateRec),1 ); nv_crtc->head = crtc_num; nv_crtc->last_dpms =NV_DPMS_CLEARED ; - nv_crtc->ditherEnabled = pNv->FPDither; crtc->driver_private = nv_crtc;
src/nv_output.c +2 -2
@@ -752,7 +752,7 @@ nv_scaling_mode_lookup(char *name, int size)return scaling_mode[i].mode; } -static void +void nv_digital_output_create_resources (xf86OutputPtr output) {NVOutputPrivatePtr nv_output = output->driver_private;
@@ -815,7 +815,7 @@ nv_digital_output_create_resources(xf86OutputPtr output) } } -static Bool +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value) {
src/nv_proto.h +3 -0
@@ -87,10 +87,13 @@ void nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num);void NVCrtcLockUnlock (xf86CrtcPtr crtc,Bool lock);void NVCrtcWriteCRTC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val);void NVCrtcWriteRAMDAC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val); +xf86OutputPtr NVGetOutputFromCRTC (xf86CrtcPtr crtc);/* nv_output.c */ void NvSetupOutputs (ScrnInfoPtr pScrn);uint32_t nv_get_clock_from_crtc (ScrnInfoPtr pScrn,RIVA_HW_STATE *state,uint8_t crtc); +void nv_digital_output_create_resources (xf86OutputPtr output); +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value);/* nv_hw.c */ uint32_t NVRead (NVPtr pNv,uint32_t reg);
src/nv_type.h +0 -1
@@ -181,7 +181,6 @@ typedef struct _NVCrtcPrivateRec {int head;uint8_t last_dpms;Bool cursorVisible; -Bool ditherEnabled;Bool skipModeFixup;/* NV50 only */ int pclk;/* Pixel clock in kHz */ /* NV50 only */ #if NOUVEAU_EXA_PIXMAPS
Signature · 1 line
1.5.4.3
From 83f4f1dbefdf31b5a6444c0bd572a7c01828a294 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 01:05:03 +0100
Subject: [PATCH] NV50: Fix a potentional bug.
--- src/nv50_display.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
src/nv50_display.c +7 -4
@@ -391,12 +391,13 @@ NV50CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)static void NV50CrtcShowHideCursor (xf86CrtcPtr crtc,Bool show,Bool update) {NVCrtcPrivatePtr nv_crtc = crtc->driver_private; +ScrnInfoPtr pScrn = crtc->scrn;NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR0 , show ?NV50_CRTC0_CURSOR0_SHOW :NV50_CRTC0_CURSOR0_HIDE ); -if (update) { +if (update) { nv_crtc->cursorVisible = show; -NV50CrtcCommand (crtc,0x80 ,0 ); +NV50DisplayCommand (pScrn,0x80 ,0 ); } }
@@ -441,6 +442,7 @@ void NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update) {xf86OutputPtr output =NVGetOutputFromCRTC (crtc); +ScrnInfoPtr pScrn = crtc->scrn;if (!output)return ;
@@ -449,7 +451,7 @@ NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update)NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 );if (update) -NV50CrtcCommand (crtc,0x80 ,0 ); +NV50DisplayCommand (pScrn,0x80 ,0 ); }static void ComputeAspectScale (DisplayModePtr mode,int *outX,int *outY)
@@ -502,6 +504,7 @@ void NV50CrtcCommit(xf86CrtcPtr crtc) {xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (crtc->scrn); +ScrnInfoPtr pScrn = crtc->scrn;int i, crtc_mask =0 ;/* If any heads are unused, blank them */
@@ -520,6 +523,6 @@ NV50CrtcCommit(xf86CrtcPtr crtc) } } -NV50CrtcCommand (crtc,0x80 ,0 ); +NV50DisplayCommand (pScrn,0x80 ,0 ); }
Signature · 1 line
1.5.4.3
From 92e883edc50ca2d430b78b56d622c02ba3926190 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 01:09:48 +0100
Subject: [PATCH] NV50: Another subtle difference.
--- src/nv50_display.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
src/nv50_display.c +3 -2
@@ -205,6 +205,7 @@ Bool NV50DispInit(ScrnInfoPtr pScrn) {NVPtr pNv =NVPTR (pScrn); +uint32_t val;if (NVRead (pNv,0x00610024 ) &0x100 ) {NVWrite (pNv,0x00610024 ,0x100 );NVWrite (pNv,0x006194e8 ,NVRead (pNv,0x006194e8 ) & ~1 );
@@ -214,13 +215,13 @@ NV50DispInit(ScrnInfoPtr pScrn)NVWrite (pNv,0x00610200 ,0x2b00 );/* A bugfix (#12637) from the nv driver, to unlock the driver if it's left in a poor state */ do { -CARD32 val =NVRead (pNv,0x00610200 ); + val =NVRead (pNv,0x00610200 );if ((val &0x9f0000 ) ==0x20000 )NVWrite (pNv,0x00610200 , val |0x800000 );if ((val &0x3f0000 ) ==0x30000 )NVWrite (pNv,0x00610200 , val |0x200000 ); - }while ((NVRead (pNv,0x00610200 ) &0x1e0000 ) !=0 ); + }while ((val &0x1e0000 ) !=0 );NVWrite (pNv,0x00610300 ,0x1 );NVWrite (pNv,0x00610200 ,0x1000b03 );while (!(NVRead (pNv,0x00610200 ) &0x40000000 ));
Signature · 1 line
1.5.4.3
From 5a727d738afdfa485e3790b298a38fddfb359bf6 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 12:33:19 +0100
Subject: [PATCH] NV50: Some more educated guesses at register names.
--- src/nv50_display.c | 23 ++++++++++--------- src/nv50reg.h | 58 +++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 60 insertions(+), 21 deletions(-)
src/nv50_display.c +12 -11
@@ -228,7 +228,8 @@ NV50DispInit(ScrnInfoPtr pScrn)NV50DisplayCommand (pScrn,0x84 ,0 );NV50DisplayCommand (pScrn,0x88 ,0 ); -NV50DisplayCommand (pScrn,0x874 ,0 ); +/* Does the bios always use crtc0? */ +NV50DisplayCommand (pScrn,NV50_CRTC0_BLANK_CTRL ,NV50_CRTC0_BLANK_CTRL_BLANK );NV50DisplayCommand (pScrn,0x800 ,0 );NV50DisplayCommand (pScrn,0x810 ,0 );NV50DisplayCommand (pScrn,0x82c ,0 );
@@ -249,7 +250,7 @@ NV50DispShutdown(ScrnInfoPtr pScrn)NV50CrtcBlankScreen (crtc, TRUE); } -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 );for (i =0 ; i < xf86_config->num_crtc; i++) {xf86CrtcPtr crtc = xf86_config->crtc[i];
@@ -362,10 +363,10 @@ NV50CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_MODE ,NV50_CRTC0_CLUT_MODE_BLANK );NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_OFFSET ,0 );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x85c ,0 ); -NV50CrtcCommand (crtc,0x874 ,0 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK1 ,NV84_CRTC0_BLANK_UNK1_BLANK ); +NV50CrtcCommand (crtc,NV50_CRTC0_BLANK_CTRL ,NV50_CRTC0_BLANK_CTRL_BLANK );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x89c ,0 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK2 ,NV84_CRTC0_BLANK_UNK2_BLANK ); }else {NV50CrtcCommand (crtc,NV50_CRTC0_FB_OFFSET , pNv->FB->offset >>8 );NV50CrtcCommand (crtc,0x864 ,0 );
@@ -376,15 +377,15 @@ NV50CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)NVWrite (pNv,0x0061038C ,0 );NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR_OFFSET , pNv->Cursor->offset >>8 );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x89c ,1 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK2 ,NV84_CRTC0_BLANK_UNK2_UNBLANK );if (nv_crtc->cursorVisible)NV50CrtcShowHideCursor (crtc, TRUE, FALSE);NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_MODE , pScrn->depth ==8 ?NV50_CRTC0_CLUT_MODE_OFF :NV50_CRTC0_CLUT_MODE_ON );NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_OFFSET , pNv->CLUT->offset >>8 );if (pNv->NVArch !=0x50 ) -NV50CrtcCommand (crtc,0x85c ,1 ); -NV50CrtcCommand (crtc,0x874 ,1 ); +NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK1 ,NV84_CRTC0_BLANK_UNK1_UNBLANK ); +NV50CrtcCommand (crtc,NV50_CRTC0_BLANK_CTRL_BLANK ,NV50_CRTC0_BLANK_CTRL_UNBLANK ); } }
@@ -398,7 +399,7 @@ static void NV50CrtcShowHideCursor(xf86CrtcPtr crtc, Bool show, Bool update) show ? NV50_CRTC0_CURSOR0_SHOW : NV50_CRTC0_CURSOR0_HIDE);if (update) { nv_crtc->cursorVisible = show; -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); } }
@@ -452,7 +453,7 @@ NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update)NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 );if (update) -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); }static void ComputeAspectScale (DisplayModePtr mode,int *outX,int *outY)
@@ -524,6 +525,6 @@ NV50CrtcCommit(xf86CrtcPtr crtc) } } -NV50DisplayCommand (pScrn,0x80 ,0 ); +NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); }
src/nv50reg.h +48 -10
87 lines not on this page · raw message
Signature · 1 line
1.5.4.3
From 885a2fa57d328c4374fe0921cf25dba15e0d3d11 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 12:46:40 +0100
Subject: [PATCH] NV50: Mostly resorting regs.
- Also a dithering register define and rename cursor related reg.
--- src/nv50_display.c | 7 ++- src/nv50reg.h | 108 ++++++++++++++++++++++++++++----------------------- 2 files changed, 63 insertions(+), 52 deletions(-)
src/nv50_display.c +4 -3
@@ -395,8 +395,8 @@ static void NV50CrtcShowHideCursor(xf86CrtcPtr crtc, Bool show, Bool update)NVCrtcPrivatePtr nv_crtc = crtc->driver_private;ScrnInfoPtr pScrn = crtc->scrn; -NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR0 , - show ?NV50_CRTC0_CURSOR0_SHOW :NV50_CRTC0_CURSOR0_HIDE ); +NV50CrtcCommand (crtc,NV50_CRTC0_CURSOR , + show ?NV50_CRTC0_CURSOR_SHOW :NV50_CRTC0_CURSOR_HIDE );if (update) { nv_crtc->cursorVisible = show;NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 );
@@ -451,7 +451,8 @@ NV50CrtcSetDither(xf86CrtcPtr crtc, Bool update)NVOutputPrivatePtr nv_output = output->driver_private; -NV50CrtcCommand (crtc,0x8a0 , nv_output->dithering ?0x11 :0 ); +NV50CrtcCommand (crtc,NV50_CRTC0_DITHERING_CTRL , nv_output->dithering ? +NV50_CRTC0_DITHERING_CTRL_ON :NV50_CRTC0_DITHERING_CTRL_OFF );if (update)NV50DisplayCommand (pScrn,NV50_UPDATE_DISPLAY ,0 ); }
src/nv50reg.h +59 -49
158 lines not on this page · raw message
Signature · 1 line
1.5.4.3
From c1ff9b6a7867b11f264e199da7475dd090e593ee Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 16 Mar 2008 16:09:11 +0100
Subject: [PATCH] NV50: kill output_resource and use or directly.
--- src/nv50_dac.c | 28 ++++++++++++++-------------- src/nv50_sor.c | 12 ++++++------ src/nv_output.c | 11 ++++------- src/nv_type.h | 1 - 4 files changed, 24 insertions(+), 28 deletions(-)
src/nv50_dac.c +14 -14
@@ -36,7 +36,7 @@ NV50DacSetPClk(xf86OutputPtr output, int pclk)NVOutputPrivatePtr nv_output = output->driver_private;ScrnInfoPtr pScrn = output->scrn;NVPtr pNv =NVPTR (pScrn); -NVWrite (pNv,0x00614280 + nv_output->output_resource *0x800 ,0 ); +NVWrite (pNv,0x00614280 +ffs (nv_output->or) *0x800 ,0 ); } static void
@@ -53,9 +53,9 @@ NV50DacDPMSSet(xf86OutputPtr output, int mode)* DPMSModeSuspend hsync enabled, vsync disabled * DPMSModeOff sync disabled */ -while (NVRead (pNv,0x0061a004 + nv_output->output_resource *0x800 ) &0x80000000 ); +while (NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ) &0x80000000 ); - tmp =NVRead (pNv,0x0061a004 + nv_output->output_resource *0x800 ); + tmp =NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ); tmp &= ~0x7f ; tmp |=0x80000000 ;
@@ -68,7 +68,7 @@ NV50DacDPMSSet(xf86OutputPtr output, int mode)if (mode == DPMSModeOff) tmp |=0x40 ; -NVWrite (pNv,0x0061a004 + nv_output->output_resource *0x800 , tmp); +NVWrite (pNv,0x0061a004 +ffs (nv_output->or) *0x800 , tmp); } Bool
@@ -84,7 +84,7 @@ NV50DacModeSet(xf86OutputPtr output, DisplayModePtr mode, {ScrnInfoPtr pScrn = output->scrn;NVOutputPrivatePtr nv_output = output->driver_private; -const int dacOff =0x80 * nv_output->output_resource; +const int dacOff =0x80 *ffs (nv_output->or);if (!adjusted_mode) {NV50DisplayCommand (pScrn,0x400 + dacOff,0 );
@@ -142,21 +142,21 @@ NV50DacLoadDetect(xf86OutputPtr output)CARD32 load, tmp, tmp2;xf86DrvMsg (scrnIndex,X_PROBED ,"Trying load detection on VGA%i ... " , - nv_output->output_resource); +ffs (nv_output->or)); -NVWrite (pNv,0x0061a010 + nv_output->output_resource *0x800 ,0x00000001 ); - tmp2 =NVRead (pNv,0x0061a004 + nv_output->output_resource *0x800 ); +NVWrite (pNv,0x0061a010 +ffs (nv_output->or) *0x800 ,0x00000001 ); + tmp2 =NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ); -NVWrite (pNv,0x0061a004 + nv_output->output_resource *0x800 ,0x80150000 ); -while (NVRead (pNv,0x0061a004 + nv_output->output_resource *0x800 ) &0x80000000 ); +NVWrite (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ,0x80150000 ); +while (NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ) &0x80000000 ); tmp = (pNv->NVArch ==0x50 ) ?420 :340 ; -NVWrite (pNv,0x0061a00c + nv_output->output_resource *0x800 , tmp |0x100000 ); +NVWrite (pNv,0x0061a00c +ffs (nv_output->or) *0x800 , tmp |0x100000 ); sigstate =xf86BlockSIGIO ();usleep (45000 );xf86UnblockSIGIO (sigstate); - load =NVRead (pNv,0x0061a00c + nv_output->output_resource *0x800 ); -NVWrite (pNv,0x0061a00c + nv_output->output_resource *0x800 ,0 ); -NVWrite (pNv,0x0061a004 + nv_output->output_resource *0x800 ,0x80000000 | tmp2); + load =NVRead (pNv,0x0061a00c +ffs (nv_output->or) *0x800 ); +NVWrite (pNv,0x0061a00c +ffs (nv_output->or) *0x800 ,0 ); +NVWrite (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ,0x80000000 | tmp2);// Use this DAC if all three channels show load. if ((load &0x38000000 ) ==0x38000000 ) {
src/nv50_sor.c +6 -6
@@ -38,7 +38,7 @@ NV50SorSetPClk(xf86OutputPtr output, int pclk)NVPtr pNv =NVPTR (pScrn);const int limit =165000 ; -NVWrite (pNv,0x00614300 + nv_output->output_resource *0x800 , (pclk > limit) ?0x101 :0 ); +NVWrite (pNv,0x00614300 +ffs (nv_output->or) *0x800 , (pclk > limit) ?0x101 :0 ); } static void
@@ -49,9 +49,9 @@ NV50SorDPMSSet(xf86OutputPtr output, int mode)NVPtr pNv =NVPTR (pScrn);CARD32 tmp; -while ((NVRead (pNv,0x0061c004 + nv_output->output_resource *0x800 ) &0x80000000 )); +while ((NVRead (pNv,0x0061c004 +ffs (nv_output->or) *0x800 ) &0x80000000 )); - tmp =NVRead (pNv,0x0061c004 + nv_output->output_resource *0x800 ); + tmp =NVRead (pNv,0x0061c004 +ffs (nv_output->or) *0x800 ); tmp |=0x80000000 ;if (mode == DPMSModeOn)
@@ -59,8 +59,8 @@ NV50SorDPMSSet(xf86OutputPtr output, int mode)else tmp &= ~1 ; -NVWrite (pNv,0x0061c004 + nv_output->output_resource *0x800 , tmp); -while ((NVRead (pNv,0x0061c030 + nv_output->output_resource *0x800 ) &0x10000000 )); +NVWrite (pNv,0x0061c004 +ffs (nv_output->or) *0x800 , tmp); +while ((NVRead (pNv,0x0061c030 +ffs (nv_output->or) *0x800 ) &0x10000000 )); } static int
@@ -93,7 +93,7 @@ NV50SorModeSet(xf86OutputPtr output, DisplayModePtr mode, {ScrnInfoPtr pScrn = output->scrn;NVOutputPrivatePtr nv_output = output->driver_private; -const int sorOff =0x40 * nv_output->output_resource; +const int sorOff =0x40 *ffs (nv_output->or);CARD32 type;if (!adjusted_mode) {
src/nv_output.c +4 -7
@@ -997,9 +997,6 @@ static void nv_add_output(ScrnInfoPtr pScrn, int dcb_entry, const xf86OutputFunc output->driver_private = nv_output; -/* needed for NV5x, used by pre-NV5x as well. */ - nv_output->output_resource =ffs (pNv->dcb_table.entry[dcb_entry].or); - nv_output->pDDCBus = pNv->pI2CBus[i2c_index]; nv_output->dcb_entry = dcb_entry; nv_output->type = pNv->dcb_table.entry[dcb_entry].type;
@@ -1039,10 +1036,10 @@ static void nv_add_output(ScrnInfoPtr pScrn, int dcb_entry, const xf86OutputFuncif (pNv->Architecture ==NV_ARCH_50 ) {if (nv_output->type ==OUTPUT_TMDS ) { -NVWrite (pNv,0x0061c00c + nv_output->output_resource *0x800 ,0x03010700 ); -NVWrite (pNv,0x0061c010 + nv_output->output_resource *0x800 ,0x0000152f ); -NVWrite (pNv,0x0061c014 + nv_output->output_resource *0x800 ,0x00000000 ); -NVWrite (pNv,0x0061c018 + nv_output->output_resource *0x800 ,0x00245af8 ); +NVWrite (pNv,0x0061c00c +ffs (nv_output->or) *0x800 ,0x03010700 ); +NVWrite (pNv,0x0061c010 +ffs (nv_output->or) *0x800 ,0x0000152f ); +NVWrite (pNv,0x0061c014 +ffs (nv_output->or) *0x800 ,0x00000000 ); +NVWrite (pNv,0x0061c018 +ffs (nv_output->or) *0x800 ,0x00245af8 ); }/* This needs to be handled in the same way as pre-NV5x on the long run. */
src/nv_type.h +0 -1
@@ -198,7 +198,6 @@ typedef enum { typedef struct _NVOutputPrivateRec { uint8_t or; - uint8_t output_resource; uint8_t last_dpms; I2CBusPtr pDDCBus; NVOutputType type;
Signature · 1 line
1.5.4.3
From ea9429ea18abddebcf2600e60ef2dee294b7fab5 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Mon, 17 Mar 2008 22:05:12 +0100
Subject: [PATCH] NV50: Handle some things that weren't fixed during rebase.
--- src/nv50_display.c | 11 ++++++++++- src/nv_proto.h | 1 - 2 files changed, 10 insertions(+), 2 deletions(-)
src/nv50_display.c +10 -1
@@ -443,8 +443,17 @@ NV50CrtcSkipModeFixup(xf86CrtcPtr crtc)void NV50CrtcSetDither (xf86CrtcPtr crtc,Bool update) { -xf86OutputPtr output =NVGetOutputFromCRTC (crtc); +xf86OutputPtr output =NULL ;ScrnInfoPtr pScrn = crtc->scrn; +xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (pScrn); +int i; + +for (i =0 ; i < xf86_config->num_output; i++) { +if (xf86_config->output[i]->crtc == crtc) { + output = xf86_config->output[i]; +break ; + } + }if (!output)return ;
src/nv_proto.h +0 -1
@@ -87,7 +87,6 @@ void nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num);void NVCrtcLockUnlock (xf86CrtcPtr crtc,Bool lock);void NVCrtcWriteCRTC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val);void NVCrtcWriteRAMDAC (xf86CrtcPtr crtc,uint32_t reg,uint32_t val); -xf86OutputPtr NVGetOutputFromCRTC (xf86CrtcPtr crtc);/* nv_output.c */ void NvSetupOutputs (ScrnInfoPtr pScrn);
Signature · 1 line
1.5.4.3
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 6d4bc9fc0803171523v771e6a8yf26905636419d2e0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 23 lines · Maarten Maathuis
Quoted 12 lines · Maarten Maathuis
Quoted 11 lines · Maarten Maathuis
Quoted 8 lines · Maarten Maathuis
This is primarily targeted at
Koala_BR, but if someone happens to have
a a fully working nouveay g80 setup, then go ahead.Maarten.
(this is attempt 2, as 100 KiB seems to be the maximum allowed size)
Quoted 8 lines
Quoted 3 lines
And a combined patch.
New patches that apply against current git head.
Quoted 7 lines
New patches against current git head.
If you need to do them seperately, then 3, 4 and 10 are (probably) required together.
But i haven't tested if 10 applies cleanly on top of 4.
src/nv50_crtc.c +2 -16
@@ -99,22 +99,8 @@ static const xf86CrtcFuncsRec nv50_crtc_funcs = { .destroy = NULL, }; -void NV50DispCreateCrtcs (ScrnInfoPtr pScrn) +const xf86CrtcFuncsRec *nv50_get_crtc_funcs () { -NVPtr pNv =NVPTR (pScrn); -Head head; -xf86CrtcPtr crtc; -NVCrtcPrivatePtr nv50_crtc; - -/* Create a "crtc" object for each head */ -for (head =HEAD0 ; head <=HEAD1 ; head++) { - crtc =xf86CrtcCreate (pScrn, &nv50_crtc_funcs); -if (!crtc)return ; - - nv50_crtc =xnfcalloc (sizeof (*nv50_crtc),1 ); - nv50_crtc->head = head; - nv50_crtc->ditherEnabled = pNv->FPDither; - crtc->driver_private = nv50_crtc; - } +return &nv50_crtc_funcs; }
src/nv50_dac.c +16 -33
92 lines not on this page · raw message
src/nv50_display.c +40 -22
144 lines not on this page · raw message
src/nv50_display.h +2 -1
@@ -15,9 +15,10 @@ void NV50CrtcEnableCursor(xf86CrtcPtr, Bool update);void NV50CrtcDisableCursor (xf86CrtcPtr ,Bool update);void NV50CrtcSetCursorPosition (xf86CrtcPtr ,int x,int y);void NV50CrtcSkipModeFixup (xf86CrtcPtr ); -void NV50CrtcSetDither (xf86CrtcPtr ,Bool dither,Bool update); +void NV50CrtcSetDither (xf86CrtcPtr ,Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn); +const xf86CrtcFuncsRec *nv50_get_crtc_funcs ();#endif
src/nv50_output.c +0 -206
215 lines not on this page · raw message
src/nv50_output.h +4 -1
@@ -10,15 +10,18 @@ void NV50OutputPrepare(xf86OutputPtr);void NV50OutputCommit (xf86OutputPtr );DisplayModePtr NV50OutputGetDDCModes (xf86OutputPtr );void NV50OutputDestroy (xf86OutputPtr ); -Bool NV50CreateOutputs (ScrnInfoPtr );/* nv50_dac.c */ xf86OutputPtr NV50CreateDac (ScrnInfoPtr ,ORNum );Bool NV50DacLoadDetect (xf86OutputPtr );void NV50DacSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_analog_output_funcs ();/* nv50_sor.c */ xf86OutputPtr NV50CreateSor (ScrnInfoPtr pScrn,ORNum or,NVOutputType type);void NV50SorSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_tmds_output_funcs (); +const xf86OutputFuncsRec *nv50_get_lvds_output_funcs (); +DisplayModePtr GetLVDSNativeMode (ScrnInfoPtr pScrn);#endif
src/nv50_sor.c +21 -207
283 lines not on this page · raw message
src/nv50reg.h +87 -39
158 lines not on this page · raw message
src/nv_crtc.c +28 -13
65 lines not on this page · raw message
src/nv_driver.c +9 -13
@@ -1424,23 +1424,19 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVCommonSetup (pScrn);if (pNv->randr12_enable) { -if (pNv->Architecture <NV_ARCH_50 ) { -NVI2CInit (pScrn); - - num_crtc = pNv->twoHeads ?2 :1 ; -for (i =0 ; i < num_crtc; i++) { -nv_crtc_init (pScrn, i); - } - -NvSetupOutputs (pScrn); - }else { +if (pNv->Architecture ==NV_ARCH_50 )if (!NV50DispPreInit (pScrn))NVPreInitFail ("\n" ); -if (!NV50CreateOutputs (pScrn)) -NVPreInitFail ("\n" ); -NV50DispCreateCrtcs (pScrn); + +NVI2CInit (pScrn); + + num_crtc = pNv->twoHeads ?2 :1 ; +for (i =0 ; i < num_crtc; i++) { +nv_crtc_init (pScrn, i); } +NvSetupOutputs (pScrn); +if (!xf86InitialConfiguration (pScrn, FALSE))NVPreInitFail ("No valid modes.\n" ); }
src/nv_i2c.c +34 -3
@@ -46,10 +46,30 @@ NVI2CPutBits(I2CBusPtr b, int clock, int data)NVWriteVgaCrtc (pNv,0 , b->DriverPrivate.uval +1 , val |0x1 ); } +static void NV50_I2CPutBits (I2CBusPtr b,int clock,int data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; + +NVWrite (pNv, (0x0000E138 +off)/4 , (4 | clock | data <<1 )); +} + +static void NV50_I2CGetBits (I2CBusPtr b,int *clock,int *data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; +unsigned char val; + + val =NVRead (pNv, (0x0000E138 +off)/4 ); + *clock = !!(val &1 ); + *data = !!(val &2 ); +} +Bool NV_I2CInit (ScrnInfoPtr pScrn,I2CBusPtr *bus_ptr,int i2c_reg,char *name) {I2CBusPtr pI2CBus; +NVPtr pNv =NVPTR (pScrn); pI2CBus =xf86CreateI2CBusRec ();if (!pI2CBus)
@@ -57,9 +77,20 @@ NV_I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name) pI2CBus->BusName = name; pI2CBus->scrnIndex = pScrn->scrnIndex; - pI2CBus->I2CPutBits = NVI2CPutBits; - pI2CBus->I2CGetBits = NVI2CGetBits; - pI2CBus->AcknTimeout =5 ; +if (pNv->Architecture ==NV_ARCH_50 ) { + pI2CBus->I2CPutBits = NV50_I2CPutBits; + pI2CBus->I2CGetBits = NV50_I2CGetBits; +/* Could this be used for the rest as well? */ + pI2CBus->ByteTimeout =2200 ;/* VESA DDC spec 3 p. 43 (+10 %) */ + pI2CBus->StartTimeout =550 ; + pI2CBus->BitTimeout =40 ; + pI2CBus->ByteTimeout =40 ; + pI2CBus->AcknTimeout =40 ; + }else { + pI2CBus->I2CPutBits = NVI2CPutBits; + pI2CBus->I2CGetBits = NVI2CGetBits; + pI2CBus->AcknTimeout =5 ; + } pI2CBus->DriverPrivate.uval = i2c_reg;
src/nv_output.c +103 -6
177 lines not on this page · raw message
src/nv_proto.h +2 -0
@@ -91,6 +91,8 @@ void NVCrtcWriteRAMDAC(xf86CrtcPtr crtc, uint32_t reg, uint32_t val);/* nv_output.c */ void NvSetupOutputs (ScrnInfoPtr pScrn);uint32_t nv_get_clock_from_crtc (ScrnInfoPtr pScrn,RIVA_HW_STATE *state,uint8_t crtc); +void nv_digital_output_create_resources (xf86OutputPtr output); +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value);/* nv_hw.c */ uint32_t NVRead (NVPtr pNv,uint32_t reg);
src/nv_type.h +1 -2
@@ -181,7 +181,6 @@ typedef struct _NVCrtcPrivateRec {int head;uint8_t last_dpms;Bool cursorVisible; -Bool ditherEnabled;Bool skipModeFixup;/* NV50 only */ int pclk;/* Pixel clock in kHz */ /* NV50 only */ #if NOUVEAU_EXA_PIXMAPS
@@ -199,7 +198,6 @@ typedef enum { typedef struct _NVOutputPrivateRec { uint8_t or; - uint8_t output_resource; uint8_t last_dpms; I2CBusPtr pDDCBus; NVOutputType type;
@@ -208,6 +206,7 @@ typedef struct _NVOutputPrivateRec {uint32_t fpHeight;DisplayModePtr native_mode;uint8_t scaling_mode; +Bool dithering;NVOutputRegRec restore; } NVOutputPrivateRec, *NVOutputPrivatePtr;
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 23 lines · Maarten Maathuis
Quoted 12 lines · Maarten Maathuis
Quoted 11 lines · Maarten Maathuis
Quoted 8 lines · Maarten Maathuis
This is primarily targeted at
Koala_BR, but if someone happens to have
a a fully working nouveay g80 setup, then go ahead.Maarten.
(this is attempt 2, as 100 KiB seems to be the maximum allowed size)
Quoted 8 lines
Quoted 3 lines
And a combined patch.
New patches that apply against current git head.
Quoted 7 lines
New patches against current git head.
If you need to do them seperately, then 3, 4 and 10 are (probably) required together.
But i haven't tested if 10 applies cleanly on top of 4.
A new patch, to fix number 9.
From 0896877e87d274b6d93aa9dc86095d98c3ce1fc0 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Mon, 17 Mar 2008 23:40:16 +0100
Subject: [PATCH] NV50: Fix major thinko in "NV50: kill output_resource and use or directly."
--- src/nv50_dac.c | 32 ++++++++++++++------------------ src/nv50_output.c | 8 ++++++++ src/nv50_output.h | 1 + src/nv50_sor.c | 14 ++++++-------- src/nv_output.c | 8 ++++---- 5 files changed, 33 insertions(+), 30 deletions(-)
src/nv50_dac.c +14 -18
@@ -33,17 +33,15 @@void NV50DacSetPClk (xf86OutputPtr output,int pclk) { -NVOutputPrivatePtr nv_output = output->driver_private;ScrnInfoPtr pScrn = output->scrn;NVPtr pNv =NVPTR (pScrn); -NVWrite (pNv,0x00614280 +ffs (nv_output->or) *0x800 ,0 ); +NVWrite (pNv,0x00614280 +NV50OrOffset (output) *0x800 ,0 ); }static void NV50DacDPMSSet (xf86OutputPtr output,int mode) {CARD32 tmp; -NVOutputPrivatePtr nv_output = output->driver_private;ScrnInfoPtr pScrn = output->scrn;NVPtr pNv =NVPTR (pScrn);
@@ -53,9 +51,9 @@ NV50DacDPMSSet(xf86OutputPtr output, int mode)* DPMSModeSuspend hsync enabled, vsync disabled * DPMSModeOff sync disabled */ -while (NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ) &0x80000000 ); +while (NVRead (pNv,0x0061a004 +NV50OrOffset (output) *0x800 ) &0x80000000 ); - tmp =NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ); + tmp =NVRead (pNv,0x0061a004 +NV50OrOffset (output) *0x800 ); tmp &= ~0x7f ; tmp |=0x80000000 ;
@@ -68,7 +66,7 @@ NV50DacDPMSSet(xf86OutputPtr output, int mode)if (mode == DPMSModeOff) tmp |=0x40 ; -NVWrite (pNv,0x0061a004 +ffs (nv_output->or) *0x800 , tmp); +NVWrite (pNv,0x0061a004 +NV50OrOffset (output) *0x800 , tmp); } Bool
@@ -83,8 +81,7 @@ NV50DacModeSet(xf86OutputPtr output, DisplayModePtr mode, DisplayModePtr adjusted_mode) {ScrnInfoPtr pScrn = output->scrn; -NVOutputPrivatePtr nv_output = output->driver_private; -const int dacOff =0x80 *ffs (nv_output->or); +const int dacOff =0x80 *NV50OrOffset (output);if (!adjusted_mode) {NV50DisplayCommand (pScrn,0x400 + dacOff,0 );
@@ -136,27 +133,26 @@ NV50DacLoadDetect(xf86OutputPtr output) {ScrnInfoPtr pScrn = output->scrn;NVPtr pNv =NVPTR (pScrn); -NVOutputPrivatePtr nv_output = output->driver_private;const int scrnIndex = pScrn->scrnIndex;int sigstate;CARD32 load, tmp, tmp2;xf86DrvMsg (scrnIndex,X_PROBED ,"Trying load detection on VGA%i ... " , -ffs (nv_output->or)); +NV50OrOffset (output)); -NVWrite (pNv,0x0061a010 +ffs (nv_output->or) *0x800 ,0x00000001 ); - tmp2 =NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ); +NVWrite (pNv,0x0061a010 +NV50OrOffset (output) *0x800 ,0x00000001 ); + tmp2 =NVRead (pNv,0x0061a004 +NV50OrOffset (output) *0x800 ); -NVWrite (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ,0x80150000 ); -while (NVRead (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ) &0x80000000 ); +NVWrite (pNv,0x0061a004 +NV50OrOffset (output) *0x800 ,0x80150000 ); +while (NVRead (pNv,0x0061a004 +NV50OrOffset (output) *0x800 ) &0x80000000 ); tmp = (pNv->NVArch ==0x50 ) ?420 :340 ; -NVWrite (pNv,0x0061a00c +ffs (nv_output->or) *0x800 , tmp |0x100000 ); +NVWrite (pNv,0x0061a00c +NV50OrOffset (output) *0x800 , tmp |0x100000 ); sigstate =xf86BlockSIGIO ();usleep (45000 );xf86UnblockSIGIO (sigstate); - load =NVRead (pNv,0x0061a00c +ffs (nv_output->or) *0x800 ); -NVWrite (pNv,0x0061a00c +ffs (nv_output->or) *0x800 ,0 ); -NVWrite (pNv,0x0061a004 +ffs (nv_output->or) *0x800 ,0x80000000 | tmp2); + load =NVRead (pNv,0x0061a00c +NV50OrOffset (output) *0x800 ); +NVWrite (pNv,0x0061a00c +NV50OrOffset (output) *0x800 ,0 ); +NVWrite (pNv,0x0061a004 +NV50OrOffset (output) *0x800 ,0x80000000 | tmp2);// Use this DAC if all three channels show load. if ((load &0x38000000 ) ==0x38000000 ) {
src/nv50_output.c +8 -0
@@ -30,6 +30,14 @@#include <xf86DDC.h> +int +NV50OrOffset (xf86OutputPtr output) +{ +NVOutputPrivatePtr nv_output = output->driver_private; + +return ffs (nv_output->or) -1 ; +} +void NV50OutputSetPClk (xf86OutputPtr output,int pclk) {
src/nv50_output.h +1 -0
@@ -4,6 +4,7 @@#include "nv50_display.h" #include "nv_type.h" +int NV50OrOffset (xf86OutputPtr output);void NV50OutputSetPClk (xf86OutputPtr ,int pclk);int NV50OutputModeValid (xf86OutputPtr ,DisplayModePtr );void NV50OutputPrepare (xf86OutputPtr );
src/nv50_sor.c +6 -8
@@ -33,25 +33,23 @@void NV50SorSetPClk (xf86OutputPtr output,int pclk) { -NVOutputPrivatePtr nv_output = output->driver_private;ScrnInfoPtr pScrn = output->scrn;NVPtr pNv =NVPTR (pScrn);const int limit =165000 ; -NVWrite (pNv,0x00614300 +ffs (nv_output->or) *0x800 , (pclk > limit) ?0x101 :0 ); +NVWrite (pNv,0x00614300 +NV50OrOffset (output) *0x800 , (pclk > limit) ?0x101 :0 ); }static void NV50SorDPMSSet (xf86OutputPtr output,int mode) { -NVOutputPrivatePtr nv_output = output->driver_private;ScrnInfoPtr pScrn = output->scrn;NVPtr pNv =NVPTR (pScrn);CARD32 tmp; -while ((NVRead (pNv,0x0061c004 +ffs (nv_output->or) *0x800 ) &0x80000000 )); +while ((NVRead (pNv,0x0061c004 +NV50OrOffset (output) *0x800 ) &0x80000000 )); - tmp =NVRead (pNv,0x0061c004 +ffs (nv_output->or) *0x800 ); + tmp =NVRead (pNv,0x0061c004 +NV50OrOffset (output) *0x800 ); tmp |=0x80000000 ;if (mode == DPMSModeOn)
@@ -59,8 +57,8 @@ NV50SorDPMSSet(xf86OutputPtr output, int mode)else tmp &= ~1 ; -NVWrite (pNv,0x0061c004 +ffs (nv_output->or) *0x800 , tmp); -while ((NVRead (pNv,0x0061c030 +ffs (nv_output->or) *0x800 ) &0x10000000 )); +NVWrite (pNv,0x0061c004 +NV50OrOffset (output) *0x800 , tmp); +while ((NVRead (pNv,0x0061c030 +NV50OrOffset (output) *0x800 ) &0x10000000 )); } static int
@@ -93,7 +91,7 @@ NV50SorModeSet(xf86OutputPtr output, DisplayModePtr mode, {ScrnInfoPtr pScrn = output->scrn;NVOutputPrivatePtr nv_output = output->driver_private; -const int sorOff =0x40 *ffs (nv_output->or); +const int sorOff =0x40 *NV50OrOffset (output);CARD32 type;if (!adjusted_mode) {
src/nv_output.c +4 -4
@@ -1036,10 +1036,10 @@ static void nv_add_output(ScrnInfoPtr pScrn, int dcb_entry, const xf86OutputFuncif (pNv->Architecture ==NV_ARCH_50 ) {if (nv_output->type ==OUTPUT_TMDS ) { -NVWrite (pNv,0x0061c00c +ffs (nv_output->or) *0x800 ,0x03010700 ); -NVWrite (pNv,0x0061c010 +ffs (nv_output->or) *0x800 ,0x0000152f ); -NVWrite (pNv,0x0061c014 +ffs (nv_output->or) *0x800 ,0x00000000 ); -NVWrite (pNv,0x0061c018 +ffs (nv_output->or) *0x800 ,0x00245af8 ); +NVWrite (pNv,0x0061c00c +NV50OrOffset (output) *0x800 ,0x03010700 ); +NVWrite (pNv,0x0061c010 +NV50OrOffset (output) *0x800 ,0x0000152f ); +NVWrite (pNv,0x0061c014 +NV50OrOffset (output) *0x800 ,0x00000000 ); +NVWrite (pNv,0x0061c018 +NV50OrOffset (output) *0x800 ,0x00245af8 ); }/* This needs to be handled in the same way as pre-NV5x on the long run. */
Signature · 1 line
1.5.4.3
src/nv50_crtc.c +2 -16
@@ -99,22 +99,8 @@ static const xf86CrtcFuncsRec nv50_crtc_funcs = { .destroy = NULL, }; -void NV50DispCreateCrtcs (ScrnInfoPtr pScrn) +const xf86CrtcFuncsRec *nv50_get_crtc_funcs () { -NVPtr pNv =NVPTR (pScrn); -Head head; -xf86CrtcPtr crtc; -NVCrtcPrivatePtr nv50_crtc; - -/* Create a "crtc" object for each head */ -for (head =HEAD0 ; head <=HEAD1 ; head++) { - crtc =xf86CrtcCreate (pScrn, &nv50_crtc_funcs); -if (!crtc)return ; - - nv50_crtc =xnfcalloc (sizeof (*nv50_crtc),1 ); - nv50_crtc->head = head; - nv50_crtc->ditherEnabled = pNv->FPDither; - crtc->driver_private = nv50_crtc; - } +return &nv50_crtc_funcs; }
src/nv50_dac.c +16 -37
109 lines not on this page · raw message
src/nv50_display.c +40 -22
144 lines not on this page · raw message
src/nv50_display.h +2 -1
@@ -15,9 +15,10 @@ void NV50CrtcEnableCursor(xf86CrtcPtr, Bool update);void NV50CrtcDisableCursor (xf86CrtcPtr ,Bool update);void NV50CrtcSetCursorPosition (xf86CrtcPtr ,int x,int y);void NV50CrtcSkipModeFixup (xf86CrtcPtr ); -void NV50CrtcSetDither (xf86CrtcPtr ,Bool dither,Bool update); +void NV50CrtcSetDither (xf86CrtcPtr ,Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn); +const xf86CrtcFuncsRec *nv50_get_crtc_funcs ();#endif
src/nv50_output.c +4 -202
217 lines not on this page · raw message
src/nv50_output.h +5 -1
@@ -4,21 +4,25 @@#include "nv50_display.h" #include "nv_type.h" +int NV50OrOffset (xf86OutputPtr output);void NV50OutputSetPClk (xf86OutputPtr ,int pclk);int NV50OutputModeValid (xf86OutputPtr ,DisplayModePtr );void NV50OutputPrepare (xf86OutputPtr );void NV50OutputCommit (xf86OutputPtr );DisplayModePtr NV50OutputGetDDCModes (xf86OutputPtr );void NV50OutputDestroy (xf86OutputPtr ); -Bool NV50CreateOutputs (ScrnInfoPtr );/* nv50_dac.c */ xf86OutputPtr NV50CreateDac (ScrnInfoPtr ,ORNum );Bool NV50DacLoadDetect (xf86OutputPtr );void NV50DacSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_analog_output_funcs ();/* nv50_sor.c */ xf86OutputPtr NV50CreateSor (ScrnInfoPtr pScrn,ORNum or,NVOutputType type);void NV50SorSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_tmds_output_funcs (); +const xf86OutputFuncsRec *nv50_get_lvds_output_funcs (); +DisplayModePtr GetLVDSNativeMode (ScrnInfoPtr pScrn);#endif
src/nv50_sor.c +21 -209
292 lines not on this page · raw message
src/nv50reg.h +87 -39
158 lines not on this page · raw message
src/nv_crtc.c +28 -13
65 lines not on this page · raw message
src/nv_driver.c +9 -13
@@ -1424,23 +1424,19 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVCommonSetup (pScrn);if (pNv->randr12_enable) { -if (pNv->Architecture <NV_ARCH_50 ) { -NVI2CInit (pScrn); - - num_crtc = pNv->twoHeads ?2 :1 ; -for (i =0 ; i < num_crtc; i++) { -nv_crtc_init (pScrn, i); - } - -NvSetupOutputs (pScrn); - }else { +if (pNv->Architecture ==NV_ARCH_50 )if (!NV50DispPreInit (pScrn))NVPreInitFail ("\n" ); -if (!NV50CreateOutputs (pScrn)) -NVPreInitFail ("\n" ); -NV50DispCreateCrtcs (pScrn); + +NVI2CInit (pScrn); + + num_crtc = pNv->twoHeads ?2 :1 ; +for (i =0 ; i < num_crtc; i++) { +nv_crtc_init (pScrn, i); } +NvSetupOutputs (pScrn); +if (!xf86InitialConfiguration (pScrn, FALSE))NVPreInitFail ("No valid modes.\n" ); }
src/nv_i2c.c +34 -3
@@ -46,10 +46,30 @@ NVI2CPutBits(I2CBusPtr b, int clock, int data)NVWriteVgaCrtc (pNv,0 , b->DriverPrivate.uval +1 , val |0x1 ); } +static void NV50_I2CPutBits (I2CBusPtr b,int clock,int data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; + +NVWrite (pNv, (0x0000E138 +off)/4 , (4 | clock | data <<1 )); +} + +static void NV50_I2CGetBits (I2CBusPtr b,int *clock,int *data) +{ +NVPtr pNv =NVPTR (xf86Screens[b->scrnIndex]); +const int off = b->DriverPrivate.val *0x18 ; +unsigned char val; + + val =NVRead (pNv, (0x0000E138 +off)/4 ); + *clock = !!(val &1 ); + *data = !!(val &2 ); +} +Bool NV_I2CInit (ScrnInfoPtr pScrn,I2CBusPtr *bus_ptr,int i2c_reg,char *name) {I2CBusPtr pI2CBus; +NVPtr pNv =NVPTR (pScrn); pI2CBus =xf86CreateI2CBusRec ();if (!pI2CBus)
@@ -57,9 +77,20 @@ NV_I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name) pI2CBus->BusName = name; pI2CBus->scrnIndex = pScrn->scrnIndex; - pI2CBus->I2CPutBits = NVI2CPutBits; - pI2CBus->I2CGetBits = NVI2CGetBits; - pI2CBus->AcknTimeout =5 ; +if (pNv->Architecture ==NV_ARCH_50 ) { + pI2CBus->I2CPutBits = NV50_I2CPutBits; + pI2CBus->I2CGetBits = NV50_I2CGetBits; +/* Could this be used for the rest as well? */ + pI2CBus->ByteTimeout =2200 ;/* VESA DDC spec 3 p. 43 (+10 %) */ + pI2CBus->StartTimeout =550 ; + pI2CBus->BitTimeout =40 ; + pI2CBus->ByteTimeout =40 ; + pI2CBus->AcknTimeout =40 ; + }else { + pI2CBus->I2CPutBits = NVI2CPutBits; + pI2CBus->I2CGetBits = NVI2CGetBits; + pI2CBus->AcknTimeout =5 ; + } pI2CBus->DriverPrivate.uval = i2c_reg;
src/nv_output.c +103 -6
177 lines not on this page · raw message
src/nv_proto.h +2 -0
@@ -91,6 +91,8 @@ void NVCrtcWriteRAMDAC(xf86CrtcPtr crtc, uint32_t reg, uint32_t val);/* nv_output.c */ void NvSetupOutputs (ScrnInfoPtr pScrn);uint32_t nv_get_clock_from_crtc (ScrnInfoPtr pScrn,RIVA_HW_STATE *state,uint8_t crtc); +void nv_digital_output_create_resources (xf86OutputPtr output); +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value);/* nv_hw.c */ uint32_t NVRead (NVPtr pNv,uint32_t reg);
src/nv_type.h +1 -2
@@ -181,7 +181,6 @@ typedef struct _NVCrtcPrivateRec {int head;uint8_t last_dpms;Bool cursorVisible; -Bool ditherEnabled;Bool skipModeFixup;/* NV50 only */ int pclk;/* Pixel clock in kHz */ /* NV50 only */ #if NOUVEAU_EXA_PIXMAPS
@@ -199,7 +198,6 @@ typedef enum { typedef struct _NVOutputPrivateRec { uint8_t or; - uint8_t output_resource; uint8_t last_dpms; I2CBusPtr pDDCBus; NVOutputType type;
@@ -208,6 +206,7 @@ typedef struct _NVOutputPrivateRec {uint32_t fpHeight;DisplayModePtr native_mode;uint8_t scaling_mode; +Bool dithering;NVOutputRegRec restore; } NVOutputPrivateRec, *NVOutputPrivatePtr;
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 6d4bc9fc0803171542k35cdf5ccl5a042d5c09ba202b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 26 lines · Maarten Maathuis
Quoted 25 lines · Maarten Maathuis
Quoted 12 lines · Maarten Maathuis
Quoted 11 lines · Maarten Maathuis
Quoted 8 lines · Maarten Maathuis
This is primarily targeted at
Koala_BR, but if someone happens to have
a a fully working nouveay g80 setup, then go ahead.Maarten.
(this is attempt 2, as 100 KiB seems to be the maximum allowed size)
Quoted 8 lines
Quoted 3 lines
And a combined patch.
New patches that apply against current git head.
New patches against current git head.
Quoted 10 lines
Quoted 5 lines
If you need to do them seperately, then 3, 4 and 10 are (probably) required together.
But i haven't tested if 10 applies cleanly on top of 4.A new patch, to fix number 9.
Patch number 12, which hopefully fixes and i2c and should fix the blank screen issue.
From e2c119b9de93d4f09bd1cafeed2f1b64d1adff41 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Wed, 19 Mar 2008 08:57:33 +0100
Subject: [PATCH] NV50: Fix a typo and hopefully fix i2c.
--- src/nv50_display.c | 2 +- src/nv50reg.h | 4 ++++ src/nv_i2c.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/nv_output.c | 12 +++++++++++- src/nv_type.h | 4 ++++ 5 files changed, 64 insertions(+), 2 deletions(-)
src/nv50_display.c +1 -1
@@ -385,7 +385,7 @@ NV50CrtcBlankScreen(xf86CrtcPtr crtc, Bool blank)NV50CrtcCommand (crtc,NV50_CRTC0_CLUT_OFFSET , pNv->CLUT->offset >>8 );if (pNv->NVArch !=0x50 )NV50CrtcCommand (crtc,NV84_CRTC0_BLANK_UNK1 ,NV84_CRTC0_BLANK_UNK1_UNBLANK ); -NV50CrtcCommand (crtc,NV50_CRTC0_BLANK_CTRL_BLANK ,NV50_CRTC0_BLANK_CTRL_UNBLANK ); +NV50CrtcCommand (crtc,NV50_CRTC0_BLANK_CTRL ,NV50_CRTC0_BLANK_CTRL_UNBLANK ); } }
src/nv50reg.h +4 -0
@@ -146,4 +146,8 @@#define NV50_CRTC1_FB_POS 0xCC0#define NV50_CRTC1_SCRN_SIZE 0xCC8 +/* misc stuff */ +#define NV50_I2C_START 0x7 +#define NV50_I2C_STOP 0x3 +#endif /* __NV50REG_H_ */
src/nv_i2c.c +44 -0
56 lines not on this page · raw message
src/nv_output.c +11 -1
@@ -984,9 +984,19 @@ static void nv_add_output(ScrnInfoPtr pScrn, int dcb_entry, const xf86OutputFuncNVPtr pNv =NVPTR (pScrn);xf86OutputPtr output;NVOutputPrivatePtr nv_output; +Bool valid_index = FALSE;int i2c_index = pNv->dcb_table.entry[dcb_entry].i2c_index; -if (pNv->dcb_table.i2c_read[i2c_index] && pNv->pI2CBus[i2c_index] ==NULL ) + +if (pNv->Architecture ==NV_ARCH_50 ) { +if (i2c_index >=0 && i2c_index <=16 ) + valid_index = TRUE; + }else { +if (i2c_index) + valid_index = TRUE; + } + +if (valid_index && (pNv->pI2CBus[i2c_index] ==NULL ))NV_I2CInit (pScrn, &pNv->pI2CBus[i2c_index], pNv->dcb_table.i2c_read[i2c_index],xstrdup (outputname));if (!(output =xf86OutputCreate (pScrn, output_funcs, outputname)))
src/nv_type.h +4 -0
@@ -436,6 +436,10 @@ typedef struct _NVRec {Bool randr12_enable;Bool new_restore; +/* Needed to wrap the NV50 i2c stuff. */ +Bool (*I2CStart) (I2CBusPtr b,int timeout); +void (*I2CStop) (I2CDevPtr d); +I2CBusPtr pI2CBus[MAX_NUM_DCB_ENTRIES ];struct {
Signature · 1 line
1.5.4.4
src/nv50_crtc.c +2 -16
@@ -99,22 +99,8 @@ static const xf86CrtcFuncsRec nv50_crtc_funcs = { .destroy = NULL, }; -void NV50DispCreateCrtcs (ScrnInfoPtr pScrn) +const xf86CrtcFuncsRec *nv50_get_crtc_funcs () { -NVPtr pNv =NVPTR (pScrn); -Head head; -xf86CrtcPtr crtc; -NVCrtcPrivatePtr nv50_crtc; - -/* Create a "crtc" object for each head */ -for (head =HEAD0 ; head <=HEAD1 ; head++) { - crtc =xf86CrtcCreate (pScrn, &nv50_crtc_funcs); -if (!crtc)return ; - - nv50_crtc =xnfcalloc (sizeof (*nv50_crtc),1 ); - nv50_crtc->head = head; - nv50_crtc->ditherEnabled = pNv->FPDither; - crtc->driver_private = nv50_crtc; - } +return &nv50_crtc_funcs; }
src/nv50_dac.c +16 -37
109 lines not on this page · raw message
src/nv50_display.c +40 -22
144 lines not on this page · raw message
src/nv50_display.h +2 -1
@@ -15,9 +15,10 @@ void NV50CrtcEnableCursor(xf86CrtcPtr, Bool update);void NV50CrtcDisableCursor (xf86CrtcPtr ,Bool update);void NV50CrtcSetCursorPosition (xf86CrtcPtr ,int x,int y);void NV50CrtcSkipModeFixup (xf86CrtcPtr ); -void NV50CrtcSetDither (xf86CrtcPtr ,Bool dither,Bool update); +void NV50CrtcSetDither (xf86CrtcPtr ,Bool update);void NV50CrtcSetScale (xf86CrtcPtr ,DisplayModePtr ,enum scaling_modes );void NV50DispCreateCrtcs (ScrnInfoPtr pScrn); +const xf86CrtcFuncsRec *nv50_get_crtc_funcs ();#endif
src/nv50_output.c +4 -202
217 lines not on this page · raw message
src/nv50_output.h +5 -1
@@ -4,21 +4,25 @@#include "nv50_display.h" #include "nv_type.h" +int NV50OrOffset (xf86OutputPtr output);void NV50OutputSetPClk (xf86OutputPtr ,int pclk);int NV50OutputModeValid (xf86OutputPtr ,DisplayModePtr );void NV50OutputPrepare (xf86OutputPtr );void NV50OutputCommit (xf86OutputPtr );DisplayModePtr NV50OutputGetDDCModes (xf86OutputPtr );void NV50OutputDestroy (xf86OutputPtr ); -Bool NV50CreateOutputs (ScrnInfoPtr );/* nv50_dac.c */ xf86OutputPtr NV50CreateDac (ScrnInfoPtr ,ORNum );Bool NV50DacLoadDetect (xf86OutputPtr );void NV50DacSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_analog_output_funcs ();/* nv50_sor.c */ xf86OutputPtr NV50CreateSor (ScrnInfoPtr pScrn,ORNum or,NVOutputType type);void NV50SorSetPClk (xf86OutputPtr output,int pclk); +const xf86OutputFuncsRec *nv50_get_tmds_output_funcs (); +const xf86OutputFuncsRec *nv50_get_lvds_output_funcs (); +DisplayModePtr GetLVDSNativeMode (ScrnInfoPtr pScrn);#endif
src/nv50_sor.c +21 -209
292 lines not on this page · raw message
src/nv50reg.h +90 -38
161 lines not on this page · raw message
src/nv_crtc.c +28 -13
65 lines not on this page · raw message
src/nv_driver.c +9 -13
@@ -1424,23 +1424,19 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)NVCommonSetup (pScrn);if (pNv->randr12_enable) { -if (pNv->Architecture <NV_ARCH_50 ) { -NVI2CInit (pScrn); - - num_crtc = pNv->twoHeads ?2 :1 ; -for (i =0 ; i < num_crtc; i++) { -nv_crtc_init (pScrn, i); - } - -NvSetupOutputs (pScrn); - }else { +if (pNv->Architecture ==NV_ARCH_50 )if (!NV50DispPreInit (pScrn))NVPreInitFail ("\n" ); -if (!NV50CreateOutputs (pScrn)) -NVPreInitFail ("\n" ); -NV50DispCreateCrtcs (pScrn); + +NVI2CInit (pScrn); + + num_crtc = pNv->twoHeads ?2 :1 ; +for (i =0 ; i < num_crtc; i++) { +nv_crtc_init (pScrn, i); } +NvSetupOutputs (pScrn); +if (!xf86InitialConfiguration (pScrn, FALSE))NVPreInitFail ("No valid modes.\n" ); }
src/nv_i2c.c +78 -3
103 lines not on this page · raw message
src/nv_output.c +114 -7
197 lines not on this page · raw message
src/nv_proto.h +2 -0
@@ -91,6 +91,8 @@ void NVCrtcWriteRAMDAC(xf86CrtcPtr crtc, uint32_t reg, uint32_t val);/* nv_output.c */ void NvSetupOutputs (ScrnInfoPtr pScrn);uint32_t nv_get_clock_from_crtc (ScrnInfoPtr pScrn,RIVA_HW_STATE *state,uint8_t crtc); +void nv_digital_output_create_resources (xf86OutputPtr output); +Bool nv_digital_output_set_property (xf86OutputPtr output,Atom property,RRPropertyValuePtr value);/* nv_hw.c */ uint32_t NVRead (NVPtr pNv,uint32_t reg);
src/nv_type.h +5 -2
@@ -181,7 +181,6 @@ typedef struct _NVCrtcPrivateRec {int head;uint8_t last_dpms;Bool cursorVisible; -Bool ditherEnabled;Bool skipModeFixup;/* NV50 only */ int pclk;/* Pixel clock in kHz */ /* NV50 only */ #if NOUVEAU_EXA_PIXMAPS
@@ -199,7 +198,6 @@ typedef enum { typedef struct _NVOutputPrivateRec { uint8_t or; - uint8_t output_resource; uint8_t last_dpms; I2CBusPtr pDDCBus; NVOutputType type;
@@ -208,6 +206,7 @@ typedef struct _NVOutputPrivateRec {uint32_t fpHeight;DisplayModePtr native_mode;uint8_t scaling_mode; +Bool dithering;NVOutputRegRec restore; } NVOutputPrivateRec, *NVOutputPrivatePtr;
@@ -437,6 +436,10 @@ typedef struct _NVRec {Bool randr12_enable;Bool new_restore; +/* Needed to wrap the NV50 i2c stuff. */ +Bool (*I2CStart) (I2CBusPtr b,int timeout); +void (*I2CStop) (I2CDevPtr d); +I2CBusPtr pI2CBus[MAX_NUM_DCB_ENTRIES ];struct {
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau