aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/blorp.h
blob: 602d97e2d9d0d1e9a6b1b10baccf8f4f19546293 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
 * Copyright © 2012 Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

#pragma once

#include <stdint.h>
#include <stdbool.h>

#include "isl/isl.h"
#include "intel_resolve_map.h" /* needed for enum gen6_hiz_op */
#include "intel_bufmgr.h" /* needed for drm_intel_bo */

struct brw_context;
struct brw_wm_prog_key;

#ifdef __cplusplus
extern "C" {
#endif

struct blorp_context {
   void *driver_ctx;

   const struct isl_device *isl_dev;

   bool (*lookup_shader)(struct blorp_context *blorp,
                         const void *key, uint32_t key_size,
                         uint32_t *kernel_out, void *prog_data_out);
   void (*upload_shader)(struct blorp_context *blorp,
                         const void *key, uint32_t key_size,
                         const void *kernel, uint32_t kernel_size,
                         const void *prog_data, uint32_t prog_data_size,
                         uint32_t *kernel_out, void *prog_data_out);
};

void blorp_init(struct blorp_context *blorp, void *driver_ctx,
                struct isl_device *isl_dev);
void blorp_finish(struct blorp_context *blorp);

struct brw_blorp_surf
{
   const struct isl_surf *surf;
   drm_intel_bo *bo;
   uint32_t offset;

   const struct isl_surf *aux_surf;
   drm_intel_bo *aux_bo;
   uint32_t aux_offset;
   enum isl_aux_usage aux_usage;

   union isl_color_value clear_color;
};

void
brw_blorp_blit(struct brw_context *brw,
               const struct brw_blorp_surf *src_surf,
               unsigned src_level, unsigned src_layer,
               enum isl_format src_format, int src_swizzle,
               const struct brw_blorp_surf *dst_surf,
               unsigned dst_level, unsigned dst_layer,
               enum isl_format dst_format,
               float src_x0, float src_y0,
               float src_x1, float src_y1,
               float dst_x0, float dst_y0,
               float dst_x1, float dst_y1,
               uint32_t filter, bool mirror_x, bool mirror_y);

void
blorp_fast_clear(struct brw_context *brw,
                 const struct brw_blorp_surf *surf,
                 uint32_t level, uint32_t layer,
                 uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1);

void
blorp_clear(struct brw_context *brw,
            const struct brw_blorp_surf *surf,
            uint32_t level, uint32_t layer,
            uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1,
            enum isl_format format, union isl_color_value clear_color,
            bool color_write_disable[4]);

void
brw_blorp_ccs_resolve(struct brw_context *brw, struct brw_blorp_surf *surf,
                      enum isl_format format);

void
blorp_gen6_hiz_op(struct brw_context *brw, struct brw_blorp_surf *surf,
                  unsigned level, unsigned layer, enum gen6_hiz_op op);

#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */