r300_screen.h revision 6c7fac846ef99cde5305cf1011b4570bd1901625
1/* 2 * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com> 3 * Copyright 2010 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#ifndef R300_SCREEN_H 25#define R300_SCREEN_H 26 27#include "pipe/p_screen.h" 28 29#include "r300_chipset.h" 30 31#define R300_TEXTURE_USAGE_TRANSFER PIPE_TEXTURE_USAGE_CUSTOM 32 33struct radeon_winsys; 34 35struct r300_screen { 36 /* Parent class */ 37 struct pipe_screen screen; 38 39 struct radeon_winsys* radeon_winsys; 40 41 /* XXX This hack will be removed once texture transfers become part of 42 * pipe_context. */ 43 struct pipe_context* ctx; 44 45 /* Chipset capabilities */ 46 struct r300_capabilities* caps; 47 48 /** Combination of DBG_xxx flags */ 49 unsigned debug; 50}; 51 52 53/* Convenience cast wrapper. */ 54static INLINE struct r300_screen* r300_screen(struct pipe_screen* screen) { 55 return (struct r300_screen*)screen; 56} 57 58/* Creates a new r300 screen. */ 59struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys); 60 61/* Debug functionality. */ 62 63/** 64 * Debug flags to disable/enable certain groups of debugging outputs. 65 * 66 * \note These may be rather coarse, and the grouping may be impractical. 67 * If you find, while debugging the driver, that a different grouping 68 * of these flags would be beneficial, just feel free to change them 69 * but make sure to update the documentation in r300_debug.c to reflect 70 * those changes. 71 */ 72/*@{*/ 73#define DBG_HELP 0x0000001 74#define DBG_FP 0x0000002 75#define DBG_VP 0x0000004 76#define DBG_CS 0x0000008 77#define DBG_DRAW 0x0000010 78#define DBG_TEX 0x0000020 79#define DBG_FALL 0x0000040 80/*@}*/ 81 82static INLINE boolean SCREEN_DBG_ON(struct r300_screen * screen, unsigned flags) 83{ 84 return (screen->debug & flags) ? TRUE : FALSE; 85} 86 87static INLINE void SCREEN_DBG(struct r300_screen * screen, unsigned flags, 88 const char * fmt, ...) 89{ 90 if (SCREEN_DBG_ON(screen, flags)) { 91 va_list va; 92 va_start(va, fmt); 93 debug_vprintf(fmt, va); 94 va_end(va); 95 } 96} 97 98void r300_init_debug(struct r300_screen* ctx); 99 100#endif /* R300_SCREEN_H */ 101 102