Path: blob/21.2-virgl/src/gallium/drivers/r300/r300_chipset.c
4570 views
/*1* Copyright 2008 Corbin Simpson <[email protected]>2* Copyright 2011 Marek Olšák <[email protected]>3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* on the rights to use, copy, modify, merge, publish, distribute, sub8* license, and/or sell copies of the Software, and to permit persons to whom9* the Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice (including the next12* paragraph) shall be included in all copies or substantial portions of the13* Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL18* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,19* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR20* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE21* USE OR OTHER DEALINGS IN THE SOFTWARE. */2223#include "r300_chipset.h"24#include "radeon/radeon_winsys.h"2526#include "util/u_debug.h"27#include "util/u_memory.h"28#include "os/os_process.h"2930#include <stdio.h>31#include <errno.h>3233/* r300_chipset: A file all to itself for deducing the various properties of34* Radeons. */3536static void r300_apply_hyperz_blacklist(struct r300_capabilities* caps)37{38static const char *list[] = {39"X", /* the DDX or indirect rendering */40"Xorg", /* (alternative name) */41"check_gl_texture_size", /* compiz */42"Compiz",43"gnome-session-check-accelerated-helper",44"gnome-shell",45"kwin_opengl_test",46"kwin",47"firefox",48};49int i;50char proc_name[128];5152if (!os_get_process_name(proc_name, sizeof(proc_name)))53return;5455for (i = 0; i < ARRAY_SIZE(list); i++) {56if (strcmp(list[i], proc_name) == 0) {57caps->zmask_ram = 0;58caps->hiz_ram = 0;59break;60}61}62}6364/* Parse a PCI ID and fill an r300_capabilities struct with information. */65void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)66{67switch (pci_id) {68#define CHIPSET(pci_id, name, chipfamily) \69case pci_id: \70caps->family = CHIP_##chipfamily; \71break;72#include "pci_ids/r300_pci_ids.h"73#undef CHIPSET7475default:76fprintf(stderr, "r300: Warning: Unknown chipset 0x%x\nAborting...",77pci_id);78abort();79}8081/* Defaults. */82caps->high_second_pipe = FALSE;83caps->num_vert_fpus = 0;84caps->hiz_ram = 0;85caps->zmask_ram = 0;86caps->has_cmask = FALSE;878889switch (caps->family) {90case CHIP_R300:91case CHIP_R350:92caps->high_second_pipe = TRUE;93caps->num_vert_fpus = 4;94caps->has_cmask = TRUE; /* guessed because there is also HiZ */95caps->hiz_ram = R300_HIZ_LIMIT;96caps->zmask_ram = PIPE_ZMASK_SIZE;97break;9899case CHIP_RV350:100case CHIP_RV370:101caps->high_second_pipe = TRUE;102caps->num_vert_fpus = 2;103caps->zmask_ram = RV3xx_ZMASK_SIZE;104break;105106case CHIP_RV380:107caps->high_second_pipe = TRUE;108caps->num_vert_fpus = 2;109caps->has_cmask = TRUE; /* guessed because there is also HiZ */110caps->hiz_ram = R300_HIZ_LIMIT;111caps->zmask_ram = RV3xx_ZMASK_SIZE;112break;113114case CHIP_RS400:115case CHIP_RS600:116case CHIP_RS690:117case CHIP_RS740:118break;119120case CHIP_RC410:121case CHIP_RS480:122caps->zmask_ram = RV3xx_ZMASK_SIZE;123break;124125case CHIP_R420:126case CHIP_R423:127case CHIP_R430:128case CHIP_R480:129case CHIP_R481:130case CHIP_RV410:131caps->num_vert_fpus = 6;132caps->has_cmask = TRUE; /* guessed because there is also HiZ */133caps->hiz_ram = R300_HIZ_LIMIT;134caps->zmask_ram = PIPE_ZMASK_SIZE;135break;136137case CHIP_R520:138caps->num_vert_fpus = 8;139caps->has_cmask = TRUE;140caps->hiz_ram = R300_HIZ_LIMIT;141caps->zmask_ram = PIPE_ZMASK_SIZE;142break;143144case CHIP_RV515:145caps->num_vert_fpus = 2;146caps->has_cmask = TRUE;147caps->hiz_ram = R300_HIZ_LIMIT;148caps->zmask_ram = PIPE_ZMASK_SIZE;149break;150151case CHIP_RV530:152caps->num_vert_fpus = 5;153caps->has_cmask = TRUE;154caps->hiz_ram = RV530_HIZ_LIMIT;155caps->zmask_ram = PIPE_ZMASK_SIZE;156break;157158case CHIP_R580:159case CHIP_RV560:160case CHIP_RV570:161caps->num_vert_fpus = 8;162caps->has_cmask = TRUE;163caps->hiz_ram = RV530_HIZ_LIMIT;164caps->zmask_ram = PIPE_ZMASK_SIZE;165break;166}167168caps->num_tex_units = 16;169caps->is_r400 = caps->family >= CHIP_R420 && caps->family < CHIP_RV515;170caps->is_r500 = caps->family >= CHIP_RV515;171caps->is_rv350 = caps->family >= CHIP_RV350;172caps->z_compress = caps->is_rv350 ? R300_ZCOMP_8X8 : R300_ZCOMP_4X4;173caps->dxtc_swizzle = caps->is_r400 || caps->is_r500;174caps->has_us_format = caps->family == CHIP_R520;175caps->has_tcl = caps->num_vert_fpus > 0;176177if (caps->has_tcl) {178caps->has_tcl = debug_get_bool_option("RADEON_NO_TCL", FALSE) ? FALSE : TRUE;179}180181r300_apply_hyperz_blacklist(caps);182}183184185