summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2008-07-30 00:54:32 -0700
committerAlex Deucher <alexdeucher@gmail.com>2008-08-25 06:22:36 -0400
commita4ec30a677906ec2ff9824c7ddca586655f6d1a8 (patch)
tree0a9acb45670f97f88b7e38a3dd9e6631ee14f355
parentf3b81c7582aed307fa44e134ee161cd8a3158657 (diff)
Merge upstream changes to vertices, and also add Xv attributes for textured video, including bicubic filtering.
-rw-r--r--src/radeon_textured_video.c60
-rw-r--r--src/radeon_textured_videofuncs.c21
-rw-r--r--src/radeon_video.c9
-rw-r--r--src/radeon_video.h15
4 files changed, 67 insertions, 38 deletions
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index b1b28be6..8075ef21 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -93,6 +93,7 @@ static __inline__ uint32_t F_TO_DW(float val)
#undef VIDEO_PREAMBLE
#undef BEGIN_VIDEO
#undef OUT_VIDEO_REG
+#undef OUT_VIDEO_REG_F
#undef FINISH_VIDEO
#ifdef XF86DRI
@@ -103,6 +104,7 @@ static __inline__ uint32_t F_TO_DW(float val)
RADEONCP_REFRESH(pScrn, info)
#define BEGIN_VIDEO(n) BEGIN_RING(2*(n))
#define OUT_VIDEO_REG(reg, val) OUT_RING_REG(reg, val)
+#define OUT_VIDEO_REG_F(reg, val) OUT_VIDEO_REG(reg, F_TO_DW(val))
#define FINISH_VIDEO() ADVANCE_RING()
#define OUT_VIDEO_RING_F(x) OUT_RING(F_TO_DW(x))
@@ -200,7 +202,8 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
}
/* Bicubic filter loading */
- pPriv->bicubic_enabled = IS_R500_3D;
+ if (!IS_R500_3D)
+ pPriv->bicubic_enabled = FALSE;
if (pPriv->bicubic_memory == NULL && pPriv->bicubic_enabled) {
pPriv->bicubic_offset = RADEONAllocateMemory(pScrn,
&pPriv->bicubic_memory,
@@ -335,12 +338,16 @@ static XF86VideoFormatRec Formats[NUM_FORMATS] =
{15, TrueColor}, {16, TrueColor}, {24, TrueColor}
};
-#define NUM_ATTRIBUTES 0
+#define NUM_ATTRIBUTES 1
-static XF86AttributeRec Attributes[NUM_ATTRIBUTES] =
+static XF86AttributeRec Attributes[NUM_ATTRIBUTES+1] =
{
+ {XvSettable | XvGettable, -1, 1, "XV_BICUBIC"},
+ {0, 0, 0, NULL}
};
+static Atom xvBicubic;
+
#define NUM_IMAGES 4
static XF86ImageRec Images[NUM_IMAGES] =
@@ -351,6 +358,46 @@ static XF86ImageRec Images[NUM_IMAGES] =
XVIMAGE_UYVY
};
+int
+RADEONGetTexPortAttribute(ScrnInfoPtr pScrn,
+ Atom attribute,
+ INT32 *value,
+ pointer data)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data;
+
+ if (info->accelOn) RADEON_SYNC(info, pScrn);
+
+ if (attribute == xvBicubic)
+ *value = pPriv->bicubic_enabled ? 1 : 0;
+ else
+ return BadMatch;
+
+ return Success;
+}
+
+int
+RADEONSetTexPortAttribute(ScrnInfoPtr pScrn,
+ Atom attribute,
+ INT32 value,
+ pointer data)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data;
+
+ RADEON_SYNC(info, pScrn);
+
+ if (attribute == xvBicubic)
+ /* -1 -> set default (disable for RV515 and punier) */
+ pPriv->bicubic_enabled = (value == -1) ?
+ (info->ChipFamily >= CHIP_FAMILY_RV530) : value;
+ else
+ return BadMatch;
+
+ return Success;
+}
+
XF86VideoAdaptorPtr
RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
{
@@ -366,6 +413,8 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
if (adapt == NULL)
return NULL;
+ xvBicubic = MAKE_ATOM("XV_BICUBIC");
+
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
adapt->flags = 0;
adapt->name = "Radeon Textured Video";
@@ -391,8 +440,8 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
adapt->GetVideo = NULL;
adapt->GetStill = NULL;
adapt->StopVideo = RADEONStopVideo;
- adapt->SetPortAttribute = RADEONSetPortAttribute;
- adapt->GetPortAttribute = RADEONGetPortAttribute;
+ adapt->SetPortAttribute = RADEONSetTexPortAttribute;
+ adapt->GetPortAttribute = RADEONGetTexPortAttribute;
adapt->QueryBestSize = RADEONQueryBestSize;
adapt->PutImage = RADEONPutImageTextured;
adapt->ReputImage = NULL;
@@ -405,6 +454,7 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
pPriv->videoStatus = 0;
pPriv->currentBuffer = 0;
pPriv->doubleBuffer = 0;
+ pPriv->bicubic_enabled = (info->ChipFamily >= CHIP_FAMILY_RV530);
/* 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 ce500a1d..93d48b28 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -1147,15 +1147,15 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
OUT_VIDEO_REG(R500_GA_US_VECTOR_INDEX, (1 << 16));
/* const0 = {1 / texture[0].width, 0, 0, 0} */
- OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, r300PackFloat32(1.0/(float)pPriv->w));
- OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0);
- OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0);
- OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0);
+ OUT_VIDEO_REG_F(R500_GA_US_VECTOR_DATA, (1.0/(float)pPriv->w));
+ OUT_VIDEO_REG_F(R500_GA_US_VECTOR_DATA, 0x0);
+ OUT_VIDEO_REG_F(R500_GA_US_VECTOR_DATA, 0x0);
+ OUT_VIDEO_REG_F(R500_GA_US_VECTOR_DATA, 0x0);
/* const1 = {0, 1 / -texture[0].height, 0, 0) */
- OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0);
- OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, r300PackFloat32(-1.0/(float)pPriv->h));
- OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0);
- OUT_VIDEO_REG(R500_GA_US_VECTOR_DATA, 0x0);
+ OUT_VIDEO_REG_F(R500_GA_US_VECTOR_DATA, 0x0);
+ OUT_VIDEO_REG_F(R500_GA_US_VECTOR_DATA, (-1.0/(float)pPriv->h));
+ OUT_VIDEO_REG_F(R500_GA_US_VECTOR_DATA, 0x0);
+ OUT_VIDEO_REG_F(R500_GA_US_VECTOR_DATA, 0x0);
FINISH_VIDEO();
@@ -1490,7 +1490,7 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
if (pPriv->bicubic_enabled) {
VTX_OUT_FILTER((float)dstX, (float)dstY,
xFixedToFloat(srcTopLeft.x) / info->texW[0], xFixedToFloat(srcTopLeft.y) / info->texH[0],
- xFixedToFloat(srcTopLeft.x) + 0.5, xFixedToFloat(srcTopLeft.y) + 0.5));
+ xFixedToFloat(srcTopLeft.x) + 0.5, xFixedToFloat(srcTopLeft.y) + 0.5);
VTX_OUT_FILTER((float)dstX, (float)dstY,
xFixedToFloat(srcTopLeft.x) / info->texW[0], xFixedToFloat(srcTopLeft.y) / info->texH[0],
xFixedToFloat(srcTopLeft.x) + 0.5, xFixedToFloat(srcTopLeft.y) + 0.5);
@@ -1504,9 +1504,10 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
xFixedToFloat(srcTopRight.x) / info->texW[0], xFixedToFloat(srcTopRight.y) / info->texH[0],
xFixedToFloat(srcTopRight.x) + 0.5, xFixedToFloat(srcTopRight.y) + 0.5);
} else {
- if (info->ChipFamily >= CHIP_FAMILY_R200)
+ if (info->ChipFamily >= CHIP_FAMILY_R200) {
VTX_OUT((float)dstX, (float)(dstY + dsth),
xFixedToFloat(srcTopLeft.x) / info->texW[0], xFixedToFloat(srcTopLeft.y) / info->texH[0]);
+ }
VTX_OUT((float)dstX, (float)dstY,
xFixedToFloat(srcTopLeft.x) / info->texW[0], xFixedToFloat(srcTopLeft.y) / info->texH[0]);
VTX_OUT((float)dstX, (float)(dstY + dsth),
diff --git a/src/radeon_video.c b/src/radeon_video.c
index 4f71e28a..46a2e551 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -106,7 +106,6 @@ static Atom xvEncoding, xvFrequency, xvVolume, xvMute,
static Atom xvOvAlpha, xvGrAlpha, xvAlphaMode;
-
#define GET_PORT_PRIVATE(pScrn) \
(RADEONPortPrivPtr)((RADEONPTR(pScrn))->adaptor->pPortPrivates[0].ptr)
@@ -1703,9 +1702,6 @@ RADEONSetPortAttribute(ScrnInfoPtr pScrn,
Bool setAlpha = FALSE;
unsigned char *RADEONMMIO = info->MMIO;
- if (pPriv->textured)
- return BadMatch;
-
RADEON_SYNC(info, pScrn);
#define RTFSaturation(a) (1.0 + ((a)*1.0)/1000.0)
@@ -1932,7 +1928,7 @@ RADEONSetPortAttribute(ScrnInfoPtr pScrn,
if(pPriv->fi1236!=NULL){
xf86_fi1236_dump_status(pPriv->fi1236);
}
- }
+ }
else if(attribute == xvAdjustment)
{
pPriv->adjustment=value;
@@ -1977,9 +1973,6 @@ RADEONGetPortAttribute(ScrnInfoPtr pScrn,
RADEONInfoPtr info = RADEONPTR(pScrn);
RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data;
- if (pPriv->textured)
- return BadMatch;
-
if (info->accelOn) RADEON_SYNC(info, pScrn);
if(attribute == xvAutopaintColorkey)
diff --git a/src/radeon_video.h b/src/radeon_video.h
index 34bfb307..abf8d983 100644
--- a/src/radeon_video.h
+++ b/src/radeon_video.h
@@ -15,20 +15,6 @@
#include "bicubic_table.h"
-/*
- * This function takes a float and packs it into a uint32_t. Thanks, Mesa!
- */
-static inline uint32_t r300PackFloat32(float fl)
-{
- union {
- float fl;
- uint32_t u;
- } u;
-
- u.fl = fl;
- return u.u;
-}
-
/* Xvideo port struct */
typedef struct {
uint32_t transform_index;
@@ -128,7 +114,6 @@ typedef struct {
int drw_x, drw_y;
} RADEONPortPrivRec, *RADEONPortPrivPtr;
-
void RADEONInitI2C(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
void RADEONResetI2C(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);