1 /**************************************************************************
3 Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
4 VA Linux Systems Inc., Fremont, California.
8 Permission is hereby granted, free of charge, to any person obtaining
9 a copy of this software and associated documentation files (the
10 "Software"), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense, and/or sell copies of the Software, and to
13 permit persons to whom the Software is furnished to do so, subject to
14 the following conditions:
16 The above copyright notice and this permission notice (including the
17 next paragraph) shall be included in all copies or substantial
18 portions of the Software.
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
24 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 **************************************************************************/
31 * \file radeon_screen.c
32 * Screen initialization functions for the Radeon driver.
34 * \author Kevin E. Martin <martin@valinux.com>
35 * \author Gareth Hughes <gareth@valinux.com>
39 #include "main/glheader.h"
40 #include "main/imports.h"
41 #include "main/mtypes.h"
42 #include "main/framebuffer.h"
43 #include "main/renderbuffer.h"
44 #include "main/fbobject.h"
46 #define STANDALONE_MMIO
47 #include "radeon_chipset.h"
48 #include "radeon_macros.h"
49 #include "radeon_screen.h"
50 #include "radeon_common.h"
51 #include "radeon_common_context.h"
52 #if defined(RADEON_R100)
53 #include "radeon_context.h"
54 #include "radeon_tex.h"
55 #elif defined(RADEON_R200)
56 #include "r200_context.h"
58 #elif defined(RADEON_R300)
59 #include "r300_context.h"
61 #elif defined(RADEON_R600)
62 #include "r600_context.h"
63 #include "r700_driconf.h" /* +r6/r7 */
64 #include "r600_tex.h" /* +r6/r7 */
70 #include "radeon_bocs_wrapper.h"
72 #include "GL/internal/dri_interface.h"
74 /* Radeon configuration
78 #define DRI_CONF_COMMAND_BUFFER_SIZE(def,min,max) \
79 DRI_CONF_OPT_BEGIN_V(command_buffer_size,int,def, # min ":" # max ) \
80 DRI_CONF_DESC(en,"Size of command buffer (in KB)") \
81 DRI_CONF_DESC(de,"Grösse des Befehlspuffers (in KB)") \
84 #if defined(RADEON_R100) /* R100 */
85 PUBLIC
const char __driConfigOptions
[] =
87 DRI_CONF_SECTION_PERFORMANCE
88 DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN
)
89 DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS
)
90 DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0
)
91 DRI_CONF_MAX_TEXTURE_UNITS(3,2,3)
92 DRI_CONF_HYPERZ(false)
93 DRI_CONF_COMMAND_BUFFER_SIZE(8, 8, 32)
95 DRI_CONF_SECTION_QUALITY
96 DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB
)
97 DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0")
98 DRI_CONF_NO_NEG_LOD_BIAS(false)
99 DRI_CONF_FORCE_S3TC_ENABLE(false)
100 DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER
)
101 DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC
)
102 DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF
)
103 DRI_CONF_ALLOW_LARGE_TEXTURES(2)
105 DRI_CONF_SECTION_DEBUG
106 DRI_CONF_NO_RAST(false)
109 static const GLuint __driNConfigOptions
= 15;
111 #elif defined(RADEON_R200)
113 PUBLIC
const char __driConfigOptions
[] =
115 DRI_CONF_SECTION_PERFORMANCE
116 DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN
)
117 DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS
)
118 DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0
)
119 DRI_CONF_MAX_TEXTURE_UNITS(6,2,6)
120 DRI_CONF_HYPERZ(false)
121 DRI_CONF_COMMAND_BUFFER_SIZE(8, 8, 32)
123 DRI_CONF_SECTION_QUALITY
124 DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB
)
125 DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0")
126 DRI_CONF_NO_NEG_LOD_BIAS(false)
127 DRI_CONF_FORCE_S3TC_ENABLE(false)
128 DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER
)
129 DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC
)
130 DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF
)
131 DRI_CONF_ALLOW_LARGE_TEXTURES(2)
132 DRI_CONF_TEXTURE_BLEND_QUALITY(1.0,"0.0:1.0")
134 DRI_CONF_SECTION_DEBUG
135 DRI_CONF_NO_RAST(false)
137 DRI_CONF_SECTION_SOFTWARE
138 DRI_CONF_NV_VERTEX_PROGRAM(false)
141 static const GLuint __driNConfigOptions
= 17;
143 #elif defined(RADEON_R300) || defined(RADEON_R600)
145 #define DRI_CONF_FP_OPTIMIZATION_SPEED 0
146 #define DRI_CONF_FP_OPTIMIZATION_QUALITY 1
148 /* TODO: integrate these into xmlpool.h! */
149 #define DRI_CONF_MAX_TEXTURE_IMAGE_UNITS(def,min,max) \
150 DRI_CONF_OPT_BEGIN_V(texture_image_units,int,def, # min ":" # max ) \
151 DRI_CONF_DESC(en,"Number of texture image units") \
152 DRI_CONF_DESC(de,"Anzahl der Textureinheiten") \
155 #define DRI_CONF_MAX_TEXTURE_COORD_UNITS(def,min,max) \
156 DRI_CONF_OPT_BEGIN_V(texture_coord_units,int,def, # min ":" # max ) \
157 DRI_CONF_DESC(en,"Number of texture coordinate units") \
158 DRI_CONF_DESC(de,"Anzahl der Texturkoordinateneinheiten") \
163 #define DRI_CONF_DISABLE_S3TC(def) \
164 DRI_CONF_OPT_BEGIN(disable_s3tc,bool,def) \
165 DRI_CONF_DESC(en,"Disable S3TC compression") \
168 #define DRI_CONF_DISABLE_FALLBACK(def) \
169 DRI_CONF_OPT_BEGIN(disable_lowimpact_fallback,bool,def) \
170 DRI_CONF_DESC(en,"Disable Low-impact fallback") \
173 #define DRI_CONF_DISABLE_DOUBLE_SIDE_STENCIL(def) \
174 DRI_CONF_OPT_BEGIN(disable_stencil_two_side,bool,def) \
175 DRI_CONF_DESC(en,"Disable GL_EXT_stencil_two_side") \
178 #define DRI_CONF_FP_OPTIMIZATION(def) \
179 DRI_CONF_OPT_BEGIN_V(fp_optimization,enum,def,"0:1") \
180 DRI_CONF_DESC_BEGIN(en,"Fragment Program optimization") \
181 DRI_CONF_ENUM(0,"Optimize for Speed") \
182 DRI_CONF_ENUM(1,"Optimize for Quality") \
186 PUBLIC
const char __driConfigOptions
[] =
188 DRI_CONF_SECTION_PERFORMANCE
189 DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN
)
190 DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS
)
191 DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0
)
192 DRI_CONF_MAX_TEXTURE_IMAGE_UNITS(8, 2, 8)
193 DRI_CONF_MAX_TEXTURE_COORD_UNITS(8, 2, 8)
194 DRI_CONF_COMMAND_BUFFER_SIZE(8, 8, 32)
195 DRI_CONF_DISABLE_FALLBACK(true)
196 DRI_CONF_DISABLE_DOUBLE_SIDE_STENCIL(false)
198 DRI_CONF_SECTION_QUALITY
199 DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB
)
200 DRI_CONF_DEF_MAX_ANISOTROPY(1.0, "1.0,2.0,4.0,8.0,16.0")
201 DRI_CONF_FORCE_S3TC_ENABLE(false)
202 DRI_CONF_DISABLE_S3TC(false)
203 DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER
)
204 DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC
)
205 DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF
)
206 DRI_CONF_FP_OPTIMIZATION(DRI_CONF_FP_OPTIMIZATION_SPEED
)
208 DRI_CONF_SECTION_DEBUG
209 DRI_CONF_NO_RAST(false)
212 static const GLuint __driNConfigOptions
= 17;
216 static int getSwapInfo( __DRIdrawable
*dPriv
, __DRIswapInfo
* sInfo
);
218 #ifndef RADEON_INFO_TILE_CONFIG
219 #define RADEON_INFO_TILE_CONFIG 0x6
223 radeonGetParam(__DRIscreen
*sPriv
, int param
, void *value
)
226 drm_radeon_getparam_t gp
= { 0 };
227 struct drm_radeon_info info
= { 0 };
229 if (sPriv
->drm_version
.major
>= 2) {
230 info
.value
= (uint64_t)(uintptr_t)value
;
232 case RADEON_PARAM_DEVICE_ID
:
233 info
.request
= RADEON_INFO_DEVICE_ID
;
235 case RADEON_PARAM_NUM_GB_PIPES
:
236 info
.request
= RADEON_INFO_NUM_GB_PIPES
;
238 case RADEON_PARAM_NUM_Z_PIPES
:
239 info
.request
= RADEON_INFO_NUM_Z_PIPES
;
241 case RADEON_INFO_TILE_CONFIG
:
242 info
.request
= RADEON_INFO_TILE_CONFIG
;
247 ret
= drmCommandWriteRead(sPriv
->fd
, DRM_RADEON_INFO
, &info
, sizeof(info
));
252 ret
= drmCommandWriteRead(sPriv
->fd
, DRM_RADEON_GETPARAM
, &gp
, sizeof(gp
));
257 static const __DRIconfig
**
258 radeonFillInModes( __DRIscreen
*psp
,
259 unsigned pixel_bits
, unsigned depth_bits
,
260 unsigned stencil_bits
, GLboolean have_back_buffer
)
262 __DRIconfig
**configs
;
264 unsigned depth_buffer_factor
;
265 unsigned back_buffer_factor
;
268 /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
269 * enough to add support. Basically, if a context is created with an
270 * fbconfig where the swap method is GLX_SWAP_COPY_OML, pageflipping
271 * will never be used.
273 static const GLenum back_buffer_modes
[] = {
274 GLX_NONE
, GLX_SWAP_UNDEFINED_OML
/*, GLX_SWAP_COPY_OML */
277 uint8_t depth_bits_array
[2];
278 uint8_t stencil_bits_array
[2];
279 uint8_t msaa_samples_array
[1];
281 depth_bits_array
[0] = depth_bits
;
282 depth_bits_array
[1] = depth_bits
;
284 /* Just like with the accumulation buffer, always provide some modes
285 * with a stencil buffer. It will be a sw fallback, but some apps won't
288 stencil_bits_array
[0] = stencil_bits
;
289 stencil_bits_array
[1] = (stencil_bits
== 0) ? 8 : stencil_bits
;
291 msaa_samples_array
[0] = 0;
293 depth_buffer_factor
= (stencil_bits
== 0) ? 2 : 1;
294 back_buffer_factor
= (have_back_buffer
) ? 2 : 1;
296 if (pixel_bits
== 16) {
297 __DRIconfig
**configs_a8r8g8b8
;
298 __DRIconfig
**configs_r5g6b5
;
300 configs_r5g6b5
= driCreateConfigs(GL_RGB
, GL_UNSIGNED_SHORT_5_6_5
,
301 depth_bits_array
, stencil_bits_array
,
302 depth_buffer_factor
, back_buffer_modes
,
303 back_buffer_factor
, msaa_samples_array
,
305 configs_a8r8g8b8
= driCreateConfigs(GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
,
306 depth_bits_array
, stencil_bits_array
,
307 1, back_buffer_modes
, 1,
308 msaa_samples_array
, 1, GL_TRUE
);
309 configs
= driConcatConfigs(configs_r5g6b5
, configs_a8r8g8b8
);
311 configs
= driCreateConfigs(GL_BGRA
, GL_UNSIGNED_INT_8_8_8_8_REV
,
312 depth_bits_array
, stencil_bits_array
,
314 back_buffer_modes
, back_buffer_factor
,
315 msaa_samples_array
, 1, GL_TRUE
);
317 if (configs
== NULL
) {
318 fprintf( stderr
, "[%s:%u] Error creating FBConfig!\n",
319 __func__
, __LINE__
);
323 /* Mark the visual as slow if there are "fake" stencil bits.
325 for (i
= 0; configs
[i
]; i
++) {
326 m
= &configs
[i
]->modes
;
327 if ((m
->stencilBits
!= 0) && (m
->stencilBits
!= stencil_bits
)) {
328 m
->visualRating
= GLX_SLOW_CONFIG
;
332 return (const __DRIconfig
**) configs
;
335 #if defined(RADEON_R100)
336 static const __DRItexOffsetExtension radeonTexOffsetExtension
= {
337 { __DRI_TEX_OFFSET
, __DRI_TEX_OFFSET_VERSION
},
341 static const __DRItexBufferExtension radeonTexBufferExtension
= {
342 { __DRI_TEX_BUFFER
, __DRI_TEX_BUFFER_VERSION
},
348 #if defined(RADEON_R200)
350 static const __DRItexOffsetExtension r200texOffsetExtension
= {
351 { __DRI_TEX_OFFSET
, __DRI_TEX_OFFSET_VERSION
},
355 static const __DRItexBufferExtension r200TexBufferExtension
= {
356 { __DRI_TEX_BUFFER
, __DRI_TEX_BUFFER_VERSION
},
362 #if defined(RADEON_R300)
363 static const __DRItexOffsetExtension r300texOffsetExtension
= {
364 { __DRI_TEX_OFFSET
, __DRI_TEX_OFFSET_VERSION
},
368 static const __DRItexBufferExtension r300TexBufferExtension
= {
369 { __DRI_TEX_BUFFER
, __DRI_TEX_BUFFER_VERSION
},
375 #if defined(RADEON_R600)
376 static const __DRItexOffsetExtension r600texOffsetExtension
= {
377 { __DRI_TEX_OFFSET
, __DRI_TEX_OFFSET_VERSION
},
378 r600SetTexOffset
, /* +r6/r7 */
381 static const __DRItexBufferExtension r600TexBufferExtension
= {
382 { __DRI_TEX_BUFFER
, __DRI_TEX_BUFFER_VERSION
},
383 r600SetTexBuffer
, /* +r6/r7 */
384 r600SetTexBuffer2
, /* +r6/r7 */
389 radeonDRI2Flush(__DRIdrawable
*drawable
)
391 radeonContextPtr rmesa
;
393 rmesa
= (radeonContextPtr
) drawable
->driContextPriv
->driverPrivate
;
394 radeonFlush(rmesa
->glCtx
);
397 static const struct __DRI2flushExtensionRec radeonFlushExtension
= {
398 { __DRI2_FLUSH
, __DRI2_FLUSH_VERSION
},
400 dri2InvalidateDrawable
,
404 radeon_create_image_from_name(__DRIcontext
*context
,
405 int width
, int height
, int format
,
406 int name
, int pitch
, void *loaderPrivate
)
409 radeonContextPtr radeon
= context
->driverPrivate
;
414 image
= CALLOC(sizeof *image
);
419 case __DRI_IMAGE_FORMAT_RGB565
:
420 image
->format
= MESA_FORMAT_RGB565
;
421 image
->internal_format
= GL_RGB
;
422 image
->data_type
= GL_UNSIGNED_BYTE
;
424 case __DRI_IMAGE_FORMAT_XRGB8888
:
425 image
->format
= MESA_FORMAT_XRGB8888
;
426 image
->internal_format
= GL_RGB
;
427 image
->data_type
= GL_UNSIGNED_BYTE
;
429 case __DRI_IMAGE_FORMAT_ARGB8888
:
430 image
->format
= MESA_FORMAT_ARGB8888
;
431 image
->internal_format
= GL_RGBA
;
432 image
->data_type
= GL_UNSIGNED_BYTE
;
439 image
->data
= loaderPrivate
;
440 image
->cpp
= _mesa_get_format_bytes(image
->format
);
441 image
->width
= width
;
442 image
->pitch
= pitch
;
443 image
->height
= height
;
445 image
->bo
= radeon_bo_open(radeon
->radeonScreen
->bom
,
447 image
->pitch
* image
->height
* image
->cpp
,
449 RADEON_GEM_DOMAIN_VRAM
,
452 if (image
->bo
== NULL
) {
461 radeon_create_image_from_renderbuffer(__DRIcontext
*context
,
462 int renderbuffer
, void *loaderPrivate
)
465 radeonContextPtr radeon
= context
->driverPrivate
;
466 struct gl_renderbuffer
*rb
;
467 struct radeon_renderbuffer
*rrb
;
469 rb
= _mesa_lookup_renderbuffer(radeon
->glCtx
, renderbuffer
);
471 _mesa_error(radeon
->glCtx
,
472 GL_INVALID_OPERATION
, "glRenderbufferExternalMESA");
476 rrb
= radeon_renderbuffer(rb
);
477 image
= CALLOC(sizeof *image
);
481 image
->internal_format
= rb
->InternalFormat
;
482 image
->format
= rb
->Format
;
483 image
->cpp
= rrb
->cpp
;
484 image
->data_type
= rb
->DataType
;
485 image
->data
= loaderPrivate
;
486 radeon_bo_ref(rrb
->bo
);
489 image
->width
= rb
->Width
;
490 image
->height
= rb
->Height
;
491 image
->pitch
= rrb
->pitch
/ image
->cpp
;
497 radeon_destroy_image(__DRIimage
*image
)
499 radeon_bo_unref(image
->bo
);
504 radeon_create_image(__DRIscreen
*screen
,
505 int width
, int height
, int format
,
510 radeonScreenPtr radeonScreen
= screen
->private;
512 image
= CALLOC(sizeof *image
);
517 case __DRI_IMAGE_FORMAT_RGB565
:
518 image
->format
= MESA_FORMAT_RGB565
;
519 image
->internal_format
= GL_RGB
;
520 image
->data_type
= GL_UNSIGNED_BYTE
;
522 case __DRI_IMAGE_FORMAT_XRGB8888
:
523 image
->format
= MESA_FORMAT_XRGB8888
;
524 image
->internal_format
= GL_RGB
;
525 image
->data_type
= GL_UNSIGNED_BYTE
;
527 case __DRI_IMAGE_FORMAT_ARGB8888
:
528 image
->format
= MESA_FORMAT_ARGB8888
;
529 image
->internal_format
= GL_RGBA
;
530 image
->data_type
= GL_UNSIGNED_BYTE
;
537 image
->data
= loaderPrivate
;
538 image
->cpp
= _mesa_get_format_bytes(image
->format
);
539 image
->width
= width
;
540 image
->height
= height
;
541 image
->pitch
= ((image
->cpp
* image
->width
+ 255) & ~255) / image
->cpp
;
543 image
->bo
= radeon_bo_open(radeonScreen
->bom
,
545 image
->pitch
* image
->height
* image
->cpp
,
547 RADEON_GEM_DOMAIN_VRAM
,
550 if (image
->bo
== NULL
) {
559 radeon_query_image(__DRIimage
*image
, int attrib
, int *value
)
562 case __DRI_IMAGE_ATTRIB_STRIDE
:
563 *value
= image
->pitch
* image
->cpp
;
565 case __DRI_IMAGE_ATTRIB_HANDLE
:
566 *value
= image
->bo
->handle
;
568 case __DRI_IMAGE_ATTRIB_NAME
:
569 radeon_gem_get_kernel_name(image
->bo
, (uint32_t *) value
);
576 static struct __DRIimageExtensionRec radeonImageExtension
= {
577 { __DRI_IMAGE
, __DRI_IMAGE_VERSION
},
578 radeon_create_image_from_name
,
579 radeon_create_image_from_renderbuffer
,
580 radeon_destroy_image
,
585 static int radeon_set_screen_flags(radeonScreenPtr screen
, int device_id
)
587 screen
->device_id
= device_id
;
588 screen
->chip_flags
= 0;
589 switch ( device_id
) {
590 case PCI_CHIP_RN50_515E
:
591 case PCI_CHIP_RN50_5969
:
594 case PCI_CHIP_RADEON_LY
:
595 case PCI_CHIP_RADEON_LZ
:
596 case PCI_CHIP_RADEON_QY
:
597 case PCI_CHIP_RADEON_QZ
:
598 screen
->chip_family
= CHIP_FAMILY_RV100
;
601 case PCI_CHIP_RS100_4136
:
602 case PCI_CHIP_RS100_4336
:
603 screen
->chip_family
= CHIP_FAMILY_RS100
;
606 case PCI_CHIP_RS200_4137
:
607 case PCI_CHIP_RS200_4337
:
608 case PCI_CHIP_RS250_4237
:
609 case PCI_CHIP_RS250_4437
:
610 screen
->chip_family
= CHIP_FAMILY_RS200
;
613 case PCI_CHIP_RADEON_QD
:
614 case PCI_CHIP_RADEON_QE
:
615 case PCI_CHIP_RADEON_QF
:
616 case PCI_CHIP_RADEON_QG
:
617 /* all original radeons (7200) presumably have a stencil op bug */
618 screen
->chip_family
= CHIP_FAMILY_R100
;
619 screen
->chip_flags
= RADEON_CHIPSET_TCL
| RADEON_CHIPSET_BROKEN_STENCIL
;
622 case PCI_CHIP_RV200_QW
:
623 case PCI_CHIP_RV200_QX
:
624 case PCI_CHIP_RADEON_LW
:
625 case PCI_CHIP_RADEON_LX
:
626 screen
->chip_family
= CHIP_FAMILY_RV200
;
627 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
630 case PCI_CHIP_R200_BB
:
631 case PCI_CHIP_R200_BC
:
632 case PCI_CHIP_R200_QH
:
633 case PCI_CHIP_R200_QL
:
634 case PCI_CHIP_R200_QM
:
635 screen
->chip_family
= CHIP_FAMILY_R200
;
636 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
639 case PCI_CHIP_RV250_If
:
640 case PCI_CHIP_RV250_Ig
:
641 case PCI_CHIP_RV250_Ld
:
642 case PCI_CHIP_RV250_Lf
:
643 case PCI_CHIP_RV250_Lg
:
644 screen
->chip_family
= CHIP_FAMILY_RV250
;
645 screen
->chip_flags
= R200_CHIPSET_YCBCR_BROKEN
| RADEON_CHIPSET_TCL
;
648 case PCI_CHIP_RV280_5960
:
649 case PCI_CHIP_RV280_5961
:
650 case PCI_CHIP_RV280_5962
:
651 case PCI_CHIP_RV280_5964
:
652 case PCI_CHIP_RV280_5965
:
653 case PCI_CHIP_RV280_5C61
:
654 case PCI_CHIP_RV280_5C63
:
655 screen
->chip_family
= CHIP_FAMILY_RV280
;
656 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
659 case PCI_CHIP_RS300_5834
:
660 case PCI_CHIP_RS300_5835
:
661 case PCI_CHIP_RS350_7834
:
662 case PCI_CHIP_RS350_7835
:
663 screen
->chip_family
= CHIP_FAMILY_RS300
;
666 case PCI_CHIP_R300_AD
:
667 case PCI_CHIP_R300_AE
:
668 case PCI_CHIP_R300_AF
:
669 case PCI_CHIP_R300_AG
:
670 case PCI_CHIP_R300_ND
:
671 case PCI_CHIP_R300_NE
:
672 case PCI_CHIP_R300_NF
:
673 case PCI_CHIP_R300_NG
:
674 screen
->chip_family
= CHIP_FAMILY_R300
;
675 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
678 case PCI_CHIP_RV350_AP
:
679 case PCI_CHIP_RV350_AQ
:
680 case PCI_CHIP_RV350_AR
:
681 case PCI_CHIP_RV350_AS
:
682 case PCI_CHIP_RV350_AT
:
683 case PCI_CHIP_RV350_AV
:
684 case PCI_CHIP_RV350_AU
:
685 case PCI_CHIP_RV350_NP
:
686 case PCI_CHIP_RV350_NQ
:
687 case PCI_CHIP_RV350_NR
:
688 case PCI_CHIP_RV350_NS
:
689 case PCI_CHIP_RV350_NT
:
690 case PCI_CHIP_RV350_NV
:
691 screen
->chip_family
= CHIP_FAMILY_RV350
;
692 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
695 case PCI_CHIP_R350_AH
:
696 case PCI_CHIP_R350_AI
:
697 case PCI_CHIP_R350_AJ
:
698 case PCI_CHIP_R350_AK
:
699 case PCI_CHIP_R350_NH
:
700 case PCI_CHIP_R350_NI
:
701 case PCI_CHIP_R360_NJ
:
702 case PCI_CHIP_R350_NK
:
703 screen
->chip_family
= CHIP_FAMILY_R350
;
704 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
707 case PCI_CHIP_RV370_5460
:
708 case PCI_CHIP_RV370_5462
:
709 case PCI_CHIP_RV370_5464
:
710 case PCI_CHIP_RV370_5B60
:
711 case PCI_CHIP_RV370_5B62
:
712 case PCI_CHIP_RV370_5B63
:
713 case PCI_CHIP_RV370_5B64
:
714 case PCI_CHIP_RV370_5B65
:
715 case PCI_CHIP_RV380_3150
:
716 case PCI_CHIP_RV380_3152
:
717 case PCI_CHIP_RV380_3154
:
718 case PCI_CHIP_RV380_3155
:
719 case PCI_CHIP_RV380_3E50
:
720 case PCI_CHIP_RV380_3E54
:
721 screen
->chip_family
= CHIP_FAMILY_RV380
;
722 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
725 case PCI_CHIP_R420_JN
:
726 case PCI_CHIP_R420_JH
:
727 case PCI_CHIP_R420_JI
:
728 case PCI_CHIP_R420_JJ
:
729 case PCI_CHIP_R420_JK
:
730 case PCI_CHIP_R420_JL
:
731 case PCI_CHIP_R420_JM
:
732 case PCI_CHIP_R420_JO
:
733 case PCI_CHIP_R420_JP
:
734 case PCI_CHIP_R420_JT
:
735 case PCI_CHIP_R481_4B49
:
736 case PCI_CHIP_R481_4B4A
:
737 case PCI_CHIP_R481_4B4B
:
738 case PCI_CHIP_R481_4B4C
:
739 case PCI_CHIP_R423_UH
:
740 case PCI_CHIP_R423_UI
:
741 case PCI_CHIP_R423_UJ
:
742 case PCI_CHIP_R423_UK
:
743 case PCI_CHIP_R430_554C
:
744 case PCI_CHIP_R430_554D
:
745 case PCI_CHIP_R430_554E
:
746 case PCI_CHIP_R430_554F
:
747 case PCI_CHIP_R423_5550
:
748 case PCI_CHIP_R423_UQ
:
749 case PCI_CHIP_R423_UR
:
750 case PCI_CHIP_R423_UT
:
751 case PCI_CHIP_R430_5D48
:
752 case PCI_CHIP_R430_5D49
:
753 case PCI_CHIP_R430_5D4A
:
754 case PCI_CHIP_R480_5D4C
:
755 case PCI_CHIP_R480_5D4D
:
756 case PCI_CHIP_R480_5D4E
:
757 case PCI_CHIP_R480_5D4F
:
758 case PCI_CHIP_R480_5D50
:
759 case PCI_CHIP_R480_5D52
:
760 case PCI_CHIP_R423_5D57
:
761 screen
->chip_family
= CHIP_FAMILY_R420
;
762 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
765 case PCI_CHIP_RV410_5E4C
:
766 case PCI_CHIP_RV410_5E4F
:
767 case PCI_CHIP_RV410_564A
:
768 case PCI_CHIP_RV410_564B
:
769 case PCI_CHIP_RV410_564F
:
770 case PCI_CHIP_RV410_5652
:
771 case PCI_CHIP_RV410_5653
:
772 case PCI_CHIP_RV410_5657
:
773 case PCI_CHIP_RV410_5E48
:
774 case PCI_CHIP_RV410_5E4A
:
775 case PCI_CHIP_RV410_5E4B
:
776 case PCI_CHIP_RV410_5E4D
:
777 screen
->chip_family
= CHIP_FAMILY_RV410
;
778 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
781 case PCI_CHIP_RS480_5954
:
782 case PCI_CHIP_RS480_5955
:
783 case PCI_CHIP_RS482_5974
:
784 case PCI_CHIP_RS482_5975
:
785 case PCI_CHIP_RS400_5A41
:
786 case PCI_CHIP_RS400_5A42
:
787 case PCI_CHIP_RC410_5A61
:
788 case PCI_CHIP_RC410_5A62
:
789 screen
->chip_family
= CHIP_FAMILY_RS400
;
792 case PCI_CHIP_RS600_793F
:
793 case PCI_CHIP_RS600_7941
:
794 case PCI_CHIP_RS600_7942
:
795 screen
->chip_family
= CHIP_FAMILY_RS600
;
798 case PCI_CHIP_RS690_791E
:
799 case PCI_CHIP_RS690_791F
:
800 screen
->chip_family
= CHIP_FAMILY_RS690
;
802 case PCI_CHIP_RS740_796C
:
803 case PCI_CHIP_RS740_796D
:
804 case PCI_CHIP_RS740_796E
:
805 case PCI_CHIP_RS740_796F
:
806 screen
->chip_family
= CHIP_FAMILY_RS740
;
809 case PCI_CHIP_R520_7100
:
810 case PCI_CHIP_R520_7101
:
811 case PCI_CHIP_R520_7102
:
812 case PCI_CHIP_R520_7103
:
813 case PCI_CHIP_R520_7104
:
814 case PCI_CHIP_R520_7105
:
815 case PCI_CHIP_R520_7106
:
816 case PCI_CHIP_R520_7108
:
817 case PCI_CHIP_R520_7109
:
818 case PCI_CHIP_R520_710A
:
819 case PCI_CHIP_R520_710B
:
820 case PCI_CHIP_R520_710C
:
821 case PCI_CHIP_R520_710E
:
822 case PCI_CHIP_R520_710F
:
823 screen
->chip_family
= CHIP_FAMILY_R520
;
824 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
827 case PCI_CHIP_RV515_7140
:
828 case PCI_CHIP_RV515_7141
:
829 case PCI_CHIP_RV515_7142
:
830 case PCI_CHIP_RV515_7143
:
831 case PCI_CHIP_RV515_7144
:
832 case PCI_CHIP_RV515_7145
:
833 case PCI_CHIP_RV515_7146
:
834 case PCI_CHIP_RV515_7147
:
835 case PCI_CHIP_RV515_7149
:
836 case PCI_CHIP_RV515_714A
:
837 case PCI_CHIP_RV515_714B
:
838 case PCI_CHIP_RV515_714C
:
839 case PCI_CHIP_RV515_714D
:
840 case PCI_CHIP_RV515_714E
:
841 case PCI_CHIP_RV515_714F
:
842 case PCI_CHIP_RV515_7151
:
843 case PCI_CHIP_RV515_7152
:
844 case PCI_CHIP_RV515_7153
:
845 case PCI_CHIP_RV515_715E
:
846 case PCI_CHIP_RV515_715F
:
847 case PCI_CHIP_RV515_7180
:
848 case PCI_CHIP_RV515_7181
:
849 case PCI_CHIP_RV515_7183
:
850 case PCI_CHIP_RV515_7186
:
851 case PCI_CHIP_RV515_7187
:
852 case PCI_CHIP_RV515_7188
:
853 case PCI_CHIP_RV515_718A
:
854 case PCI_CHIP_RV515_718B
:
855 case PCI_CHIP_RV515_718C
:
856 case PCI_CHIP_RV515_718D
:
857 case PCI_CHIP_RV515_718F
:
858 case PCI_CHIP_RV515_7193
:
859 case PCI_CHIP_RV515_7196
:
860 case PCI_CHIP_RV515_719B
:
861 case PCI_CHIP_RV515_719F
:
862 case PCI_CHIP_RV515_7200
:
863 case PCI_CHIP_RV515_7210
:
864 case PCI_CHIP_RV515_7211
:
865 screen
->chip_family
= CHIP_FAMILY_RV515
;
866 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
869 case PCI_CHIP_RV530_71C0
:
870 case PCI_CHIP_RV530_71C1
:
871 case PCI_CHIP_RV530_71C2
:
872 case PCI_CHIP_RV530_71C3
:
873 case PCI_CHIP_RV530_71C4
:
874 case PCI_CHIP_RV530_71C5
:
875 case PCI_CHIP_RV530_71C6
:
876 case PCI_CHIP_RV530_71C7
:
877 case PCI_CHIP_RV530_71CD
:
878 case PCI_CHIP_RV530_71CE
:
879 case PCI_CHIP_RV530_71D2
:
880 case PCI_CHIP_RV530_71D4
:
881 case PCI_CHIP_RV530_71D5
:
882 case PCI_CHIP_RV530_71D6
:
883 case PCI_CHIP_RV530_71DA
:
884 case PCI_CHIP_RV530_71DE
:
885 screen
->chip_family
= CHIP_FAMILY_RV530
;
886 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
889 case PCI_CHIP_R580_7240
:
890 case PCI_CHIP_R580_7243
:
891 case PCI_CHIP_R580_7244
:
892 case PCI_CHIP_R580_7245
:
893 case PCI_CHIP_R580_7246
:
894 case PCI_CHIP_R580_7247
:
895 case PCI_CHIP_R580_7248
:
896 case PCI_CHIP_R580_7249
:
897 case PCI_CHIP_R580_724A
:
898 case PCI_CHIP_R580_724B
:
899 case PCI_CHIP_R580_724C
:
900 case PCI_CHIP_R580_724D
:
901 case PCI_CHIP_R580_724E
:
902 case PCI_CHIP_R580_724F
:
903 case PCI_CHIP_R580_7284
:
904 screen
->chip_family
= CHIP_FAMILY_R580
;
905 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
908 case PCI_CHIP_RV570_7280
:
909 case PCI_CHIP_RV560_7281
:
910 case PCI_CHIP_RV560_7283
:
911 case PCI_CHIP_RV560_7287
:
912 case PCI_CHIP_RV570_7288
:
913 case PCI_CHIP_RV570_7289
:
914 case PCI_CHIP_RV570_728B
:
915 case PCI_CHIP_RV570_728C
:
916 case PCI_CHIP_RV560_7290
:
917 case PCI_CHIP_RV560_7291
:
918 case PCI_CHIP_RV560_7293
:
919 case PCI_CHIP_RV560_7297
:
920 screen
->chip_family
= CHIP_FAMILY_RV560
;
921 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
924 case PCI_CHIP_R600_9400
:
925 case PCI_CHIP_R600_9401
:
926 case PCI_CHIP_R600_9402
:
927 case PCI_CHIP_R600_9403
:
928 case PCI_CHIP_R600_9405
:
929 case PCI_CHIP_R600_940A
:
930 case PCI_CHIP_R600_940B
:
931 case PCI_CHIP_R600_940F
:
932 screen
->chip_family
= CHIP_FAMILY_R600
;
933 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
936 case PCI_CHIP_RV610_94C0
:
937 case PCI_CHIP_RV610_94C1
:
938 case PCI_CHIP_RV610_94C3
:
939 case PCI_CHIP_RV610_94C4
:
940 case PCI_CHIP_RV610_94C5
:
941 case PCI_CHIP_RV610_94C6
:
942 case PCI_CHIP_RV610_94C7
:
943 case PCI_CHIP_RV610_94C8
:
944 case PCI_CHIP_RV610_94C9
:
945 case PCI_CHIP_RV610_94CB
:
946 case PCI_CHIP_RV610_94CC
:
947 case PCI_CHIP_RV610_94CD
:
948 screen
->chip_family
= CHIP_FAMILY_RV610
;
949 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
952 case PCI_CHIP_RV630_9580
:
953 case PCI_CHIP_RV630_9581
:
954 case PCI_CHIP_RV630_9583
:
955 case PCI_CHIP_RV630_9586
:
956 case PCI_CHIP_RV630_9587
:
957 case PCI_CHIP_RV630_9588
:
958 case PCI_CHIP_RV630_9589
:
959 case PCI_CHIP_RV630_958A
:
960 case PCI_CHIP_RV630_958B
:
961 case PCI_CHIP_RV630_958C
:
962 case PCI_CHIP_RV630_958D
:
963 case PCI_CHIP_RV630_958E
:
964 case PCI_CHIP_RV630_958F
:
965 screen
->chip_family
= CHIP_FAMILY_RV630
;
966 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
969 case PCI_CHIP_RV670_9500
:
970 case PCI_CHIP_RV670_9501
:
971 case PCI_CHIP_RV670_9504
:
972 case PCI_CHIP_RV670_9505
:
973 case PCI_CHIP_RV670_9506
:
974 case PCI_CHIP_RV670_9507
:
975 case PCI_CHIP_RV670_9508
:
976 case PCI_CHIP_RV670_9509
:
977 case PCI_CHIP_RV670_950F
:
978 case PCI_CHIP_RV670_9511
:
979 case PCI_CHIP_RV670_9515
:
980 case PCI_CHIP_RV670_9517
:
981 case PCI_CHIP_RV670_9519
:
982 screen
->chip_family
= CHIP_FAMILY_RV670
;
983 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
986 case PCI_CHIP_RV620_95C0
:
987 case PCI_CHIP_RV620_95C2
:
988 case PCI_CHIP_RV620_95C4
:
989 case PCI_CHIP_RV620_95C5
:
990 case PCI_CHIP_RV620_95C6
:
991 case PCI_CHIP_RV620_95C7
:
992 case PCI_CHIP_RV620_95C9
:
993 case PCI_CHIP_RV620_95CC
:
994 case PCI_CHIP_RV620_95CD
:
995 case PCI_CHIP_RV620_95CE
:
996 case PCI_CHIP_RV620_95CF
:
997 screen
->chip_family
= CHIP_FAMILY_RV620
;
998 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1001 case PCI_CHIP_RV635_9590
:
1002 case PCI_CHIP_RV635_9591
:
1003 case PCI_CHIP_RV635_9593
:
1004 case PCI_CHIP_RV635_9595
:
1005 case PCI_CHIP_RV635_9596
:
1006 case PCI_CHIP_RV635_9597
:
1007 case PCI_CHIP_RV635_9598
:
1008 case PCI_CHIP_RV635_9599
:
1009 case PCI_CHIP_RV635_959B
:
1010 screen
->chip_family
= CHIP_FAMILY_RV635
;
1011 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1014 case PCI_CHIP_RS780_9610
:
1015 case PCI_CHIP_RS780_9611
:
1016 case PCI_CHIP_RS780_9612
:
1017 case PCI_CHIP_RS780_9613
:
1018 case PCI_CHIP_RS780_9614
:
1019 case PCI_CHIP_RS780_9615
:
1020 case PCI_CHIP_RS780_9616
:
1021 screen
->chip_family
= CHIP_FAMILY_RS780
;
1022 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1024 case PCI_CHIP_RS880_9710
:
1025 case PCI_CHIP_RS880_9711
:
1026 case PCI_CHIP_RS880_9712
:
1027 case PCI_CHIP_RS880_9713
:
1028 case PCI_CHIP_RS880_9714
:
1029 case PCI_CHIP_RS880_9715
:
1030 screen
->chip_family
= CHIP_FAMILY_RS880
;
1031 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1034 case PCI_CHIP_RV770_9440
:
1035 case PCI_CHIP_RV770_9441
:
1036 case PCI_CHIP_RV770_9442
:
1037 case PCI_CHIP_RV770_9443
:
1038 case PCI_CHIP_RV770_9444
:
1039 case PCI_CHIP_RV770_9446
:
1040 case PCI_CHIP_RV770_944A
:
1041 case PCI_CHIP_RV770_944B
:
1042 case PCI_CHIP_RV770_944C
:
1043 case PCI_CHIP_RV770_944E
:
1044 case PCI_CHIP_RV770_9450
:
1045 case PCI_CHIP_RV770_9452
:
1046 case PCI_CHIP_RV770_9456
:
1047 case PCI_CHIP_RV770_945A
:
1048 case PCI_CHIP_RV770_945B
:
1049 case PCI_CHIP_RV770_945E
:
1050 case PCI_CHIP_RV790_9460
:
1051 case PCI_CHIP_RV790_9462
:
1052 case PCI_CHIP_RV770_946A
:
1053 case PCI_CHIP_RV770_946B
:
1054 case PCI_CHIP_RV770_947A
:
1055 case PCI_CHIP_RV770_947B
:
1056 screen
->chip_family
= CHIP_FAMILY_RV770
;
1057 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1060 case PCI_CHIP_RV730_9480
:
1061 case PCI_CHIP_RV730_9487
:
1062 case PCI_CHIP_RV730_9488
:
1063 case PCI_CHIP_RV730_9489
:
1064 case PCI_CHIP_RV730_948A
:
1065 case PCI_CHIP_RV730_948F
:
1066 case PCI_CHIP_RV730_9490
:
1067 case PCI_CHIP_RV730_9491
:
1068 case PCI_CHIP_RV730_9495
:
1069 case PCI_CHIP_RV730_9498
:
1070 case PCI_CHIP_RV730_949C
:
1071 case PCI_CHIP_RV730_949E
:
1072 case PCI_CHIP_RV730_949F
:
1073 screen
->chip_family
= CHIP_FAMILY_RV730
;
1074 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1077 case PCI_CHIP_RV710_9540
:
1078 case PCI_CHIP_RV710_9541
:
1079 case PCI_CHIP_RV710_9542
:
1080 case PCI_CHIP_RV710_954E
:
1081 case PCI_CHIP_RV710_954F
:
1082 case PCI_CHIP_RV710_9552
:
1083 case PCI_CHIP_RV710_9553
:
1084 case PCI_CHIP_RV710_9555
:
1085 case PCI_CHIP_RV710_9557
:
1086 case PCI_CHIP_RV710_955F
:
1087 screen
->chip_family
= CHIP_FAMILY_RV710
;
1088 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1091 case PCI_CHIP_RV740_94A0
:
1092 case PCI_CHIP_RV740_94A1
:
1093 case PCI_CHIP_RV740_94A3
:
1094 case PCI_CHIP_RV740_94B1
:
1095 case PCI_CHIP_RV740_94B3
:
1096 case PCI_CHIP_RV740_94B4
:
1097 case PCI_CHIP_RV740_94B5
:
1098 case PCI_CHIP_RV740_94B9
:
1099 screen
->chip_family
= CHIP_FAMILY_RV740
;
1100 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1103 case PCI_CHIP_CEDAR_68E0
:
1104 case PCI_CHIP_CEDAR_68E1
:
1105 case PCI_CHIP_CEDAR_68E4
:
1106 case PCI_CHIP_CEDAR_68E5
:
1107 case PCI_CHIP_CEDAR_68E8
:
1108 case PCI_CHIP_CEDAR_68E9
:
1109 case PCI_CHIP_CEDAR_68F1
:
1110 case PCI_CHIP_CEDAR_68F8
:
1111 case PCI_CHIP_CEDAR_68F9
:
1112 case PCI_CHIP_CEDAR_68FE
:
1113 screen
->chip_family
= CHIP_FAMILY_CEDAR
;
1114 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1117 case PCI_CHIP_REDWOOD_68C0
:
1118 case PCI_CHIP_REDWOOD_68C1
:
1119 case PCI_CHIP_REDWOOD_68C8
:
1120 case PCI_CHIP_REDWOOD_68C9
:
1121 case PCI_CHIP_REDWOOD_68D8
:
1122 case PCI_CHIP_REDWOOD_68D9
:
1123 case PCI_CHIP_REDWOOD_68DA
:
1124 case PCI_CHIP_REDWOOD_68DE
:
1125 screen
->chip_family
= CHIP_FAMILY_REDWOOD
;
1126 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1129 case PCI_CHIP_JUNIPER_68A0
:
1130 case PCI_CHIP_JUNIPER_68A1
:
1131 case PCI_CHIP_JUNIPER_68A8
:
1132 case PCI_CHIP_JUNIPER_68A9
:
1133 case PCI_CHIP_JUNIPER_68B0
:
1134 case PCI_CHIP_JUNIPER_68B8
:
1135 case PCI_CHIP_JUNIPER_68B9
:
1136 case PCI_CHIP_JUNIPER_68BE
:
1137 screen
->chip_family
= CHIP_FAMILY_JUNIPER
;
1138 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1141 case PCI_CHIP_CYPRESS_6880
:
1142 case PCI_CHIP_CYPRESS_6888
:
1143 case PCI_CHIP_CYPRESS_6889
:
1144 case PCI_CHIP_CYPRESS_688A
:
1145 case PCI_CHIP_CYPRESS_6898
:
1146 case PCI_CHIP_CYPRESS_6899
:
1147 case PCI_CHIP_CYPRESS_689E
:
1148 screen
->chip_family
= CHIP_FAMILY_CYPRESS
;
1149 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1152 case PCI_CHIP_HEMLOCK_689C
:
1153 case PCI_CHIP_HEMLOCK_689D
:
1154 screen
->chip_family
= CHIP_FAMILY_HEMLOCK
;
1155 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1158 case PCI_CHIP_PALM_9802
:
1159 case PCI_CHIP_PALM_9803
:
1160 case PCI_CHIP_PALM_9804
:
1161 case PCI_CHIP_PALM_9805
:
1162 screen
->chip_family
= CHIP_FAMILY_PALM
;
1163 screen
->chip_flags
= RADEON_CHIPSET_TCL
;
1167 fprintf(stderr
, "unknown chip id 0x%x, can't guess.\n",
1176 /* Create the device specific screen private data struct.
1178 static radeonScreenPtr
1179 radeonCreateScreen( __DRIscreen
*sPriv
)
1181 radeonScreenPtr screen
;
1182 RADEONDRIPtr dri_priv
= (RADEONDRIPtr
)sPriv
->pDevPriv
;
1183 unsigned char *RADEONMMIO
= NULL
;
1188 if (sPriv
->devPrivSize
!= sizeof(RADEONDRIRec
)) {
1189 fprintf(stderr
,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n");
1193 /* Allocate the private area */
1194 screen
= (radeonScreenPtr
) CALLOC( sizeof(*screen
) );
1196 __driUtilMessage("%s: Could not allocate memory for screen structure",
1201 radeon_init_debug();
1203 /* parse information in __driConfigOptions */
1204 driParseOptionInfo (&screen
->optionCache
,
1205 __driConfigOptions
, __driNConfigOptions
);
1207 /* This is first since which regions we map depends on whether or
1208 * not we are using a PCI card.
1210 screen
->card_type
= (dri_priv
->IsPCI
? RADEON_CARD_PCI
: RADEON_CARD_AGP
);
1214 ret
= radeonGetParam(sPriv
, RADEON_PARAM_GART_BUFFER_OFFSET
,
1215 &screen
->gart_buffer_offset
);
1219 fprintf(stderr
, "drm_radeon_getparam_t (RADEON_PARAM_GART_BUFFER_OFFSET): %d\n", ret
);
1223 ret
= radeonGetParam(sPriv
, RADEON_PARAM_GART_BASE
,
1224 &screen
->gart_base
);
1227 fprintf(stderr
, "drm_radeon_getparam_t (RADEON_PARAM_GART_BASE): %d\n", ret
);
1231 ret
= radeonGetParam(sPriv
, RADEON_PARAM_IRQ_NR
,
1235 fprintf(stderr
, "drm_radeon_getparam_t (RADEON_PARAM_IRQ_NR): %d\n", ret
);
1238 screen
->drmSupportsCubeMapsR200
= (sPriv
->drm_version
.minor
>= 7);
1239 screen
->drmSupportsBlendColor
= (sPriv
->drm_version
.minor
>= 11);
1240 screen
->drmSupportsTriPerf
= (sPriv
->drm_version
.minor
>= 16);
1241 screen
->drmSupportsFragShader
= (sPriv
->drm_version
.minor
>= 18);
1242 screen
->drmSupportsPointSprites
= (sPriv
->drm_version
.minor
>= 13);
1243 screen
->drmSupportsCubeMapsR100
= (sPriv
->drm_version
.minor
>= 15);
1244 screen
->drmSupportsVertexProgram
= (sPriv
->drm_version
.minor
>= 25);
1245 screen
->drmSupportsOcclusionQueries
= (sPriv
->drm_version
.minor
>= 30);
1248 ret
= radeon_set_screen_flags(screen
, dri_priv
->deviceID
);
1252 screen
->mmio
.handle
= dri_priv
->registerHandle
;
1253 screen
->mmio
.size
= dri_priv
->registerSize
;
1254 if ( drmMap( sPriv
->fd
,
1255 screen
->mmio
.handle
,
1257 &screen
->mmio
.map
) ) {
1259 __driUtilMessage("%s: drmMap failed\n", __FUNCTION__
);
1263 RADEONMMIO
= screen
->mmio
.map
;
1265 screen
->status
.handle
= dri_priv
->statusHandle
;
1266 screen
->status
.size
= dri_priv
->statusSize
;
1267 if ( drmMap( sPriv
->fd
,
1268 screen
->status
.handle
,
1269 screen
->status
.size
,
1270 &screen
->status
.map
) ) {
1271 drmUnmap( screen
->mmio
.map
, screen
->mmio
.size
);
1273 __driUtilMessage("%s: drmMap (2) failed\n", __FUNCTION__
);
1276 if (screen
->chip_family
< CHIP_FAMILY_R600
)
1277 screen
->scratch
= (__volatile__
uint32_t *)
1278 ((GLubyte
*)screen
->status
.map
+ RADEON_SCRATCH_REG_OFFSET
);
1280 screen
->scratch
= (__volatile__
uint32_t *)
1281 ((GLubyte
*)screen
->status
.map
+ R600_SCRATCH_REG_OFFSET
);
1283 screen
->buffers
= drmMapBufs( sPriv
->fd
);
1284 if ( !screen
->buffers
) {
1285 drmUnmap( screen
->status
.map
, screen
->status
.size
);
1286 drmUnmap( screen
->mmio
.map
, screen
->mmio
.size
);
1288 __driUtilMessage("%s: drmMapBufs failed\n", __FUNCTION__
);
1292 if ( dri_priv
->gartTexHandle
&& dri_priv
->gartTexMapSize
) {
1293 screen
->gartTextures
.handle
= dri_priv
->gartTexHandle
;
1294 screen
->gartTextures
.size
= dri_priv
->gartTexMapSize
;
1295 if ( drmMap( sPriv
->fd
,
1296 screen
->gartTextures
.handle
,
1297 screen
->gartTextures
.size
,
1298 (drmAddressPtr
)&screen
->gartTextures
.map
) ) {
1299 drmUnmapBufs( screen
->buffers
);
1300 drmUnmap( screen
->status
.map
, screen
->status
.size
);
1301 drmUnmap( screen
->mmio
.map
, screen
->mmio
.size
);
1303 __driUtilMessage("%s: drmMap failed for GART texture area\n", __FUNCTION__
);
1307 screen
->gart_texture_offset
= dri_priv
->gartTexOffset
+ screen
->gart_base
;
1310 if ((screen
->chip_family
== CHIP_FAMILY_R350
|| screen
->chip_family
== CHIP_FAMILY_R300
) &&
1311 sPriv
->ddx_version
.minor
< 2) {
1312 fprintf(stderr
, "xf86-video-ati-6.6.2 or newer needed for Radeon 9500/9700/9800 cards.\n");
1316 if ((sPriv
->drm_version
.minor
< 29) && (screen
->chip_family
>= CHIP_FAMILY_RV515
)) {
1317 fprintf(stderr
, "R500 support requires a newer drm.\n");
1321 if (getenv("R300_NO_TCL"))
1322 screen
->chip_flags
&= ~RADEON_CHIPSET_TCL
;
1324 if (screen
->chip_family
<= CHIP_FAMILY_RS200
)
1325 screen
->chip_flags
|= RADEON_CLASS_R100
;
1326 else if (screen
->chip_family
<= CHIP_FAMILY_RV280
)
1327 screen
->chip_flags
|= RADEON_CLASS_R200
;
1328 else if (screen
->chip_family
<= CHIP_FAMILY_RV570
)
1329 screen
->chip_flags
|= RADEON_CLASS_R300
;
1331 screen
->chip_flags
|= RADEON_CLASS_R600
;
1333 /* set group bytes for r6xx+ */
1334 if (screen
->chip_family
>= CHIP_FAMILY_CEDAR
)
1335 screen
->group_bytes
= 512;
1337 screen
->group_bytes
= 256;
1339 screen
->cpp
= dri_priv
->bpp
/ 8;
1340 screen
->AGPMode
= dri_priv
->AGPMode
;
1342 ret
= radeonGetParam(sPriv
, RADEON_PARAM_FB_LOCATION
, &temp
);
1345 if(screen
->chip_family
>= CHIP_FAMILY_R600
)
1350 fprintf(stderr
, "Unable to get fb location need newer drm\n");
1355 screen
->fbLocation
= (temp
& 0xffff) << 24;
1362 if (screen
->chip_family
< CHIP_FAMILY_RS600
&& !screen
->kernel_mm
)
1363 screen
->fbLocation
= ( INREG( RADEON_MC_FB_LOCATION
) & 0xffff) << 16;
1367 fprintf(stderr
, "Unable to get fb location need newer drm\n");
1373 screen
->fbLocation
= (temp
& 0xffff) << 16;
1377 if (IS_R300_CLASS(screen
)) {
1378 ret
= radeonGetParam(sPriv
, RADEON_PARAM_NUM_GB_PIPES
, &temp
);
1380 fprintf(stderr
, "Unable to get num_pipes, need newer drm\n");
1381 switch (screen
->chip_family
) {
1382 case CHIP_FAMILY_R300
:
1383 case CHIP_FAMILY_R350
:
1384 screen
->num_gb_pipes
= 2;
1386 case CHIP_FAMILY_R420
:
1387 case CHIP_FAMILY_R520
:
1388 case CHIP_FAMILY_R580
:
1389 case CHIP_FAMILY_RV560
:
1390 case CHIP_FAMILY_RV570
:
1391 screen
->num_gb_pipes
= 4;
1393 case CHIP_FAMILY_RV350
:
1394 case CHIP_FAMILY_RV515
:
1395 case CHIP_FAMILY_RV530
:
1396 case CHIP_FAMILY_RV410
:
1398 screen
->num_gb_pipes
= 1;
1402 screen
->num_gb_pipes
= temp
;
1405 /* pipe overrides */
1406 switch (dri_priv
->deviceID
) {
1407 case PCI_CHIP_R300_AD
: /* 9500 with 1 quadpipe verified by: Reid Linnemann <lreid@cs.okstate.edu> */
1408 case PCI_CHIP_R350_AH
: /* 9800 SE only have 1 quadpipe */
1409 case PCI_CHIP_RV410_5E4C
: /* RV410 SE only have 1 quadpipe */
1410 case PCI_CHIP_RV410_5E4F
: /* RV410 SE only have 1 quadpipe */
1411 screen
->num_gb_pipes
= 1;
1417 if ( sPriv
->drm_version
.minor
>= 31 ) {
1418 ret
= radeonGetParam(sPriv
, RADEON_PARAM_NUM_Z_PIPES
, &temp
);
1420 screen
->num_z_pipes
= 2;
1422 screen
->num_z_pipes
= temp
;
1424 screen
->num_z_pipes
= 2;
1427 if ( sPriv
->drm_version
.minor
>= 10 ) {
1428 drm_radeon_setparam_t sp
;
1430 sp
.param
= RADEON_SETPARAM_FB_LOCATION
;
1431 sp
.value
= screen
->fbLocation
;
1433 drmCommandWrite( sPriv
->fd
, DRM_RADEON_SETPARAM
,
1434 &sp
, sizeof( sp
) );
1437 screen
->frontOffset
= dri_priv
->frontOffset
;
1438 screen
->frontPitch
= dri_priv
->frontPitch
;
1439 screen
->backOffset
= dri_priv
->backOffset
;
1440 screen
->backPitch
= dri_priv
->backPitch
;
1441 screen
->depthOffset
= dri_priv
->depthOffset
;
1442 screen
->depthPitch
= dri_priv
->depthPitch
;
1444 /* Check if ddx has set up a surface reg to cover depth buffer */
1445 screen
->depthHasSurface
= (sPriv
->ddx_version
.major
> 4) ||
1446 /* these chips don't use tiled z without hyperz. So always pretend
1447 we have set up a surface which will cause linear reads/writes */
1448 (IS_R100_CLASS(screen
) &&
1449 !(screen
->chip_flags
& RADEON_CHIPSET_TCL
));
1451 if ( dri_priv
->textureSize
== 0 ) {
1452 screen
->texOffset
[RADEON_LOCAL_TEX_HEAP
] = screen
->gart_texture_offset
;
1453 screen
->texSize
[RADEON_LOCAL_TEX_HEAP
] = dri_priv
->gartTexMapSize
;
1454 screen
->logTexGranularity
[RADEON_LOCAL_TEX_HEAP
] =
1455 dri_priv
->log2GARTTexGran
;
1457 screen
->texOffset
[RADEON_LOCAL_TEX_HEAP
] = dri_priv
->textureOffset
1458 + screen
->fbLocation
;
1459 screen
->texSize
[RADEON_LOCAL_TEX_HEAP
] = dri_priv
->textureSize
;
1460 screen
->logTexGranularity
[RADEON_LOCAL_TEX_HEAP
] =
1461 dri_priv
->log2TexGran
;
1464 if ( !screen
->gartTextures
.map
|| dri_priv
->textureSize
== 0
1465 || getenv( "RADEON_GARTTEXTURING_FORCE_DISABLE" ) ) {
1466 screen
->numTexHeaps
= RADEON_NR_TEX_HEAPS
- 1;
1467 screen
->texOffset
[RADEON_GART_TEX_HEAP
] = 0;
1468 screen
->texSize
[RADEON_GART_TEX_HEAP
] = 0;
1469 screen
->logTexGranularity
[RADEON_GART_TEX_HEAP
] = 0;
1471 screen
->numTexHeaps
= RADEON_NR_TEX_HEAPS
;
1472 screen
->texOffset
[RADEON_GART_TEX_HEAP
] = screen
->gart_texture_offset
;
1473 screen
->texSize
[RADEON_GART_TEX_HEAP
] = dri_priv
->gartTexMapSize
;
1474 screen
->logTexGranularity
[RADEON_GART_TEX_HEAP
] =
1475 dri_priv
->log2GARTTexGran
;
1479 screen
->extensions
[i
++] = &driCopySubBufferExtension
.base
;
1480 screen
->extensions
[i
++] = &driReadDrawableExtension
;
1482 if ( screen
->irq
!= 0 ) {
1483 screen
->extensions
[i
++] = &driSwapControlExtension
.base
;
1484 screen
->extensions
[i
++] = &driMediaStreamCounterExtension
.base
;
1487 #if defined(RADEON_R100)
1488 screen
->extensions
[i
++] = &radeonTexOffsetExtension
.base
;
1491 #if defined(RADEON_R200)
1492 screen
->extensions
[i
++] = &r200texOffsetExtension
.base
;
1495 #if defined(RADEON_R300)
1496 screen
->extensions
[i
++] = &r300texOffsetExtension
.base
;
1499 #if defined(RADEON_R600)
1500 screen
->extensions
[i
++] = &r600texOffsetExtension
.base
;
1503 screen
->extensions
[i
++] = &dri2ConfigQueryExtension
.base
;
1505 screen
->extensions
[i
++] = NULL
;
1506 sPriv
->extensions
= screen
->extensions
;
1508 screen
->driScreen
= sPriv
;
1509 screen
->sarea_priv_offset
= dri_priv
->sarea_priv_offset
;
1510 screen
->sarea
= (drm_radeon_sarea_t
*) ((GLubyte
*) sPriv
->pSAREA
+
1511 screen
->sarea_priv_offset
);
1513 screen
->bom
= radeon_bo_manager_legacy_ctor(screen
);
1514 if (screen
->bom
== NULL
) {
1522 static radeonScreenPtr
1523 radeonCreateScreen2(__DRIscreen
*sPriv
)
1525 radeonScreenPtr screen
;
1528 uint32_t device_id
= 0;
1531 /* Allocate the private area */
1532 screen
= (radeonScreenPtr
) CALLOC( sizeof(*screen
) );
1534 __driUtilMessage("%s: Could not allocate memory for screen structure",
1536 fprintf(stderr
, "leaving here\n");
1540 radeon_init_debug();
1542 /* parse information in __driConfigOptions */
1543 driParseOptionInfo (&screen
->optionCache
,
1544 __driConfigOptions
, __driNConfigOptions
);
1546 screen
->kernel_mm
= 1;
1547 screen
->chip_flags
= 0;
1549 /* if we have kms we can support all of these */
1550 screen
->drmSupportsCubeMapsR200
= 1;
1551 screen
->drmSupportsBlendColor
= 1;
1552 screen
->drmSupportsTriPerf
= 1;
1553 screen
->drmSupportsFragShader
= 1;
1554 screen
->drmSupportsPointSprites
= 1;
1555 screen
->drmSupportsCubeMapsR100
= 1;
1556 screen
->drmSupportsVertexProgram
= 1;
1557 screen
->drmSupportsOcclusionQueries
= 1;
1560 ret
= radeonGetParam(sPriv
, RADEON_PARAM_DEVICE_ID
, &device_id
);
1563 fprintf(stderr
, "drm_radeon_getparam_t (RADEON_PARAM_DEVICE_ID): %d\n", ret
);
1567 ret
= radeon_set_screen_flags(screen
, device_id
);
1571 if (getenv("R300_NO_TCL"))
1572 screen
->chip_flags
&= ~RADEON_CHIPSET_TCL
;
1574 if (screen
->chip_family
<= CHIP_FAMILY_RS200
)
1575 screen
->chip_flags
|= RADEON_CLASS_R100
;
1576 else if (screen
->chip_family
<= CHIP_FAMILY_RV280
)
1577 screen
->chip_flags
|= RADEON_CLASS_R200
;
1578 else if (screen
->chip_family
<= CHIP_FAMILY_RV570
)
1579 screen
->chip_flags
|= RADEON_CLASS_R300
;
1581 screen
->chip_flags
|= RADEON_CLASS_R600
;
1583 /* r6xx+ tiling, default group bytes */
1584 if (screen
->chip_family
>= CHIP_FAMILY_CEDAR
)
1585 screen
->group_bytes
= 512;
1587 screen
->group_bytes
= 256;
1588 if (IS_R600_CLASS(screen
) && (sPriv
->drm_version
.minor
>= 6) &&
1589 (screen
->chip_family
< CHIP_FAMILY_CEDAR
)) {
1590 ret
= radeonGetParam(sPriv
, RADEON_INFO_TILE_CONFIG
, &temp
);
1592 fprintf(stderr
, "failed to get tiling info\n");
1594 screen
->tile_config
= temp
;
1595 screen
->r7xx_bank_op
= 0;
1596 switch((screen
->tile_config
& 0xe) >> 1) {
1598 screen
->num_channels
= 1;
1601 screen
->num_channels
= 2;
1604 screen
->num_channels
= 4;
1607 screen
->num_channels
= 8;
1610 fprintf(stderr
, "bad channels\n");
1613 switch((screen
->tile_config
& 0x30) >> 4) {
1615 screen
->num_banks
= 4;
1618 screen
->num_banks
= 8;
1621 fprintf(stderr
, "bad banks\n");
1624 switch((screen
->tile_config
& 0xc0) >> 6) {
1626 screen
->group_bytes
= 256;
1629 screen
->group_bytes
= 512;
1632 fprintf(stderr
, "bad group_bytes\n");
1638 if (IS_R300_CLASS(screen
)) {
1639 ret
= radeonGetParam(sPriv
, RADEON_PARAM_NUM_GB_PIPES
, &temp
);
1641 fprintf(stderr
, "Unable to get num_pipes, need newer drm\n");
1642 switch (screen
->chip_family
) {
1643 case CHIP_FAMILY_R300
:
1644 case CHIP_FAMILY_R350
:
1645 screen
->num_gb_pipes
= 2;
1647 case CHIP_FAMILY_R420
:
1648 case CHIP_FAMILY_R520
:
1649 case CHIP_FAMILY_R580
:
1650 case CHIP_FAMILY_RV560
:
1651 case CHIP_FAMILY_RV570
:
1652 screen
->num_gb_pipes
= 4;
1654 case CHIP_FAMILY_RV350
:
1655 case CHIP_FAMILY_RV515
:
1656 case CHIP_FAMILY_RV530
:
1657 case CHIP_FAMILY_RV410
:
1659 screen
->num_gb_pipes
= 1;
1663 screen
->num_gb_pipes
= temp
;
1666 /* pipe overrides */
1667 switch (device_id
) {
1668 case PCI_CHIP_R300_AD
: /* 9500 with 1 quadpipe verified by: Reid Linnemann <lreid@cs.okstate.edu> */
1669 case PCI_CHIP_R350_AH
: /* 9800 SE only have 1 quadpipe */
1670 case PCI_CHIP_RV410_5E4C
: /* RV410 SE only have 1 quadpipe */
1671 case PCI_CHIP_RV410_5E4F
: /* RV410 SE only have 1 quadpipe */
1672 screen
->num_gb_pipes
= 1;
1678 ret
= radeonGetParam(sPriv
, RADEON_PARAM_NUM_Z_PIPES
, &temp
);
1680 screen
->num_z_pipes
= 2;
1682 screen
->num_z_pipes
= temp
;
1687 screen
->extensions
[i
++] = &driCopySubBufferExtension
.base
;
1688 screen
->extensions
[i
++] = &driReadDrawableExtension
;
1689 screen
->extensions
[i
++] = &dri2ConfigQueryExtension
.base
;
1691 if ( screen
->irq
!= 0 ) {
1692 screen
->extensions
[i
++] = &driSwapControlExtension
.base
;
1693 screen
->extensions
[i
++] = &driMediaStreamCounterExtension
.base
;
1696 #if defined(RADEON_R100)
1697 screen
->extensions
[i
++] = &radeonTexBufferExtension
.base
;
1700 #if defined(RADEON_R200)
1701 screen
->extensions
[i
++] = &r200TexBufferExtension
.base
;
1704 #if defined(RADEON_R300)
1705 screen
->extensions
[i
++] = &r300TexBufferExtension
.base
;
1708 #if defined(RADEON_R600)
1709 screen
->extensions
[i
++] = &r600TexBufferExtension
.base
;
1712 screen
->extensions
[i
++] = &radeonFlushExtension
.base
;
1713 screen
->extensions
[i
++] = &radeonImageExtension
.base
;
1715 screen
->extensions
[i
++] = NULL
;
1716 sPriv
->extensions
= screen
->extensions
;
1718 screen
->driScreen
= sPriv
;
1719 screen
->bom
= radeon_bo_manager_gem_ctor(sPriv
->fd
);
1720 if (screen
->bom
== NULL
) {
1727 /* Destroy the device specific screen private data struct.
1730 radeonDestroyScreen( __DRIscreen
*sPriv
)
1732 radeonScreenPtr screen
= (radeonScreenPtr
)sPriv
->private;
1737 if (screen
->kernel_mm
) {
1738 #ifdef RADEON_BO_TRACK
1739 radeon_tracker_print(&screen
->bom
->tracker
, stderr
);
1741 radeon_bo_manager_gem_dtor(screen
->bom
);
1743 radeon_bo_manager_legacy_dtor(screen
->bom
);
1745 if ( screen
->gartTextures
.map
) {
1746 drmUnmap( screen
->gartTextures
.map
, screen
->gartTextures
.size
);
1748 drmUnmapBufs( screen
->buffers
);
1749 drmUnmap( screen
->status
.map
, screen
->status
.size
);
1750 drmUnmap( screen
->mmio
.map
, screen
->mmio
.size
);
1753 /* free all option information */
1754 driDestroyOptionInfo (&screen
->optionCache
);
1757 sPriv
->private = NULL
;
1761 /* Initialize the driver specific screen private data.
1764 radeonInitDriver( __DRIscreen
*sPriv
)
1766 if (sPriv
->dri2
.enabled
) {
1767 sPriv
->private = (void *) radeonCreateScreen2( sPriv
);
1769 sPriv
->private = (void *) radeonCreateScreen( sPriv
);
1771 if ( !sPriv
->private ) {
1772 radeonDestroyScreen( sPriv
);
1782 * Create the Mesa framebuffer and renderbuffers for a given window/drawable.
1784 * \todo This function (and its interface) will need to be updated to support
1788 radeonCreateBuffer( __DRIscreen
*driScrnPriv
,
1789 __DRIdrawable
*driDrawPriv
,
1790 const struct gl_config
*mesaVis
,
1791 GLboolean isPixmap
)
1793 radeonScreenPtr screen
= (radeonScreenPtr
) driScrnPriv
->private;
1795 const GLboolean swDepth
= GL_FALSE
;
1796 const GLboolean swAlpha
= GL_FALSE
;
1797 const GLboolean swAccum
= mesaVis
->accumRedBits
> 0;
1798 const GLboolean swStencil
= mesaVis
->stencilBits
> 0 &&
1799 mesaVis
->depthBits
!= 24;
1800 gl_format rgbFormat
;
1801 struct radeon_framebuffer
*rfb
;
1804 return GL_FALSE
; /* not implemented */
1806 rfb
= CALLOC_STRUCT(radeon_framebuffer
);
1810 _mesa_initialize_window_framebuffer(&rfb
->base
, mesaVis
);
1812 if (mesaVis
->redBits
== 5)
1813 rgbFormat
= _mesa_little_endian() ? MESA_FORMAT_RGB565
: MESA_FORMAT_RGB565_REV
;
1814 else if (mesaVis
->alphaBits
== 0)
1815 rgbFormat
= _mesa_little_endian() ? MESA_FORMAT_XRGB8888
: MESA_FORMAT_XRGB8888_REV
;
1817 rgbFormat
= _mesa_little_endian() ? MESA_FORMAT_ARGB8888
: MESA_FORMAT_ARGB8888_REV
;
1819 /* front color renderbuffer */
1820 rfb
->color_rb
[0] = radeon_create_renderbuffer(rgbFormat
, driDrawPriv
);
1821 _mesa_add_renderbuffer(&rfb
->base
, BUFFER_FRONT_LEFT
, &rfb
->color_rb
[0]->base
);
1822 rfb
->color_rb
[0]->has_surface
= 1;
1824 /* back color renderbuffer */
1825 if (mesaVis
->doubleBufferMode
) {
1826 rfb
->color_rb
[1] = radeon_create_renderbuffer(rgbFormat
, driDrawPriv
);
1827 _mesa_add_renderbuffer(&rfb
->base
, BUFFER_BACK_LEFT
, &rfb
->color_rb
[1]->base
);
1828 rfb
->color_rb
[1]->has_surface
= 1;
1831 if (mesaVis
->depthBits
== 24) {
1832 if (mesaVis
->stencilBits
== 8) {
1833 struct radeon_renderbuffer
*depthStencilRb
=
1834 radeon_create_renderbuffer(MESA_FORMAT_S8_Z24
, driDrawPriv
);
1835 _mesa_add_renderbuffer(&rfb
->base
, BUFFER_DEPTH
, &depthStencilRb
->base
);
1836 _mesa_add_renderbuffer(&rfb
->base
, BUFFER_STENCIL
, &depthStencilRb
->base
);
1837 depthStencilRb
->has_surface
= screen
->depthHasSurface
;
1839 /* depth renderbuffer */
1840 struct radeon_renderbuffer
*depth
=
1841 radeon_create_renderbuffer(MESA_FORMAT_X8_Z24
, driDrawPriv
);
1842 _mesa_add_renderbuffer(&rfb
->base
, BUFFER_DEPTH
, &depth
->base
);
1843 depth
->has_surface
= screen
->depthHasSurface
;
1845 } else if (mesaVis
->depthBits
== 16) {
1846 /* just 16-bit depth buffer, no hw stencil */
1847 struct radeon_renderbuffer
*depth
=
1848 radeon_create_renderbuffer(MESA_FORMAT_Z16
, driDrawPriv
);
1849 _mesa_add_renderbuffer(&rfb
->base
, BUFFER_DEPTH
, &depth
->base
);
1850 depth
->has_surface
= screen
->depthHasSurface
;
1853 _mesa_add_soft_renderbuffers(&rfb
->base
,
1854 GL_FALSE
, /* color */
1859 GL_FALSE
/* aux */);
1860 driDrawPriv
->driverPrivate
= (void *) rfb
;
1862 return (driDrawPriv
->driverPrivate
!= NULL
);
1866 static void radeon_cleanup_renderbuffers(struct radeon_framebuffer
*rfb
)
1868 struct radeon_renderbuffer
*rb
;
1870 rb
= rfb
->color_rb
[0];
1872 radeon_bo_unref(rb
->bo
);
1875 rb
= rfb
->color_rb
[1];
1877 radeon_bo_unref(rb
->bo
);
1880 rb
= radeon_get_renderbuffer(&rfb
->base
, BUFFER_DEPTH
);
1882 radeon_bo_unref(rb
->bo
);
1888 radeonDestroyBuffer(__DRIdrawable
*driDrawPriv
)
1890 struct radeon_framebuffer
*rfb
;
1894 rfb
= (void*)driDrawPriv
->driverPrivate
;
1897 radeon_cleanup_renderbuffers(rfb
);
1898 _mesa_reference_framebuffer((struct gl_framebuffer
**)(&(driDrawPriv
->driverPrivate
)), NULL
);
1903 * This is the driver specific part of the createNewScreen entry point.
1905 * \todo maybe fold this into intelInitDriver
1907 * \return the struct gl_config supported by this driver
1909 static const __DRIconfig
**
1910 radeonInitScreen(__DRIscreen
*psp
)
1912 #if defined(RADEON_R100)
1913 static const char *driver_name
= "Radeon";
1914 static const __DRIutilversion2 ddx_expected
= { 4, 5, 0, 0 };
1915 static const __DRIversion dri_expected
= { 4, 0, 0 };
1916 static const __DRIversion drm_expected
= { 1, 6, 0 };
1917 #elif defined(RADEON_R200)
1918 static const char *driver_name
= "R200";
1919 static const __DRIutilversion2 ddx_expected
= { 4, 5, 0, 0 };
1920 static const __DRIversion dri_expected
= { 4, 0, 0 };
1921 static const __DRIversion drm_expected
= { 1, 6, 0 };
1922 #elif defined(RADEON_R300)
1923 static const char *driver_name
= "R300";
1924 static const __DRIutilversion2 ddx_expected
= { 4, 5, 0, 0 };
1925 static const __DRIversion dri_expected
= { 4, 0, 0 };
1926 static const __DRIversion drm_expected
= { 1, 24, 0 };
1927 #elif defined(RADEON_R600)
1928 static const char *driver_name
= "R600";
1929 static const __DRIutilversion2 ddx_expected
= { 4, 5, 0, 0 };
1930 static const __DRIversion dri_expected
= { 4, 0, 0 };
1931 static const __DRIversion drm_expected
= { 1, 24, 0 };
1933 RADEONDRIPtr dri_priv
= (RADEONDRIPtr
) psp
->pDevPriv
;
1935 if ( ! driCheckDriDdxDrmVersions3( driver_name
,
1936 &psp
->dri_version
, & dri_expected
,
1937 &psp
->ddx_version
, & ddx_expected
,
1938 &psp
->drm_version
, & drm_expected
) ) {
1942 if (!radeonInitDriver(psp
))
1945 /* for now fill in all modes */
1946 return radeonFillInModes( psp
,
1948 (dri_priv
->bpp
== 16) ? 16 : 24,
1949 (dri_priv
->bpp
== 16) ? 0 : 8, 1);
1951 #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
1954 * This is the driver specific part of the createNewScreen entry point.
1955 * Called when using DRI2.
1957 * \return the struct gl_config supported by this driver
1960 __DRIconfig
**radeonInitScreen2(__DRIscreen
*psp
)
1962 GLenum fb_format
[3];
1964 /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
1965 * support pageflipping at all.
1967 static const GLenum back_buffer_modes
[] = {
1968 GLX_NONE
, GLX_SWAP_UNDEFINED_OML
, /*, GLX_SWAP_COPY_OML*/
1970 uint8_t depth_bits
[4], stencil_bits
[4], msaa_samples_array
[1];
1972 __DRIconfig
**configs
= NULL
;
1974 if (!radeonInitDriver(psp
)) {
1978 stencil_bits
[0] = 0;
1980 stencil_bits
[1] = 0;
1982 stencil_bits
[2] = 0;
1984 stencil_bits
[3] = 8;
1986 msaa_samples_array
[0] = 0;
1988 fb_format
[0] = GL_RGB
;
1989 fb_type
[0] = GL_UNSIGNED_SHORT_5_6_5
;
1991 fb_format
[1] = GL_BGR
;
1992 fb_type
[1] = GL_UNSIGNED_INT_8_8_8_8_REV
;
1994 fb_format
[2] = GL_BGRA
;
1995 fb_type
[2] = GL_UNSIGNED_INT_8_8_8_8_REV
;
1997 for (color
= 0; color
< ARRAY_SIZE(fb_format
); color
++) {
1998 __DRIconfig
**new_configs
;
2000 new_configs
= driCreateConfigs(fb_format
[color
], fb_type
[color
],
2003 ARRAY_SIZE(depth_bits
),
2005 ARRAY_SIZE(back_buffer_modes
),
2007 ARRAY_SIZE(msaa_samples_array
),
2009 if (configs
== NULL
)
2010 configs
= new_configs
;
2012 configs
= driConcatConfigs(configs
, new_configs
);
2015 if (configs
== NULL
) {
2016 fprintf(stderr
, "[%s:%u] Error creating FBConfig!\n", __func__
,
2021 return (const __DRIconfig
**)configs
;
2025 * Get information about previous buffer swaps.
2028 getSwapInfo( __DRIdrawable
*dPriv
, __DRIswapInfo
* sInfo
)
2030 struct radeon_framebuffer
*rfb
;
2032 if ( (dPriv
== NULL
) || (dPriv
->driContextPriv
== NULL
)
2033 || (dPriv
->driContextPriv
->driverPrivate
== NULL
)
2034 || (sInfo
== NULL
) ) {
2038 rfb
= dPriv
->driverPrivate
;
2039 sInfo
->swap_count
= rfb
->swap_count
;
2040 sInfo
->swap_ust
= rfb
->swap_ust
;
2041 sInfo
->swap_missed_count
= rfb
->swap_missed_count
;
2043 sInfo
->swap_missed_usage
= (sInfo
->swap_missed_count
!= 0)
2044 ? driCalculateSwapUsage( dPriv
, 0, rfb
->swap_missed_ust
)
2050 const struct __DriverAPIRec driDriverAPI
= {
2051 .InitScreen
= radeonInitScreen
,
2052 .DestroyScreen
= radeonDestroyScreen
,
2053 #if defined(RADEON_R200)
2054 .CreateContext
= r200CreateContext
,
2055 .DestroyContext
= r200DestroyContext
,
2056 #elif defined(RADEON_R600)
2057 .CreateContext
= r600CreateContext
,
2058 .DestroyContext
= radeonDestroyContext
,
2059 #elif defined(RADEON_R300)
2060 .CreateContext
= r300CreateContext
,
2061 .DestroyContext
= radeonDestroyContext
,
2063 .CreateContext
= r100CreateContext
,
2064 .DestroyContext
= radeonDestroyContext
,
2066 .CreateBuffer
= radeonCreateBuffer
,
2067 .DestroyBuffer
= radeonDestroyBuffer
,
2068 .SwapBuffers
= radeonSwapBuffers
,
2069 .MakeCurrent
= radeonMakeCurrent
,
2070 .UnbindContext
= radeonUnbindContext
,
2071 .GetSwapInfo
= getSwapInfo
,
2072 .GetDrawableMSC
= driDrawableGetMSC32
,
2073 .WaitForMSC
= driWaitForMSC32
,
2075 .SwapBuffersMSC
= NULL
,
2076 .CopySubBuffer
= radeonCopySubBuffer
,
2078 .InitScreen2
= radeonInitScreen2
,
2081 /* This is the table of extensions that the loader will dlsym() for. */
2082 PUBLIC
const __DRIextension
*__driDriverExtensions
[] = {
2083 &driCoreExtension
.base
,
2084 &driLegacyExtension
.base
,
2085 &driDRI2Extension
.base
,