i915_screen.c File Reference

Include dependency graph for i915_screen.c:

Go to the source code of this file.

Functions

static const char * i915_get_vendor (struct pipe_screen *pscreen)
static const char * i915_get_name (struct pipe_screen *pscreen)
static int i915_get_param (struct pipe_screen *screen, int param)
static float i915_get_paramf (struct pipe_screen *screen, int param)
static boolean i915_is_format_supported (struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned tex_usage, unsigned geom_flags)
static void i915_destroy_screen (struct pipe_screen *screen)
static void * i915_surface_map (struct pipe_screen *screen, struct pipe_surface *surface, unsigned flags)
static void i915_surface_unmap (struct pipe_screen *screen, struct pipe_surface *surface)
struct pipe_screeni915_create_screen (struct pipe_winsys *winsys, uint pci_id)
 Create a new i915_screen object.


Function Documentation

struct pipe_screen* i915_create_screen ( struct pipe_winsys winsys,
uint  pci_id 
) [read]

Create a new i915_screen object.

Definition at line 239 of file i915_screen.c.

References CALLOC_STRUCT, debug_printf(), pipe_screen::destroy, FALSE, pipe_screen::get_name, pipe_screen::get_param, pipe_screen::get_paramf, pipe_screen::get_vendor, i915_destroy_screen(), i915_get_name(), i915_get_param(), i915_get_paramf(), i915_get_vendor(), i915_init_screen_texture_functions(), i915_is_format_supported(), i915_surface_map(), i915_surface_unmap(), pipe_screen::is_format_supported, i915_screen::is_i945, PCI_CHIP_G33_G, PCI_CHIP_I915_G, PCI_CHIP_I915_GM, PCI_CHIP_I945_G, PCI_CHIP_I945_GM, PCI_CHIP_I945_GME, PCI_CHIP_Q33_G, PCI_CHIP_Q35_G, i915_screen::pci_id, i915_screen::screen, pipe_screen::surface_map, pipe_screen::surface_unmap, TRUE, and pipe_screen::winsys.

00240 {
00241    struct i915_screen *i915screen = CALLOC_STRUCT(i915_screen);
00242 
00243    if (!i915screen)
00244       return NULL;
00245 
00246    switch (pci_id) {
00247    case PCI_CHIP_I915_G:
00248    case PCI_CHIP_I915_GM:
00249       i915screen->is_i945 = FALSE;
00250       break;
00251 
00252    case PCI_CHIP_I945_G:
00253    case PCI_CHIP_I945_GM:
00254    case PCI_CHIP_I945_GME:
00255    case PCI_CHIP_G33_G:
00256    case PCI_CHIP_Q33_G:
00257    case PCI_CHIP_Q35_G:
00258       i915screen->is_i945 = TRUE;
00259       break;
00260 
00261    default:
00262       debug_printf("%s: unknown pci id 0x%x, cannot create screen\n", 
00263                    __FUNCTION__, pci_id);
00264       return NULL;
00265    }
00266 
00267    i915screen->pci_id = pci_id;
00268 
00269    i915screen->screen.winsys = winsys;
00270 
00271    i915screen->screen.destroy = i915_destroy_screen;
00272 
00273    i915screen->screen.get_name = i915_get_name;
00274    i915screen->screen.get_vendor = i915_get_vendor;
00275    i915screen->screen.get_param = i915_get_param;
00276    i915screen->screen.get_paramf = i915_get_paramf;
00277    i915screen->screen.is_format_supported = i915_is_format_supported;
00278    i915screen->screen.surface_map = i915_surface_map;
00279    i915screen->screen.surface_unmap = i915_surface_unmap;
00280 
00281    i915_init_screen_texture_functions(&i915screen->screen);
00282 
00283    return &i915screen->screen;
00284 }

static void i915_destroy_screen ( struct pipe_screen screen  )  [static]

Definition at line 195 of file i915_screen.c.

References pipe_winsys::destroy, FREE, and pipe_screen::winsys.

00196 {
00197    struct pipe_winsys *winsys = screen->winsys;
00198 
00199    if(winsys->destroy)
00200       winsys->destroy(winsys);
00201 
00202    FREE(screen);
00203 }

static const char* i915_get_name ( struct pipe_screen pscreen  )  [static]

