Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 65621 | Differences between
and this patch

Collapse All | Expand All

(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/common/xmlpool.h (+6 lines)
Lines 159-164 Link Here
159
        DRI_CONF_DESC(de,"Verbiete negativen Textur-LOD-Bias") \
159
        DRI_CONF_DESC(de,"Verbiete negativen Textur-LOD-Bias") \
160
DRI_CONF_OPT_END
160
DRI_CONF_OPT_END
161
161
162
#define DRI_CONF_FORCE_S3TC_ENABLE(def) \
163
DRI_CONF_OPT_BEGIN(force_s3tc_enable,bool,def) \
164
        DRI_CONF_DESC(en,"enable s3tc even if software support is not available") \
165
        DRI_CONF_DESC(de,"Benutze s3tc auch ohne Softwareunterstuetzung") \
166
DRI_CONF_OPT_END
167
162
#define DRI_CONF_COLOR_REDUCTION_ROUND 0
168
#define DRI_CONF_COLOR_REDUCTION_ROUND 0
163
#define DRI_CONF_COLOR_REDUCTION_DITHER 1
169
#define DRI_CONF_COLOR_REDUCTION_DITHER 1
164
#define DRI_CONF_COLOR_REDUCTION(def) \
170
#define DRI_CONF_COLOR_REDUCTION(def) \
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.c (+12 lines)
Lines 290-295 Link Here
290
				 12,
290
				 12,
291
				 GL_FALSE );
291
				 GL_FALSE );
292
292
293
   /* adjust max texture size a bit. Hack, but I really want to use larger textures
294
      which will work just fine in 99.999999% of all cases, especially with texture compression... */
295
   if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1;
296
293
   ctx->Const.MaxTextureMaxAnisotropy = 2.0;
297
   ctx->Const.MaxTextureMaxAnisotropy = 2.0;
294
298
295
   ctx->Const.MinLineWidth = 1.0;
299
   ctx->Const.MinLineWidth = 1.0;
Lines 372-377 Link Here
372
376
373
   driInitExtensions( ctx, card_extensions, GL_TRUE );
377
   driInitExtensions( ctx, card_extensions, GL_TRUE );
374
378
379
   if (imesa->glCtx->Mesa_DXTn) {
380
     _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
381
     _mesa_enable_extension( ctx, "GL_S3_s3tc" );
382
   }
383
   else if (driQueryOptionb (&imesa->optionCache, "force_s3tc_enable")) {
384
     _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
385
   }
386
375
   _mesa_enable_extension( ctx, "GL_3DFX_texture_compression_FXT1" );
387
   _mesa_enable_extension( ctx, "GL_3DFX_texture_compression_FXT1" );
376
388
377
   /* XXX these should really go right after _mesa_init_driver_functions() */
389
   /* XXX these should really go right after _mesa_init_driver_functions() */
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.c (-1 / +2 lines)
Lines 59-67 Link Here
59
DRI_CONF_BEGIN
59
DRI_CONF_BEGIN
60
    DRI_CONF_SECTION_PERFORMANCE
60
    DRI_CONF_SECTION_PERFORMANCE
61
       DRI_CONF_MAX_TEXTURE_UNITS(4,2,4)
61
       DRI_CONF_MAX_TEXTURE_UNITS(4,2,4)
62
       DRI_CONF_FORCE_S3TC_ENABLE(false)
62
    DRI_CONF_SECTION_END
63
    DRI_CONF_SECTION_END
63
DRI_CONF_END;
64
DRI_CONF_END;
64
const GLuint __driNConfigOptions = 1;
65
const GLuint __driNConfigOptions = 2;
65
66
66
#ifdef USE_NEW_INTERFACE
67
#ifdef USE_NEW_INTERFACE
67
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
68
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.c (+16 lines)
Lines 643-648 Link Here
643
   case GL_COMPRESSED_RGBA_FXT1_3DFX:
643
   case GL_COMPRESSED_RGBA_FXT1_3DFX:
644
     return &_mesa_texformat_rgba_fxt1;
644
     return &_mesa_texformat_rgba_fxt1;
645
645
646
   case GL_RGB_S3TC:
647
   case GL_RGB4_S3TC:
648
   case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
649
     return &_mesa_texformat_rgb_dxt1;
650
651
   case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
652
     return &_mesa_texformat_rgba_dxt1;
653
654
   case GL_RGBA_S3TC:
655
   case GL_RGBA4_S3TC:
656
   case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
657
     return &_mesa_texformat_rgba_dxt3;
658
659
   case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
660
      return &_mesa_texformat_rgba_dxt5;
661
646
   default:
662
   default:
647
      fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
663
      fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
648
      return NULL;
664
      return NULL;
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_texmem.c (+14 lines)
Lines 116-121 Link Here
116
	       src += image->Width*2;
116
	       src += image->Width*2;
117
	     }
117
	     }
118
	   }
118
	   }
119
   else if ((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_DXT1)
120
     {
121
       for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
122
         __memcpy(dst, src, (image->Width*2) );
123
         src += image->Width*2;
124
       }
125
     }
126
   else if (((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_DXT2_3) || ((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_DXT4_5))
127
     {
128
       for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
129
         __memcpy(dst, src, (image->Width*4) );
130
         src += image->Width*4;
131
       }
132
     }
119
   }
133
   }
120
   else if (image->Width * image->TexFormat->TexelBytes == t->Pitch) {
134
   else if (image->Width * image->TexFormat->TexelBytes == t->Pitch) {
121
	 GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset);
135
	 GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset);
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_texstate.c (+19 lines)
Lines 118-123 Link Here
118
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
118
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
119
     break;
119
     break;
120
120
121
   case MESA_FORMAT_RGBA_DXT1:
122
   case MESA_FORMAT_RGB_DXT1:
123
     /*
124
      * DXTn pitches are Width/4 * blocksize in bytes
125
      * for DXT1: blocksize=8 so Width/4*8 = Width * 2
126
      * for DXT3/5: blocksize=16 so Width/4*16 = Width * 4
127
      */
128
     t->texelBytes = 2;
129
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
130
     break;
131
   case MESA_FORMAT_RGBA_DXT3:
132
     t->texelBytes = 4;
133
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
134
     break;
135
   case MESA_FORMAT_RGBA_DXT5:
136
     t->texelBytes = 4;
137
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
138
     break;
139
121
   default:
