From 79bbdd984c925e37f5b3db2605339f1a21377fcf Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 3 Dec 2008 20:33:36 +0100 Subject: Change the XV_BICUBIC attribute to a tristate, where the third state automatically turns the filter on and off as appropriate. --- src/radeon_textured_video.c | 21 ++++++++++++++++----- src/radeon_video.h | 4 ++++ 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; -- cgit v1.2.3