summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2009-11-11 17:33:37 +0100
committerLuc Verhaegen <libv@skynet.be>2009-11-11 17:33:37 +0100
commit7f250dd7e4174411b4b8c1b645b3e0b62c0183d3 (patch)
treef45f92bdbf8098ed5bba76ef140909e9055293be
parentf079865427b78b8330bbabe67b114bd155a00505 (diff)
Xv: Fix colourspace after resume.
Reported by LluĂ­s Batlle i Rossell.
-rw-r--r--src/via_video.c30
-rw-r--r--src/via_video.h2
2 files changed, 18 insertions, 14 deletions
diff --git a/src/via_video.c b/src/via_video.c
index c754a1b..1933dd8 100644
--- a/src/via_video.c
+++ b/src/via_video.c
@@ -414,9 +414,9 @@ vPackFloat(float val, float hiLimit, float loLimit, float mult, int shift,
* be added in the table above and, if needed, implemented in the model switch below. -- Thomas
*/
static void
-viaCalculateVideoColor(VIAPtr pVia, CARD32 *col1, CARD32 *col2)
+viaCalculateVideoColor(struct ViaXvPort *Port, CARD32 *col1, CARD32 *col2)
{
- struct ViaXvPort *Port = pVia->Swov->Port;
+ VIAPtr pVia = VIAPTR(xf86Screens[Port->scrnIndex]);
float fA,fB1,fC1,fD,fB2,fC2,fB3,fC3;
float fPI,fContrast,fSaturation,fHue,fBrightness;
@@ -523,14 +523,15 @@ viaCalculateVideoColor(VIAPtr pVia, CARD32 *col1, CARD32 *col2)
*
*/
static void
-VIASetColorSpace(VIAPtr pVia)
+VIASetColorSpace(struct ViaXvPort *Port)
{
+ struct ViaSwov *Swov = VIAPTR(xf86Screens[Port->scrnIndex])->Swov;
CARD32 col1,col2;
- viaCalculateVideoColor(pVia, &col1, &col2);
+ viaCalculateVideoColor(Port, &col1, &col2);
- pVia->Swov->Video->Video3ColorSpace1 = col1;
- pVia->Swov->Video->Video3ColorSpace2 = col2;
+ Swov->Video->Video3ColorSpace1 = col1;
+ Swov->Video->Video3ColorSpace2 = col2;
}
/*
@@ -868,7 +869,6 @@ ViaSwovAlphaSet(ScrnInfoPtr pScrn, INT32 value)
static int
viaSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, pointer data)
{
- VIAPtr pVia = VIAPTR(pScrn);
struct ViaXvPort *Port = (struct ViaXvPort *) data;
if (attribute == xvColorKey) {
@@ -887,25 +887,25 @@ viaSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, pointer data
return Success;
} else if (attribute == xvBrightness) {
Port->brightness = value;
- VIASetColorSpace(pVia);
+ VIASetColorSpace(Port);
return Success;
} else if (attribute == xvContrast) {
Port->contrast = value;
- VIASetColorSpace(pVia);
+ VIASetColorSpace(Port);
return Success;
} else if (attribute == xvSaturation) {
Port->saturation = value;
- VIASetColorSpace(pVia);
+ VIASetColorSpace(Port);
return Success;
} else if (attribute == xvHue) {
Port->hue = value;
- VIASetColorSpace(pVia);
+ VIASetColorSpace(Port);
return Success;
} else if (attribute == xvOpacity) {
if ((value < 0) || (value > 15))
return BadValue;
- if (pVia->Swov->Active)
+ if (VIAPTR(pScrn)->Swov->Active)
ViaSwovAlphaSet(pScrn, value);
else
Port->Opacity = value;
@@ -1469,6 +1469,8 @@ ViaVideo3Init(struct ViaSwov *Swov)
Swov->V3Shadow->Control = V3_COLORSPACE_SIGN | V3_YUV422 | V3_SWAP_HW_HQV;
ViaVideo3Format(Swov);
+
+ VIASetColorSpace(Swov->Port);
}
/*
@@ -2497,6 +2499,8 @@ ViaXvPortInit(ScreenPtr pScreen)
{
struct ViaXvPort *Port = xnfcalloc(1, sizeof(struct ViaXvPort));
+ Port->scrnIndex = pScreen->myNum;
+
Port->ColorKey = 0x821;
Port->autoPaint = TRUE;
Port->brightness = 5000.;
@@ -2615,8 +2619,6 @@ ViaVideoInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
if (Swov->Mpeg)
ViaXvMCInit(pScrn, pScreen);
#endif
-
- VIASetColorSpace(pVia);
}
/*
diff --git a/src/via_video.h b/src/via_video.h
index f5769ef..fe047ec 100644
--- a/src/via_video.h
+++ b/src/via_video.h
@@ -30,6 +30,8 @@
* Stream specific stuff.
*/
struct ViaXvPort {
+ int scrnIndex;
+
int brightness;
int saturation;
int contrast;