Definition at line 48 of file i915_screen.c.

References i915_screen(), PCI_CHIP_G33_G, PCI_CHIP_I915_G, PCI_CHIP_I915_GM, PCI_CHIP_I945_G, PCI_CHIP_I945_GM, PCI_CHIP_I945_GME, PCI_CHIP_Q33_G, PCI_CHIP_Q35_G, and util_snprintf.

00049 {
00050    static char buffer[128];
00051    const char *chipset;
00052 
00053    switch (i915_screen(pscreen)->pci_id) {
00054    case PCI_CHIP_I915_G:
00055       chipset = "915G";
00056       break;
00057    case PCI_CHIP_I915_GM:
00058       chipset = "915GM";
00059       break;
00060    case PCI_CHIP_I945_G:
00061       chipset = "945G";
00062       break;
00063    case PCI_CHIP_I945_GM:
00064       chipset = "945GM";
00065       break;
00066    case PCI_CHIP_I945_GME:
00067       chipset = "945GME";
00068       break;
00069    case PCI_CHIP_G33_G:
00070       chipset = "G33";
00071       break;
00072    case PCI_CHIP_Q35_G:
00073       chipset = "Q35";
00074       break;
00075    case PCI_CHIP_Q33_G:
00076       chipset = "Q33";
00077       break;
00078    default:
00079       chipset = "unknown";
00080       break;
00081    }
00082 
00083    util_snprintf(buffer, sizeof(buffer), "i915 (chipset: %s)", chipset);
00084    return buffer;
00085 }

static int i915_get_param ( struct pipe_screen screen,
int  param 
) [static]

Definition at line 89 of file i915_screen.c.

References PIPE_CAP_ANISOTROPIC_FILTER, PIPE_CAP_GLSL, PIPE_CAP_MAX_RENDER_TARGETS, PIPE_CAP_MAX_TEXTURE_2D_LEVELS, PIPE_CAP_MAX_TEXTURE_3D_LEVELS, PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS, PIPE_CAP_NPOT_TEXTURES, PIPE_CAP_OCCLUSION_QUERY, PIPE_CAP_POINT_SPRITE, PIPE_CAP_S3TC, PIPE_CAP_TEXTURE_SHADOW_MAP, and PIPE_CAP_TWO_SIDED_STENCIL.

00090 {
00091    switch (param) {
00092    case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
00093       return 8;
00094    case PIPE_CAP_NPOT_TEXTURES:
00095       return 1;
00096    case PIPE_CAP_TWO_SIDED_STENCIL:
00097       return 1;
00098    case PIPE_CAP_GLSL:
00099       return 0;
00100    case PIPE_CAP_S3TC:
00101       return 0;
00102    case PIPE_CAP_ANISOTROPIC_FILTER:
00103       return 0;
00104    case PIPE_CAP_POINT_SPRITE:
00105       return 0;
00106    case PIPE_CAP_MAX_RENDER_TARGETS:
00107       return 1;
00108    case PIPE_CAP_OCCLUSION_QUERY:
00109       return 0;
00110    case PIPE_CAP_TEXTURE_SHADOW_MAP:
00111       return 1;
00112    case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
00113       return 11; /* max 1024x1024 */
00114    case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
00115       return 8;  /* max 128x128x128 */
00116    case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
00117       return 11; /* max 1024x1024 */
00118    default:
00119       return 0;
00120    }
00121 }

static float i915_get_paramf ( struct pipe_screen screen,
int  param 
) [static]

Definition at line 125 of file i915_screen.c.

References PIPE_CAP_MAX_LINE_WIDTH, PIPE_CAP_MAX_LINE_WIDTH_AA, PIPE_CAP_MAX_POINT_WIDTH, PIPE_CAP_MAX_POINT_WIDTH_AA, PIPE_CAP_MAX_TEXTURE_ANISOTROPY, and PIPE_CAP_MAX_TEXTURE_LOD_BIAS.

