1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/************************************************************************** 2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright 2010 VMware, Inc. 4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * All Rights Reserved. 5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a 7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the 8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * "Software"), to deal in the Software without restriction, including 9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * without limitation the rights to use, copy, modify, merge, publish, 10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * distribute, sub license, and/or sell copies of the Software, and to 11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * permit persons to whom the Software is furnished to do so, subject to 12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the following conditions: 13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the 15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * next paragraph) shall be included in all copies or substantial portions 16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * of the Software. 17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org **************************************************************************/ 27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef RBUG_CONTEXT_H 29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define RBUG_CONTEXT_H 30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_state.h" 32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_context.h" 33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "rbug_screen.h" 35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct rbug_context { 38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pipe_context base; /**< base class */ 39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pipe_context *pipe; 41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct rbug_list list; 43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* call locking */ 45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org pipe_mutex call_mutex; 46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* current state */ 48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct { 49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct rbug_shader *shader[PIPE_SHADER_TYPES]; 50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct rbug_sampler_view *views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; 52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct rbug_resource *texs[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; 53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned num_views[PIPE_SHADER_TYPES]; 54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned nr_cbufs; 56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct rbug_resource *cbufs[PIPE_MAX_COLOR_BUFS]; 57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct rbug_resource *zsbuf; 58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } curr; 59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* draw locking */ 61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org pipe_mutex draw_mutex; 62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org pipe_condvar draw_cond; 63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned draw_num_rules; 64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int draw_blocker; 65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int draw_blocked; 66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct { 68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct rbug_shader *shader[PIPE_SHADER_TYPES]; 69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct rbug_resource *texture; 71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct rbug_resource *surf; 72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int blocker; 74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } draw_rule; 75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* list of state objects */ 77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org pipe_mutex list_mutex; 78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned num_shaders; 79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct rbug_list shaders; 80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE struct rbug_context * 83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgrbug_context(struct pipe_context *pipe) 84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return (struct rbug_context *)pipe; 86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/********************************************************** 90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * rbug_context.c 91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct pipe_context * 94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgrbug_context_create(struct pipe_screen *screen, struct pipe_context *pipe); 95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/********************************************************** 98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * rbug_core.c 99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid rbug_notify_draw_blocked(struct rbug_context *rb_context); 102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif /* RBUG_CONTEXT_H */ 105