xref: /openbmc/linux/drivers/gpu/drm/i915/gt/intel_renderstate.h (revision f7af616c632ee2ac3af0876fe33bf9e0232e665a)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2014 Intel Corporation
4  */
5 
6 #ifndef _INTEL_RENDERSTATE_H_
7 #define _INTEL_RENDERSTATE_H_
8 
9 #include <linux/types.h>
10 #include "i915_gem.h"
11 
12 struct i915_request;
13 struct intel_context;
14 struct i915_vma;
15 
16 struct intel_renderstate_rodata {
17 	const u32 *reloc;
18 	const u32 *batch;
19 	const u32 batch_items;
20 };
21 
22 #define RO_RENDERSTATE(_g)						\
23 	const struct intel_renderstate_rodata gen ## _g ## _null_state = { \
24 		.reloc = gen ## _g ## _null_state_relocs,		\
25 		.batch = gen ## _g ## _null_state_batch,		\
26 		.batch_items = sizeof(gen ## _g ## _null_state_batch)/4, \
27 	}
28 
29 extern const struct intel_renderstate_rodata gen6_null_state;
30 extern const struct intel_renderstate_rodata gen7_null_state;
31 extern const struct intel_renderstate_rodata gen8_null_state;
32 extern const struct intel_renderstate_rodata gen9_null_state;
33 
34 struct intel_renderstate {
35 	struct i915_gem_ww_ctx ww;
36 	const struct intel_renderstate_rodata *rodata;
37 	struct i915_vma *vma;
38 	u32 batch_offset;
39 	u32 batch_size;
40 	u32 aux_offset;
41 	u32 aux_size;
42 };
43 
44 int intel_renderstate_init(struct intel_renderstate *so,
45 			   struct intel_context *ce);
46 int intel_renderstate_emit(struct intel_renderstate *so,
47 			   struct i915_request *rq);
48 void intel_renderstate_fini(struct intel_renderstate *so,
49 			    struct intel_context *ce);
50 
51 #endif /* _INTEL_RENDERSTATE_H_ */
52