Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4358 Serge 1
/*
2
 * Mesa 3-D graphics library
3
 *
4
 * Copyright (C) 2011 Benjamin Franzke 
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a
7
 * copy of this software and associated documentation files (the "Software"),
8
 * to deal in the Software without restriction, including without limitation
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
 * and/or sell copies of the Software, and to permit persons to whom the
11
 * Software is furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included
14
 * in all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
 * DEALINGS IN THE SOFTWARE.
23
 */
24
 
25
#ifndef _NATIVE_WAYLAND_H_
26
#define _NATIVE_WAYLAND_H_
27
 
28
#include "pipe/p_compiler.h"
29
#include "pipe/p_format.h"
30
 
31
#include "common/native.h"
32
#include "common/native_helper.h"
33
 
34
#include "wayland-egl-priv.h"
35
 
36
struct wayland_surface;
37
 
38
enum wayland_format_flag {
39
   HAS_ARGB8888        = (1 << 0),
40
   HAS_XRGB8888        = (1 << 1)
41
};
42
 
43
struct wayland_display {
44
   struct native_display base;
45
 
46
   struct wl_display *dpy;
47
   struct wl_event_queue *queue;
48
   struct wl_registry *registry;
49
   boolean own_dpy;
50
   /* supported formats */
51
   uint32_t formats;
52
 
53
   struct wayland_config *configs;
54
   int num_configs;
55
 
56
   struct wl_buffer *(*create_buffer)(struct wayland_display *display,
57
                                      struct wayland_surface *surface,
58
                                      enum native_attachment attachment);
59
};
60
 
61
enum wayland_buffer_type {
62
   WL_BUFFER_FRONT,
63
   WL_BUFFER_BACK,
64
   WL_BUFFER_COUNT
65
};
66
 
67
enum wayland_surface_type {
68
   WL_WINDOW_SURFACE,
69
   WL_PBUFFER_SURFACE
70
};
71
 
72
struct wayland_surface {
73
   struct native_surface base;
74
   struct wayland_display *display;
75
 
76
   struct wl_egl_window *win;
77
   enum wayland_surface_type type;
78
   int dx, dy;
79
   struct resource_surface *rsurf;
80
   struct pipe_resource *pending_resource;
81
   enum pipe_format color_format;
82
 
83
   unsigned int sequence_number;
84
   struct wl_buffer *buffer[WL_BUFFER_COUNT];
85
   unsigned int attachment_mask;
86
 
87
   struct wl_callback *frame_callback;
88
   boolean premultiplied_alpha;
89
};
90
 
91
struct wayland_config {
92
   struct native_config base;
93
};
94
 
95
static INLINE struct wayland_display *
96
wayland_display(const struct native_display *ndpy)
97
{
98
   return (struct wayland_display *) ndpy;
99
}
100
 
101
static INLINE struct wayland_surface *
102
wayland_surface(const struct native_surface *nsurf)
103
{
104
   return (struct wayland_surface *) nsurf;
105
}
106
 
107
static INLINE struct wayland_config *
108
wayland_config(const struct native_config *nconf)
109
{
110
   return (struct wayland_config *) nconf;
111
}
112
 
113
struct wayland_display *
114
wayland_create_shm_display(struct wl_display *display,
115
                           const struct native_event_handler *event_handler);
116
 
117
struct wayland_display *
118
wayland_create_drm_display(struct wl_display *display,
119
                           const struct native_event_handler *event_handler);
120
 
121
int
122
wayland_roundtrip(struct wayland_display *drmdpy);
123
 
124
#endif /* _NATIVE_WAYLAND_H_ */