summaryrefslogtreecommitdiff
path: root/community/directfb/directfb-missing_include.patch
blob: 4b1af5a30a2ca29578b40a2ea4dc66a0c821a850 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
--- /dev/null	2012-02-14 14:47:01.028967126 -0500
+++ b/lib/voodoo/link.h	2012-02-14 21:19:05.000000000 -0500
@@ -0,0 +1,85 @@
+/*
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __VOODOO__LINK_H__
+#define __VOODOO__LINK_H__
+
+#include <voodoo/types.h>
+
+
+typedef struct {
+     void   *ptr;
+     size_t  length;
+     size_t  done;
+} VoodooChunk;
+
+
+struct __V_VoodooLink {
+     void *priv;
+     u32   code;
+
+     void    (*Close)( VoodooLink *link );
+
+     /* See 'read(2)', blocking */
+     ssize_t (*Read) ( VoodooLink *link,
+                       void       *buffer,
+                       size_t      count );
+
+     /* See 'write(2)', blocking */
+     ssize_t (*Write)( VoodooLink *link,
+                       const void *buffer,
+                       size_t      count );
+
+
+     /* For later... */
+     DirectResult (*SendReceive)( VoodooLink  *link,
+                                  VoodooChunk *send,
+                                  size_t       num_send,
+                                  VoodooChunk *recv,
+                                  size_t       num_recv );
+
+     DirectResult (*WakeUp)     ( VoodooLink  *link );
+
+     DirectResult (*WaitForData)( VoodooLink  *link,
+                                  int          timeout_ms );
+};
+
+
+DirectResult VOODOO_API voodoo_link_init_connect( VoodooLink *link,
+                                                  const char *hostname,
+                                                  int         port,
+                                                  bool        raw );
+
+DirectResult VOODOO_API voodoo_link_init_local  ( VoodooLink *link,
+                                                  const char *path,
+                                                  bool        raw );
+
+DirectResult VOODOO_API voodoo_link_init_fd     ( VoodooLink *link,
+                                                  int         fd[2] );
+
+#endif
--- /dev/null	2012-02-14 14:47:01.028967126 -0500
+++ b/lib/voodoo/packet.h	2012-02-14 21:37:45.000000000 -0500
@@ -0,0 +1,285 @@
+/*
+   (c) Copyright 2001-2011  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   Written by Denis Oliver Kropp <dok@directfb.org>,
+              Andreas Hundt <andi@fischlustig.de>,
+              Sven Neumann <neo@directfb.org>,
+              Ville Syrjälä <syrjala@sci.fi> and
+              Claudio Ciccani <klan@users.sf.net>.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __VOODOO__PACKET_H__
+#define __VOODOO__PACKET_H__
+
+extern "C" {
+#include <direct/fastlz.h>
+#include <direct/list.h>
+#include <direct/mem.h>
+#include <direct/memcpy.h>
+
+
+#include <voodoo/types.h>
+}
+
+
+typedef enum {
+     VPHF_NONE       = 0x00000000,
+
+     VPHF_COMPRESSED = 0x00000001,
+
+     VPHF_ALL        = 0x00000001
+} VoodooPacketHeaderFlags;
+
+
+typedef struct {
+     u32  size;
+     u32  flags;
+     u32  uncompressed;
+     u32  align;
+} VoodooPacketHeader;
+
+
+class VoodooPacket {
+public:
+     DirectLink          link;
+     bool                sending;
+
+private:
+     void               *data;
+     void               *current;
+     VoodooPacketHeader  header;
+
+     VoodooPacket( u32   size,
+                   void *data )
+          :
+          sending(false),
+          data(data),
+          current(data)
+     {
+          memset( &link, 0, sizeof(link) );
+
+          header.size         = size;
+          header.flags        = VPHF_NONE;
+          header.uncompressed = size;
+     }
+
+     VoodooPacket( u32   size,
+                   u32   flags,
+                   u32   uncompressed,
+                   void *data )
+          :
+          sending(false),
+          data(data),
+          current(data)
+     {
+          memset( &link, 0, sizeof(link) );
+
+          header.size         = size;
+          header.flags        = VPHF_COMPRESSED;
+          header.uncompressed = uncompressed;
+     }
+
+     ~VoodooPacket() {};
+
+public:
+/*
+     static VoodooPacket *
+     New( u32 size )
+     {
+          VoodooPacket *packet = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + size );
+
+          if (!packet) {
+               D_OOM();
+               return NULL;
+          }
+
+          return new (packet) VoodooPacket( size, packet + 1 );
+
+
+          if (data)
+               this->data = data;
+          else
+               this->data = header + 1;
+     }
+*/
+     static VoodooPacket *
+     New( u32   size,
+          void *data )
+     {
+          return new VoodooPacket( size, data );
+     }
+
+     static VoodooPacket *
+     Reset( VoodooPacket *packet,
+            u32           size,
+            void         *data )
+     {
+          return new (packet) VoodooPacket( size, data );
+     }
+
+     static VoodooPacket *
+     New( void *header,
+          u32   size )
+     {
+          VoodooPacketHeader *h = (VoodooPacketHeader*) header;
+
+          h->size         = size;
+          h->flags        = VPHF_NONE;
+          h->uncompressed = size;
+
+          return new VoodooPacket( size, (char*) header + sizeof(VoodooPacketHeader) );
+     }
+
+     static VoodooPacket *
+     New( u32 size )
+     {
+          VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + VOODOO_PACKET_MAX );
+
+          if (!p) {
+               D_OOM();
+               return NULL;
+          }
+
+          return new (p) VoodooPacket( size, p + 1 );
+     }
+
+     static VoodooPacket *
+     Compressed( VoodooPacket *packet )
+     {
+          VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + packet->header.size * 4 / 3 );
+
+          if (!p) {
+               D_OOM();
+               return NULL;
+          }
+
+          int compressed = direct_fastlz_compress( packet->data, packet->header.uncompressed, p + 1 );
+
+          if ((size_t) compressed < packet->header.uncompressed)
+               return new (p) VoodooPacket( compressed, VPHF_COMPRESSED, packet->header.uncompressed, p + 1 );
+
+          D_FREE( p );
+
+          return packet;
+     }
+
+     static VoodooPacket *
+     Copy( VoodooPacket *packet )
+     {
+          VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + packet->header.size );
+
+          if (!p) {
+               D_OOM();
+               return NULL;
+          }
+
+          direct_memcpy( p + 1, packet->data_start(), packet->header.size );
+
+          return new (p) VoodooPacket( packet->header.size, packet->header.flags, packet->header.uncompressed, p + 1 );
+     }
+
+     static VoodooPacket *
+     Copy( u32   size,
+           u32   flags,
+           u32   uncompressed,
+           void *data )
+     {
+          VoodooPacket *p = (VoodooPacket*) D_MALLOC( sizeof(VoodooPacket) + size );
+
+          if (!p) {
+               D_OOM();
+               return NULL;
+          }
+
+          direct_memcpy( p + 1, data, size );
+
+          return new (p) VoodooPacket( size, flags, uncompressed, p + 1 );
+     }
+
+     inline u32
+     size() const
+     {
+          return header.size;
+     }
+
+     inline u32
+     flags() const
+     {
+          return header.flags;
+     }
+
+     inline u32
+     uncompressed() const
+     {
+          return header.uncompressed;
+     }
+
+     inline const void *
+     data_header() const
+     {
+          D_ASSERT( data == this + 1 );
+
+          return &header;
+     }
+
+     inline const void *
+     data_start() const
+     {
+          return data;
+     }
+
+     inline void *
+     data_raw() const
+     {
+          return current;
+     }
+
+
+     inline bool
+     append( size_t size )
+     {
+          D_ASSERT( data == this + 1 );
+
+          if (header.size + size > VOODOO_PACKET_MAX)
+               return false;
+
+          current = (char*) data + header.size;
+
+          header.size         += size;
+          header.uncompressed += size;
+
+          return true;
+     }
+
+     inline void
+     reset( size_t size )
+     {
+          D_ASSERT( data == this + 1 );
+
+          current = (char*) data;
+
+          header.size         = size;
+          header.uncompressed = size;
+     }
+};
+
+
+#endif