summaryrefslogtreecommitdiff
path: root/src/g80_driver.c
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2010-03-01 14:26:51 -0800
committerAaron Plattner <aplattner@nvidia.com>2010-03-02 08:19:08 -0800
commit7b01fc8f4ba1182370980f54a34bdb959e291e02 (patch)
tree3bf49f2f8f0648e76b2b5b0eaac508795ade0406 /src/g80_driver.c
parente6f4c9c6379b20b9fee50489d6afd05867c35967 (diff)
Bug #26612: Separate LUTs per output.
Wire up the RandR 1.2 gamma_set hook. Call it from G80SetPalette like the Intel driver does. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Signed-off-by: Andy Ritger <aritger@nvidia.com> Reviewed-by: Christian Zander <chzander@nvidia.com>
Diffstat (limited to 'src/g80_driver.c')
-rw-r--r--src/g80_driver.c56
1 files changed, 7 insertions, 49 deletions
diff --git a/src/g80_driver.c b/src/g80_driver.c
index 13e417a..8ea45af 100644
--- a/src/g80_driver.c
+++ b/src/g80_driver.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007 NVIDIA, Corporation
+ * Copyright (c) 2007,2010 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -57,7 +57,7 @@
#include "g80_xaa.h"
#define G80_REG_SIZE (1024 * 1024 * 16)
-#define G80_RESERVED_VIDMEM 0xd000
+#define G80_RESERVED_VIDMEM 0xe000
typedef enum {
OPTION_HW_CURSOR,
@@ -630,7 +630,7 @@ G80InitHW(ScrnInfoPtr pScrn)
pNv->reg[0x00003224/4] = 0x000f0078;
pNv->reg[0x0000322c/4] = 0x00000644;
- pNv->reg[0x00003234/4] = G80_RESERVED_VIDMEM - 0x5001;
+ pNv->reg[0x00003234/4] = G80_RESERVED_VIDMEM - 0x6001;
pNv->reg[0x00003254/4] = 0x00000001;
pNv->reg[0x00002210/4] = 0x1c001000;
@@ -655,7 +655,7 @@ G80InitHW(ScrnInfoPtr pScrn)
pNv->dmaPut = 0;
pNv->dmaCurrent = SKIPS;
- pNv->dmaMax = (G80_RESERVED_VIDMEM - 0x5000) / 4 - 2;
+ pNv->dmaMax = (G80_RESERVED_VIDMEM - 0x6000) / 4 - 2;
pNv->dmaFree = pNv->dmaMax - pNv->dmaCurrent;
G80DmaStart(pNv, 0, 1);
@@ -726,48 +726,6 @@ G80InitHW(ScrnInfoPtr pScrn)
pNv->currentRop = ~0; /* Set to something invalid */
}
-#define DEPTH_SHIFT(val, w) ((val << (8 - w)) | (val >> ((w << 1) - 8)))
-#define COLOR(c) (unsigned int)(0x3fff * ((c)/255.0))
-static void
-G80LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
- VisualPtr pVisual)
-{
- G80Ptr pNv = G80PTR(pScrn);
- int i, index;
- volatile struct {
- unsigned short red, green, blue, unused;
- } *lut = (void*)&pNv->mem[pNv->videoRam * 1024 - 0x5000];
-
- switch(pScrn->depth) {
- case 15:
- for(i = 0; i < numColors; i++) {
- index = indices[i];
- lut[DEPTH_SHIFT(index, 5)].red = COLOR(colors[index].red);
- lut[DEPTH_SHIFT(index, 5)].green = COLOR(colors[index].green);
- lut[DEPTH_SHIFT(index, 5)].blue = COLOR(colors[index].blue);
- }
- break;
- case 16:
- for(i = 0; i < numColors; i++) {
- index = indices[i];
- lut[DEPTH_SHIFT(index, 6)].green = COLOR(colors[index].green);
- if(index < 32) {
- lut[DEPTH_SHIFT(index, 5)].red = COLOR(colors[index].red);
- lut[DEPTH_SHIFT(index, 5)].blue = COLOR(colors[index].blue);
- }
- }
- break;
- default:
- for(i = 0; i < numColors; i++) {
- index = indices[i];
- lut[index].red = COLOR(colors[index].red);
- lut[index].green = COLOR(colors[index].green);
- lut[index].blue = COLOR(colors[index].blue);
- }
- break;
- }
-}
-
static Bool
G80ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
{
@@ -866,6 +824,9 @@ G80ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
Must precede creation of the default colormap */
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+ if(!xf86CrtcScreenInit(pScreen))
+ return FALSE;
+
/* Initialize default colormap */
if(!miCreateDefColormap(pScreen))
return FALSE;
@@ -909,9 +870,6 @@ G80ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pNv->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = G80BlockHandler;
- if(!xf86CrtcScreenInit(pScreen))
- return FALSE;
-
return TRUE;
}