summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@fairlite.demon.co.uk>2005-02-08 20:13:33 +0000
committerAlan Hourihane <alanh@fairlite.demon.co.uk>2005-02-08 20:13:33 +0000
commitf691f959213d3eb5c365edaf5a5a53fa96300491 (patch)
tree55a38c0f1fd7eb5b621ae83e9968f5675638f122 /src
parent31a4191a97f538b2c6d4b8036796f06443f783c1 (diff)
Setup the Xv atoms correctly.
Diffstat (limited to 'src')
-rw-r--r--src/i830_video.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/src/i830_video.c b/src/i830_video.c
index 6eb34da9..7b977174 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -251,19 +251,26 @@ static XF86VideoFormatRec Formats[NUM_FORMATS] = {
{15, TrueColor}, {16, TrueColor}, {24, TrueColor}
};
-#define NUM_ATTRIBUTES 10
+#define CLONE_ATTRIBUTES 1
+static XF86AttributeRec CloneAttributes[CLONE_ATTRIBUTES] = {
+ {XvSettable | XvGettable, 0, 1, "XV_PIPE"}
+};
+#define NUM_ATTRIBUTES 3
static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = {
{XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
{XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
- {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"},
+ {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
+};
+
+#define GAMMA_ATTRIBUTES 6
+static XF86AttributeRec GammaAttributes[GAMMA_ATTRIBUTES] = {
{XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA0"},
{XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA1"},
{XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA2"},
{XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA3"},
{XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA4"},
- {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA5"},
- {XvSettable | XvGettable, 0, 1, "XV_PIPE"}
+ {XvSettable | XvGettable, 0, 0xffffff, "XV_GAMMA5"}
};
#define NUM_IMAGES 4
@@ -582,6 +589,7 @@ I830SetupImageVideo(ScreenPtr pScreen)
I830Ptr pI830 = I830PTR(pScrn);
XF86VideoAdaptorPtr adapt;
I830PortPrivPtr pPriv;
+ XF86AttributePtr att;
DPRINTF(PFX, "I830SetupImageVideo\n");
@@ -602,14 +610,25 @@ I830SetupImageVideo(ScreenPtr pScreen)
pPriv = (I830PortPrivPtr) (&adapt->pPortPrivates[1]);
adapt->pPortPrivates[0].ptr = (pointer) (pPriv);
- adapt->pAttributes = Attributes;
- adapt->nImages = NUM_IMAGES;
- if (IS_I915G(pI830) || IS_I915GM(pI830))
- adapt->nAttributes = 9; /* has gamma */
- else
- adapt->nAttributes = 3;
+ adapt->nAttributes = NUM_ATTRIBUTES;
if (pI830->Clone)
- adapt->nAttributes += 1;
+ adapt->nAttributes += CLONE_ATTRIBUTES;
+ if (IS_I915G(pI830) || IS_I915GM(pI830))
+ adapt->nAttributes += GAMMA_ATTRIBUTES; /* has gamma */
+ adapt->pAttributes = xnfalloc(sizeof(XF86AttributeRec) * adapt->nAttributes);
+ /* Now copy the attributes */
+ att = adapt->pAttributes;
+ memcpy((char *)att, (char*)Attributes, sizeof(XF86AttributeRec)* NUM_ATTRIBUTES);
+ att+=NUM_ATTRIBUTES;
+ if (pI830->Clone) {
+ memcpy((char*)att, (char*)CloneAttributes, sizeof(XF86AttributeRec) * CLONE_ATTRIBUTES);
+ att+=CLONE_ATTRIBUTES;
+ }
+ if (IS_I915G(pI830) || IS_I915GM(pI830)) {
+ memcpy((char*)att, (char*)GammaAttributes, sizeof(XF86AttributeRec) * GAMMA_ATTRIBUTES);
+ att+=GAMMA_ATTRIBUTES;
+ }
+ adapt->nImages = NUM_IMAGES;
adapt->pImages = Images;
adapt->PutVideo = NULL;
adapt->PutStill = NULL;
@@ -660,7 +679,7 @@ I830SetupImageVideo(ScreenPtr pScreen)
xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
xvContrast = MAKE_ATOM("XV_CONTRAST");
xvColorKey = MAKE_ATOM("XV_COLORKEY");
-
+
/* Allow the pipe to be switched from pipe A to B when in clone mode */
if (pI830->Clone)
xvPipe = MAKE_ATOM("XV_PIPE");