[haiku-commits] r33653 - in haiku/trunk: headers/private/graphics/nvidia src/add-ons/accelerants/nvidia/engine src/add-ons/kernel/drivers/graphics/nvidia

  • From: rudolf.cornelissen@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 19 Oct 2009 12:33:01 +0200 (CEST)

Author: rudolfc
Date: 2009-10-19 12:33:01 +0200 (Mon, 19 Oct 2009)
New Revision: 33653
Changeset: http://dev.haiku-os.org/changeset/33653/haiku

Modified:
   haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h
   haiku/trunk/headers/private/graphics/nvidia/nv_macros.h
   haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_dac.c
   haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c
   haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_proto.h
   haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
Log:
added dithering support for DAC1. Dithering is enabled for digitally connected 
panels on DAC1 on laptops. This should remove the 'colorbands' displayed 
previously on gradients. Bumped version to 1.06.

Modified: haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h
===================================================================
--- haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h       
2009-10-19 09:06:10 UTC (rev 33652)
+++ haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h       
2009-10-19 10:33:01 UTC (rev 33653)
@@ -5,7 +5,7 @@
        Other authors:
        Mark Watson;
        Apsed;
-       Rudolf Cornelissen 10/2002-8/2009.
+       Rudolf Cornelissen 10/2002-10/2009.
 */
 
 #ifndef DRIVERINTERFACE_H
@@ -89,12 +89,9 @@
        NV06,
        NV10,
        NV11,
-       NV11M,
        NV15,
        NV17,
-       NV17M,
        NV18,
-       NV18M,
        NV20,
        NV25,
        NV28,

Modified: haiku/trunk/headers/private/graphics/nvidia/nv_macros.h
===================================================================
--- haiku/trunk/headers/private/graphics/nvidia/nv_macros.h     2009-10-19 
09:06:10 UTC (rev 33652)
+++ haiku/trunk/headers/private/graphics/nvidia/nv_macros.h     2009-10-19 
10:33:01 UTC (rev 33653)
@@ -650,6 +650,7 @@
 #define NVDAC_PIXPLLC          0x00680508
 #define NVDAC_PLLSEL           0x0068050c
 #define NVDAC_NV30_PLLSETUP    0x00680524
+#define NVDAC_NV11_DITHER      0x00680528
 #define NVDAC_OUTPUT           0x0068052c
 #define NVDAC_PIXPLLC2         0x00680578
 #define NVDAC_NV40_PLLSEL2     0x00680580
@@ -672,9 +673,16 @@
 #define NVDAC_FP_HSYNC_E       0x00680830
 #define NVDAC_FP_HVALID_S      0x00680834
 #define NVDAC_FP_HVALID_E      0x00680838
+#define NVDAC_FP_DITHER                0x0068083c
 #define NVDAC_FP_CHKSUM                0x00680840
 #define NVDAC_FP_TST_CTRL      0x00680844
 #define NVDAC_FP_TG_CTRL       0x00680848
+#define NVDAC_FP_DITH_PATT1    0x00680850
+#define NVDAC_FP_DITH_PATT2    0x00680854
+#define NVDAC_FP_DITH_PATT3    0x00680858
+#define NVDAC_FP_DITH_PATT4    0x0068085c
+#define NVDAC_FP_DITH_PATT5    0x00680860
+#define NVDAC_FP_DITH_PATT6    0x00680864
 #define NVDAC_FP_DEBUG0                0x00680880
 #define NVDAC_FP_DEBUG1                0x00680884
 #define NVDAC_FP_DEBUG2                0x00680888

Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_dac.c
===================================================================
--- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_dac.c  2009-10-19 
09:06:10 UTC (rev 33652)
+++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_dac.c  2009-10-19 
10:33:01 UTC (rev 33653)
@@ -1,6 +1,6 @@
 /* program the DAC */
 /* Author:
-   Rudolf Cornelissen 12/2003-9/2009
+   Rudolf Cornelissen 12/2003-10/2009
 */
 
 #define MODULE_BIT 0x00010000
@@ -103,6 +103,47 @@
        return B_OK;
 }
 