140
   default:
122
      fprintf(stderr, "%s: bad image format\n", __FUNCTION__);
141
      fprintf(stderr, "%s: bad image format\n", __FUNCTION__);
123
      free( t );
142
      free( t );
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/i830_texstate.c (+19 lines)
Lines 112-117 Link Here
112
     textureFormat = MAPSURF_COMPRESSED | MT_COMPRESS_FXT1;
112
     textureFormat = MAPSURF_COMPRESSED | MT_COMPRESS_FXT1;
113
     break;
113
     break;
114
114
115
   case MESA_FORMAT_RGBA_DXT1:
116
   case MESA_FORMAT_RGB_DXT1:
117
     /*
118
      * DXTn pitches are Width/4 * blocksize in bytes
119
      * for DXT1: blocksize=8 so Width/4*8 = Width * 2
120
      * for DXT3/5: blocksize=16 so Width/4*16 = Width * 4
121
      */
122
     t->intel.texelBytes = 2;
123
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
124
     break;
125
   case MESA_FORMAT_RGBA_DXT3:
126
     t->intel.texelBytes = 4;
127
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
128
     break;
129
   case MESA_FORMAT_RGBA_DXT5:
130
     t->intel.texelBytes = 4;
131
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
132
     break;
133
115
   default:
134
   default:
116
      fprintf(stderr, "%s: bad image format\n", __FUNCTION__);
135
      fprintf(stderr, "%s: bad image format\n", __FUNCTION__);
117
      abort();
136
      abort();
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/i915_texstate.c (+18 lines)
Lines 127-132 Link Here
127
     t->intel.texelBytes = 2;
127
     t->intel.texelBytes = 2;
128
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
128
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
129
     break;
129
     break;
130
   case MESA_FORMAT_RGBA_DXT1:
131
   case MESA_FORMAT_RGB_DXT1:
132
     /*
133
      * DXTn pitches are Width/4 * blocksize in bytes
134
      * for DXT1: blocksize=8 so Width/4*8 = Width * 2
135
      * for DXT3/5: blocksize=16 so Width/4*16 = Width * 4
136
      */
137
     t->intel.texelBytes = 2;
138
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
139
     break;
140
   case MESA_FORMAT_RGBA_DXT3:
141
     t->intel.texelBytes = 4;
142
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
143
     break;
144
   case MESA_FORMAT_RGBA_DXT5:
145
     t->intel.texelBytes = 4;
146
     textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
147
     break;
130
148
131
   default:
149
   default:
132
      fprintf(stderr, "%s: bad image format\n", __FUNCTION__);
150
      fprintf(stderr, "%s: bad image format\n", __FUNCTION__);
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.c (+8 lines)
Lines 352-357 Link Here
352
352
353
   driInitExtensions( ctx, card_extensions, GL_TRUE );
353
   driInitExtensions( ctx, card_extensions, GL_TRUE );
354
354
355
   if (intel->ctx.Mesa_DXTn) {
356
     _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
357
     _mesa_enable_extension( ctx, "GL_S3_s3tc" );
358
   }
359
   else if (driQueryOptionb (&intelScreen->optionCache, "force_s3tc_enable")) {
360
     _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
361
   }
362
355
/*    driInitTextureObjects( ctx, & intel->swapped, */
363
/*    driInitTextureObjects( ctx, & intel->swapped, */
356
/* 			  DRI_TEXMGR_DO_TEXTURE_1D | */
364
/* 			  DRI_TEXMGR_DO_TEXTURE_1D | */
357
/* 			  DRI_TEXMGR_DO_TEXTURE_2D |  */
365
/* 			  DRI_TEXMGR_DO_TEXTURE_2D |  */
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.h (+5 lines)
Lines 230-235 Link Here
230
   __DRIscreenPrivate *driScreen;
230
   __DRIscreenPrivate *driScreen;
231
   intelScreenPrivate *intelScreen; 
231
   intelScreenPrivate *intelScreen; 
232
   drmI830Sarea *sarea; 
232
   drmI830Sarea *sarea; 
233
234
   /**
235
    * Configuration cache
236
    */
237
   driOptionCache optionCache;
233
};
238
};
234
239
235
240
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.c (-2 / +11 lines)
Lines 30-35 Link Here
30
#include "matrix.h"
30
#include "matrix.h"
31
#include "simple_list.h"
31
#include "simple_list.h"
32
#include "utils.h"
32
#include "utils.h"
33
#include "xmlpool.h"
33
34
34
35
35
#include "intel_screen.h"
36
#include "intel_screen.h"
Lines 43-50 Link Here
43
44
44
#include "i830_dri.h"
45
#include "i830_dri.h"
45
46
46
const char __driConfigOptions[] = { 0 };
47
const char __driConfigOptions[] =
47
const GLuint __driNConfigOptions = 0;
48
DRI_CONF_BEGIN
49
    DRI_CONF_SECTION_PERFORMANCE
50
       DRI_CONF_FORCE_S3TC_ENABLE(false)
51
    DRI_CONF_SECTION_END
52
DRI_CONF_END;
53
const GLuint __driNConfigOptions = 1;
48
54
49
#ifdef USE_NEW_INTERFACE
55
#ifdef USE_NEW_INTERFACE
50
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
56
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
Lines 78-83 Link Here
78
      fprintf(stderr,"\nERROR!  Allocating private area failed\n");
84
      fprintf(stderr,"\nERROR!  Allocating private area failed\n");
79
      return GL_FALSE;
85
      return GL_FALSE;
80
   }
86
   }
87
   /* parse information in __driConfigOptions */
88
   driParseOptionInfo (&intelScreen->optionCache,
89
              __driConfigOptions, __driNConfigOptions);
81
90
82
   intelScreen->driScrnPriv = sPriv;
91
   intelScreen->driScrnPriv = sPriv;
83
   sPriv->private = (void *)intelScreen;
92
   sPriv->private = (void *)intelScreen;
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.h (-1 / +6 lines)
Lines 30-36 Link Here
30
30
31
#include <sys/time.h>
31
#include <sys/time.h>
32
#include "dri_util.h"
32
#include "dri_util.h"
33
33
#include "xmlconfig.h"
34
34
35
typedef struct {
35
typedef struct {
36
   drm_handle_t handle;
36
   drm_handle_t handle;
Lines 76-81 Link Here
76
76
77
   int irq_active;
77
   int irq_active;
78
   int allow_batchbuffer;
78
   int allow_batchbuffer;
79
80
   /**
81
    * Configuration cache with default values for all contexts
82
    */
83
   driOptionCache optionCache;
79
} intelScreenPrivate;
84
} intelScreenPrivate;
80
85
81
86
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.c (+29 lines)
Lines 554-559 Link Here
554
   case GL_COMPRESSED_RGBA_FXT1_3DFX:
