Path: blob/21.2-virgl/src/gallium/drivers/i915/i915_query.c
4570 views
/**************************************************************************1*2* Copyright 2011 The Chromium OS authors.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL GOOGLE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/2627/* Fake occlusion queries which return 0, it's better than crashing */2829#include "pipe/p_compiler.h"3031#include "util/u_memory.h"3233#include "i915_context.h"34#include "i915_query.h"3536struct i915_query {37unsigned query;38};3940static struct pipe_query *41i915_create_query(struct pipe_context *ctx, unsigned query_type, unsigned index)42{43struct i915_query *query = CALLOC_STRUCT(i915_query);4445return (struct pipe_query *)query;46}4748static void49i915_destroy_query(struct pipe_context *ctx, struct pipe_query *query)50{51FREE(query);52}5354static bool55i915_begin_query(struct pipe_context *ctx, struct pipe_query *query)56{57return true;58}5960static bool61i915_end_query(struct pipe_context *ctx, struct pipe_query *query)62{63return true;64}6566static bool67i915_get_query_result(struct pipe_context *ctx, struct pipe_query *query,68bool wait, union pipe_query_result *vresult)69{70uint64_t *result = (uint64_t *)vresult;7172/* 2* viewport Max */73*result = 512 * 1024 * 1024;74return true;75}7677static void78i915_set_active_query_state(struct pipe_context *pipe, bool enable)79{80}8182void83i915_init_query_functions(struct i915_context *i915)84{85i915->base.create_query = i915_create_query;86i915->base.destroy_query = i915_destroy_query;87i915->base.begin_query = i915_begin_query;88i915->base.end_query = i915_end_query;89i915->base.get_query_result = i915_get_query_result;90i915->base.set_active_query_state = i915_set_active_query_state;91}929394