radeon/r200/r300: add support for new tfp interface
authorDave Airlie <airlied@linux.ie>
Sun, 22 Mar 2009 02:03:24 +0000 (12:03 +1000)
committerDave Airlie <airlied@linux.ie>
Sun, 22 Mar 2009 02:03:24 +0000 (12:03 +1000)
also fixup old interface, gets rid of white boxes in compiz

src/mesa/drivers/dri/r200/r200_tex.h
src/mesa/drivers/dri/r200/r200_texstate.c
src/mesa/drivers/dri/r300/r300_tex.h
src/mesa/drivers/dri/r300/r300_texstate.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_tex.h
src/mesa/drivers/dri/radeon/radeon_texstate.c

index 886682b36b7f4a5927a23969fb4d271e8f437429..e122de6e5edd7665df7a3d23001c2db12c866070 100644 (file)
@@ -36,6 +36,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define __R200_TEX_H__
 
 extern void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv);
+extern void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format,
+                             __DRIdrawable *dPriv);
 extern void r200SetTexOffset(__DRIcontext *pDRICtx, GLint texname,
                             unsigned long long offset, GLint depth,
                             GLuint pitch);
index e9cee1a637d0a9d9f9cddfebed09187ff0617531..2212fe64a6d711787e2f7258dcb33ecb85b48644 100644 (file)
@@ -765,7 +765,8 @@ void r200SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
        }
 }
 
-void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
+void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format,
+                      __DRIdrawable *dPriv)
 {
        struct gl_texture_unit *texUnit;
        struct gl_texture_object *texObj;
@@ -777,8 +778,11 @@ void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
        struct radeon_framebuffer *rfb;
        radeonTexObjPtr t;
        uint32_t pitch_val;
+       uint32_t internalFormat, type, format;
 
-       target = GL_TEXTURE_RECTANGLE_ARB;
+       type = GL_BGRA;
+       format = GL_UNSIGNED_BYTE;
+       internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
 
        radeon = pDRICtx->driverPrivate;
        rmesa = pDRICtx->driverPrivate;
@@ -832,7 +836,9 @@ void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
        fprintf(stderr,"settexbuf %d %dx%d@%d\n", rb->pitch, rb->width, rb->height, rb->cpp);
        _mesa_init_teximage_fields(radeon->glCtx, target, texImage,
                                   rb->width, rb->height, 1, 0, rb->cpp);
-       texImage->TexFormat = &_mesa_texformat_rgba8888_rev;
+       texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx,
+                                                       internalFormat,
+                                                       type, format);
        rImage->bo = rb->bo;
        radeon_bo_ref(rImage->bo);
        t->bo = rb->bo;
@@ -868,6 +874,13 @@ void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
        return;
 }
 
+
+void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
+{
+        r200SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+}
+
+
 #define REF_COLOR 1
 #define REF_ALPHA 2
 
index baad3fe6c06f85b739f021514a5b448c5d0d689d..8a653ea2d11b0b186e384056141f63f9e751562a 100644 (file)
@@ -40,6 +40,9 @@ extern void r300SetDepthTexMode(struct gl_texture_object *tObj);
 extern void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target,
                             __DRIdrawable *dPriv);
 
+extern void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
+                             GLint format, __DRIdrawable *dPriv);
+
 extern void r300SetTexOffset(__DRIcontext *pDRICtx, GLint texname,
                             unsigned long long offset, GLint depth,
                             GLuint pitch);
index 14d470a11c01f8b3f66edfdaf8f23b8f8dfd62c9..d16cf688ed583ef9ffa5f099aded662b638b8514 100644 (file)
@@ -384,7 +384,7 @@ void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname,
        t->pp_txpitch |= pitch_val;
 }
 
-void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
+void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv)
 {
        struct gl_texture_unit *texUnit;
        struct gl_texture_object *texObj;
@@ -396,8 +396,11 @@ void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
        struct radeon_framebuffer *rfb;
        radeonTexObjPtr t;
        uint32_t pitch_val;
+       uint32_t internalFormat, type, format;
 
-       target = GL_TEXTURE_RECTANGLE_ARB;
+       type = GL_BGRA;
+       format = GL_UNSIGNED_BYTE;
+       internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
 
        radeon = pDRICtx->driverPrivate;
        rmesa = pDRICtx->driverPrivate;
@@ -448,10 +451,12 @@ void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
                radeon_miptree_unreference(rImage->mt);
                rImage->mt = NULL;
        }
