Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/gallium/frontends/xa/xa_composite.h
4561 views
1
/**********************************************************
2
* Copyright 2009-2011 VMware, Inc. All rights reserved.
3
*
4
* Permission is hereby granted, free of charge, to any person
5
* obtaining a copy of this software and associated documentation
6
* files (the "Software"), to deal in the Software without
7
* restriction, including without limitation the rights to use, copy,
8
* modify, merge, publish, distribute, sublicense, and/or sell copies
9
* of the Software, and to permit persons to whom the Software is
10
* furnished to do so, subject to the following conditions:
11
*
12
* The above copyright notice and this permission notice shall be
13
* included in all copies or substantial portions of the Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
* SOFTWARE.
23
*
24
*********************************************************
25
* Authors:
26
* Zack Rusin <zackr-at-vmware-dot-com>
27
* Thomas Hellstrom <thellstrom-at-vmware-dot-com>
28
*/
29
30
#ifndef _XA_COMPOSITE_H_
31
#define _XA_COMPOSITE_H_
32
33
#include "xa_tracker.h"
34
#include "xa_context.h"
35
36
/*
37
* Supported composite ops.
38
*/
39
enum xa_composite_op {
40
xa_op_clear,
41
xa_op_src,
42
xa_op_dst,
43
xa_op_over,
44
xa_op_over_reverse,
45
xa_op_in,
46
xa_op_in_reverse,
47
xa_op_out,
48
xa_op_out_reverse,
49
xa_op_atop,
50
xa_op_atop_reverse,
51
xa_op_xor,
52
xa_op_add
53
};
54
55
/*
56
* Supported filters.
57
*/
58
enum xa_composite_filter {
59
xa_filter_nearest,
60
xa_filter_linear
61
};
62
63
/*
64
* Supported clamp methods.
65
*/
66
enum xa_composite_wrap {
67
xa_wrap_clamp_to_border,
68
xa_wrap_repeat,
69
xa_wrap_mirror_repeat,
70
xa_wrap_clamp_to_edge
71
};
72
73
/*
74
* Src picture types.
75
*/
76
enum xa_composite_src_pict_type {
77
xa_src_pict_solid_fill,
78
xa_src_pict_float_solid_fill
79
};
80
81
82
/*
83
* struct xa_pict_solid_fill - Description of a solid_fill picture
84
* Deprecated. Use struct xa_pict_float_solid_fill instead.
85
*/
86
struct xa_pict_solid_fill {
87
enum xa_composite_src_pict_type type;
88
unsigned int class;
89
uint32_t color;
90
};
91
92
/*
93
* struct xa_pict_solid_fill - Description of a solid_fill picture
94
* with color channels represented by floats.
95
*/
96
struct xa_pict_float_solid_fill {
97
enum xa_composite_src_pict_type type;
98
float color[4]; /* R, G, B, A */
99
};
100
101
union xa_source_pict {
102
enum xa_composite_src_pict_type type;
103
struct xa_pict_solid_fill solid_fill;
104
struct xa_pict_float_solid_fill float_solid_fill;
105
};
106
107
struct xa_picture {
108
enum xa_formats pict_format;
109
struct xa_surface *srf;
110
struct xa_surface *alpha_map;
111
float transform[9];
112
int has_transform;
113
int component_alpha;
114
enum xa_composite_wrap wrap;
115
enum xa_composite_filter filter;
116
union xa_source_pict *src_pict;
117
};
118
119
struct xa_composite {
120
struct xa_picture *src, *mask, *dst;
121
int op;
122
int no_solid;
123
};
124
125
struct xa_composite_allocation {
126
unsigned int xa_composite_size;
127
unsigned int xa_picture_size;
128
unsigned int xa_source_pict_size;
129
};
130
131
/*
132
* Get allocation sizes for minor bump compatibility.
133
*/
134
135
extern const struct xa_composite_allocation *
136
xa_composite_allocation(void);
137
138
/*
139
* This function checks most things except the format of the hardware
140
* surfaces, since they are generally not available at the time this
141
* function is called. Returns usual XA error codes.
142
*/
143
extern int
144
xa_composite_check_accelerated(const struct xa_composite *comp);
145
146
extern int
147
xa_composite_prepare(struct xa_context *ctx, const struct xa_composite *comp);
148
149
extern void
150
xa_composite_rect(struct xa_context *ctx,
151
int srcX, int srcY, int maskX, int maskY,
152
int dstX, int dstY, int width, int height);
153
extern void
154
xa_composite_done(struct xa_context *ctx);
155
156
#endif
157
158