554
   case GL_COMPRESSED_RGBA_FXT1_3DFX:
555
     return &_mesa_texformat_rgba_fxt1;
555
     return &_mesa_texformat_rgba_fxt1;
556
556
557
   case GL_RGB_S3TC:
558
   case GL_RGB4_S3TC:
559
   case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
560
     return &_mesa_texformat_rgb_dxt1;
561
562
   case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
563
     return &_mesa_texformat_rgba_dxt1;
564
565
   case GL_RGBA_S3TC:
566
   case GL_RGBA4_S3TC:
567
   case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
568
     return &_mesa_texformat_rgba_dxt3;
569
570
   case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
571
      return &_mesa_texformat_rgba_dxt5;
572
557
   default:
573
   default:
558
      fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
574
      fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
559
      return NULL;
575
      return NULL;
Lines 628-638 Link Here
628
	{
644
	{
629
	case GL_COMPRESSED_RGB_FXT1_3DFX:
645
	case GL_COMPRESSED_RGB_FXT1_3DFX:
630
	case GL_COMPRESSED_RGBA_FXT1_3DFX:
646
	case GL_COMPRESSED_RGBA_FXT1_3DFX:
647
    case GL_RGB_S3TC:
648
    case GL_RGB4_S3TC:
649
    case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
650
    case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
631
	  for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
651
	  for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
632
	    __memcpy(dst, src, row_len );
652
	    __memcpy(dst, src, row_len );
633
	    src += row_len;
653
	    src += row_len;
634
	  }
654
	  }
635
	  break;
655
	  break;
656
    case GL_RGBA_S3TC:
657
    case GL_RGBA4_S3TC:
658
    case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
659
    case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
660
      for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
661
        __memcpy(dst, src, (image->Width*4) );
662
        src += image->Width*4;
663
      }
664
      break;
636
	default:
665
	default:
637
	  fprintf(stderr,"Internal Compressed format not supported %d\n", image->IntFormat);
666
	  fprintf(stderr,"Internal Compressed format not supported %d\n", image->IntFormat);
638
	  break;
667
	  break;
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.c (+12 lines)
Lines 350-355 Link Here
350
				 12,
350
				 12,
351
				 GL_FALSE );
351
				 GL_FALSE );
352
352
353
/* adjust max texture size a bit. Hack, but I really want to use larger textures
354
   which will work just fine in 99.999999% of all cases, especially with texture compression... */
355
   if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1;
356
353
   ctx->Const.MaxTextureMaxAnisotropy = 16.0;
357
   ctx->Const.MaxTextureMaxAnisotropy = 16.0;
354
358
355
   /* No wide points.
359
   /* No wide points.
Lines 400-405 Link Here
400
   _math_matrix_set_identity( &rmesa->tmpmat );
404
   _math_matrix_set_identity( &rmesa->tmpmat );
401
405
402
   driInitExtensions( ctx, card_extensions, GL_TRUE );
406
   driInitExtensions( ctx, card_extensions, GL_TRUE );
407
   if (rmesa->glCtx->Mesa_DXTn) {
408
      _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
409
      _mesa_enable_extension( ctx, "GL_S3_s3tc" );
410
   }
411
   else if (driQueryOptionb (&rmesa->optionCache, "force_s3tc_enable")) {
412
      _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
413
   }
414
403
   if (rmesa->r200Screen->drmSupportsCubeMaps)
415
   if (rmesa->r200Screen->drmSupportsCubeMaps)
404
      _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" );
416
      _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" );
405
   if (rmesa->r200Screen->drmSupportsBlendColor) {
417
   if (rmesa->r200Screen->drmSupportsBlendColor) {
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.c (-1 / +2 lines)
Lines 68-73 Link Here
68
        DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
68
        DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
69
        DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0")
69
        DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0")
70
        DRI_CONF_NO_NEG_LOD_BIAS(false)
70
        DRI_CONF_NO_NEG_LOD_BIAS(false)
71
        DRI_CONF_FORCE_S3TC_ENABLE(false)
71
        DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
72
        DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
72
        DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
73
        DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
73
        DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
74
        DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
Lines 76-82 Link Here
76
        DRI_CONF_NO_RAST(false)
77
        DRI_CONF_NO_RAST(false)
77
    DRI_CONF_SECTION_END
78
    DRI_CONF_SECTION_END
78
DRI_CONF_END;
79
DRI_CONF_END;
79
static const GLuint __driNConfigOptions = 11;
80
static const GLuint __driNConfigOptions = 12; /* S3TC: was 11. (13->14?) */
80
81
81
#if 1
82
#if 1
82
/* Including xf86PciInfo.h introduces a bunch of errors...
83
/* Including xf86PciInfo.h introduces a bunch of errors...
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.c (+143 lines)
Lines 420-425 Link Here
420
      else
420
      else
421
         return &_mesa_texformat_ycbcr_rev;
421
         return &_mesa_texformat_ycbcr_rev;
422
422
423
   case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
424
      return &_mesa_texformat_rgb_dxt1;
425
426
   case GL_RGB_S3TC:
427
   case GL_RGB4_S3TC:
428
      /* only return this format if software compression/decompression is available, since
429
         no app will ever use this for precompressed textures */
430
/*      if (ctx->Mesa_DXTn) */
431
         return &_mesa_texformat_rgb_dxt1;
432
/*      else */
433
         /* mesa will crash if we return uncompressed format unfortunately */
434
/*         return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565; */
435
436
   case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
437
      return &_mesa_texformat_rgba_dxt1;
438
439
   case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
440
      return &_mesa_texformat_rgba_dxt3;
441
442
   case GL_RGBA_S3TC:
443
   case GL_RGBA4_S3TC:
444
/*      if (ctx->Mesa_DXTn) */
445
         return &_mesa_texformat_rgba_dxt3;
446
/*      else */
447
         /* mesa will crash if we return uncompressed format unfortunately */
448
/*         return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444; */
449
450
   case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
451
      return &_mesa_texformat_rgba_dxt5;
452
423
   default:
453
   default:
424
      _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__);
454
      _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__);
425
      return NULL;
455
      return NULL;
Lines 708-713 Link Here
708
}
738
}
709
739
710
740
741
static void r200CompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
742
                              GLint internalFormat,
743
                              GLint width, GLint height, GLint border,
744
                              GLsizei imageSize, const GLvoid *data,
745
                              struct gl_texture_object *texObj,
746
                              struct gl_texture_image *texImage )
747
{
748
   driTextureObject * t = (driTextureObject *) texObj->DriverData;
749
   GLuint face;
750
751
   /* which cube face or ordinary 2D image */
752
   switch (target) {
753
   case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
754
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
755
   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
756
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
757
   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
758
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
759
      face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
760
      ASSERT(face < 6);
761
      break;
762
   default:
763
      face = 0;
764
   }
765
766
   if ( t != NULL ) {
767
      driSwapOutTextureObject( t );
768
   }
769
   else {
770
      t = (driTextureObject *) r200AllocTexObj( texObj );
771
      if (!t) {
772
         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
773
         return;
774
      }
775
   }
776
777
   texImage->IsClientData = GL_FALSE;
778
/* can't call this, different parameters. Would never evaluate to true anyway currently
779
   if (r200ValidateClientStorage( ctx, target,
780
                 internalFormat,
781
                 width, height,
782
                 format, type, pixels,
783
                 packing, texObj, texImage)) {
784
      if (R200_DEBUG & DEBUG_TEXTURE)
785
    fprintf(stderr, "%s: Using client storage\n", __FUNCTION__);
786
   }
787
   else */{
788
      if (R200_DEBUG & DEBUG_TEXTURE)
789
    fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__);
790
791
      /* Normal path: copy (to cached memory) and eventually upload
792
       * via another copy to GART memory and then a blit...  Could
793
       * eliminate one copy by going straight to (permanent) GART.
794
       *
795
       * Note, this will call r200ChooseTextureFormat.
796
       */
797
      _mesa_store_compressed_teximage2d(ctx, target, level, internalFormat, width,
798
                                 height, border, imageSize, data, texObj, texImage);
799
800
      t->dirty_images[face] |= (1 << level);
801
   }
802
}
803
804
805
static void r200CompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
806
                                 GLint xoffset, GLint yoffset,
807
                                 GLsizei width, GLsizei height,
808
                                 GLenum format,
809
                                 GLsizei imageSize, const GLvoid *data,
810
                                 struct gl_texture_object *texObj,
811
                                 struct gl_texture_image *texImage )
812
{
813
   driTextureObject * t = (driTextureObject *) texObj->DriverData;
814
   GLuint face;
815
816
817
   /* which cube face or ordinary 2D image */
818
   switch (target) {
819
   case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
820
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
821
   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
822
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
823
   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
824
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
825
      face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
826
      ASSERT(face < 6);
827
      break;
828
   default:
829
      face = 0;
830
   }
831
832
   assert( t ); /* this _should_ be true */
833
   if ( t ) {
834
      driSwapOutTextureObject( t );
835
   }
836
   else {
837
      t = (driTextureObject *) r200AllocTexObj( texObj );
838
      if (!t) {
839
         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2D");
840
         return;
841
      }
842
   }
843
844
   _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
845
                            height, format, imageSize, data, texObj, texImage);
846
847
   t->dirty_images[face] |= (1 << level);
848
}
849
850
711
#if ENABLE_HW_3D_TEXTURE
851
#if ENABLE_HW_3D_TEXTURE
712
static void r200TexImage3D( GLcontext *ctx, GLenum target, GLint level,
852
static void r200TexImage3D( GLcontext *ctx, GLenum target, GLint level,
713
                            GLint internalFormat,
853
                            GLint internalFormat,
Lines 1034-1039 Link Here
1034
   functions->TexParameter		= r200TexParameter;
1174
   functions->TexParameter		= r200TexParameter;
1035
   functions->TexGen			= r200TexGen;
1175
   functions->TexGen			= r200TexGen;
1036
1176
1177
   functions->CompressedTexImage2D = r200CompressedTexImage2D;
1178
   functions->CompressedTexSubImage2D  = r200CompressedTexSubImage2D;
1179
1037
   driInitTextureFormats();
1180
   driInitTextureFormats();
1038
1181
1039
#if 000
1182
#if 000
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_texmem.c (+17 lines)
Lines 379-384 Link Here
379
      tex.height = imageHeight;
379
      tex.height = imageHeight;
380
      if (tex.height < 4)
380
      if (tex.height < 4)
381
         tex.height = 4;
381
         tex.height = 4;
382
      /* In case of for instance 8x8 texture (2x2 dxt blocks), padding after the first two blocks is
383
         needed (only with dxt1 since 2 dxt3/dxt5 blocks already use 32 Byte). */
384
      /* set tex.height to 1/4 since 1 "macropixel" (dxt-block) has 4 real pixels. Needed
385
         so the kernel module reads the right amount of data. */
386
      tex.height = (imageHeight + 3) / 4;
387
      tex.width = (imageWidth + 3) / 4;
388
      switch (t->pp_txformat & R200_TXFORMAT_FORMAT_MASK) {
389
      case R200_TXFORMAT_DXT1:
390
           tex.width *= 8;
391
           break;
392
      case R200_TXFORMAT_DXT23:
393
      case R200_TXFORMAT_DXT45:
394
           tex.width *= 16;
395
           break;
396
      default:
397
          fprintf(stderr, "unknown compressed tex format in uploadSubImage\n");
398
      }
382
   }
399
   }
383
   tex.image = &tmp;
400
   tex.image = &tmp;
384
401
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c (-2 / +29 lines)
Lines 53-58 Link Here
53
#define R200_TXFORMAT_AL88      R200_TXFORMAT_AI88
53
#define R200_TXFORMAT_AL88      R200_TXFORMAT_AI88
54
#define R200_TXFORMAT_YCBCR     R200_TXFORMAT_YVYU422
54
#define R200_TXFORMAT_YCBCR     R200_TXFORMAT_YVYU422
55
#define R200_TXFORMAT_YCBCR_REV R200_TXFORMAT_VYUY422
55
#define R200_TXFORMAT_YCBCR_REV R200_TXFORMAT_VYUY422
56
#define R200_TXFORMAT_RGB_DXT1  R200_TXFORMAT_DXT1
57
#define R200_TXFORMAT_RGBA_DXT1 R200_TXFORMAT_DXT1
58
#define R200_TXFORMAT_RGBA_DXT3 R200_TXFORMAT_DXT23
59
#define R200_TXFORMAT_RGBA_DXT5 R200_TXFORMAT_DXT45
56
60
57
#define _COLOR(f) \
61
#define _COLOR(f) \
58
    [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, 0 }
