Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/gallium/drivers/i915/i915_query.c
4570 views
1
/**************************************************************************
2
*
3
* Copyright 2011 The Chromium OS authors.
4
* All Rights Reserved.
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a
7
* copy of this software and associated documentation files (the
8
* "Software"), to deal in the Software without restriction, including
9
* without limitation the rights to use, copy, modify, merge, publish,
10
* distribute, sub license, and/or sell copies of the Software, and to
11
* permit persons to whom the Software is furnished to do so, subject to
12
* the following conditions:
13
*
14
* The above copyright notice and this permission notice (including the
15
* next paragraph) shall be included in all copies or substantial portions
16
* of the Software.
17
*
18
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21
* IN NO EVENT SHALL GOOGLE AND/OR ITS SUPPLIERS BE LIABLE FOR
22
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
*
26
**************************************************************************/
27
28
/* Fake occlusion queries which return 0, it's better than crashing */
29
30
#include "pipe/p_compiler.h"
31
32
#include "util/u_memory.h"
33
34
#include "i915_context.h"
35
#include "i915_query.h"
36
37
struct i915_query {
38
unsigned query;
39
};
40
41
static struct pipe_query *
42
i915_create_query(struct pipe_context *ctx, unsigned query_type, unsigned index)
43
{
44
struct i915_query *query = CALLOC_STRUCT(i915_query);
45
46
return (struct pipe_query *)query;
47
}
48
49
static void
50
i915_destroy_query(struct pipe_context *ctx, struct pipe_query *query)
51
{
52
FREE(query);
53
}
54
55
static bool
56
i915_begin_query(struct pipe_context *ctx, struct pipe_query *query)
57
{
58
return true;
59
}
60
61
static bool
62
i915_end_query(struct pipe_context *ctx, struct pipe_query *query)
63
{
64
return true;
65
}
66
67
static bool
68
i915_get_query_result(struct pipe_context *ctx, struct pipe_query *query,
69
bool wait, union pipe_query_result *vresult)
70
{
71
uint64_t *result = (uint64_t *)vresult;
72
73
/* 2* viewport Max */
74
*result = 512 * 1024 * 1024;
75
return true;
76
}
77
78
static void
79
i915_set_active_query_state(struct pipe_context *pipe, bool enable)
80
{
81
}
82
83
void
84
i915_init_query_functions(struct i915_context *i915)
85
{
86
i915->base.create_query = i915_create_query;
87
i915->base.destroy_query = i915_destroy_query;
88
i915->base.begin_query = i915_begin_query;
89
i915->base.end_query = i915_end_query;
90
i915->base.get_query_result = i915_get_query_result;
91
i915->base.set_active_query_state = i915_set_active_query_state;
92
}
93
94