i965/blorp: Add driver mocs settings to the context
[mesa.git] / src / mesa / drivers / dri / i965 / blorp.h
1 /*
2 * Copyright © 2012 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #pragma once
25
26 #include <stdint.h>
27 #include <stdbool.h>
28
29 #include "isl/isl.h"
30 #include "intel_resolve_map.h" /* needed for enum gen6_hiz_op */
31 #include "intel_bufmgr.h" /* needed for drm_intel_bo */
32
33 struct brw_context;
34 struct brw_wm_prog_key;
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 struct blorp_context {
41 void *driver_ctx;
42
43 const struct isl_device *isl_dev;
44
45 struct {
46 uint32_t tex;
47 uint32_t rb;
48 uint32_t vb;
49 } mocs;
50
51 bool (*lookup_shader)(struct blorp_context *blorp,
52 const void *key, uint32_t key_size,
53 uint32_t *kernel_out, void *prog_data_out);
54 void (*upload_shader)(struct blorp_context *blorp,
55 const void *key, uint32_t key_size,
56 const void *kernel, uint32_t kernel_size,
57 const void *prog_data, uint32_t prog_data_size,
58 uint32_t *kernel_out, void *prog_data_out);
59 };
60
61 void blorp_init(struct blorp_context *blorp, void *driver_ctx,
62 struct isl_device *isl_dev);
63 void blorp_finish(struct blorp_context *blorp);
64
65 struct brw_blorp_surf
66 {
67 const struct isl_surf *surf;
68 drm_intel_bo *bo;
69 uint32_t offset;
70
71 const struct isl_surf *aux_surf;
72 drm_intel_bo *aux_bo;
73 uint32_t aux_offset;
74 enum isl_aux_usage aux_usage;
75
76 union isl_color_value clear_color;
77 };
78
79 void
80 brw_blorp_blit(struct brw_context *brw,
81 const struct brw_blorp_surf *src_surf,
82 unsigned src_level, unsigned src_layer,
83 enum isl_format src_format, int src_swizzle,
84 const struct brw_blorp_surf *dst_surf,
85 unsigned dst_level, unsigned dst_layer,
86 enum isl_format dst_format,
87 float src_x0, float src_y0,
88 float src_x1, float src_y1,
89 float dst_x0, float dst_y0,
90 float dst_x1, float dst_y1,
91 uint32_t filter, bool mirror_x, bool mirror_y);
92
93 void
94 blorp_fast_clear(struct brw_context *brw,
95 const struct brw_blorp_surf *surf,
96 uint32_t level, uint32_t layer,
97 uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1);
98
99 void
100 blorp_clear(struct brw_context *brw,
101 const struct brw_blorp_surf *surf,
102 uint32_t level, uint32_t layer,
103 uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1,
104 enum isl_format format, union isl_color_value clear_color,
105 bool color_write_disable[4]);
106
107 void
108 brw_blorp_ccs_resolve(struct brw_context *brw, struct brw_blorp_surf *surf,
109 enum isl_format format);
110
111 void
112 blorp_gen6_hiz_op(struct brw_context *brw, struct brw_blorp_surf *surf,
113 unsigned level, unsigned layer, enum gen6_hiz_op op);
114
115 #ifdef __cplusplus
116 } /* end extern "C" */
117 #endif /* __cplusplus */