62
    [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, 0 }
Lines 66-72 Link Here
66
    [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, R200_YUV_TO_RGB }
70
    [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, R200_YUV_TO_RGB }
67
#define _INVALID(f) \
71
#define _INVALID(f) \
68
    [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
72
    [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
69
#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_YCBCR_REV) \
73
#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5) \
70
			     && (tx_table[f].format != 0xffffffff) )
74
			     && (tx_table[f].format != 0xffffffff) )
71
75
72
static const struct {
76
static const struct {
Lines 93-98 Link Here
93
   _INVALID(CI8),
97
   _INVALID(CI8),
94
   _YUV(YCBCR),
98
   _YUV(YCBCR),
95
   _YUV(YCBCR_REV),
99
   _YUV(YCBCR_REV),
100
   _INVALID(RGB_FXT1),
101
   _INVALID(RGBA_FXT1),
102
   _COLOR(RGB_DXT1),
103
   _ALPHA(RGBA_DXT1),
104
   _ALPHA(RGBA_DXT3),
105
   _ALPHA(RGBA_DXT5),
96
};
106
};
97
107
98
#undef _COLOR
108
#undef _COLOR
Lines 165-171 Link Here
165
175
166
      /* find image size in bytes */
176
      /* find image size in bytes */
167
      if (texImage->IsCompressed) {
177
      if (texImage->IsCompressed) {
168
         size = texImage->CompressedSize;
178
      /* need to calculate the size AFTER padding even though the texture is
179
         submitted without padding.
180
         Only handle pot textures currently - don't know if npot is even possible,
181
         size calculation would certainly need (trivial) adjustments.
182
         Align (and later pad) to 32byte, not sure what that 64byte blit width is
183
         good for? */
184
         if ((t->pp_txformat & R200_TXFORMAT_FORMAT_MASK) == R200_TXFORMAT_DXT1) {
185
            /* RGB_DXT1/RGBA_DXT1, 8 bytes per block */
186
            if ((texImage->Width + 3) < 8) /* width one block */
187
               size = texImage->CompressedSize * 4;
188
            else if ((texImage->Width + 3) < 16)
189
               size = texImage->CompressedSize * 2;
190
            else size = texImage->CompressedSize;
191
         }
192
         else /* DXT3/5, 16 bytes per block */
193
            if ((texImage->Width + 3) < 8)
194
               size = texImage->CompressedSize * 2;
195
            else size = texImage->CompressedSize;
169
      }
196
      }
170
      else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
197
      else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
171
         size = ((texImage->Width * texImage->TexFormat->TexelBytes + 63)
198
         size = ((texImage->Width * texImage->TexFormat->TexelBytes + 63)
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c (+11 lines)
Lines 329-334 Link Here
329
				 12,
329
				 12,
330
				 GL_FALSE );
330
				 GL_FALSE );
331
331
332
/* adjust max texture size a bit. Hack, but I really want to use larger textures
333
   which will work just fine in 99.999999% of all cases, especially with texture compression... */
334
   if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1;
335
332
   ctx->Const.MaxTextureMaxAnisotropy = 16.0;
336
   ctx->Const.MaxTextureMaxAnisotropy = 16.0;
333
337
334
   /* No wide points.
338
   /* No wide points.
Lines 397-402 Link Here
397
   _math_matrix_set_identity( &rmesa->tmpmat );
401
   _math_matrix_set_identity( &rmesa->tmpmat );
398
402
399
   driInitExtensions( ctx, card_extensions, GL_TRUE );
403
   driInitExtensions( ctx, card_extensions, GL_TRUE );
404
   if (rmesa->glCtx->Mesa_DXTn) {
405
      _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
406
      _mesa_enable_extension( ctx, "GL_S3_s3tc" );
407
   }
408
   else if (driQueryOptionb (&rmesa->optionCache, "force_s3tc_enable")) {
409
      _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
410
   }
400
411
401
   if (rmesa->dri.drmMinor >= 9)
412
   if (rmesa->dri.drmMinor >= 9)
402
      _mesa_enable_extension( ctx, "GL_NV_texture_rectangle");
413
      _mesa_enable_extension( ctx, "GL_NV_texture_rectangle");
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c (-1 / +2 lines)
Lines 65-70 Link Here
65
        DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
65
        DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
66
        DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0")
66
        DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0")
67
        DRI_CONF_NO_NEG_LOD_BIAS(false)
67
        DRI_CONF_NO_NEG_LOD_BIAS(false)
68
        DRI_CONF_FORCE_S3TC_ENABLE(false)
68
        DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
69
        DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
69
        DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
70
        DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
70
        DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
71
        DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
Lines 73-79 Link Here
73
        DRI_CONF_NO_RAST(false)
74
        DRI_CONF_NO_RAST(false)
74
    DRI_CONF_SECTION_END
75
    DRI_CONF_SECTION_END
75
DRI_CONF_END;
76
DRI_CONF_END;
76
static const GLuint __driNConfigOptions = 10;
77
static const GLuint __driNConfigOptions = 11;
77
78
78
#if 1
79
#if 1
79
/* Including xf86PciInfo.h introduces a bunch of errors...
80
/* Including xf86PciInfo.h introduces a bunch of errors...
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.c (+120 lines)
Lines 382-387 Link Here
382
      else
382
      else
383
         return &_mesa_texformat_ycbcr_rev;
383
         return &_mesa_texformat_ycbcr_rev;
384
384
385
   case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
386
      return &_mesa_texformat_rgb_dxt1;
387
388
   case GL_RGB_S3TC:
389
   case GL_RGB4_S3TC:
390
      /* only return this format if software compression/decompression is available, since
391
         no app will ever use this for precompressed textures */
392
/*      if (ctx->Mesa_DXTn) */
393
         return &_mesa_texformat_rgb_dxt1;
