1848b8605Smrg/* 2848b8605Smrg * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com> 3848b8605Smrg * Copyright 2010 Marek Olšák <maraeo@gmail.com> 4848b8605Smrg * 5848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 6848b8605Smrg * copy of this software and associated documentation files (the "Software"), 7848b8605Smrg * to deal in the Software without restriction, including without limitation 8848b8605Smrg * on the rights to use, copy, modify, merge, publish, distribute, sub 9848b8605Smrg * license, and/or sell copies of the Software, and to permit persons to whom 10848b8605Smrg * the Software is furnished to do so, subject to the following conditions: 11848b8605Smrg * 12848b8605Smrg * The above copyright notice and this permission notice (including the next 13848b8605Smrg * paragraph) shall be included in all copies or substantial portions of the 14848b8605Smrg * Software. 15848b8605Smrg * 16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17848b8605Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 19848b8605Smrg * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 20848b8605Smrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 21848b8605Smrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 22848b8605Smrg * USE OR OTHER DEALINGS IN THE SOFTWARE. */ 23848b8605Smrg 24848b8605Smrg#ifndef R300_SCREEN_H 25848b8605Smrg#define R300_SCREEN_H 26848b8605Smrg 27848b8605Smrg#include "r300_chipset.h" 28b8e80941Smrg#include "radeon/radeon_winsys.h" 29848b8605Smrg#include "pipe/p_screen.h" 30b8e80941Smrg#include "util/slab.h" 31848b8605Smrg#include "os/os_thread.h" 32848b8605Smrg#include <stdio.h> 33848b8605Smrg 34848b8605Smrgstruct r300_screen { 35848b8605Smrg /* Parent class */ 36848b8605Smrg struct pipe_screen screen; 37848b8605Smrg 38848b8605Smrg struct radeon_winsys *rws; 39848b8605Smrg 40848b8605Smrg /* Chipset info and capabilities. */ 41848b8605Smrg struct radeon_info info; 42848b8605Smrg struct r300_capabilities caps; 43848b8605Smrg 44848b8605Smrg /** Combination of DBG_xxx flags */ 45848b8605Smrg unsigned debug; 46848b8605Smrg 47b8e80941Smrg struct slab_parent_pool pool_transfers; 48b8e80941Smrg 49848b8605Smrg /* The MSAA texture with CMASK access; */ 50848b8605Smrg struct pipe_resource *cmask_resource; 51b8e80941Smrg mtx_t cmask_mutex; 52848b8605Smrg}; 53848b8605Smrg 54848b8605Smrg 55848b8605Smrg/* Convenience cast wrappers. */ 56b8e80941Smrgstatic inline struct r300_screen* r300_screen(struct pipe_screen* screen) { 57848b8605Smrg return (struct r300_screen*)screen; 58848b8605Smrg} 59848b8605Smrg 60b8e80941Smrgstatic inline struct radeon_winsys * 61848b8605Smrgradeon_winsys(struct pipe_screen *screen) { 62848b8605Smrg return r300_screen(screen)->rws; 63848b8605Smrg} 64848b8605Smrg 65848b8605Smrg/* Debug functionality. */ 66848b8605Smrg 67848b8605Smrg/** 68848b8605Smrg * Debug flags to disable/enable certain groups of debugging outputs. 69848b8605Smrg * 70848b8605Smrg * \note These may be rather coarse, and the grouping may be impractical. 71848b8605Smrg * If you find, while debugging the driver, that a different grouping 72848b8605Smrg * of these flags would be beneficial, just feel free to change them 73848b8605Smrg * but make sure to update the documentation in r300_debug.c to reflect 74848b8605Smrg * those changes. 75848b8605Smrg */ 76848b8605Smrg/*@{*/ 77848b8605Smrg 78848b8605Smrg/* Logging. */ 79848b8605Smrg#define DBG_PSC (1 << 0) 80848b8605Smrg#define DBG_FP (1 << 1) 81848b8605Smrg#define DBG_VP (1 << 2) 82848b8605Smrg#define DBG_SWTCL (1 << 3) 83848b8605Smrg#define DBG_DRAW (1 << 4) 84848b8605Smrg#define DBG_TEX (1 << 5) 85848b8605Smrg#define DBG_TEXALLOC (1 << 6) 86848b8605Smrg#define DBG_RS (1 << 7) 87848b8605Smrg#define DBG_FB (1 << 8) 88848b8605Smrg#define DBG_RS_BLOCK (1 << 9) 89848b8605Smrg#define DBG_CBZB (1 << 10) 90848b8605Smrg#define DBG_HYPERZ (1 << 11) 91848b8605Smrg#define DBG_SCISSOR (1 << 12) 92848b8605Smrg#define DBG_INFO (1 << 13) 93848b8605Smrg#define DBG_MSAA (1 << 14) 94848b8605Smrg/* Features. */ 95848b8605Smrg#define DBG_ANISOHQ (1 << 16) 96848b8605Smrg#define DBG_NO_TILING (1 << 17) 97848b8605Smrg#define DBG_NO_IMMD (1 << 18) 98848b8605Smrg#define DBG_NO_OPT (1 << 19) 99848b8605Smrg#define DBG_NO_CBZB (1 << 20) 100848b8605Smrg#define DBG_NO_ZMASK (1 << 21) 101848b8605Smrg#define DBG_NO_HIZ (1 << 22) 102848b8605Smrg#define DBG_NO_CMASK (1 << 23) 103848b8605Smrg/* Statistics. */ 104848b8605Smrg#define DBG_P_STAT (1 << 25) 105848b8605Smrg/*@}*/ 106848b8605Smrg 107b8e80941Smrgstatic inline boolean SCREEN_DBG_ON(struct r300_screen * screen, unsigned flags) 108848b8605Smrg{ 109848b8605Smrg return (screen->debug & flags) ? TRUE : FALSE; 110848b8605Smrg} 111848b8605Smrg 112b8e80941Smrgstatic inline void SCREEN_DBG(struct r300_screen * screen, unsigned flags, 113848b8605Smrg const char * fmt, ...) 114848b8605Smrg{ 115848b8605Smrg if (SCREEN_DBG_ON(screen, flags)) { 116848b8605Smrg va_list va; 117848b8605Smrg va_start(va, fmt); 118848b8605Smrg vfprintf(stderr, fmt, va); 119848b8605Smrg va_end(va); 120848b8605Smrg } 121848b8605Smrg} 122848b8605Smrg 123848b8605Smrgvoid r300_init_debug(struct r300_screen* ctx); 124848b8605Smrg 125848b8605Smrgvoid r300_init_screen_resource_functions(struct r300_screen *r300screen); 126848b8605Smrg 127848b8605Smrg#endif /* R300_SCREEN_H */ 128