xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/i915/gt/intel_renderstate.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: intel_renderstate.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
2 
3 /*
4  * Copyright © 2014 Intel Corporation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the next
14  * paragraph) shall be included in all copies or substantial portions of the
15  * Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  */
25 
26 #ifndef _INTEL_RENDERSTATE_H_
27 #define _INTEL_RENDERSTATE_H_
28 
29 #include <linux/types.h>
30 
31 struct i915_request;
32 struct intel_engine_cs;
33 struct i915_vma;
34 
35 struct intel_renderstate_rodata {
36 	const u32 *reloc;
37 	const u32 *batch;
38 	const u32 batch_items;
39 };
40 
41 #define RO_RENDERSTATE(_g)						\
42 	const struct intel_renderstate_rodata gen ## _g ## _null_state = { \
43 		.reloc = gen ## _g ## _null_state_relocs,		\
44 		.batch = gen ## _g ## _null_state_batch,		\
45 		.batch_items = sizeof(gen ## _g ## _null_state_batch)/4, \
46 	}
47 
48 extern const struct intel_renderstate_rodata gen6_null_state;
49 extern const struct intel_renderstate_rodata gen7_null_state;
50 extern const struct intel_renderstate_rodata gen8_null_state;
51 extern const struct intel_renderstate_rodata gen9_null_state;
52 
53 struct intel_renderstate {
54 	const struct intel_renderstate_rodata *rodata;
55 	struct i915_vma *vma;
56 	u32 batch_offset;
57 	u32 batch_size;
58 	u32 aux_offset;
59 	u32 aux_size;
60 };
61 
62 int intel_renderstate_init(struct intel_renderstate *so,
63 			   struct intel_engine_cs *engine);
64 int intel_renderstate_emit(struct intel_renderstate *so,
65 			   struct i915_request *rq);
66 void intel_renderstate_fini(struct intel_renderstate *so);
67 
68 #endif /* _INTEL_RENDERSTATE_H_ */
69