394
/*      else */
395
         /* mesa will crash if we return uncompressed format unfortunately */
396
/*         return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565; */
397
398
   case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
399
      return &_mesa_texformat_rgba_dxt1;
400
401
   case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
402
      return &_mesa_texformat_rgba_dxt3;
403
404
   case GL_RGBA_S3TC:
405
   case GL_RGBA4_S3TC:
406
/*      if (ctx->Mesa_DXTn) */
407
         return &_mesa_texformat_rgba_dxt3;
408
/*      else */
409
         /* mesa will crash if we return uncompressed format unfortunately */
410
/*         return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444; */
411
412
   case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
413
      return &_mesa_texformat_rgba_dxt5;
414
385
   default:
415
   default:
386
      _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__);
416
      _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__);
387
      return NULL;
417
      return NULL;
Lines 544-550 Link Here
544
   t->dirty_images[face] |= (1 << level);
574
   t->dirty_images[face] |= (1 << level);
545
}
575
}
546
576
577
static void radeonCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
578
                              GLint internalFormat,
579
                              GLint width, GLint height, GLint border,
580
                              GLsizei imageSize, const GLvoid *data,
581
                              struct gl_texture_object *texObj,
582
                              struct gl_texture_image *texImage )
583
{
584
   driTextureObject * t = (driTextureObject *) texObj->DriverData;
585
   GLuint face;
586
587
   /* which cube face or ordinary 2D image */
588
   switch (target) {
589
   case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
590
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
591
   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
592
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
593
   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
594
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
595
      face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
596
      ASSERT(face < 6);
597
      break;
598
   default:
599
      face = 0;
600
   }
601
602
   if ( t != NULL ) {
603
      driSwapOutTextureObject( t );
604
   }
605
   else {
606
      t = (driTextureObject *) radeonAllocTexObj( texObj );
607
      if (!t) {
608
         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
609
         return;
610
      }
611
   }
612
613
   /* Note, this will call ChooseTextureFormat */
614
   _mesa_store_compressed_teximage2d(ctx, target, level, internalFormat, width,
615
                                 height, border, imageSize, data, texObj, texImage);
616
617
   t->dirty_images[face] |= (1 << level);
618
}
619
620
621
static void radeonCompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
622
                                 GLint xoffset, GLint yoffset,
623
                                 GLsizei width, GLsizei height,
624
                                 GLenum format,
625
                                 GLsizei imageSize, const GLvoid *data,
626
                                 struct gl_texture_object *texObj,
627
                                 struct gl_texture_image *texImage )
628
{
629
   driTextureObject * t = (driTextureObject *) texObj->DriverData;
630
   GLuint face;
631
632
633
   /* which cube face or ordinary 2D image */
634
   switch (target) {
635
   case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
636
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
637
   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
638
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
639
   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
640
   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
641
      face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
642
      ASSERT(face < 6);
643
      break;
644
   default:
645
      face = 0;
646
   }
647
648
   assert( t ); /* this _should_ be true */
649
   if ( t ) {
650
      driSwapOutTextureObject( t );
651
   }
652
   else {
653
      t = (driTextureObject *) radeonAllocTexObj( texObj );
654
      if (!t) {
655
         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2D");
656
         return;
657
      }
658
   }
659
660
   _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
661
                                 height, format, imageSize, data, texObj, texImage);
547
662
663
   t->dirty_images[face] |= (1 << level);
664
}
548
665
549
#define SCALED_FLOAT_TO_BYTE( x, scale ) \
666
#define SCALED_FLOAT_TO_BYTE( x, scale ) \
550
		(((GLuint)((255.0F / scale) * (x))) / 2)
667
		(((GLuint)((255.0F / scale) * (x))) / 2)
Lines 756-760 Link Here
756
   functions->TexParameter		= radeonTexParameter;
873
   functions->TexParameter		= radeonTexParameter;
757
   functions->TexGen			= radeonTexGen;
874
   functions->TexGen			= radeonTexGen;
758
875
876
   functions->CompressedTexImage2D = radeonCompressedTexImage2D;
877
   functions->CompressedTexSubImage2D  = radeonCompressedTexSubImage2D;
878
759
   driInitTextureFormats();
879
   driInitTextureFormats();
760
}
880
}
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texmem.c (-4 / +15 lines)
Lines 259-268 Link Here
259
      tex.height = imageHeight;
259
      tex.height = imageHeight;
260
   }
260
   }
261
   else {
261
   else {
262
      tex.width = imageWidth; /* compressed */
262
      /* In case of for instance 8x8 texture (2x2 dxt blocks), padding after the first two blocks is
263
      tex.height = imageHeight;
263
         needed (only with dxt1 since 2 dxt3/dxt5 blocks already use 32 Byte). */
264
      if (tex.height < 4)
264
      /* set tex.height to 1/4 since 1 "macropixel" (dxt-block) has 4 real pixels. Needed
265
         tex.height = 4;
265
         so the kernel module reads the right amount of data. */
266
      tex.height = (imageHeight + 3) / 4;
267
      tex.width = (imageWidth + 3) / 4;
268
      switch (t->pp_txformat & RADEON_TXFORMAT_FORMAT_MASK) {
269
      case RADEON_TXFORMAT_DXT1:
270
         tex.width *= 8;
271
         break;
272
      case RADEON_TXFORMAT_DXT23:
273
      case RADEON_TXFORMAT_DXT45:
274
         tex.width *= 16;
275
         break;
276
      }
266
   }
277
   }
267
   tex.image = &tmp;
278
   tex.image = &tmp;
268
279
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texstate.c (-2 / +29 lines)
Lines 55-60 Link Here
55
#define RADEON_TXFORMAT_AL88      RADEON_TXFORMAT_AI88
55
#define RADEON_TXFORMAT_AL88      RADEON_TXFORMAT_AI88
56
#define RADEON_TXFORMAT_YCBCR     RADEON_TXFORMAT_YVYU422
56
#define RADEON_TXFORMAT_YCBCR     RADEON_TXFORMAT_YVYU422
57
#define RADEON_TXFORMAT_YCBCR_REV RADEON_TXFORMAT_VYUY422
57
#define RADEON_TXFORMAT_YCBCR_REV RADEON_TXFORMAT_VYUY422
58
#define RADEON_TXFORMAT_RGB_DXT1  RADEON_TXFORMAT_DXT1
59
#define RADEON_TXFORMAT_RGBA_DXT1 RADEON_TXFORMAT_DXT1
60
#define RADEON_TXFORMAT_RGBA_DXT3 RADEON_TXFORMAT_DXT23
61
#define RADEON_TXFORMAT_RGBA_DXT5 RADEON_TXFORMAT_DXT45
58
62
59
#define _COLOR(f) \
63
#define _COLOR(f) \
60
    [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f, 0 }
