1848b8605Smrg/************************************************************************** 2848b8605Smrg * 3848b8605Smrg * Copyright 2011 The Chromium OS authors. 4848b8605Smrg * All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the 8848b8605Smrg * "Software"), to deal in the Software without restriction, including 9848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish, 10848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to 11848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to 12848b8605Smrg * the following conditions: 13848b8605Smrg * 14848b8605Smrg * The above copyright notice and this permission notice (including the 15848b8605Smrg * next paragraph) shall be included in all copies or substantial portions 16848b8605Smrg * of the Software. 17848b8605Smrg * 18848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21848b8605Smrg * IN NO EVENT SHALL GOOGLE AND/OR ITS SUPPLIERS BE LIABLE FOR 22848b8605Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24848b8605Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25848b8605Smrg * 26848b8605Smrg **************************************************************************/ 27848b8605Smrg 28848b8605Smrg/* Fake occlusion queries which return 0, it's better than crashing */ 29848b8605Smrg 30848b8605Smrg#include "pipe/p_compiler.h" 31848b8605Smrg 32848b8605Smrg#include "util/u_memory.h" 33848b8605Smrg 34848b8605Smrg#include "i915_context.h" 35848b8605Smrg#include "i915_query.h" 36848b8605Smrg 37848b8605Smrgstruct i915_query 38848b8605Smrg{ 39848b8605Smrg unsigned query; 40848b8605Smrg}; 41848b8605Smrg 42848b8605Smrgstatic struct pipe_query *i915_create_query(struct pipe_context *ctx, 43848b8605Smrg unsigned query_type, 44848b8605Smrg unsigned index) 45848b8605Smrg{ 46848b8605Smrg struct i915_query *query = CALLOC_STRUCT( i915_query ); 47848b8605Smrg 48848b8605Smrg return (struct pipe_query *)query; 49848b8605Smrg} 50848b8605Smrg 51848b8605Smrgstatic void i915_destroy_query(struct pipe_context *ctx, 52848b8605Smrg struct pipe_query *query) 53848b8605Smrg{ 54848b8605Smrg FREE(query); 55848b8605Smrg} 56848b8605Smrg 57b8e80941Smrgstatic boolean i915_begin_query(struct pipe_context *ctx, 58848b8605Smrg struct pipe_query *query) 59848b8605Smrg{ 60b8e80941Smrg return true; 61848b8605Smrg} 62848b8605Smrg 63b8e80941Smrgstatic bool i915_end_query(struct pipe_context *ctx, struct pipe_query *query) 64848b8605Smrg{ 65b8e80941Smrg return true; 66848b8605Smrg} 67848b8605Smrg 68848b8605Smrgstatic boolean i915_get_query_result(struct pipe_context *ctx, 69848b8605Smrg struct pipe_query *query, 70848b8605Smrg boolean wait, 71848b8605Smrg union pipe_query_result *vresult) 72848b8605Smrg{ 73848b8605Smrg uint64_t *result = (uint64_t*)vresult; 74848b8605Smrg 75848b8605Smrg /* 2* viewport Max */ 76848b8605Smrg *result = 512*1024*1024; 77848b8605Smrg return TRUE; 78848b8605Smrg} 79848b8605Smrg 80b8e80941Smrgstatic void 81b8e80941Smrgi915_set_active_query_state(struct pipe_context *pipe, boolean enable) 82b8e80941Smrg{ 83b8e80941Smrg} 84b8e80941Smrg 85848b8605Smrgvoid 86848b8605Smrgi915_init_query_functions(struct i915_context *i915) 87848b8605Smrg{ 88848b8605Smrg i915->base.create_query = i915_create_query; 89848b8605Smrg i915->base.destroy_query = i915_destroy_query; 90848b8605Smrg i915->base.begin_query = i915_begin_query; 91848b8605Smrg i915->base.end_query = i915_end_query; 92848b8605Smrg i915->base.get_query_result = i915_get_query_result; 93b8e80941Smrg i915->base.set_active_query_state = i915_set_active_query_state; 94848b8605Smrg} 95848b8605Smrg 96