00126 {
00127    switch (param) {
00128    case PIPE_CAP_MAX_LINE_WIDTH:
00129       /* fall-through */
00130    case PIPE_CAP_MAX_LINE_WIDTH_AA:
00131       return 7.5;
00132 
00133    case PIPE_CAP_MAX_POINT_WIDTH:
00134       /* fall-through */
00135    case PIPE_CAP_MAX_POINT_WIDTH_AA:
00136       return 255.0;
00137 
00138    case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
00139       return 4.0;
00140 
00141    case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
00142       return 16.0;
00143 
00144    default:
00145       return 0;
00146    }
00147 }

static const char* i915_get_vendor ( struct pipe_screen pscreen  )  [static]

Definition at line 41 of file i915_screen.c.

00042 {
00043    return "Tungsten Graphics, Inc.";
00044 }

static boolean i915_is_format_supported ( struct pipe_screen screen,
enum pipe_format  format,
enum pipe_texture_target  target,
unsigned  tex_usage,
unsigned  geom_flags 
) [static]

Definition at line 151 of file i915_screen.c.

References FALSE, list, PIPE_FORMAT_A8_UNORM, PIPE_FORMAT_A8L8_UNORM, PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_FORMAT_I8_UNORM, PIPE_FORMAT_L8_UNORM, PIPE_FORMAT_NONE, PIPE_FORMAT_R5G6B5_UNORM, PIPE_FORMAT_R8G8B8A8_UNORM, PIPE_FORMAT_S8Z24_UNORM, PIPE_FORMAT_YCBCR, PIPE_FORMAT_YCBCR_REV, PIPE_TEXTURE_USAGE_RENDER_TARGET, and TRUE.

00156 {
00157    static const enum pipe_format tex_supported[] = {
00158       PIPE_FORMAT_R8G8B8A8_UNORM,
00159       PIPE_FORMAT_A8R8G8B8_UNORM,
00160       PIPE_FORMAT_R5G6B5_UNORM,
00161       PIPE_FORMAT_L8_UNORM,
00162       PIPE_FORMAT_A8_UNORM,
00163       PIPE_FORMAT_I8_UNORM,
00164       PIPE_FORMAT_A8L8_UNORM,
00165       PIPE_FORMAT_YCBCR,
00166       PIPE_FORMAT_YCBCR_REV,
00167       PIPE_FORMAT_S8Z24_UNORM,
00168       PIPE_FORMAT_NONE  /* list terminator */
00169    };
00170    static const enum pipe_format surface_supported[] = {
00171       PIPE_FORMAT_A8R8G8B8_UNORM,
00172       PIPE_FORMAT_R5G6B5_UNORM,
00173       PIPE_FORMAT_S8Z24_UNORM,
00174       /*PIPE_FORMAT_R16G16B16A16_SNORM,*/
00175       PIPE_FORMAT_NONE  /* list terminator */
00176    };
00177    const enum pipe_format *list;
00178    uint i;
00179 
00180    if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET)
00181       list = surface_supported;
00182    else
00183       list = tex_supported;
00184 
00185    for (i = 0; list[i] != PIPE_FORMAT_NONE; i++) {
00186       if (list[i] == format)
00187          return TRUE;
00188    }
00189 
00190    return FALSE;
00191 }

static void* i915_surface_map ( struct pipe_screen screen,
struct pipe_surface surface,
unsigned  flags 
) [static]

Definition at line 207 of file i915_screen.c.

References pipe_surface::buffer, pipe_surface::offset, pipe_buffer_map(), PIPE_BUFFER_USAGE_CPU_WRITE, and pipe_surface::texture.

00210 {
00211    char *map = pipe_buffer_map( screen, surface->buffer, flags );
00212    if (map == NULL)
00213       return NULL;
00214 
00215    if (surface->texture &&
00216        (flags & PIPE_BUFFER_USAGE_CPU_WRITE)) 
00217    {
00218       /* Do something to notify contexts of a texture change.  
00219        */
00220       /* i915_screen(screen)->timestamp++; */
00221    }
00222    
00223    return map + surface->offset;
00224 }

static void i915_surface_unmap ( struct pipe_screen screen,
struct pipe_surface surface 
) [static]

Definition at line 227 of file i915_screen.c.

References pipe_surface::buffer, and pipe_buffer_unmap().

00229 {
00230    pipe_buffer_unmap( screen, surface->buffer );
00231 }


Generated on Tue Sep 29 06:25:35 2009 for Gallium3D by  doxygen 1.5.4