Home | History | Annotate | Download | only in r200
      1 /**************************************************************************
      2 
      3 Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
      4                      VA Linux Systems Inc., Fremont, California.
      5 
      6 All Rights Reserved.
      7 
      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:
     15 
     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.
     19 
     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.
     27 
     28 **************************************************************************/
     29 
     30 /*
     31  * Authors:
     32  *   Kevin E. Martin <martin (at) valinux.com>
     33  *   Gareth Hughes <gareth (at) valinux.com>
     34  */
     35 
     36 #ifndef __RADEON_SCREEN_H__
     37 #define __RADEON_SCREEN_H__
     38 
     39 /*
     40  * IMPORTS: these headers contain all the DRI, X and kernel-related
     41  * definitions that we need.
     42  */
     43 #include <xf86drm.h>
     44 #include <radeon_drm.h>
     45 #include "dri_util.h"
     46 #include "radeon_chipset.h"
     47 #include "radeon_reg.h"
     48 #include "xmlconfig.h"
     49 
     50 
     51 typedef struct {
     52    drm_handle_t handle;			/* Handle to the DRM region */
     53    drmSize size;			/* Size of the DRM region */
     54    drmAddress map;			/* Mapping of the DRM region */
     55 } radeonRegionRec, *radeonRegionPtr;
     56 
     57 typedef struct radeon_screen {
     58    int chip_family;
     59    int chip_flags;
     60    int cpp;
     61    int card_type;
     62    int device_id; /* PCI ID */
     63    int AGPMode;
     64    unsigned int irq;			/* IRQ number (0 means none) */
     65 
     66    unsigned int fbLocation;
     67    unsigned int frontOffset;
     68    unsigned int frontPitch;
     69    unsigned int backOffset;
     70    unsigned int backPitch;
     71 
     72    unsigned int depthOffset;
     73    unsigned int depthPitch;
     74 
     75     /* Shared texture data */
     76    int numTexHeaps;
     77    int texOffset[RADEON_NR_TEX_HEAPS];
     78    int texSize[RADEON_NR_TEX_HEAPS];
     79    int logTexGranularity[RADEON_NR_TEX_HEAPS];
     80 
     81    radeonRegionRec mmio;
     82    radeonRegionRec status;
     83    radeonRegionRec gartTextures;
     84 
     85    drmBufMapPtr buffers;
     86 
     87    __volatile__ uint32_t *scratch;
     88 
     89    __DRIscreen *driScreen;
     90    unsigned int gart_buffer_offset;	/* offset in card memory space */
     91    unsigned int gart_texture_offset;	/* offset in card memory space */
     92    unsigned int gart_base;
     93 
     94    GLboolean depthHasSurface;
     95 
     96    /* Configuration cache with default values for all contexts */
     97    driOptionCache optionCache;
     98 
     99    int num_gb_pipes;
    100    int num_z_pipes;
    101    struct radeon_bo_manager *bom;
    102 
    103 } radeonScreenRec, *radeonScreenPtr;
    104 
    105 struct __DRIimageRec {
    106    struct radeon_bo *bo;
    107    GLenum internal_format;
    108    uint32_t dri_format;
    109    GLuint format;
    110    GLenum data_type;
    111    int width, height;  /* in pixels */
    112    int pitch;          /* in pixels */
    113    int cpp;
    114    void *data;
    115 };
    116 
    117 #ifdef RADEON_R200
    118 /* These defines are to ensure that r200_dri's symbols don't conflict with
    119  * radeon's when linked together.
    120  */
    121 #define get_radeon_buffer_object            r200_get_radeon_buffer_object
    122 #define radeonInitBufferObjectFuncs         r200_radeonInitBufferObjectFuncs
    123 #define radeonDestroyContext                r200_radeonDestroyContext
    124 #define radeonInitContext                   r200_radeonInitContext
    125 #define radeonMakeCurrent                   r200_radeonMakeCurrent
    126 #define radeon_prepare_render               r200_radeon_prepare_render
    127 #define radeonUnbindContext                 r200_radeonUnbindContext
    128 #define radeon_update_renderbuffers         r200_radeon_update_renderbuffers
    129 #define radeon_check_front_buffer_rendering r200_radeon_check_front_buffer_rendering
    130 #define radeonCountStateEmitSize            r200_radeonCountStateEmitSize
    131 #define radeon_draw_buffer                  r200_radeon_draw_buffer
    132 #define radeonDrawBuffer                    r200_radeonDrawBuffer
    133 #define radeonEmitState                     r200_radeonEmitState
    134 #define radeonFinish                        r200_radeonFinish
    135 #define radeonFlush                         r200_radeonFlush
    136 #define radeonGetAge                        r200_radeonGetAge
    137 #define radeonReadBuffer                    r200_radeonReadBuffer
    138 #define radeonScissor                       r200_radeonScissor
    139 #define radeonSetCliprects                  r200_radeonSetCliprects
    140 #define radeonUpdateScissor                 r200_radeonUpdateScissor
    141 #define radeonUserClear                     r200_radeonUserClear
    142 #define radeon_viewport                     r200_radeon_viewport
    143 #define radeon_window_moved                 r200_radeon_window_moved
    144 #define rcommonBeginBatch                   r200_rcommonBeginBatch
    145 #define rcommonDestroyCmdBuf                r200_rcommonDestroyCmdBuf
    146 #define rcommonEnsureCmdBufSpace            r200_rcommonEnsureCmdBufSpace
    147 #define rcommonFlushCmdBuf                  r200_rcommonFlushCmdBuf
    148 #define rcommonFlushCmdBufLocked            r200_rcommonFlushCmdBufLocked
    149 #define rcommonInitCmdBuf                   r200_rcommonInitCmdBuf
    150 #define radeonAllocDmaRegion                r200_radeonAllocDmaRegion
    151 #define radeonEmitVec12                     r200_radeonEmitVec12
    152 #define radeonEmitVec16                     r200_radeonEmitVec16
    153 #define radeonEmitVec4                      r200_radeonEmitVec4
    154 #define radeonEmitVec8                      r200_radeonEmitVec8
    155 #define radeonFreeDmaRegions                r200_radeonFreeDmaRegions
    156 #define radeon_init_dma                     r200_radeon_init_dma
    157 #define radeonRefillCurrentDmaRegion        r200_radeonRefillCurrentDmaRegion
    158 #define radeonReleaseArrays                 r200_radeonReleaseArrays
    159 #define radeonReleaseDmaRegions             r200_radeonReleaseDmaRegions
    160 #define radeonReturnDmaRegion               r200_radeonReturnDmaRegion
    161 #define rcommonAllocDmaLowVerts             r200_rcommonAllocDmaLowVerts
    162 #define rcommon_emit_vecfog                 r200_rcommon_emit_vecfog
    163 #define rcommon_emit_vector                 r200_rcommon_emit_vector
    164 #define rcommon_flush_last_swtcl_prim       r200_rcommon_flush_last_swtcl_prim
    165 #define _radeon_debug_add_indent            r200__radeon_debug_add_indent
    166 #define _radeon_debug_remove_indent         r200__radeon_debug_remove_indent
    167 #define radeon_init_debug                   r200_radeon_init_debug
    168 #define _radeon_print                       r200__radeon_print
    169 #define radeon_create_renderbuffer          r200_radeon_create_renderbuffer
    170 #define radeon_fbo_init                     r200_radeon_fbo_init
    171 #define radeon_renderbuffer_set_bo          r200_radeon_renderbuffer_set_bo
    172 #define radeonComputeFogBlendFactor         r200_radeonComputeFogBlendFactor
    173 #define radeonInitStaticFogData             r200_radeonInitStaticFogData
    174 #define get_base_teximage_offset            r200_get_base_teximage_offset
    175 #define get_texture_image_row_stride        r200_get_texture_image_row_stride
    176 #define get_texture_image_size              r200_get_texture_image_size
    177 #define radeon_miptree_create               r200_radeon_miptree_create
    178 #define radeon_miptree_image_offset         r200_radeon_miptree_image_offset
    179 #define radeon_miptree_matches_image        r200_radeon_miptree_matches_image
    180 #define radeon_miptree_reference            r200_radeon_miptree_reference
    181 #define radeon_miptree_unreference          r200_radeon_miptree_unreference
    182 #define radeon_try_alloc_miptree            r200_radeon_try_alloc_miptree
    183 #define radeon_validate_texture_miptree     r200_radeon_validate_texture_miptree
    184 #define radeonReadPixels                    r200_radeonReadPixels
    185 #define radeon_check_query_active           r200_radeon_check_query_active
    186 #define radeonEmitQueryEnd                  r200_radeonEmitQueryEnd
    187 #define radeon_emit_queryobj                r200_radeon_emit_queryobj
    188 #define radeonInitQueryObjFunctions         r200_radeonInitQueryObjFunctions
    189 #define radeonInitSpanFuncs                 r200_radeonInitSpanFuncs
    190 #define copy_rows                           r200_copy_rows
    191 #define radeonChooseTextureFormat           r200_radeonChooseTextureFormat
    192 #define radeonChooseTextureFormat_mesa      r200_radeonChooseTextureFormat_mesa
    193 #define radeonFreeTextureImageBuffer        r200_radeonFreeTextureImageBuffer
    194 #define radeon_image_target_texture_2d      r200_radeon_image_target_texture_2d
    195 #define radeon_init_common_texture_funcs    r200_radeon_init_common_texture_funcs
    196 #define radeonIsFormatRenderable            r200_radeonIsFormatRenderable
    197 #define radeonNewTextureImage               r200_radeonNewTextureImage
    198 #define _radeon_texformat_al88              r200__radeon_texformat_al88
    199 #define _radeon_texformat_argb1555          r200__radeon_texformat_argb1555
    200 #define _radeon_texformat_argb4444          r200__radeon_texformat_argb4444
    201 #define _radeon_texformat_argb8888          r200__radeon_texformat_argb8888
    202 #define _radeon_texformat_rgb565            r200__radeon_texformat_rgb565
    203 #define _radeon_texformat_rgba8888          r200__radeon_texformat_rgba8888
    204 #define radeonCopyTexSubImage               r200_radeonCopyTexSubImage
    205 #define get_tile_size                       r200_get_tile_size
    206 #define tile_image                          r200_tile_image
    207 #define untile_image                        r200_untile_image
    208 #define set_re_cntl_d3d                     r200_set_re_cntl_d3d
    209 #define radeonDestroyBuffer                 r200_radeonDestroyBuffer
    210 #define radeonVendorString                  r200_radeonVendorString
    211 #define radeonGetRendererString             r200_radeonGetRendererString
    212 #endif
    213 
    214 extern void radeonDestroyBuffer(__DRIdrawable *driDrawPriv);
    215 const __DRIextension **__driDriverGetExtensions_radeon(void);
    216 const __DRIextension **__driDriverGetExtensions_r200(void);
    217 
    218 #endif /* __RADEON_SCREEN_H__ */
    219