summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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");