xref: /aosp_15_r20/external/mesa3d/src/gallium/frontends/hgl/hgl_context.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2009-2023, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Alexander von Gluck IV, [email protected]
7  */
8 #ifndef HGL_CONTEXT_H
9 #define HGL_CONTEXT_H
10 
11 #include "util/u_thread.h"
12 #include "util/format/u_formats.h"
13 #include "util/compiler.h"
14 #include "pipe/p_screen.h"
15 #include "postprocess/filters.h"
16 
17 #include "frontend/api.h"
18 
19 // visual options
20 #define HGL_RGB			0
21 #define HGL_INDEX		1
22 #define HGL_SINGLE		0
23 #define HGL_DOUBLE		2
24 #define HGL_DIRECT		0
25 #define HGL_INDIRECT		4
26 #define HGL_ACCUM		8
27 #define HGL_ALPHA		16
28 #define HGL_DEPTH		32
29 #define HGL_OVERLAY		64
30 #define HGL_UNDERLAY		128
31 #define HGL_STENCIL		512
32 #define HGL_SHARE_CONTEXT	1024
33 
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 
40 #define CONTEXT_MAX 32
41 
42 typedef int64 context_id;
43 
44 
45 struct hgl_buffer
46 {
47 	struct pipe_frontend_drawable base;
48 	struct st_visual visual;
49 
50 	unsigned width;
51 	unsigned height;
52 	unsigned newWidth;
53 	unsigned newHeight;
54 	unsigned mask;
55 
56 	struct pipe_screen* screen;
57 	void* winsysContext;
58 
59 	enum pipe_texture_target target;
60 	struct pipe_resource* textures[ST_ATTACHMENT_COUNT];
61 };
62 
63 
64 struct hgl_display
65 {
66 	mtx_t mutex;
67 
68 	struct pipe_frontend_screen *fscreen;
69 };
70 
71 
72 struct hgl_context
73 {
74 	struct hgl_display* display;
75 	struct st_context* st;
76 
77 	// Post processing
78 	struct pp_queue_t* postProcess;
79 	unsigned int postProcessEnable[PP_FILTERS];
80 };
81 
82 // hgl framebuffer
83 struct hgl_buffer* hgl_create_st_framebuffer(struct hgl_display *display, struct st_visual* visual, void *winsysContext);
84 void hgl_destroy_st_framebuffer(struct hgl_buffer *buffer);
85 
86 struct hgl_context* hgl_create_context(struct hgl_display *display, struct st_visual* visual, struct st_context* shared);
87 void hgl_destroy_context(struct hgl_context* context);
88 
89 // hgl visual
90 void hgl_get_st_visual(struct st_visual* visual, ulong options);
91 
92 // hgl display
93 struct hgl_display* hgl_create_display(struct pipe_screen* screen);
94 void hgl_destroy_display(struct hgl_display *display);
95 
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* HGL_CONTEXT_H */
102