summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-10-13 12:27:52 -0400
committerAlex Deucher <alexdeucher@gmail.com>2009-10-13 12:27:52 -0400
commit255ac8d54e3dc12e579e05edb41b40946a00eab8 (patch)
treeaccd1c1b5252943680a1958374901e8c2a366da9
parent801d900add4731f3c424ebb780ad2dbd7a1c6a25 (diff)
radeon: add XV_CRTC attribute for textured video
This attribute allows the user to override which crtc is synced with when XV_VSYNC is enabled. This is useful for clone modes where the user can might want to override the default.
-rw-r--r--man/radeon.man10
-rw-r--r--src/r600_textured_videofuncs.c14
-rw-r--r--src/radeon_textured_video.c39
-rw-r--r--src/radeon_textured_videofuncs.c56
4 files changed, 87 insertions, 32 deletions
diff --git a/man/radeon.man b/man/radeon.man
index 62270fb..8514c1c 100644
--- a/man/radeon.man
+++ b/man/radeon.man
@@ -616,6 +616,16 @@ It has two values: 'off'(0) and 'on'(1). The default is
.B 'on'(1).
.TP
+.BI "XV_CRTC"
+XV_CRTC is used to control which display controller (crtc) the textured
+adapter synchronizes the screen update with when XV_VSYNC is enabled.
+The default, 'auto'(-1), will sync to the display controller that more
+of the video is on. This attribute is useful for things like clone mode
+where the user can best decide which display should be synced.
+The default is
+.B 'auto'(-1).
+
+.TP
.BI "XV_BICUBIC"
XV_BICUBIC is used to control whether textured adapter should apply
a bicubic filter to smooth the output. It has three values: 'off'(0), 'on'(1)
diff --git a/src/r600_textured_videofuncs.c b/src/r600_textured_videofuncs.c
index dd4d3d1..7598429 100644
--- a/src/r600_textured_videofuncs.c
+++ b/src/r600_textured_videofuncs.c
@@ -574,11 +574,15 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
sizeof(vs_alu_consts) / SQ_ALU_CONSTANT_offset, vs_alu_consts);
if (pPriv->vsync) {
- xf86CrtcPtr crtc = radeon_xv_pick_best_crtc(pScrn,
- pPriv->drw_x,
- pPriv->drw_x + pPriv->dst_w,
- pPriv->drw_y,
- pPriv->drw_y + pPriv->dst_h);
+ xf86CrtcPtr crtc;
+ if (pPriv->desired_crtc)
+ crtc = pPriv->desired_crtc;
+ else
+ crtc = radeon_xv_pick_best_crtc(pScrn,
+ pPriv->drw_x,
+ pPriv->drw_x + pPriv->dst_w,
+ pPriv->drw_y,
+ pPriv->drw_y + pPriv->dst_h);
if (crtc)
cp_wait_vline_sync(pScrn, accel_state->ib, pPixmap,
crtc,
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index d6b221f..39c7574 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -538,15 +538,16 @@ static XF86VideoFormatRec Formats[NUM_FORMATS] =
{15, TrueColor}, {16, TrueColor}, {24, TrueColor}
};
-#define NUM_ATTRIBUTES 1
+#define NUM_ATTRIBUTES 2
static XF86AttributeRec Attributes[NUM_ATTRIBUTES+1] =
{
{XvSettable | XvGettable, 0, 1, "XV_VSYNC"},
+ {XvSettable | XvGettable, -1, 1, "XV_CRTC"},
{0, 0, 0, NULL}
};
-#define NUM_ATTRIBUTES_R200 6
+#define NUM_ATTRIBUTES_R200 7
static XF86AttributeRec Attributes_r200[NUM_ATTRIBUTES_R200+1] =
{
@@ -556,10 +557,11 @@ static XF86AttributeRec Attributes_r200[NUM_ATTRIBUTES_R200+1] =
{XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"},
{XvSettable | XvGettable, -1000, 1000, "XV_HUE"},
{XvSettable | XvGettable, 0, 1, "XV_COLORSPACE"},
+ {XvSettable | XvGettable, -1, 1, "XV_CRTC"},
{0, 0, 0, NULL}
};
-#define NUM_ATTRIBUTES_R300 8
+#define NUM_ATTRIBUTES_R300 9
static XF86AttributeRec Attributes_r300[NUM_ATTRIBUTES_R300+1] =
{
@@ -571,10 +573,11 @@ static XF86AttributeRec Attributes_r300[NUM_ATTRIBUTES_R300+1] =
{XvSettable | XvGettable, -1000, 1000, "XV_HUE"},
{XvSettable | XvGettable, 100, 10000, "XV_GAMMA"},
{XvSettable | XvGettable, 0, 1, "XV_COLORSPACE"},
+ {XvSettable | XvGettable, -1, 1, "XV_CRTC"},
{0, 0, 0, NULL}
};
-#define NUM_ATTRIBUTES_R500 7
+#define NUM_ATTRIBUTES_R500 8
static XF86AttributeRec Attributes_r500[NUM_ATTRIBUTES_R500+1] =
{
@@ -585,10 +588,11 @@ static XF86AttributeRec Attributes_r500[NUM_ATTRIBUTES_R500+1] =
{XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"},
{XvSettable | XvGettable, -1000, 1000, "XV_HUE"},
{XvSettable | XvGettable, 0, 1, "XV_COLORSPACE"},
+ {XvSettable | XvGettable, -1, 1, "XV_CRTC"},
{0, 0, 0, NULL}
};
-#define NUM_ATTRIBUTES_R600 6
+#define NUM_ATTRIBUTES_R600 7
static XF86AttributeRec Attributes_r600[NUM_ATTRIBUTES_R600+1] =
{
@@ -598,6 +602,7 @@ static XF86AttributeRec Attributes_r600[NUM_ATTRIBUTES_R600+1] =
{XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"},
{XvSettable | XvGettable, -1000, 1000, "XV_HUE"},
{XvSettable | XvGettable, 0, 1, "XV_COLORSPACE"},
+ {XvSettable | XvGettable, -1, 1, "XV_CRTC"},
{0, 0, 0, NULL}
};
@@ -605,6 +610,7 @@ static Atom xvBicubic;
static Atom xvVSync;
static Atom xvBrightness, xvContrast, xvSaturation, xvHue;
static Atom xvGamma, xvColorspace;
+static Atom xvCRTC;
#define NUM_IMAGES 4
@@ -643,7 +649,16 @@ RADEONGetTexPortAttribute(ScrnInfoPtr pScrn,
*value = pPriv->gamma;
else if(attribute == xvColorspace)
*value = pPriv->transform_index;
- else
+ else if(attribute == xvCRTC) {
+ int c;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ if (xf86_config->crtc[c] == pPriv->desired_crtc)
+ break;
+ if (c == xf86_config->num_crtc)
+ c = -1;
+ *value = c;
+ } else
return BadMatch;
return Success;
@@ -676,7 +691,15 @@ RADEONSetTexPortAttribute(ScrnInfoPtr pScrn,
pPriv->gamma = ClipValue (value, 100, 10000);
else if(attribute == xvColorspace)
pPriv->transform_index = ClipValue (value, 0, 1);
- else
+ else if(attribute == xvCRTC) {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ if ((value < -1) || (value > xf86_config->num_crtc))
+ return BadValue;
+ if (value < 0)
+ pPriv->desired_crtc = NULL;
+ else
+ pPriv->desired_crtc = xf86_config->crtc[value];
+ } else
return BadMatch;
return Success;
@@ -759,6 +782,7 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
xvHue = MAKE_ATOM("XV_HUE");
xvGamma = MAKE_ATOM("XV_GAMMA");
xvColorspace = MAKE_ATOM("XV_COLORSPACE");
+ xvCRTC = MAKE_ATOM("XV_CRTC");
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
adapt->flags = 0;
@@ -827,6 +851,7 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
pPriv->hue = 0;
pPriv->gamma = 1000;
pPriv->transform_index = 0;
+ pPriv->desired_crtc = NULL;
/* gotta uninit this someplace, XXX: shouldn't be necessary for textured */
REGION_NULL(pScreen, &pPriv->clip);
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index 8b55efc..c7d9b02 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -351,11 +351,15 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
FINISH_ACCEL();
if (pPriv->vsync) {
- xf86CrtcPtr crtc = radeon_xv_pick_best_crtc(pScrn,
- pPriv->drw_x,
- pPriv->drw_x + pPriv->dst_w,
- pPriv->drw_y,
- pPriv->drw_y + pPriv->dst_h);
+ xf86CrtcPtr crtc;
+ if (pPriv->desired_crtc)
+ crtc = pPriv->desired_crtc;
+ else
+ crtc = radeon_xv_pick_best_crtc(pScrn,
+ pPriv->drw_x,
+ pPriv->drw_x + pPriv->dst_w,
+ pPriv->drw_y,
+ pPriv->drw_y + pPriv->dst_h);
if (crtc)
FUNC_NAME(RADEONWaitForVLine)(pScrn, pPixmap,
crtc,
@@ -910,11 +914,15 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
FINISH_ACCEL();
if (pPriv->vsync) {
- xf86CrtcPtr crtc = radeon_xv_pick_best_crtc(pScrn,
- pPriv->drw_x,
- pPriv->drw_x + pPriv->dst_w,
- pPriv->drw_y,
- pPriv->drw_y + pPriv->dst_h);
+ xf86CrtcPtr crtc;
+ if (pPriv->desired_crtc)
+ crtc = pPriv->desired_crtc;
+ else
+ crtc = radeon_xv_pick_best_crtc(pScrn,
+ pPriv->drw_x,
+ pPriv->drw_x + pPriv->dst_w,
+ pPriv->drw_y,
+ pPriv->drw_y + pPriv->dst_h);
if (crtc)
FUNC_NAME(RADEONWaitForVLine)(pScrn, pPixmap,
crtc,
@@ -2282,11 +2290,15 @@ FUNC_NAME(R300DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
FINISH_ACCEL();
if (pPriv->vsync) {
- xf86CrtcPtr crtc = radeon_xv_pick_best_crtc(pScrn,
- pPriv->drw_x,
- pPriv->drw_x + pPriv->dst_w,
- pPriv->drw_y,
- pPriv->drw_y + pPriv->dst_h);
+ xf86CrtcPtr crtc;
+ if (pPriv->desired_crtc)
+ crtc = pPriv->desired_crtc;
+ else
+ crtc = radeon_xv_pick_best_crtc(pScrn,
+ pPriv->drw_x,
+ pPriv->drw_x + pPriv->dst_w,
+ pPriv->drw_y,
+ pPriv->drw_y + pPriv->dst_h);
if (crtc)
FUNC_NAME(RADEONWaitForVLine)(pScrn, pPixmap,
crtc,
@@ -3857,11 +3869,15 @@ FUNC_NAME(R500DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
FINISH_ACCEL();
if (pPriv->vsync) {
- xf86CrtcPtr crtc = radeon_xv_pick_best_crtc(pScrn,
- pPriv->drw_x,
- pPriv->drw_x + pPriv->dst_w,
- pPriv->drw_y,
- pPriv->drw_y + pPriv->dst_h);
+ xf86CrtcPtr crtc;
+ if (pPriv->desired_crtc)
+ crtc = pPriv->desired_crtc;
+ else
+ crtc = radeon_xv_pick_best_crtc(pScrn,
+ pPriv->drw_x,
+ pPriv->drw_x + pPriv->dst_w,
+ pPriv->drw_y,
+ pPriv->drw_y + pPriv->dst_h);
if (crtc)
FUNC_NAME(RADEONWaitForVLine)(pScrn, pPixmap,
crtc,