13464ebd5Sriastradh/************************************************************************** 27ec681f3Smrg * 33464ebd5Sriastradh * Copyright 2011 The Chromium OS authors. 43464ebd5Sriastradh * All Rights Reserved. 57ec681f3Smrg * 63464ebd5Sriastradh * Permission is hereby granted, free of charge, to any person obtaining a 73464ebd5Sriastradh * copy of this software and associated documentation files (the 83464ebd5Sriastradh * "Software"), to deal in the Software without restriction, including 93464ebd5Sriastradh * without limitation the rights to use, copy, modify, merge, publish, 103464ebd5Sriastradh * distribute, sub license, and/or sell copies of the Software, and to 113464ebd5Sriastradh * permit persons to whom the Software is furnished to do so, subject to 123464ebd5Sriastradh * the following conditions: 137ec681f3Smrg * 143464ebd5Sriastradh * The above copyright notice and this permission notice (including the 153464ebd5Sriastradh * next paragraph) shall be included in all copies or substantial portions 163464ebd5Sriastradh * of the Software. 177ec681f3Smrg * 183464ebd5Sriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 193464ebd5Sriastradh * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 203464ebd5Sriastradh * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 213464ebd5Sriastradh * IN NO EVENT SHALL GOOGLE AND/OR ITS SUPPLIERS BE LIABLE FOR 223464ebd5Sriastradh * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 233464ebd5Sriastradh * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 243464ebd5Sriastradh * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 257ec681f3Smrg * 263464ebd5Sriastradh **************************************************************************/ 273464ebd5Sriastradh 283464ebd5Sriastradh/* Fake occlusion queries which return 0, it's better than crashing */ 293464ebd5Sriastradh 303464ebd5Sriastradh#include "pipe/p_compiler.h" 313464ebd5Sriastradh 323464ebd5Sriastradh#include "util/u_memory.h" 333464ebd5Sriastradh 343464ebd5Sriastradh#include "i915_context.h" 353464ebd5Sriastradh#include "i915_query.h" 363464ebd5Sriastradh 377ec681f3Smrgstruct i915_query { 383464ebd5Sriastradh unsigned query; 393464ebd5Sriastradh}; 403464ebd5Sriastradh 417ec681f3Smrgstatic struct pipe_query * 427ec681f3Smrgi915_create_query(struct pipe_context *ctx, unsigned query_type, unsigned index) 433464ebd5Sriastradh{ 447ec681f3Smrg struct i915_query *query = CALLOC_STRUCT(i915_query); 453464ebd5Sriastradh 463464ebd5Sriastradh return (struct pipe_query *)query; 473464ebd5Sriastradh} 483464ebd5Sriastradh 497ec681f3Smrgstatic void 507ec681f3Smrgi915_destroy_query(struct pipe_context *ctx, struct pipe_query *query) 513464ebd5Sriastradh{ 523464ebd5Sriastradh FREE(query); 533464ebd5Sriastradh} 543464ebd5Sriastradh 557ec681f3Smrgstatic bool 567ec681f3Smrgi915_begin_query(struct pipe_context *ctx, struct pipe_query *query) 573464ebd5Sriastradh{ 5801e04c3fSmrg return true; 593464ebd5Sriastradh} 603464ebd5Sriastradh 617ec681f3Smrgstatic bool 627ec681f3Smrgi915_end_query(struct pipe_context *ctx, struct pipe_query *query) 633464ebd5Sriastradh{ 6401e04c3fSmrg return true; 653464ebd5Sriastradh} 663464ebd5Sriastradh 677ec681f3Smrgstatic bool 687ec681f3Smrgi915_get_query_result(struct pipe_context *ctx, struct pipe_query *query, 697ec681f3Smrg bool wait, union pipe_query_result *vresult) 703464ebd5Sriastradh{ 717ec681f3Smrg uint64_t *result = (uint64_t *)vresult; 723464ebd5Sriastradh 73af69d88dSmrg /* 2* viewport Max */ 747ec681f3Smrg *result = 512 * 1024 * 1024; 757ec681f3Smrg return true; 763464ebd5Sriastradh} 773464ebd5Sriastradh 7801e04c3fSmrgstatic void 797ec681f3Smrgi915_set_active_query_state(struct pipe_context *pipe, bool enable) 8001e04c3fSmrg{ 8101e04c3fSmrg} 8201e04c3fSmrg 833464ebd5Sriastradhvoid 843464ebd5Sriastradhi915_init_query_functions(struct i915_context *i915) 853464ebd5Sriastradh{ 863464ebd5Sriastradh i915->base.create_query = i915_create_query; 873464ebd5Sriastradh i915->base.destroy_query = i915_destroy_query; 883464ebd5Sriastradh i915->base.begin_query = i915_begin_query; 893464ebd5Sriastradh i915->base.end_query = i915_end_query; 903464ebd5Sriastradh i915->base.get_query_result = i915_get_query_result; 9101e04c3fSmrg i915->base.set_active_query_state = i915_set_active_query_state; 923464ebd5Sriastradh} 93