Path: blob/21.2-virgl/src/gallium/drivers/lima/lima_query.c
4565 views
/*1* Copyright (c) 2017-2019 Lima Project2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sub license,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the11* next paragraph) shall be included in all copies or substantial portions12* of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER20* DEALINGS IN THE SOFTWARE.21*22*/2324/**25* Stub support for occlusion queries.26*27* Since we expose support for GL 2.0, we have to expose occlusion queries,28* but the spec allows you to expose 0 query counter bits, so we just return 029* as the result of all our queries.30*/3132#include "util/u_debug.h"3334#include "lima_context.h"3536struct lima_query37{38uint8_t pad;39};4041static struct pipe_query *42lima_create_query(struct pipe_context *ctx, unsigned query_type, unsigned index)43{44struct lima_query *query = calloc(1, sizeof(*query));4546/* Note that struct pipe_query isn't actually defined anywhere. */47return (struct pipe_query *)query;48}4950static void51lima_destroy_query(struct pipe_context *ctx, struct pipe_query *query)52{53free(query);54}5556static bool57lima_begin_query(struct pipe_context *ctx, struct pipe_query *query)58{59return true;60}6162static bool63lima_end_query(struct pipe_context *ctx, struct pipe_query *query)64{65return true;66}6768static bool69lima_get_query_result(struct pipe_context *ctx, struct pipe_query *query,70bool wait, union pipe_query_result *vresult)71{72uint64_t *result = &vresult->u64;7374*result = 0;7576return true;77}7879static void80lima_set_active_query_state(struct pipe_context *pipe, bool enable)81{8283}8485void86lima_query_init(struct lima_context *pctx)87{88pctx->base.create_query = lima_create_query;89pctx->base.destroy_query = lima_destroy_query;90pctx->base.begin_query = lima_begin_query;91pctx->base.end_query = lima_end_query;92pctx->base.get_query_result = lima_get_query_result;93pctx->base.set_active_query_state = lima_set_active_query_state;94}95969798