-       fprintf(stderr,"settexbuf %dx%d@%d\n", rb->width, rb->height, rb->cpp);
+       fprintf(stderr,"settexbuf %dx%d@%d targ %x format %x\n", rb->width, rb->height, rb->cpp, target, format);
        _mesa_init_teximage_fields(radeon->glCtx, target, texImage,
                                   rb->width, rb->height, 1, 0, rb->cpp);
-       texImage->TexFormat = &_mesa_texformat_rgba8888_rev;
+       texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx,
+                                                       internalFormat,
+                                                       type, format);
        rImage->bo = rb->bo;
        radeon_bo_ref(rImage->bo);
        t->bo = rb->bo;
@@ -495,3 +500,8 @@ void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
        _mesa_unlock_texture(radeon->glCtx, texObj);
        return;
 }
+
+void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
+{
+        r300SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+}
index 1d4f008cbc7acc63df419836b14ab526f677e3ff..bbcf19cceef0e962d059d06db57b1e077d426483 100644 (file)
@@ -339,6 +339,7 @@ static const __DRItexOffsetExtension radeonTexOffsetExtension = {
 static const __DRItexBufferExtension radeonTexBufferExtension = {
     { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
    radeonSetTexBuffer,
+   radeonSetTexBuffer2,
 };
 #endif
 
@@ -358,6 +359,7 @@ static const __DRItexOffsetExtension r200texOffsetExtension = {
 static const __DRItexBufferExtension r200TexBufferExtension = {
     { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
    r200SetTexBuffer,
+   r200SetTexBuffer2,
 };
 #endif
 
@@ -370,6 +372,7 @@ static const __DRItexOffsetExtension r300texOffsetExtension = {
 static const __DRItexBufferExtension r300TexBufferExtension = {
     { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
    r300SetTexBuffer,
+   r300SetTexBuffer2,
 };
 #endif
 
index 4c2fba44894dc52064e52ac175b925a1d7749f00..8d8afb43436dd98c7d6e2f521a32387c8a75505e 100644 (file)
@@ -42,6 +42,9 @@ extern void radeonSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
                                GLuint pitch);
 
 extern void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv);
+externvoid radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format,
+                              __DRIdrawable *dPriv);
+
 extern void radeonUpdateTextureState( GLcontext *ctx );
 
 extern int radeonUploadTexImages( r100ContextPtr rmesa, radeonTexObjPtr t,
index 0ece1acbeb23ec5f9e6c3f9c0f6e85fb7e5fe8fa..78e2a08559ba19ae3ab78b7017aa37f8f5e59773 100644 (file)
@@ -637,7 +637,8 @@ void radeonSetTexOffset(__DRIcontext * pDRICtx, GLint texname,
        }
 }
 
-void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
+void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format,
+                        __DRIdrawable *dPriv)
 {
        struct gl_texture_unit *texUnit;
        struct gl_texture_object *texObj;
@@ -649,8 +650,11 @@ void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPri
        struct radeon_framebuffer *rfb;
        radeonTexObjPtr t;
        uint32_t pitch_val;
+       uint32_t internalFormat, type, format;
 
-       target = GL_TEXTURE_RECTANGLE_ARB;
+       type = GL_BGRA;
+       format = GL_UNSIGNED_BYTE;
+       internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4);
 
        radeon = pDRICtx->driverPrivate;
        rmesa = pDRICtx->driverPrivate;
@@ -701,10 +705,11 @@ void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPri
                radeon_miptree_unreference(rImage->mt);
                rImage->mt = NULL;
        }
-       fprintf(stderr,"settexbuf %d %dx%d@%d\n", rb->pitch, rb->width, rb->height, rb->cpp);
        _mesa_init_teximage_fields(radeon->glCtx, target, texImage,
                                   rb->width, rb->height, 1, 0, rb->cpp);
-       texImage->TexFormat = &_mesa_texformat_rgba8888_rev;
+       texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx,
+                                                       internalFormat,
+                                                       type, format);
        rImage->bo = rb->bo;
        radeon_bo_ref(rImage->bo);
        t->bo = rb->bo;
@@ -740,6 +745,13 @@ void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPri
        return;
 }
 
+
+void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
+{
+        radeonSetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+}
+
+
 #define TEXOBJ_TXFILTER_MASK (RADEON_MAX_MIP_LEVEL_MASK |      \
                              RADEON_MIN_FILTER_MASK |          \
                              RADEON_MAG_FILTER_MASK |          \