Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
  3.  * Copyright 2011 Marek Olšák <maraeo@gmail.com>
  4.  *
  5.  * Permission is hereby granted, free of charge, to any person obtaining a
  6.  * copy of this software and associated documentation files (the "Software"),
  7.  * to deal in the Software without restriction, including without limitation
  8.  * on the rights to use, copy, modify, merge, publish, distribute, sub
  9.  * license, and/or sell copies of the Software, and to permit persons to whom
  10.  * the Software is furnished to do so, subject to the following conditions:
  11.  *
  12.  * The above copyright notice and this permission notice (including the next
  13.  * paragraph) shall be included in all copies or substantial portions of the
  14.  * Software.
  15.  *
  16.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18.  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  19.  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  20.  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  21.  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  22.  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
  23.  
  24. #include "r300_chipset.h"
  25. #include "../../winsys/radeon/drm/radeon_winsys.h"
  26.  
  27. #include "util/u_debug.h"
  28. #include "util/u_memory.h"
  29. #include "os/os_process.h"
  30.  
  31. #include <stdio.h>
  32. #include <errno.h>
  33.  
  34. /* r300_chipset: A file all to itself for deducing the various properties of
  35.  * Radeons. */
  36.  
  37. static void r300_apply_hyperz_blacklist(struct r300_capabilities* caps)
  38. {
  39.     static const char *list[] = {
  40.         "X",    /* the DDX or indirect rendering */
  41.         "Xorg", /* (alternative name) */
  42.         "check_gl_texture_size", /* compiz */
  43.         "Compiz",
  44.         "gnome-session-check-accelerated-helper",
  45.         "gnome-shell",
  46.         "kwin_opengl_test",
  47.         "kwin",
  48.         "firefox",
  49.     };
  50.     int i;
  51.     char proc_name[128];
  52.    
  53.     if (!os_get_process_name(proc_name, sizeof(proc_name)))
  54.         return;
  55.  
  56.     for (i = 0; i < Elements(list); i++) {
  57.         if (strcmp(list[i], proc_name) == 0) {
  58.             caps->zmask_ram = 0;
  59.             caps->hiz_ram = 0;
  60.             break;
  61.         }
  62.     }
  63. }
  64.  
  65. /* Parse a PCI ID and fill an r300_capabilities struct with information. */
  66. void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
  67. {
  68.     switch (pci_id) {
  69. #define CHIPSET(pci_id, name, chipfamily) \
  70.         case pci_id: \
  71.             caps->family = CHIP_##chipfamily; \
  72.             break;
  73. #include "pci_ids/r300_pci_ids.h"
  74. #undef CHIPSET
  75.  
  76.     default:
  77.         fprintf(stderr, "r300: Warning: Unknown chipset 0x%x\nAborting...",
  78.                 pci_id);
  79.         abort();
  80.     }
  81.  
  82.     /* Defaults. */
  83.     caps->high_second_pipe = FALSE;
  84.     caps->num_vert_fpus = 0;
  85.     caps->hiz_ram = 0;
  86.     caps->zmask_ram = 0;
  87.  
  88.  
  89.     switch (caps->family) {
  90.     case CHIP_R300:
  91.     case CHIP_R350:
  92.         caps->high_second_pipe = TRUE;
  93.         caps->num_vert_fpus = 4;
  94.         caps->hiz_ram = R300_HIZ_LIMIT;
  95.         caps->zmask_ram = PIPE_ZMASK_SIZE;
  96.         break;
  97.  
  98.     case CHIP_RV350:
  99.     case CHIP_RV370:
  100.         caps->high_second_pipe = TRUE;
  101.         caps->num_vert_fpus = 2;
  102.         caps->zmask_ram = RV3xx_ZMASK_SIZE;
  103.         break;
  104.  
  105.     case CHIP_RV380:
  106.         caps->high_second_pipe = TRUE;
  107.         caps->num_vert_fpus = 2;
  108.         caps->hiz_ram = R300_HIZ_LIMIT;
  109.         caps->zmask_ram = RV3xx_ZMASK_SIZE;
  110.         break;
  111.  
  112.     case CHIP_RS400:
  113.     case CHIP_RS600:
  114.     case CHIP_RS690:
  115.     case CHIP_RS740:
  116.         break;
  117.  
  118.     case CHIP_RC410:
  119.     case CHIP_RS480:
  120.         caps->zmask_ram = RV3xx_ZMASK_SIZE;
  121.         break;
  122.  
  123.     case CHIP_R420:
  124.     case CHIP_R423:
  125.     case CHIP_R430:
  126.     case CHIP_R480:
  127.     case CHIP_R481:
  128.     case CHIP_RV410:
  129.         caps->num_vert_fpus = 6;
  130.         caps->hiz_ram = R300_HIZ_LIMIT;
  131.         caps->zmask_ram = PIPE_ZMASK_SIZE;
  132.         break;
  133.  
  134.     case CHIP_R520:
  135.         caps->num_vert_fpus = 8;
  136.         caps->hiz_ram = R300_HIZ_LIMIT;
  137.         caps->zmask_ram = PIPE_ZMASK_SIZE;
  138.         break;
  139.  
  140.     case CHIP_RV515:
  141.         caps->num_vert_fpus = 2;
  142.         caps->hiz_ram = R300_HIZ_LIMIT;
  143.         caps->zmask_ram = PIPE_ZMASK_SIZE;
  144.         break;
  145.  
  146.     case CHIP_RV530:
  147.         caps->num_vert_fpus = 5;
  148.         caps->hiz_ram = RV530_HIZ_LIMIT;
  149.         caps->zmask_ram = PIPE_ZMASK_SIZE;
  150.         break;
  151.  
  152.     case CHIP_R580:
  153.     case CHIP_RV560:
  154.     case CHIP_RV570:
  155.         caps->num_vert_fpus = 8;
  156.         caps->hiz_ram = RV530_HIZ_LIMIT;
  157.         caps->zmask_ram = PIPE_ZMASK_SIZE;
  158.         break;
  159.     }
  160.  
  161.     caps->num_tex_units = 16;
  162.     caps->is_r400 = caps->family >= CHIP_R420 && caps->family < CHIP_RV515;
  163.     caps->is_r500 = caps->family >= CHIP_RV515;
  164.     caps->is_rv350 = caps->family >= CHIP_RV350;
  165.     caps->z_compress = caps->is_rv350 ? R300_ZCOMP_8X8 : R300_ZCOMP_4X4;
  166.     caps->dxtc_swizzle = caps->is_r400 || caps->is_r500;
  167.     caps->has_us_format = caps->family == CHIP_R520;
  168.     caps->has_tcl = caps->num_vert_fpus > 0;
  169.  
  170.     if (caps->has_tcl) {
  171.         caps->has_tcl = debug_get_bool_option("RADEON_NO_TCL", FALSE) ? FALSE : TRUE;
  172.     }
  173.  
  174.     r300_apply_hyperz_blacklist(caps);
  175. }
  176.