+/* enable/disable dithering */
+status_t nv_dac_dither(bool dither)
+{
+       /* older cards can't do dithering */
+       if ((si->ps.card_type != NV11) && !si->ps.secondary_head) return 
B_ERROR;
+
+       if (dither) {
+               LOG(4,("DAC: enabling dithering\n"));
+
+               if (si->ps.card_type == NV11) {
+                       /* NV11 apparantly has a fixed dithering pattern */
+
+                       /* enable dithering */
+                       DACW(NV11_DITHER, (DACR(NV11_DITHER) | 0x00010000));
+               } else {
+                       /* setup dithering pattern */
+                       DACW(FP_DITH_PATT1, 0xe4e4e4e4);
+                       DACW(FP_DITH_PATT2, 0xe4e4e4e4);
+                       DACW(FP_DITH_PATT3, 0xe4e4e4e4);
+                       DACW(FP_DITH_PATT4, 0x44444444);
+                       DACW(FP_DITH_PATT5, 0x44444444);
+                       DACW(FP_DITH_PATT6, 0x44444444);
+
+                       /* enable dithering */
+                       DACW(FP_DITHER, (DACR(FP_DITHER) | 0x00000001));
+               }
+       } else {
+               LOG(4,("DAC: disabling dithering\n"));
+
+               if (si->ps.card_type == NV11) {
+                       /* disable dithering */
+                       DACW(NV11_DITHER, (DACR(NV11_DITHER) & ~0x00010000));
+               } else {
+                       /* disable dithering */
+                       DACW(FP_DITHER, (DACR(FP_DITHER) & ~0x00000001));
+               }
+       }
+
+       return B_OK;
+}
+
 /*program the DAC palette using the given r,g,b values*/
 status_t nv_dac_palette(uint8 r[256],uint8 g[256],uint8 b[256])
 {

Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c
===================================================================
--- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c      
2009-10-19 09:06:10 UTC (rev 33652)
+++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c      
2009-10-19 10:33:01 UTC (rev 33653)
@@ -1,7 +1,7 @@
 /* Authors:
    Mark Watson 12/1999,
    Apsed,
-   Rudolf Cornelissen 10/2002-9/2009
+   Rudolf Cornelissen 10/2002-10/2009
    tst..
 */
 
@@ -92,7 +92,7 @@
 {
        status_t status;
 
-       LOG(1,("POWERUP: Haiku nVidia Accelerant 1.05 running.\n"));
+       LOG(1,("POWERUP: Haiku nVidia Accelerant 1.06 running.\n"));
 
        /* log VBLANK INT usability status */
        if (si->ps.int_assigned)
@@ -1830,6 +1830,12 @@
                NV_REG32(NV32_PFB_CLS_PAGE2) &= 0xffff7fff;
        }
 
+       /* enable dithering for internal laptop panels only (those have only 
18bit colordepth sometimes)
+        * note:
+        * dithering is only supported on digitally connected flatpanels. */
+       //fixme: how about DAC2?? (still implement and test..)
+       if (si->ps.laptop && (si->ps.monitors & CRTC1_TMDS)) 
nv_dac_dither(true);
+
        /* tweak card GPU-core and RAM speeds if requested (hoping we'll 
survive)... */
        if (si->settings.gpu_clk)
        {

Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_proto.h
===================================================================
--- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_proto.h        
2009-10-19 09:06:10 UTC (rev 33652)
+++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_proto.h        
2009-10-19 10:33:01 UTC (rev 33653)
@@ -50,6 +50,7 @@
 /* DAC functions */
 bool nv_dac_crt_connected(void);
 status_t nv_dac_mode(int,float);
+status_t nv_dac_dither(bool dither);
 status_t nv_dac_palette(uint8*,uint8*,uint8*);
 status_t nv_dac_pix_pll_find(display_mode target,float * result,uint8 *,uint8 
*,uint8 *, uint8);
 status_t nv_dac_set_pix_pll(display_mode target);

Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html  
2009-10-19 09:06:10 UTC (rev 33652)
+++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html  
2009-10-19 10:33:01 UTC (rev 33653)
@@ -4,7 +4,7 @@
 </head>
 <body>
 <p><h2>Changes done for each driverversion:</h2></p>
-<p><h1>head (SVN 1.05, Rudolf)</h1></p>
+<p><h1>head (SVN 1.06, Rudolf)</h1></p>
 <ul>
 <li>Fixed driver assuming enabling AGP mode succeeded on some occasions if it 
did not block it itself. Blocking AGP mode completely via the AGP busmanager 
(option 'block_agp') resulted in a crashing acceleration engine because it was 
setup for AGP transfers instead of using PCI transfers. Error was solved with 
help from user kraton.
 <li>Fixed shared_info struct problem occuring when 3D 'accelerant' is used 
(tested Alpha 4.1): the TVencoder type definition list apparantly gets some 
memory assigned these days when done inside the definition of shared_info. 
Moved encoder list outside the shared_info definition.
@@ -30,7 +30,8 @@
 <li>Fixed shivering display on some systems (confirmed a Geforce 5200 laptop): 
Pixelclocks should <strong>never</strong> be setup for spread spectrum on 
analog connections;
 <li>Added full HDTV mode (1920x1080p) to exported modelist: Haiku's Screen 
preflet allows you to set this mode now if your screen supports it;
 <li>Improved modeline scaling for digitally connected screens: this fixes 
missing SYNC pulses on some setups. The screen nolonger shows shifted pictures 
(this happened mostly on 640x480 resolution);
-<li>Modified head selection code on NV40 architecture cards except for NV40, 
NV41 and NV45. The cards affected have differently behaving BIOSes. This should 
fix black or disabled screens if the secondary connector was used for VGA while 
the first one was not connected.
+<li>Modified head selection code on NV40 architecture cards except for NV40, 
NV41 and NV45. The cards affected have differently behaving BIOSes. This should 
fix black or disabled screens if the secondary connector was used for VGA while 
the first one was not connected;
+<li>Added dithering for laptop panels (if they are connected to DAC1 only for 
now). Gradients should now display much more fluently on 18bit depth panels (no 
more 'colorbands').
 </ul>
 <p><h1>nv_driver 0.80 (Rudolf)</h1></p>
 <ul>


Other related posts:

  • » [haiku-commits] r33653 - in haiku/trunk: headers/private/graphics/nvidia src/add-ons/accelerants/nvidia/engine src/add-ons/kernel/drivers/graphics/nvidia - rudolf . cornelissen