64
    [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f, 0 }
Lines 68-74 Link Here
68
   [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f, RADEON_YUV_TO_RGB }
72
   [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f, RADEON_YUV_TO_RGB }
69
#define _INVALID(f) \
73
#define _INVALID(f) \
70
    [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
74
    [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
71
#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_YCBCR_REV) \
75
#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5) \
72
			     && (tx_table[f].format != 0xffffffff) )
76
			     && (tx_table[f].format != 0xffffffff) )
73
77
74
static const struct {
78
static const struct {
Lines 95-100 Link Here
95
   _INVALID(CI8),
99
   _INVALID(CI8),
96
   _YUV(YCBCR),
100
   _YUV(YCBCR),
97
   _YUV(YCBCR_REV),
101
   _YUV(YCBCR_REV),
102
   _INVALID(RGB_FXT1),
103
   _INVALID(RGBA_FXT1),
104
   _COLOR(RGB_DXT1),
105
   _ALPHA(RGBA_DXT1),
106
   _ALPHA(RGBA_DXT3),
107
   _ALPHA(RGBA_DXT5),
98
};
108
};
99
109
100
#undef _COLOR
110
#undef _COLOR
Lines 167-173 Link Here
167
177
168
      /* find image size in bytes */
178
      /* find image size in bytes */
169
      if (texImage->IsCompressed) {
179
      if (texImage->IsCompressed) {
170
         size = texImage->CompressedSize;
180
      /* need to calculate the size AFTER padding even though the texture is
181
         submitted without padding.
182
         Only handle pot textures currently - don't know if npot is even possible,
183
         size calculation would certainly need (trivial) adjustments.
184
         Align (and later pad) to 32byte, not sure what that 64byte blit width is
185
         good for? */
186
         if ((t->pp_txformat & RADEON_TXFORMAT_FORMAT_MASK) == RADEON_TXFORMAT_DXT1) {
187
            /* RGB_DXT1/RGBA_DXT1, 8 bytes per block */
188
            if ((texImage->Width + 3) < 8) /* width one block */
189
               size = texImage->CompressedSize * 4;
190
            else if ((texImage->Width + 3) < 16)
191
               size = texImage->CompressedSize * 2;
192
            else size = texImage->CompressedSize;
193
         }
194
         else /* DXT3/5, 16 bytes per block */
195
            if ((texImage->Width + 3) < 8)
196
               size = texImage->CompressedSize * 2;
197
            else size = texImage->CompressedSize;
171
      }
198
      }
172
      else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
199
      else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
173
      	 size = ((texImage->Width * texImage->TexFormat->TexelBytes + 63)
200
      	 size = ((texImage->Width * texImage->TexFormat->TexelBytes + 63)
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/main/mtypes.h (+3 lines)
Lines 2386-2391 Link Here
2386
   /** Dither disable via MESA_NO_DITHER env var */
2386
   /** Dither disable via MESA_NO_DITHER env var */
2387
   GLboolean NoDither;
2387
   GLboolean NoDither;
2388
2388
2389
   /** software compression/decompression supported or not */
2390
   GLboolean Mesa_DXTn;
2391
2389
   /** Core tnl module support */
2392
   /** Core tnl module support */
2390
   struct gl_tnl_module TnlModule;
2393
   struct gl_tnl_module TnlModule;
2391
2394
(-)/var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/main/texcompress_s3tc.c (-16 / +118 lines)
Lines 28-33 Link Here
28
 * GL_EXT_texture_compression_s3tc support.
28
 * GL_EXT_texture_compression_s3tc support.
29
 */
29
 */
30
30
31
#if defined(XFree86LOADER) && defined(IN_MODULE)
32
#define USE_EXTERNAL_DXTN_LIB 0
33
#else
34
#define USE_EXTERNAL_DXTN_LIB 1
35
#endif
31
36
32
#include "glheader.h"
37
#include "glheader.h"
33
#include "imports.h"
38
#include "imports.h"
Lines 39-50 Link Here
39
#include "texformat.h"
44
#include "texformat.h"
40
#include "texstore.h"
45
#include "texstore.h"
41
46
47
#if USE_EXTERNAL_DXTN_LIB
48
#include <dlfcn.h>
49
#endif
50
51
typedef void (*dxtFetchTexelFuncExt)( GLint srcRowstride, GLubyte *pixdata, GLint col, GLint row, GLvoid *texelOut );
52
dxtFetchTexelFuncExt fetch_ext_rgb_dxt1;
53
dxtFetchTexelFuncExt fetch_ext_rgba_dxt1;
54
dxtFetchTexelFuncExt fetch_ext_rgba_dxt3;
55
dxtFetchTexelFuncExt fetch_ext_rgba_dxt5;
42
56
57
typedef void (*dxtCompressTexFuncExt)(GLint srccomps, GLint width, GLint height, const GLubyte *srcPixData, GLenum destformat, GLubyte *dest);
58
dxtCompressTexFuncExt ext_tx_compress_dxtn;
59
60
void *dxtlibhandle = NULL;
43
61
44
void
62
void
45
_mesa_init_texture_s3tc( GLcontext *ctx )
63
_mesa_init_texture_s3tc( GLcontext *ctx )
46
{
64
{
47
   /* called during context initialization */
65
   /* called during context initialization */
66
   ctx->Mesa_DXTn = GL_FALSE;
67
#if USE_EXTERNAL_DXTN_LIB
68
   if (!dxtlibhandle) {
69
      char *error;
70
71
      dxtlibhandle = dlopen ("libtxc_dxtn.so", RTLD_LAZY | RTLD_GLOBAL);
72
      if (!dxtlibhandle) {
73
         _mesa_debug(ctx, "couldn't open libtxc_dxtn.so, "
74
            "software DXTn compression/decompression unavailable\n");
75
      }
76
      else {
77
         /* the fetch functions are not per context! Might be problematic... */
78
         fetch_ext_rgb_dxt1 = dlsym(dxtlibhandle, "fetch_2d_texel_rgb_dxt1");
79
         error = dlerror();
80
         if (error == NULL) {
81
            fetch_ext_rgba_dxt1 = dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt1");
82
            error = dlerror();
83
         }
84
         if (error == NULL) {
85
            fetch_ext_rgba_dxt3 = dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt3");
86
            error = dlerror();
87
         }
88
         if (error == NULL) {
89
            fetch_ext_rgba_dxt5 = dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt5");
90
            error = dlerror();
91
         }
92
         if (error == NULL) {
93
            ext_tx_compress_dxtn = dlsym(dxtlibhandle, "tx_compress_dxtn");
94
            error = dlerror();
95
         }
96
97
         if (error) {
98
            _mesa_debug(ctx, "couldn't reference all symbols in libtxc_dxtn.so, "
99
               "software DXTn compression/decompression unavailable\n");
100
            fetch_ext_rgb_dxt1 = NULL;
101
            fetch_ext_rgba_dxt1 = NULL;
102
            fetch_ext_rgba_dxt3 = NULL;
103
            fetch_ext_rgba_dxt5 = NULL;
104
            ext_tx_compress_dxtn = NULL;
105
            dlclose(dxtlibhandle);
106
            dxtlibhandle = NULL;
107
         }
108
      }
109
   }
110
   if (dxtlibhandle) {
111
      ctx->Mesa_DXTn = GL_TRUE;
112
      _mesa_debug(ctx, "software DXTn compression/decompression available\n");
113
   }
114
#else
115
    (void) ctx;
116
#endif
48
}
117
}
49
118
50
119
Lines 93-102 Link Here
93
                                        GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
162
                                        GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
94
                                        texWidth, (GLubyte *) dstAddr);
163
                                        texWidth, (GLubyte *) dstAddr);
