DRI2: report swap events correctly in direct rendered case
[mesa.git] / src / gallium / state_trackers / vega / vg_tracker.h
1 /**************************************************************************
2 *
3 * Copyright 2009 VMware, Inc. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 **************************************************************************/
26
27 #ifndef VG_TRACKER_H
28 #define VG_TRACKER_H
29
30 #include "VG/openvg.h"
31
32 #include "pipe/p_compiler.h"
33 #include "pipe/p_format.h"
34
35 #define ST_SURFACE_FRONT_LEFT 0
36 #define ST_SURFACE_BACK_LEFT 1
37 #define ST_SURFACE_FRONT_RIGHT 2
38 #define ST_SURFACE_BACK_RIGHT 3
39 #define ST_SURFACE_DEPTH 8
40
41 struct vg_context;
42 struct st_framebuffer;
43 struct pipe_context;
44 struct pipe_fence_handle;
45 struct pipe_surface;
46
47
48 PUBLIC
49 struct vg_context *st_create_context(struct pipe_context *pipe,
50 const void *visual,
51 struct vg_context *share);
52
53 PUBLIC
54 void st_destroy_context( struct vg_context *st );
55
56 PUBLIC
57 void st_copy_context_state(struct vg_context *dst, struct vg_context *src,
58 uint mask);
59
60 PUBLIC
61 struct st_framebuffer *st_create_framebuffer(const void *visual,
62 enum pipe_format colorFormat,
63 enum pipe_format depthFormat,
64 enum pipe_format stencilFormat,
65 uint width, uint height,
66 void *privateData);
67
68 PUBLIC
69 void st_resize_framebuffer(struct st_framebuffer *stfb,
70 uint width, uint height);
71
72 PUBLIC
73 void st_set_framebuffer_surface(struct st_framebuffer *stfb,
74 uint surfIndex, struct pipe_surface *surf);
75
76 PUBLIC
77 void st_get_framebuffer_dimensions( struct st_framebuffer *stfb,
78 uint *width, uint *height);
79
80 PUBLIC
81 int st_bind_texture_surface(struct pipe_surface *ps, int target, int level,
82 enum pipe_format format);
83
84 PUBLIC
85 int st_unbind_texture_surface(struct pipe_surface *ps, int target, int level);
86
87 PUBLIC
88 int st_get_framebuffer_surface(struct st_framebuffer *stfb,
89 uint surfIndex, struct pipe_surface **surf);
90
91 PUBLIC
92 int st_get_framebuffer_texture(struct st_framebuffer *stfb,
93 uint surfIndex, struct pipe_texture **tex);
94
95 PUBLIC
96 void *st_framebuffer_private(struct st_framebuffer *stfb);
97
98 PUBLIC
99 void st_unreference_framebuffer(struct st_framebuffer *stfb);
100
101 PUBLIC
102 boolean st_make_current(struct vg_context *st,
103 struct st_framebuffer *draw,
104 struct st_framebuffer *read);
105
106 PUBLIC
107 struct vg_context *st_get_current(void);
108
109 PUBLIC
110 void st_flush(struct vg_context *st, uint pipeFlushFlags,
111 struct pipe_fence_handle **fence);
112 PUBLIC
113 void st_finish(struct vg_context *st);
114
115 PUBLIC
116 void st_notify_swapbuffers(struct st_framebuffer *stfb);
117 PUBLIC
118 void st_notify_swapbuffers_complete(struct st_framebuffer *stfb);
119
120
121 /** Generic function type */
122 typedef void (*st_proc)();
123
124 PUBLIC
125 st_proc st_get_proc_address(const char *procname);
126
127 #endif