summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Ossman <pierre@ossman.eu>2008-12-03 20:33:36 +0100
committerPierre Ossman <pierre@ossman.eu>2008-12-03 20:33:36 +0100
commit79bbdd984c925e37f5b3db2605339f1a21377fcf (patch)
tree7639e4bc2c508ce5139b9019128287a7cb893949
parentbbdf821c179242266fd86edf9e688a6be9cf985f (diff)
Change the XV_BICUBIC attribute to a tristate, where the third state
automatically turns the filter on and off as appropriate.
-rw-r--r--src/radeon_textured_video.c21
-rw-r--r--src/radeon_video.h4
2 files changed, 20 insertions, 5 deletions
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index 318df492..cf6999cf 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -229,9 +229,20 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
return BadAlloc;
}
- /* Bicubic filter loading */
+ /* Bicubic filter setup */
+ pPriv->bicubic_enabled = (pPriv->bicubic_state != BICUBIC_OFF);
if (!(IS_R300_3D || IS_R500_3D))
pPriv->bicubic_enabled = FALSE;
+ if (pPriv->bicubic_enabled && (pPriv->bicubic_state == BICUBIC_AUTO)) {
+ /*
+ * Applying the bicubic filter with a scale of less than 200%
+ * results in a blurred picture, so disable the filter.
+ */
+ if ((src_w > drw_w / 2) || (src_h > drw_h / 2))
+ pPriv->bicubic_enabled = FALSE;
+ }
+
+ /* Bicubic filter loading */
if (pPriv->bicubic_memory == NULL && pPriv->bicubic_enabled) {
pPriv->bicubic_offset = radeon_legacy_allocate_memory(pScrn,
&pPriv->bicubic_memory,
@@ -370,7 +381,7 @@ static XF86VideoFormatRec Formats[NUM_FORMATS] =
static XF86AttributeRec Attributes[NUM_ATTRIBUTES+1] =
{
- {XvSettable | XvGettable, 0, 1, "XV_BICUBIC"},
+ {XvSettable | XvGettable, 0, 2, "XV_BICUBIC"},
{0, 0, 0, NULL}
};
@@ -398,7 +409,7 @@ RADEONGetTexPortAttribute(ScrnInfoPtr pScrn,
if (info->accelOn) RADEON_SYNC(info, pScrn);
if (attribute == xvBicubic)
- *value = pPriv->bicubic_enabled ? 1 : 0;
+ *value = pPriv->bicubic_state;
else
return BadMatch;
@@ -417,7 +428,7 @@ RADEONSetTexPortAttribute(ScrnInfoPtr pScrn,
RADEON_SYNC(info, pScrn);
if (attribute == xvBicubic)
- pPriv->bicubic_enabled = ClipValue (value, 0, 1);
+ pPriv->bicubic_state = ClipValue (value, 0, 2);
else
return BadMatch;
@@ -480,7 +491,7 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
pPriv->videoStatus = 0;
pPriv->currentBuffer = 0;
pPriv->doubleBuffer = 0;
- pPriv->bicubic_enabled = (info->ChipFamily >= CHIP_FAMILY_R300);
+ pPriv->bicubic_state = BICUBIC_AUTO;
/* gotta uninit this someplace, XXX: shouldn't be necessary for textured */
REGION_NULL(pScreen, &pPriv->clip);
diff --git a/src/radeon_video.h b/src/radeon_video.h
index 11b80291..448377be 100644
--- a/src/radeon_video.h
+++ b/src/radeon_video.h
@@ -95,6 +95,10 @@ typedef struct {
int bicubic_offset;
Bool bicubic_enabled;
uint32_t bicubic_src_offset;
+ int bicubic_state;
+#define BICUBIC_OFF 0
+#define BICUBIC_ON 1
+#define BICUBIC_AUTO 2
Atom device_id, location_id, instance_id;