95
164
96
#if 0
165
   if (ext_tx_compress_dxtn) {
97
   compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride,
166
      (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels,  GL_COMPRESSED_RGB_S3TC_DXT1_EXT, dst);
98
                 dst, dstRowStride);
167
   }
99
#endif
168
   else {
169
      _mesa_problem(ctx, "external dxt library not available");
170
   }
100
171
101
   if (tempImage)
172
   if (tempImage)
102
      _mesa_free((void *) tempImage);
173
      _mesa_free((void *) tempImage);
Lines 149-158 Link Here
149
   dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
220
   dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
150
                                        GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
221
                                        GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
151
                                        texWidth, (GLubyte *) dstAddr);
222
                                        texWidth, (GLubyte *) dstAddr);
152
#if 0
223
   if (ext_tx_compress_dxtn) {
153
   compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride,
224
      (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,  GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, dst);
154
                 dst, dstRowStride);
225
   }
155
#endif
226
   else {
227
      _mesa_problem(ctx, "external dxt library not available");
228
   }
229
156
   if (tempImage)
230
   if (tempImage)
157
      _mesa_free((void*) tempImage);
231
      _mesa_free((void*) tempImage);
158
232
Lines 203-212 Link Here
203
   dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
277
   dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
204
                                        GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
278
                                        GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
205
                                        texWidth, (GLubyte *) dstAddr);
279
                                        texWidth, (GLubyte *) dstAddr);
206
#if 0
280
   if (ext_tx_compress_dxtn) {
207
   compress_rgba_dxt3(ctx, srcWidth, srcHeight, pixels,
281
      (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,  GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, dst);
208
                      srcRowStride, dst, dstRowStride);
282
   }
209
#endif
283
   else {
284
      _mesa_problem(ctx, "external dxt library not available");
285
   }
286
210
   if (tempImage)
287
   if (tempImage)
211
      _mesa_free((void *) tempImage);
288
      _mesa_free((void *) tempImage);
212
289
Lines 257-266 Link Here
257
   dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
334
   dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
258
                                        GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
335
                                        GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
259
                                        texWidth, (GLubyte *) dstAddr);
336
                                        texWidth, (GLubyte *) dstAddr);
260
#if 0
337
   if (ext_tx_compress_dxtn) {
261
   compress_rgba_dxt5(ctx, srcWidth, srcHeight, pixels,
338
      (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels,  GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, dst);
262
                      srcRowStride, dst, dstRowStride);
339
   }
263
#endif
340
   else {
341
      _mesa_problem(ctx, "external dxt library not available");
342
   }
343
264
   if (tempImage)
344
   if (tempImage)
265
      _mesa_free((void *) tempImage);
345
      _mesa_free((void *) tempImage);
266
346
Lines 272-277 Link Here
272
fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
352
fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
273
                         GLint i, GLint j, GLint k, GLchan *texel )
353
                         GLint i, GLint j, GLint k, GLchan *texel )
274
{
354
{
355
    (void) k;
356
    if (fetch_ext_rgb_dxt1) {
357
       ASSERT (sizeof(GLchan) == sizeof(GLubyte));
358
       (*fetch_ext_rgb_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
359
    }
360
    else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
275
}
361
}
276
362
277
363
Lines 293-298 Link Here
293
fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
379
fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
294
                          GLint i, GLint j, GLint k, GLchan *texel )
380
                          GLint i, GLint j, GLint k, GLchan *texel )
295
{
381
{
382
   (void) k;
383
   if (fetch_ext_rgba_dxt1) {
384
       (*fetch_ext_rgba_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
385
    }
386
    else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
296
}
387
}
297
388
298
389
Lines 314-319 Link Here
314
fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
405
fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
315
                          GLint i, GLint j, GLint k, GLchan *texel )
406
                          GLint i, GLint j, GLint k, GLchan *texel )
316
{
407
{
408
   (void) k;
409
   if (fetch_ext_rgba_dxt3) {
410
       ASSERT (sizeof(GLchan) == sizeof(GLubyte));
411
       (*fetch_ext_rgba_dxt3)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
412
    }
413
    else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
317
}
414
}
318
415
319
416
Lines 335-340 Link Here
335
fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
432
fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
336
                          GLint i, GLint j, GLint k, GLchan *texel )
433
                          GLint i, GLint j, GLint k, GLchan *texel )
337
{
434
{
435
   (void) k;
436
   if (fetch_ext_rgba_dxt5) {
437
       (*fetch_ext_rgba_dxt5)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel);
438
    }
439
    else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n");
338
}
440
}
339
441
340
442

Return to bug 65621