xref: /OK3568_Linux_fs/buildroot/package/directfb/0001-fix-missing-davinci-voodoo-header.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1The archive of directfb-1.6.3 is still missing some header files against
2the tagged git tree of directfb. The following files are missing.
3
4gfxdrivers/davinci/davinci_c64x.h
5gfxdrivers/davinci/davincifb.h
6gfxdrivers/davinci/davinci_gfxdriver.h
7tests/voodoo/voodoo_test.h
8
9The headers of course are needed to be able to build every module of
10directfb. The headers are taken from the git tree of directfb
11http://git.directfb.org/?p=core/DirectFB.git;a=commit;h=38b784549bc59bb07c58bb29667cb658695d39a7,
12tag DIRECTFB_1_6_3, SHA1ID 38b784549bc59bb07c58bb29667cb658695d39a7.
13
14Signed-off-by: Carsten Schoenert <c.schoenert@gmail.com>
15
16diff -puNr -Naur directfb-1.6.3-orig/gfxdrivers/davinci/davinci_c64x.h directfb-1.6.3/gfxdrivers/davinci/davinci_c64x.h
17--- directfb-1.6.3-orig/gfxdrivers/davinci/davinci_c64x.h	1970-01-01 01:00:00.000000000 +0100
18+++ directfb-1.6.3/gfxdrivers/davinci/davinci_c64x.h	2013-04-07 21:33:25.928530187 +0200
19@@ -0,0 +1,935 @@
20+/*
21+   TI Davinci driver - C64X+ DSP Library
22+
23+   (c) Copyright 2008  directfb.org
24+   (c) Copyright 2007  Telio AG
25+
26+   Written by Denis Oliver Kropp <dok@directfb.org> and
27+              Olaf Dreesen <olaf@directfb.org>.
28+
29+   All rights reserved.
30+
31+   This library is free software; you can redistribute it and/or
32+   modify it under the terms of the GNU General Public License
33+   version 2 as published by the Free Software Foundation.
34+
35+   This library is distributed in the hope that it will be useful,
36+   but WITHOUT ANY WARRANTY; without even the implied warranty of
37+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
38+   General Public License for more details.
39+
40+   You should have received a copy of the GNU General Public
41+   License along with this library; if not, write to the
42+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
43+   Boston, MA 02111-1307, USA.
44+*/
45+
46+#ifndef __DAVINCI_C64X_H__
47+#define __DAVINCI_C64X_H__
48+
49+#include <unistd.h>
50+
51+#include <directfb.h>
52+
53+#include <direct/messages.h>
54+#include <direct/trace.h>
55+
56+#include <linux/c64x.h>
57+
58+#define mb() __asm__ __volatile__ ("" : : : "memory")
59+
60+/**********************************************************************************************************************/
61+
62+typedef struct {
63+     int                 magic;
64+
65+     int                 fd;
66+     c64xTaskControl    *ctl;
67+     void               *mem;
68+
69+     c64xTask           *QueueL;
70+} DavinciC64x;
71+
72+typedef struct {
73+     int                 magic;
74+     unsigned int        max_tasks;
75+     unsigned int        num_tasks;
76+     c64xTask           *tasks;
77+} DavinciC64xTasks;
78+
79+typedef enum {
80+     C64X_TEF_NONE       = 0x0000,
81+     C64X_TEF_RESET      = 0x0001
82+} DavinciC64xEmitFlags;
83+
84+/**********************************************************************************************************************/
85+
86+DFBResult davinci_c64x_open    ( DavinciC64x *c64x );
87+
88+DFBResult davinci_c64x_close   ( DavinciC64x *c64x );
89+
90+DFBResult davinci_c64x_wait_low( DavinciC64x *c64x );
91+
92+/**********************************************************************************************************************/
93+
94+DFBResult davinci_c64x_tasks_init   ( DavinciC64xTasks *tasks,
95+                                      unsigned int      size );
96+
97+DFBResult davinci_c64x_tasks_destroy( DavinciC64xTasks *tasks );
98+
99+/**********************************************************************************************************************/
100+
101+DFBResult davinci_c64x_emit_tasks( DavinciC64x          *c64x,
102+                                   DavinciC64xTasks     *tasks,
103+                                   DavinciC64xEmitFlags  flags );
104+
105+/**********************************************************************************************************************/
106+
107+static const char *state_names[] = { "DONE", "ERROR", "TODO", "RUNNING" };
108+
109+static inline c64xTask *
110+c64x_get_task( DavinciC64x *c64x )
111+{
112+     c64xTaskControl *ctl   = c64x->ctl;
113+     uint32_t         idx   = ctl->QL_arm;
114+     uint32_t         next  = (idx + 1) & C64X_QUEUE_MASK;
115+     c64xTask        *task  = &c64x->QueueL[idx];
116+     int              loops = 0;
117+     uint32_t         idle  = 0;
118+
119+     /* Wait for the entry (and next) to be processed by the DSP (rare case). */
120+     while (task->c64x_flags & C64X_FLAG_TODO || ctl->QL_dsp == next) {
121+          if (loops > 666 || (idle && ctl->idlecounter - idle > 666)) {
122+               c64xTask *dsp_task = &c64x->QueueL[ctl->QL_dsp];
123+
124+               D_PERROR( "Davinci/C64X+: Blocked! [DSP %d / %d (%s), ARM %d / %d (%s)]\n",
125+                         ctl->QL_dsp,
126+                         (dsp_task->c64x_function >> 2) & 0x3fff,
127+                         state_names[dsp_task->c64x_function & 3],
128+                         ctl->QL_arm,
129+                         (task->c64x_function >> 2) & 0x3fff,
130+                         state_names[task->c64x_function & 3] );
131+
132+               break;
133+          }
134+
135+          idle = ctl->idlecounter;
136+
137+          /* Queue is full, waiting 10-20ms should not be too bad. */
138+          if (loops++ > 10)
139+               usleep( 5000 );
140+     }
141+
142+     return task;
143+}
144+
145+static inline void
146+c64x_submit_task( DavinciC64x *c64x, c64xTask *task )
147+{
148+     c64xTaskControl *ctl  = c64x->ctl;
149+     uint32_t         idx  = ctl->QL_arm;
150+     uint32_t         next = (idx + 1) & C64X_QUEUE_MASK;
151+
152+     mb();
153+
154+     ctl->QL_arm = next;
155+
156+     mb();
157+}
158+
159+/**********************************************************************************************************************/
160+
161+static inline void
162+davinci_c64x_wb_inv_range( DavinciC64x   *c64x,
163+                           unsigned long  start,
164+                           u32            length,
165+                           u32            func )
166+{
167+     c64xTask *task = c64x_get_task( c64x );
168+
169+     task->c64x_arg[0] = start;
170+     task->c64x_arg[1] = length;
171+     task->c64x_arg[2] = func;
172+
173+     task->c64x_function = C64X_WB_INV_RANGE | C64X_FLAG_TODO;
174+
175+     c64x_submit_task( c64x, task );
176+}
177+
178+static inline void
179+davinci_c64x_write_back_all( DavinciC64x *c64x )
180+{
181+     c64xTask *task = c64x_get_task( c64x );
182+
183+     task->c64x_function = C64X_WRITE_BACK_ALL | C64X_FLAG_TODO;
184+
185+     c64x_submit_task( c64x, task );
186+}
187+
188+/**********************************************************************************************************************/
189+
190+static inline void
191+davinci_c64x_load_block__L( DavinciC64xTasks *tasks,
192+                            unsigned long     words,
193+                            u32               num,
194+                            u32               flags )
195+{
196+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
197+
198+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
199+
200+     task->c64x_arg[0] = words;
201+     task->c64x_arg[1] = num;
202+     task->c64x_arg[2] = flags;
203+
204+     task->c64x_function = C64X_LOAD_BLOCK | C64X_FLAG_TODO;
205+
206+     tasks->num_tasks++;
207+}
208+
209+static inline void
210+davinci_c64x_load_block( DavinciC64x   *c64x,
211+                         unsigned long  words,
212+                         u32            num,
213+                         u32            flags )
214+{
215+     c64xTask *task = c64x_get_task( c64x );
216+
217+     task->c64x_arg[0] = words;
218+     task->c64x_arg[1] = num;
219+     task->c64x_arg[2] = flags;
220+
221+     task->c64x_function = C64X_LOAD_BLOCK | C64X_FLAG_TODO;
222+
223+     c64x_submit_task( c64x, task );
224+}
225+
226+static inline void
227+davinci_c64x_fetch_uyvy( DavinciC64x   *c64x,
228+                         unsigned long  dest,
229+                         unsigned long  source,
230+                         u32            pitch,
231+                         u32            height,
232+                         u32            flags )
233+{
234+     c64xTask *task = c64x_get_task( c64x );
235+
236+     task->c64x_arg[0] = dest;
237+     task->c64x_arg[1] = source;
238+     task->c64x_arg[2] = pitch;
239+     task->c64x_arg[3] = height;
240+     task->c64x_arg[4] = flags;
241+
242+     task->c64x_function = C64X_FETCH_UYVY | C64X_FLAG_TODO;
243+
244+     c64x_submit_task( c64x, task );
245+}
246+
247+static inline void
248+davinci_c64x_mc( DavinciC64x   *c64x,
249+                 unsigned long  dest,
250+                 u32            dpitch,
251+                 unsigned long  source0,
252+                 unsigned long  source1,
253+                 u32            spitch,
254+                 u32            height,
255+                 int            func )
256+{
257+     c64xTask *task = c64x_get_task( c64x );
258+
259+     task->c64x_arg[0] = dest;
260+     task->c64x_arg[1] = dpitch;
261+     task->c64x_arg[2] = source0;
262+     task->c64x_arg[3] = source1;
263+     task->c64x_arg[4] = spitch;
264+     task->c64x_arg[5] = height;
265+
266+     task->c64x_function = func | C64X_FLAG_TODO;
267+
268+     c64x_submit_task( c64x, task );
269+}
270+
271+static inline void
272+davinci_c64x_put_idct_uyvy_16x16__L( DavinciC64xTasks *tasks,
273+                                     unsigned long     dest,
274+                                     u32               pitch,
275+                                     u32               flags )
276+{
277+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
278+
279+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
280+
281+     task->c64x_arg[0] = dest;
282+     task->c64x_arg[1] = pitch;
283+     task->c64x_arg[2] = flags;
284+
285+     task->c64x_function = C64X_PUT_IDCT_UYVY_16x16 | C64X_FLAG_TODO;
286+
287+     tasks->num_tasks++;
288+}
289+
290+static inline void
291+davinci_c64x_put_idct_uyvy_16x16( DavinciC64x   *c64x,
292+                                  unsigned long  dest,
293+                                  u32            pitch,
294+                                  u32            flags )
295+{
296+     c64xTask *task = c64x_get_task( c64x );
297+
298+     task->c64x_arg[0] = dest;
299+     task->c64x_arg[1] = pitch;
300+     task->c64x_arg[2] = flags;
301+
302+     task->c64x_function = C64X_PUT_IDCT_UYVY_16x16 | C64X_FLAG_TODO;
303+
304+     c64x_submit_task( c64x, task );
305+}
306+
307+static inline void
308+davinci_c64x_put_mc_uyvy_16x16__L( DavinciC64xTasks *tasks,
309+                                   unsigned long     dest,
310+                                   u32               pitch,
311+                                   u32               flags )
312+{
313+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
314+
315+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
316+
317+     task->c64x_arg[0] = dest;
318+     task->c64x_arg[1] = pitch;
319+     task->c64x_arg[2] = flags;
320+
321+     task->c64x_function = C64X_PUT_MC_UYVY_16x16 | C64X_FLAG_TODO;
322+
323+     tasks->num_tasks++;
324+}
325+
326+static inline void
327+davinci_c64x_put_mc_uyvy_16x16( DavinciC64x   *c64x,
328+                                unsigned long  dest,
329+                                u32            pitch,
330+                                u32            flags )
331+{
332+     c64xTask *task = c64x_get_task( c64x );
333+
334+     task->c64x_arg[0] = dest;
335+     task->c64x_arg[1] = pitch;
336+     task->c64x_arg[2] = flags;
337+
338+     task->c64x_function = C64X_PUT_MC_UYVY_16x16 | C64X_FLAG_TODO;
339+
340+     c64x_submit_task( c64x, task );
341+}
342+
343+static inline void
344+davinci_c64x_put_sum_uyvy_16x16__L( DavinciC64xTasks *tasks,
345+                                    unsigned long     dest,
346+                                    u32               pitch,
347+                                    u32               flags )
348+{
349+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
350+
351+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
352+
353+     task->c64x_arg[0] = dest;
354+     task->c64x_arg[1] = pitch;
355+     task->c64x_arg[2] = flags;
356+
357+     task->c64x_function = C64X_PUT_SUM_UYVY_16x16 | C64X_FLAG_TODO;
358+
359+     tasks->num_tasks++;
360+}
361+
362+static inline void
363+davinci_c64x_put_sum_uyvy_16x16( DavinciC64x   *c64x,
364+                                 unsigned long  dest,
365+                                 u32            pitch,
366+                                 u32            flags )
367+{
368+     c64xTask *task = c64x_get_task( c64x );
369+
370+     task->c64x_arg[0] = dest;
371+     task->c64x_arg[1] = pitch;
372+     task->c64x_arg[2] = flags;
373+
374+     task->c64x_function = C64X_PUT_SUM_UYVY_16x16 | C64X_FLAG_TODO;
375+
376+     c64x_submit_task( c64x, task );
377+}
378+
379+static inline void
380+davinci_c64x_dva_begin_frame__L( DavinciC64xTasks *tasks,
381+                                 u32               pitch,
382+                                 unsigned long     current,
383+                                 unsigned long     past,
384+                                 unsigned long     future,
385+                                 u32               flags )
386+{
387+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
388+
389+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
390+
391+     task->c64x_arg[0] = pitch;
392+     task->c64x_arg[1] = current;
393+     task->c64x_arg[2] = past;
394+     task->c64x_arg[3] = future;
395+     task->c64x_arg[4] = flags;
396+
397+     task->c64x_function = C64X_DVA_BEGIN_FRAME | C64X_FLAG_TODO;
398+
399+     tasks->num_tasks++;
400+}
401+
402+static inline void
403+davinci_c64x_dva_begin_frame( DavinciC64x   *c64x,
404+                              u32            pitch,
405+                              unsigned long  current,
406+                              unsigned long  past,
407+                              unsigned long  future,
408+                              u32            flags )
409+{
410+     c64xTask *task = c64x_get_task( c64x );
411+
412+     task->c64x_arg[0] = pitch;
413+     task->c64x_arg[1] = current;
414+     task->c64x_arg[2] = past;
415+     task->c64x_arg[3] = future;
416+     task->c64x_arg[4] = flags;
417+
418+     task->c64x_function = C64X_DVA_BEGIN_FRAME | C64X_FLAG_TODO;
419+
420+     c64x_submit_task( c64x, task );
421+}
422+
423+static inline void
424+davinci_c64x_dva_motion_block__L( DavinciC64xTasks *tasks,
425+                                  unsigned long     macroblock )
426+{
427+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
428+
429+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
430+
431+     task->c64x_arg[0] = macroblock;
432+
433+     task->c64x_function = C64X_DVA_MOTION_BLOCK | C64X_FLAG_TODO;
434+
435+     tasks->num_tasks++;
436+}
437+
438+static inline void
439+davinci_c64x_dva_motion_block( DavinciC64x   *c64x,
440+                               unsigned long  macroblock )
441+{
442+     c64xTask *task = c64x_get_task( c64x );
443+
444+     task->c64x_arg[0] = macroblock;
445+
446+     task->c64x_function = C64X_DVA_MOTION_BLOCK | C64X_FLAG_TODO;
447+
448+     c64x_submit_task( c64x, task );
449+}
450+
451+/**********************************************************************************************************************/
452+
453+static inline void
454+davinci_c64x_dva_idct( DavinciC64x   *c64x,
455+				   unsigned long  dest,
456+				   u32            pitch,
457+				   unsigned long  source )
458+{
459+     c64xTask *task = c64x_get_task( c64x );
460+
461+     task->c64x_arg[0] = dest;
462+     task->c64x_arg[1] = pitch;
463+     task->c64x_arg[2] = source;
464+
465+     task->c64x_function = C64X_DVA_IDCT | C64X_FLAG_TODO;
466+
467+     c64x_submit_task( c64x, task );
468+}
469+
470+/**********************************************************************************************************************/
471+
472+static inline void
473+davinci_c64x_put_uyvy_16x16( DavinciC64x   *c64x,
474+                             unsigned long  dest,
475+                             u32            pitch,
476+                             unsigned long  source,
477+                             u32            flags )
478+{
479+     c64xTask *task = c64x_get_task( c64x );
480+
481+     task->c64x_arg[0] = dest;
482+     task->c64x_arg[1] = pitch;
483+     task->c64x_arg[2] = source;
484+     task->c64x_arg[3] = flags;
485+
486+     task->c64x_function = C64X_PUT_UYVY_16x16 | C64X_FLAG_TODO;
487+
488+     c64x_submit_task( c64x, task );
489+}
490+
491+static inline void
492+davinci_c64x_dither_argb__L( DavinciC64xTasks *tasks,
493+                             unsigned long     dst_rgb,
494+                             unsigned long     dst_alpha,
495+                             u32               dst_pitch,
496+                             unsigned long     source,
497+                             u32               src_pitch,
498+                             u32               width,
499+                             u32               height )
500+{
501+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
502+
503+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
504+
505+     task->c64x_arg[0] = dst_rgb;
506+     task->c64x_arg[1] = dst_alpha;
507+     task->c64x_arg[2] = dst_pitch;
508+     task->c64x_arg[3] = source;
509+     task->c64x_arg[4] = src_pitch;
510+     task->c64x_arg[5] = width;
511+     task->c64x_arg[6] = height;
512+
513+     task->c64x_function = C64X_DITHER_ARGB | C64X_FLAG_TODO;
514+
515+     tasks->num_tasks++;
516+}
517+
518+static inline void
519+davinci_c64x_dither_argb( DavinciC64x   *c64x,
520+                          unsigned long  dst_rgb,
521+                          unsigned long  dst_alpha,
522+                          u32            dst_pitch,
523+                          unsigned long  source,
524+                          u32            src_pitch,
525+                          u32            width,
526+                          u32            height )
527+{
528+     c64xTask *task = c64x_get_task( c64x );
529+
530+     task->c64x_arg[0] = dst_rgb;
531+     task->c64x_arg[1] = dst_alpha;
532+     task->c64x_arg[2] = dst_pitch;
533+     task->c64x_arg[3] = source;
534+     task->c64x_arg[4] = src_pitch;
535+     task->c64x_arg[5] = width;
536+     task->c64x_arg[6] = height;
537+
538+     task->c64x_function = C64X_DITHER_ARGB | C64X_FLAG_TODO;
539+
540+     c64x_submit_task( c64x, task );
541+}
542+
543+static inline void
544+davinci_c64x_fill_16__L( DavinciC64xTasks *tasks,
545+                         unsigned long     dest,
546+                         u32               pitch,
547+                         u32               width,
548+                         u32               height,
549+                         u32               value )
550+{
551+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
552+
553+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
554+
555+     task->c64x_arg[0] = dest;
556+     task->c64x_arg[1] = pitch;
557+     task->c64x_arg[2] = width;
558+     task->c64x_arg[3] = height;
559+     task->c64x_arg[4] = value;
560+
561+     task->c64x_function = C64X_FILL_16 | C64X_FLAG_TODO;
562+
563+     tasks->num_tasks++;
564+}
565+
566+static inline void
567+davinci_c64x_fill_16( DavinciC64x   *c64x,
568+                      unsigned long  dest,
569+                      u32            pitch,
570+                      u32            width,
571+                      u32            height,
572+                      u32            value )
573+{
574+     c64xTask *task = c64x_get_task( c64x );
575+
576+     task->c64x_arg[0] = dest;
577+     task->c64x_arg[1] = pitch;
578+     task->c64x_arg[2] = width;
579+     task->c64x_arg[3] = height;
580+     task->c64x_arg[4] = value;
581+
582+     task->c64x_function = C64X_FILL_16 | C64X_FLAG_TODO;
583+
584+     c64x_submit_task( c64x, task );
585+}
586+
587+static inline void
588+davinci_c64x_fill_32__L( DavinciC64xTasks *tasks,
589+                         unsigned long     dest,
590+                         u32               pitch,
591+                         u32               width,
592+                         u32               height,
593+                         u32               value )
594+{
595+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
596+
597+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
598+
599+     task->c64x_arg[0] = dest;
600+     task->c64x_arg[1] = pitch;
601+     task->c64x_arg[2] = width;
602+     task->c64x_arg[3] = height;
603+     task->c64x_arg[4] = value;
604+
605+     task->c64x_function = C64X_FILL_32 | C64X_FLAG_TODO;
606+
607+     tasks->num_tasks++;
608+}
609+
610+static inline void
611+davinci_c64x_fill_32( DavinciC64x   *c64x,
612+                      unsigned long  dest,
613+                      u32            pitch,
614+                      u32            width,
615+                      u32            height,
616+                      u32            value )
617+{
618+     c64xTask *task = c64x_get_task( c64x );
619+
620+     task->c64x_arg[0] = dest;
621+     task->c64x_arg[1] = pitch;
622+     task->c64x_arg[2] = width;
623+     task->c64x_arg[3] = height;
624+     task->c64x_arg[4] = value;
625+
626+     task->c64x_function = C64X_FILL_32 | C64X_FLAG_TODO;
627+
628+     c64x_submit_task( c64x, task );
629+}
630+
631+static inline void
632+davinci_c64x_blit_16__L( DavinciC64xTasks *tasks,
633+                         unsigned long     dest,
634+                         u32               dpitch,
635+                         unsigned long     src,
636+                         u32               spitch,
637+                         u32               width,
638+                         u32               height )
639+{
640+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
641+
642+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
643+
644+     task->c64x_arg[0] = dest;
645+     task->c64x_arg[1] = dpitch;
646+     task->c64x_arg[2] = src;
647+     task->c64x_arg[3] = spitch;
648+     task->c64x_arg[4] = width;
649+     task->c64x_arg[5] = height;
650+
651+     task->c64x_function = C64X_COPY_16 | C64X_FLAG_TODO;
652+
653+     tasks->num_tasks++;
654+}
655+
656+static inline void
657+davinci_c64x_blit_16( DavinciC64x   *c64x,
658+                      unsigned long  dest,
659+                      u32            dpitch,
660+                      unsigned long  src,
661+                      u32            spitch,
662+                      u32            width,
663+                      u32            height )
664+{
665+     c64xTask *task = c64x_get_task( c64x );
666+
667+     task->c64x_arg[0] = dest;
668+     task->c64x_arg[1] = dpitch;
669+     task->c64x_arg[2] = src;
670+     task->c64x_arg[3] = spitch;
671+     task->c64x_arg[4] = width;
672+     task->c64x_arg[5] = height;
673+
674+     task->c64x_function = C64X_COPY_16 | C64X_FLAG_TODO;
675+
676+     c64x_submit_task( c64x, task );
677+}
678+
679+static inline void
680+davinci_c64x_blit_32__L( DavinciC64xTasks *tasks,
681+                         unsigned long     dest,
682+                         u32               dpitch,
683+                         unsigned long     src,
684+                         u32               spitch,
685+                         u32               width,
686+                         u32               height )
687+{
688+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
689+
690+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
691+
692+     task->c64x_arg[0] = dest;
693+     task->c64x_arg[1] = dpitch;
694+     task->c64x_arg[2] = src;
695+     task->c64x_arg[3] = spitch;
696+     task->c64x_arg[4] = width;
697+     task->c64x_arg[5] = height;
698+
699+     task->c64x_function = C64X_COPY_32 | C64X_FLAG_TODO;
700+
701+     tasks->num_tasks++;
702+}
703+
704+static inline void
705+davinci_c64x_blit_32( DavinciC64x   *c64x,
706+                      unsigned long  dest,
707+                      u32            dpitch,
708+                      unsigned long  src,
709+                      u32            spitch,
710+                      u32            width,
711+                      u32            height )
712+{
713+     c64xTask *task = c64x_get_task( c64x );
714+
715+     task->c64x_arg[0] = dest;
716+     task->c64x_arg[1] = dpitch;
717+     task->c64x_arg[2] = src;
718+     task->c64x_arg[3] = spitch;
719+     task->c64x_arg[4] = width;
720+     task->c64x_arg[5] = height;
721+
722+     task->c64x_function = C64X_COPY_32 | C64X_FLAG_TODO;
723+
724+     c64x_submit_task( c64x, task );
725+}
726+
727+static inline void
728+davinci_c64x_stretch_32__L( DavinciC64xTasks *tasks,
729+                            unsigned long     dest,
730+                            u32               dpitch,
731+                            unsigned long     src,
732+                            u32               spitch,
733+                            u32               dw,
734+                            u32               dh,
735+                            u32               sw,
736+                            u32               sh,
737+                            const DFBRegion  *clip )
738+{
739+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
740+
741+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
742+
743+     task->c64x_arg[0] = dest;
744+     task->c64x_arg[1] = src;
745+     task->c64x_arg[2] = dpitch   | (spitch   << 16);
746+     task->c64x_arg[3] = dh       | (dw       << 16);
747+     task->c64x_arg[4] = sh       | (sw       << 16);
748+     task->c64x_arg[5] = clip->x2 | (clip->y2 << 16);
749+     task->c64x_arg[6] = clip->x1 | (clip->y1 << 16);
750+
751+     if (sw > dw && sh > dh)
752+          task->c64x_function = C64X_STRETCH_32_down | C64X_FLAG_TODO;
753+     else
754+          task->c64x_function = C64X_STRETCH_32_up | C64X_FLAG_TODO;
755+
756+     tasks->num_tasks++;
757+}
758+
759+static inline void
760+davinci_c64x_stretch_32( DavinciC64x     *c64x,
761+                         unsigned long    dest,
762+                         u32              dpitch,
763+                         unsigned long    src,
764+                         u32              spitch,
765+                         u32              dw,
766+                         u32              dh,
767+                         u32              sw,
768+                         u32              sh,
769+                         const DFBRegion *clip )
770+{
771+     c64xTask *task = c64x_get_task( c64x );
772+
773+     task->c64x_arg[0] = dest;
774+     task->c64x_arg[1] = src;
775+     task->c64x_arg[2] = dpitch   | (spitch   << 16);
776+     task->c64x_arg[3] = dh       | (dw       << 16);
777+     task->c64x_arg[4] = sh       | (sw       << 16);
778+     task->c64x_arg[5] = clip->x2 | (clip->y2 << 16);
779+     task->c64x_arg[6] = clip->x1 | (clip->y1 << 16);
780+
781+     if (sw > dw && sh > dh)
782+          task->c64x_function = C64X_STRETCH_32_down | C64X_FLAG_TODO;
783+     else
784+          task->c64x_function = C64X_STRETCH_32_up | C64X_FLAG_TODO;
785+
786+     c64x_submit_task( c64x, task );
787+}
788+
789+static inline void
790+davinci_c64x_blit_blend_32__L( DavinciC64xTasks *tasks,
791+                               u32               sub_func,
792+                               unsigned long     dest,
793+                               u32               dpitch,
794+                               unsigned long     src,
795+                               u32               spitch,
796+                               u32               width,
797+                               u32               height,
798+                               u32               argb,
799+                               u8                alpha )
800+{
801+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
802+
803+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
804+
805+     task->c64x_arg[0] = dest;
806+     task->c64x_arg[1] = dpitch;
807+     task->c64x_arg[2] = src;
808+     task->c64x_arg[3] = spitch;
809+     task->c64x_arg[4] = width | (height << 16);
810+     task->c64x_arg[5] = argb;
811+     task->c64x_arg[6] = alpha;
812+
813+     task->c64x_function = (sub_func << 16) | C64X_BLEND_32 | C64X_FLAG_TODO;
814+
815+     tasks->num_tasks++;
816+}
817+
818+static inline void
819+davinci_c64x_blit_blend_32( DavinciC64x   *c64x,
820+                            u32            sub_func,
821+                            unsigned long  dest,
822+                            u32            dpitch,
823+                            unsigned long  src,
824+                            u32            spitch,
825+                            u32            width,
826+                            u32            height,
827+                            u32            argb,
828+                            u8             alpha )
829+{
830+     c64xTask *task = c64x_get_task( c64x );
831+
832+     task->c64x_arg[0] = dest;
833+     task->c64x_arg[1] = dpitch;
834+     task->c64x_arg[2] = src;
835+     task->c64x_arg[3] = spitch;
836+     task->c64x_arg[4] = width | (height << 16);
837+     task->c64x_arg[5] = argb;
838+     task->c64x_arg[6] = alpha;
839+
840+     task->c64x_function = (sub_func << 16) | C64X_BLEND_32 | C64X_FLAG_TODO;
841+
842+     c64x_submit_task( c64x, task );
843+}
844+
845+static inline void
846+davinci_c64x_blit_keyed_16__L( DavinciC64xTasks *tasks,
847+                               unsigned long     dest,
848+                               u32               dpitch,
849+                               unsigned long     src,
850+                               u32               spitch,
851+                               u32               width,
852+                               u32               height,
853+                               u32               key,
854+                               u32               mask )
855+{
856+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
857+
858+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
859+
860+     task->c64x_arg[0] = dest;
861+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
862+     task->c64x_arg[2] = src;
863+     task->c64x_arg[3] = width;
864+     task->c64x_arg[4] = height;
865+     task->c64x_arg[5] = key;
866+     task->c64x_arg[6] = mask;
867+
868+     task->c64x_function = C64X_COPY_KEYED_16 | C64X_FLAG_TODO;
869+
870+     tasks->num_tasks++;
871+}
872+
873+static inline void
874+davinci_c64x_blit_keyed_16( DavinciC64x   *c64x,
875+                            unsigned long  dest,
876+                            u32            dpitch,
877+                            unsigned long  src,
878+                            u32            spitch,
879+                            u32            width,
880+                            u32            height,
881+                            u32            key,
882+                            u32            mask )
883+{
884+     c64xTask *task = c64x_get_task( c64x );
885+
886+     task->c64x_arg[0] = dest;
887+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
888+     task->c64x_arg[2] = src;
889+     task->c64x_arg[3] = width;
890+     task->c64x_arg[4] = height;
891+     task->c64x_arg[5] = key;
892+     task->c64x_arg[6] = mask;
893+
894+     task->c64x_function = C64X_COPY_KEYED_16 | C64X_FLAG_TODO;
895+
896+     c64x_submit_task( c64x, task );
897+}
898+
899+static inline void
900+davinci_c64x_blit_keyed_32__L( DavinciC64xTasks *tasks,
901+                               unsigned long     dest,
902+                               u32               dpitch,
903+                               unsigned long     src,
904+                               u32               spitch,
905+                               u32               width,
906+                               u32               height,
907+                               u32               key,
908+                               u32               mask )
909+{
910+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
911+
912+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
913+
914+     task->c64x_arg[0] = dest;
915+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
916+     task->c64x_arg[2] = src;
917+     task->c64x_arg[3] = width;
918+     task->c64x_arg[4] = height;
919+     task->c64x_arg[5] = key;
920+     task->c64x_arg[6] = mask;
921+
922+     task->c64x_function = C64X_COPY_KEYED_32 | C64X_FLAG_TODO;
923+
924+     tasks->num_tasks++;
925+}
926+
927+static inline void
928+davinci_c64x_blit_keyed_32( DavinciC64x   *c64x,
929+                            unsigned long  dest,
930+                            u32            dpitch,
931+                            unsigned long  src,
932+                            u32            spitch,
933+                            u32            width,
934+                            u32            height,
935+                            u32            key,
936+                            u32            mask )
937+{
938+     c64xTask *task = c64x_get_task( c64x );
939+
940+     task->c64x_arg[0] = dest;
941+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
942+     task->c64x_arg[2] = src;
943+     task->c64x_arg[3] = width;
944+     task->c64x_arg[4] = height;
945+     task->c64x_arg[5] = key;
946+     task->c64x_arg[6] = mask;
947+
948+     task->c64x_function = C64X_COPY_KEYED_32 | C64X_FLAG_TODO;
949+
950+     c64x_submit_task( c64x, task );
951+}
952+
953+#endif
954+
955diff -puNr -Naur directfb-1.6.3-orig/gfxdrivers/davinci/davincifb.h directfb-1.6.3/gfxdrivers/davinci/davincifb.h
956--- directfb-1.6.3-orig/gfxdrivers/davinci/davincifb.h	1970-01-01 01:00:00.000000000 +0100
957+++ directfb-1.6.3/gfxdrivers/davinci/davincifb.h	2013-04-07 21:33:21.488622184 +0200
958@@ -0,0 +1,581 @@
959+/*
960+ * Copyright (C) 2006 Texas Instruments Inc
961+ *
962+ * This program is free software; you can redistribute it and/or modify
963+ * it under the terms of the GNU General Public License as published by
964+ * the Free Software Foundation; either version 2 of the License, or
965+ * (at your option)any later version.
966+ *
967+ * This program is distributed in the hope that it will be useful,
968+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
969+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
970+ * GNU General Public License for more details.
971+ *
972+ * You should have received a copy of the GNU General Public License
973+ * along with this program; if not, write to the Free Software
974+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
975+ *
976+ * File: davincifb.h
977+ */
978+
979+#ifndef DAVINVI_VPBE_H
980+#define DAVINVI_VPBE_H
981+
982+/* include Linux files */
983+#include <linux/fb.h>
984+
985+/* define the custom FBIO_WAITFORVSYNC ioctl */
986+#define FBIO_WAITFORVSYNC	_IOW('F', 0x20, u_int32_t)
987+#define FBIO_SETATTRIBUTE       _IOW('F', 0x21, struct fb_fillrect)
988+
989+/* Backported IOCTLS. */
990+#define FBIO_SETPOSX                            _IOW('F', 0x22, u_int32_t)
991+#define FBIO_SETPOSY                            _IOW('F', 0x23, u_int32_t)
992+#define FBIO_SETZOOM            		_IOW('F', 0x24, struct zoom_params)
993+#define FBIO_GETSTD                             _IOR('F', 0x25, u_int32_t)
994+#define FBIO_RESIZER		                _IOW('F', 0x26, struct vpfe_resizer_params)
995+#define FBIO_SYNC		                _IOW('F', 0x27, u_int32_t)
996+
997+typedef struct zoom_params {
998+	u_int32_t window_id;
999+	u_int32_t zoom_h;
1000+	u_int32_t zoom_v;
1001+} zoom_params_t;
1002+
1003+typedef struct vpfe_resizer_params
1004+{
1005+	u_int32_t rsz_cnt;	//busy-lock
1006+	u_int32_t out_size;	//busy-lock
1007+	u_int32_t in_start;	//busy-lock
1008+	u_int32_t in_size;	//busy-lock
1009+	u_int32_t sdr_inadd;	//shadowed
1010+	u_int32_t sdr_inoff;	//shadowed
1011+	u_int32_t sdr_outadd;	//shadowed
1012+	u_int32_t sdr_outoff;	//shadowed
1013+	u_int32_t hfilt[16];	//busy-lock
1014+	u_int32_t vfilt[16];	//busy-lock
1015+	u_int32_t yenh;		//busy-lock
1016+} vpfe_resizer_params_t;
1017+
1018+typedef struct fb_set_start {
1019+	int		offset;		/* offset from smem_start */
1020+	unsigned long	physical;	/* absolute physical address when offset < 0 */
1021+
1022+	u_int64_t	sync;		/* input:  target sync counter for change or 0 for no sync at all,
1023+					   output: sync counter of actual change or 0 if still pending */
1024+} fb_set_start_t;
1025+
1026+
1027+#ifdef _IOC_TYPECHECK
1028+#undef _IOC_TYPECHECK
1029+#define _IOC_TYPECHECK(x)     (sizeof(x))
1030+#endif
1031+
1032+#define	RAM_CLUT_SIZE	256*3
1033+#define FBIO_ENABLE_DISABLE_WIN		\
1034+	_IOW('F', 0x30, unsigned char)
1035+#define FBIO_SET_BITMAP_BLEND_FACTOR	\
1036+	_IOW('F', 0x31, vpbe_bitmap_blend_params_t)
1037+#define FBIO_SET_BITMAP_WIN_RAM_CLUT    \
1038+	_IOW('F', 0x32, unsigned char)*RAM_CLUT_SIZE)
1039+#define FBIO_ENABLE_DISABLE_ATTRIBUTE_WIN \
1040+	_IOW('F', 0x33, unsigned int)
1041+#define FBIO_GET_BLINK_INTERVAL		\
1042+	_IOR('F', 0x34, vpbe_blink_option_t)
1043+#define FBIO_SET_BLINK_INTERVAL         \
1044+	_IOW('F', 0x35, vpbe_blink_option_t)
1045+#define FBIO_GET_VIDEO_CONFIG_PARAMS    \
1046+	_IOR('F', 0x36, vpbe_video_config_params_t)
1047+#define FBIO_SET_VIDEO_CONFIG_PARAMS    \
1048+	_IOW('F', 0x37, vpbe_video_config_params_t)
1049+#define FBIO_GET_BITMAP_CONFIG_PARAMS   \
1050+	_IOR('F', 0x38, vpbe_bitmap_config_params_t)
1051+#define FBIO_SET_BITMAP_CONFIG_PARAMS   \
1052+	_IOW('F', 0x39, vpbe_bitmap_config_params_t)
1053+#define FBIO_SET_DCLK                   \
1054+	_IOW('F', 0x40, vpbe_dclk_t)
1055+#define FBIO_SET_INTERFACE		\
1056+	_IOW('F', 0x41, unsigned char)
1057+#define FBIO_GET_INTERFACE		\
1058+	_IOR('F', 0x42, unsigned char)
1059+#define FBIO_QUERY_TIMING		\
1060+	_IOWR('F', 0x43, struct vpbe_mode_info)
1061+#define FBIO_SET_TIMING			\
1062+	_IOW('F', 0x44, struct vpbe_fb_videomode)
1063+#define FBIO_GET_TIMING                 \
1064+	_IOR('F', 0x45, struct vpbe_fb_videomode)
1065+#define FBIO_SET_VENC_CLK_SOURCE	\
1066+	_IOW('F', 0x46, unsigned char)
1067+#define FBIO_SET_BACKG_COLOR            \
1068+	_IOW('F', 0x47, vpbe_backg_color_t)
1069+#define FBIO_ENABLE_DISPLAY		\
1070+	_IOW('F', 0x48, unsigned char)
1071+#define FBIO_SETPOS            		\
1072+	_IOW('F', 0x49, u_int32_t)
1073+#define FBIO_SET_CURSOR         	\
1074+	_IOW('F', 0x50, struct fb_cursor)
1075+#define FBIO_SET_START     		\
1076+	_IOW('F', 0x66, struct fb_set_start)
1077+
1078+/*
1079+ * Defines and Constants
1080+ */
1081+#ifdef __KERNEL__
1082+#define DAVINCIFB_DEVICE "davincifb"
1083+#define DAVINCIFB_DRIVER "davincifb"
1084+
1085+#define MULTIPLE_BUFFERING      1
1086+
1087+#ifdef MULTIPLE_BUFFERING
1088+#define DOUBLE_BUF      2
1089+#define TRIPLE_BUF      3
1090+#else
1091+#define DOUBLE_BUF      1
1092+#define TRIPLE_BUF      1
1093+#endif
1094+
1095+/* usage:	if (is_win(info->fix.id, OSD0)) ... */
1096+#define is_win(name, x) ((strcmp(name, x ## _FBNAME) == 0) ? 1 : 0)
1097+
1098+/*
1099+ * display controller register I/O routines
1100+ */
1101+u32 dispc_reg_in(u32 offset);
1102+u32 dispc_reg_out(u32 offset, u32 val);
1103+u32 dispc_reg_merge(u32 offset, u32 val, u32 mask);
1104+
1105+#endif				/*__KERNEL__*/
1106+
1107+/*  Error return codes  */
1108+#define VPBE_INVALID_PARA_VALUE         700
1109+#define VPBE_WRONG_WINDOW_ID            701
1110+#define VPBE_CURRENTLY_IN_REQUIRED_MODE 702
1111+#define VPBE_INSUFFICIENT_CLUT_VALUES   703
1112+#define VPBE_CLUT_WRITE_TIMEOUT         704
1113+#define VPBE_VID0_BUF_ADR_NULL          705
1114+#define VPBE_WINDOW_NOT_DISABLED        706
1115+#define VPBE_WINDOW_NOT_ENABLED         707
1116+
1117+#ifndef __KERNEL__
1118+/*  Window ID definations */
1119+#define OSD0      0
1120+#define VID0      1
1121+#define OSD1      2
1122+#define VID1      3
1123+#endif
1124+
1125+/* There are 4 framebuffers, each represented by an fb_info and
1126+ * a dm_win_info structure */
1127+#define OSD0_FBNAME "dm_osd0_fb"
1128+#define OSD1_FBNAME "dm_osd1_fb"
1129+#define VID0_FBNAME "dm_vid0_fb"
1130+#define VID1_FBNAME "dm_vid1_fb"
1131+
1132+/*  FIXME: Digital LCD RGB matrix coefficients */
1133+#define DLCD_DGY_VAL    0
1134+#define DLCD_DRV_VAL    0
1135+#define DLCD_DGU_VAL    0
1136+#define DLCD_DBU_VAL		0
1137+
1138+/* Defines for bitmap format */
1139+#define VPBE_BITMAP_BIT_1	1
1140+#define VPBE_BITMAP_BIT_2	2
1141+#define VPBE_BITMAP_BIT_4	4
1142+#define VPBE_BITMAP_BIT_8	8
1143+#define VPBE_BITMAP_RGB565	16
1144+#define VPBE_VIDEO_YUV422 	16
1145+#define VPBE_VIDEO_RGB888 	24
1146+
1147+/* Defines foe cursor parameter validation*/
1148+#define MAX_CURSOR_WIDTH	0x3FF
1149+#define MAX_CURSOR_HEIGHT	0x1FF
1150+#define MAX_CURSOR_LINEWIDTH    7
1151+
1152+#define BASEX		0x80
1153+#define BASEY		0x12
1154+#define BASEX_DLCD		0x59
1155+#define BASEY_DLCD		0x22
1156+
1157+/*
1158+ * Enumerations
1159+ */
1160+/*  Enum for blending factor  */
1161+typedef enum vpbe_blend_factor {
1162+	OSD_CONTRIBUTION_ZERO = 0,
1163+	OSD_CONTRIBUTION_1_BY_8 = 1,
1164+	OSD_CONTRIBUTION_2_BY_8 = 2,
1165+	OSD_CONTRIBUTION_3_BY_8 = 3,
1166+	OSD_CONTRIBUTION_4_BY_8 = 4,
1167+	OSD_CONTRIBUTION_5_BY_8 = 5,
1168+	OSD_CONTRIBUTION_6_BY_8 = 6,
1169+	OSD_CONTRIBUTION_ONE = 7
1170+} vpbe_blend_factor_t;
1171+
1172+/*  Enum for Boolean variables  */
1173+typedef enum {
1174+	SET_0 = 0,
1175+	SET_1 = 1
1176+} CB_CR_ORDER, ATTRIBUTE, ROM_RAM_CLUT;
1177+
1178+/*  Defines for Display Interface */
1179+#define  PRGB		0
1180+#define  COMPOSITE      1
1181+#define  SVIDEO    	2
1182+#define  COMPONENT 	3
1183+#define  RGB       	4
1184+#define  YCC16     	5
1185+#define  YCC8      	6
1186+#define  SRGB      	7
1187+#define  EPSON     	8
1188+#define  CASIO1G   	9
1189+#define  UDISP     	10
1190+#define  STN       	11
1191+#define VPBE_MAX_INTERFACES	12
1192+
1193+/*  Defines for Display Mode */
1194+#define  LCD    0
1195+#define  NTSC	1
1196+#define  PAL    2
1197+#define  P525   3
1198+#define  P625   4
1199+
1200+#define DEFAULT_MODE 0
1201+#define  P480   0
1202+#define  P400   1
1203+#define  P350   2
1204+#define NON_EXISTING_MODE 255
1205+/*  Enable/Disable enum */
1206+typedef enum {
1207+	VPBE_DISABLE = 0,
1208+	VPBE_ENABLE = 1
1209+} ATTENUATION, TRANSPARENCY, EXPANSION, BLINKING;
1210+
1211+typedef enum clk_source {
1212+	CLK_SOURCE_CLK27 = 0,
1213+	CLK_SOURCE_CLK54 = 1,
1214+	CLK_SOURCE_VPBECLK = 2
1215+} CLK_SOURCE;
1216+
1217+/*
1218+ * Structures and Union Definitions
1219+ */
1220+
1221+/*  Structure for transparency and the blending factor for the bitmap window  */
1222+typedef struct vpbe_bitmap_blend_params {
1223+	unsigned int colorkey;	/* color key to be blend */
1224+	unsigned int enable_colorkeying;	/* enable color keying */
1225+	unsigned int bf;	/* valid range from 0 to 7 only. */
1226+} vpbe_bitmap_blend_params_t;
1227+
1228+/*  Structure for window expansion  */
1229+typedef struct vpbe_win_expansion {
1230+	EXPANSION horizontal;
1231+	EXPANSION vertical;	/* 1: Enable 0:disable */
1232+} vpbe_win_expansion_t;
1233+
1234+/*  Structure for OSD window blinking options */
1235+typedef struct vpbe_blink_option {
1236+	BLINKING blinking;	/* 1: Enable blinking 0: Disable */
1237+	unsigned int interval;	/* Valid only if blinking is 1 */
1238+} vpbe_blink_option_t;
1239+
1240+/*  Structure for DCLK parameters */
1241+typedef struct vpbe_dclk {
1242+	unsigned char dclk_pattern_width;
1243+	unsigned int dclk_pattern0;
1244+	unsigned int dclk_pattern1;
1245+	unsigned int dclk_pattern2;
1246+	unsigned int dclk_pattern3;
1247+} vpbe_dclk_t;
1248+
1249+/*  Structure for display format  */
1250+typedef struct vpbe_display_format {
1251+	unsigned char interface;	/* Output interface type */
1252+	unsigned char mode;	/* output mode */
1253+} vpbe_display_format_t;
1254+
1255+/*  Structure for background color  */
1256+typedef struct vpbe_backg_color {
1257+	unsigned char clut_select;	/* 2: RAM CLUT 1:ROM1 CLUT 0:ROM0 CLUT */
1258+	unsigned char color_offset;	/* index of color */
1259+} vpbe_backg_color_t;
1260+
1261+/*  Structure for Video window configurable parameters  */
1262+typedef struct vpbe_video_config_params {
1263+	CB_CR_ORDER cb_cr_order;	/*Cb/Cr order in input data for a pixel. */
1264+	/*    0: cb cr  1:  cr cb */
1265+	vpbe_win_expansion_t exp_info;	/* HZ/VT Expansion enable disable */
1266+} vpbe_video_config_params_t;
1267+
1268+/*Union of structures giving the CLUT index for the 1, 2, 4 bit bitmap values.*/
1269+typedef union vpbe_clut_idx {
1270+	struct _for_4bit_bimap {
1271+		unsigned char bitmap_val_0;
1272+		unsigned char bitmap_val_1;
1273+		unsigned char bitmap_val_2;
1274+		unsigned char bitmap_val_3;
1275+		unsigned char bitmap_val_4;
1276+		unsigned char bitmap_val_5;
1277+		unsigned char bitmap_val_6;
1278+		unsigned char bitmap_val_7;
1279+		unsigned char bitmap_val_8;
1280+		unsigned char bitmap_val_9;
1281+		unsigned char bitmap_val_10;
1282+		unsigned char bitmap_val_11;
1283+		unsigned char bitmap_val_12;
1284+		unsigned char bitmap_val_13;
1285+		unsigned char bitmap_val_14;
1286+		unsigned char bitmap_val_15;
1287+	} for_4bit_bimap;
1288+	struct _for_2bit_bimap {
1289+		unsigned char bitmap_val_0;
1290+		unsigned char dummy0[4];
1291+		unsigned char bitmap_val_1;
1292+		unsigned char dummy1[4];
1293+		unsigned char bitmap_val_2;
1294+		unsigned char dummy2[4];
1295+		unsigned char bitmap_val_3;
1296+	} for_2bit_bimap;
1297+	struct _for_1bit_bimap {
1298+		unsigned char bitmap_val_0;
1299+		unsigned char dummy0[14];
1300+		unsigned char bitmap_val_1;
1301+	} for_1bit_bimap;
1302+} vpbe_clut_idx_t;
1303+
1304+/*  Structure for bitmap window configurable parameters */
1305+typedef struct vpbe_bitmap_config_params {
1306+	/* Only for bitmap width = 1,2,4 bits */
1307+	vpbe_clut_idx_t clut_idx;
1308+	/* Attenuation value for YUV o/p for bitmap window */
1309+	unsigned char attenuation_enable;
1310+	/* 0: ROM DM270, 1:ROM DM320, 2:RAM CLUT */
1311+	unsigned char clut_select;
1312+} vpbe_bitmap_config_params_t;
1313+
1314+/*  Unioun for video/OSD configuration parameters  */
1315+typedef union vpbe_conf_params {
1316+
1317+	struct vpbe_video_params {
1318+		CB_CR_ORDER cb_cr_order;
1319+		/* HZ/VT Expansion enable disable */
1320+		vpbe_win_expansion_t exp_info;
1321+	} video_params;
1322+
1323+	struct vpbe_bitmap_params {
1324+		/* Attenuation value for YUV o/p */
1325+		ATTENUATION attenuation_enable;
1326+		/* 0: ROM DM270, 1: ROM DM320, 2:RAM CLUT */
1327+		unsigned char clut_select;
1328+		/* Only for bitmap width = 1,2,4 bits */
1329+		vpbe_clut_idx_t clut_idx;
1330+		/* 0: OSD window is bitmap window */
1331+		/* 1: OSD window is attribute window */
1332+		ATTRIBUTE enable_attribute;
1333+		/* To hold bps value.
1334+		   Used to switch back from attribute to bitmap. */
1335+		unsigned int stored_bits_per_pixel;
1336+		/* Blending information */
1337+		vpbe_bitmap_blend_params_t blend_info;
1338+		/* OSD Blinking information */
1339+		vpbe_blink_option_t blink_info;
1340+	} bitmap_params;
1341+
1342+} vpbe_conf_params_t;
1343+
1344+typedef struct vpbe_video_params vpbe_video_params_t;
1345+typedef struct vpbe_bitmap_params vpbe_bitmap_params_t;
1346+
1347+/* Structure to hold window position */
1348+typedef struct vpbe_window_position {
1349+	unsigned int xpos;	/* X position of the window */
1350+	unsigned int ypos;	/* Y position of the window */
1351+} vpbe_window_position_t;
1352+
1353+#ifdef __KERNEL__
1354+/*  Structure for each window */
1355+typedef struct vpbe_dm_win_info {
1356+	struct fb_info info;
1357+	vpbe_window_position_t win_pos;	/* X,Y position of window */
1358+	/* Size of window is already there in var_info structure. */
1359+
1360+	dma_addr_t fb_base_phys;	/*framebuffer area */
1361+	unsigned int fb_base;	/*window memory pointer */
1362+	unsigned int fb_size;	/*memory size */
1363+	unsigned int pseudo_palette[17];
1364+	int alloc_fb_mem;
1365+	/*flag to identify if framebuffer area is fixed or not */
1366+	unsigned long sdram_address;
1367+	struct vpbe_dm_info *dm;
1368+	unsigned char window_enable;	/*Additions for all windows */
1369+	zoom_params_t zoom;	/*Zooming parameters */
1370+	unsigned char field_frame_select;	/*To select Field or frame */
1371+	unsigned char numbufs;	/*Number of buffers valid 2 or 3 */
1372+	vpbe_conf_params_t conf_params;
1373+	/*window configuration parameter union pointer */
1374+} vpbe_dm_win_info_t;
1375+#endif				/*__KERNEL__*/
1376+
1377+/*
1378+ *  Videmode structure for display interface and mode settings
1379+ */
1380+typedef struct vpbe_fb_videomode {
1381+	unsigned char name[10];	/* Mode name ( NTSC , PAL) */
1382+	unsigned int vmode;	/* FB_MODE_INTERLACED or FB_MODE_NON_INTERLACED */
1383+	unsigned int xres;	/* X Resolution of the display */
1384+	unsigned int yres;	/* Y Resolution of the display */
1385+	unsigned int fps;	/* frames per second */
1386+	/* Timing Parameters applicable for std = 0 only */
1387+	unsigned int left_margin;
1388+	unsigned int right_margin;
1389+	unsigned int upper_margin;
1390+	unsigned int lower_margin;
1391+	unsigned int hsync_len;
1392+	unsigned int vsync_len;
1393+	unsigned int sync;	/* 0: hsync -ve/vsync -ve */
1394+	/*1: hsync -ve/vsync +ve */
1395+	/*2: hsync +ve/vsync -ve */
1396+	/*3: hsync +ve/vsync +ve */
1397+	unsigned int basepx;	/* Display x,y start position */
1398+	unsigned int basepy;
1399+/*  1= Mode s available in modelist 0=Mode is not available in modelist */
1400+	unsigned int std;
1401+} vpbe_fb_videomode_t;
1402+
1403+/* Structure to interface videomode to application*/
1404+typedef struct vpbe_mode_info {
1405+	vpbe_fb_videomode_t vid_mode;
1406+	unsigned char interface;
1407+	unsigned char mode_idx;
1408+} vpbe_mode_info_t;
1409+
1410+#ifdef __KERNEL__
1411+/*
1412+ * Structure for the driver holding information of windows,
1413+ *  memory base addresses etc.
1414+ */
1415+typedef struct vpbe_dm_info {
1416+	vpbe_dm_win_info_t *osd0;
1417+	vpbe_dm_win_info_t *osd1;
1418+	vpbe_dm_win_info_t *vid0;
1419+	vpbe_dm_win_info_t *vid1;
1420+
1421+/* to map the registers */
1422+	dma_addr_t mmio_base_phys;
1423+	unsigned int mmio_base;
1424+	unsigned int mmio_size;
1425+
1426+	wait_queue_head_t vsync_wait;
1427+	unsigned int vsync_cnt;
1428+	int timeout;
1429+
1430+	/* this is the function that configures the output device (NTSC/PAL/LCD)
1431+	 * for the required output format (composite/s-video/component/rgb)
1432+	 */
1433+	void (*output_device_config) (void);
1434+
1435+	struct device *dev;
1436+
1437+	vpbe_backg_color_t backg;	/* background color */
1438+	vpbe_dclk_t dclk;	/*DCLK parameters */
1439+	vpbe_display_format_t display;	/*Display interface and mode */
1440+	vpbe_fb_videomode_t videomode;	/*Cuurent videomode */
1441+	char ram_clut[256][3];	/*RAM CLUT array */
1442+	struct fb_cursor cursor;	/* cursor config params from fb.h */
1443+/*Flag that indicates whether any of the display is enabled or not*/
1444+	int display_enable;
1445+} vpbe_dm_info_t;
1446+
1447+/*
1448+ * Functions Definitions for 'davincifb' module
1449+ */
1450+int vpbe_mem_alloc_window_buf(vpbe_dm_win_info_t *);
1451+int vpbe_mem_release_window_buf(vpbe_dm_win_info_t *);
1452+void init_display_function(vpbe_display_format_t *);
1453+int vpbe_mem_alloc_struct(vpbe_dm_win_info_t **);
1454+void set_vid0_default_conf(void);
1455+void set_vid1_default_conf(void);
1456+void set_osd0_default_conf(void);
1457+void set_osd1_default_conf(void);
1458+void set_cursor_default_conf(void);
1459+void set_dm_default_conf(void);
1460+void set_win_enable(char *, unsigned int);
1461+int within_vid0_limits(u32, u32, u32, u32);
1462+void vpbe_set_display_default(void);
1463+#ifdef __KERNEL__
1464+void set_win_position(char *, u32, u32, u32, u32);
1465+void change_win_param(int);
1466+void set_interlaced(char *, unsigned int);
1467+#endif /* __KERNEL__ */
1468+
1469+/*
1470+ *	Function definations for 'osd' module
1471+ */
1472+
1473+int vpbe_enable_window(vpbe_dm_win_info_t *);
1474+int vpbe_disable_window(vpbe_dm_win_info_t *);
1475+int vpbe_vid_osd_select_field_frame(u8 *, u8);
1476+int vpbe_bitmap_set_blend_factor(u8 *, vpbe_bitmap_blend_params_t *);
1477+int vpbe_bitmap_set_ram_clut(void);
1478+int vpbe_enable_disable_attribute_window(u32);
1479+int vpbe_get_blinking(u8 *, vpbe_blink_option_t *);
1480+int vpbe_set_blinking(u8 *, vpbe_blink_option_t *);
1481+int vpbe_set_vid_params(u8 *, vpbe_video_config_params_t *);
1482+int vpbe_get_vid_params(u8 *, vpbe_video_config_params_t *);
1483+int vpbe_bitmap_get_params(u8 *, vpbe_bitmap_config_params_t *);
1484+int vpbe_bitmap_set_params(u8 *, vpbe_bitmap_config_params_t *);
1485+int vpbe_set_cursor_params(struct fb_cursor *);
1486+int vpbe_set_vid_expansion(vpbe_win_expansion_t *);
1487+int vpbe_set_dclk(vpbe_dclk_t *);
1488+int vpbe_set_display_format(vpbe_display_format_t *);
1489+int vpbe_set_backg_color(vpbe_backg_color_t *);
1490+int vpbe_set_interface(u8);
1491+int vpbe_query_mode(vpbe_mode_info_t *);
1492+int vpbe_set_mode(struct vpbe_fb_videomode *);
1493+int vpbe_set_venc_clk_source(u8);
1494+void set_vid0_default_conf(void);
1495+void set_osd0_default_conf(void);
1496+void set_vid1_default_conf(void);
1497+void set_osd1_default_conf(void);
1498+void set_cursor_default_conf(void);
1499+void set_dm_default_conf(void);
1500+/*
1501+ * Function definations for 'venc' module
1502+ */
1503+
1504+void davincifb_ntsc_composite_config(void);
1505+void davincifb_ntsc_svideo_config(void);
1506+void davincifb_ntsc_component_config(void);
1507+void davincifb_pal_composite_config(void);
1508+void davincifb_pal_svideo_config(void);
1509+void davincifb_pal_component_config(void);
1510+
1511+void vpbe_davincifb_ntsc_rgb_config(void);
1512+void vpbe_davincifb_pal_rgb_config(void);
1513+void vpbe_davincifb_525p_component_config(void);
1514+void vpbe_davincifb_625p_component_config(void);
1515+
1516+void vpbe_enable_venc(int);
1517+void vpbe_enable_dacs(int);
1518+/*
1519+ * Function definations for 'dlcd' module
1520+ */
1521+void vpbe_davincifb_480p_prgb_config(void);
1522+void vpbe_davincifb_400p_prgb_config(void);
1523+void vpbe_davincifb_350p_prgb_config(void);
1524+void vpbe_set_display_timing(struct vpbe_fb_videomode *);
1525+
1526+void vpbe_enable_lcd(int);
1527+/*
1528+ * Following functions are not implemented
1529+ */
1530+void vpbe_davincifb_default_ycc16_config(void);
1531+void vpbe_davincifb_default_ycc8_config(void);
1532+void vpbe_davincifb_default_srgb_config(void);
1533+void vpbe_davincifb_default_epson_config(void);
1534+void vpbe_davincifb_default_casio_config(void);
1535+void vpbe_davincifb_default_UDISP_config(void);
1536+void vpbe_davincifb_default_STN_config(void);
1537+#endif				/*__KERNEL__*/
1538+
1539+#endif				/* End of #ifndef DAVINCI_VPBE_H */
1540diff -puNr -Naur directfb-1.6.3-orig/gfxdrivers/davinci/davinci_gfxdriver.h directfb-1.6.3/gfxdrivers/davinci/davinci_gfxdriver.h
1541--- directfb-1.6.3-orig/gfxdrivers/davinci/davinci_gfxdriver.h	1970-01-01 01:00:00.000000000 +0100
1542+++ directfb-1.6.3/gfxdrivers/davinci/davinci_gfxdriver.h	2013-04-07 21:33:19.560662133 +0200
1543@@ -0,0 +1,169 @@
1544+/*
1545+   TI Davinci driver - Graphics Driver
1546+
1547+   (c) Copyright 2007  Telio AG
1548+
1549+   Written by Denis Oliver Kropp <dok@directfb.org>
1550+
1551+   Code is derived from VMWare driver.
1552+
1553+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
1554+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
1555+
1556+   All rights reserved.
1557+
1558+   This library is free software; you can redistribute it and/or
1559+   modify it under the terms of the GNU Lesser General Public
1560+   License as published by the Free Software Foundation; either
1561+   version 2 of the License, or (at your option) any later version.
1562+
1563+   This library is distributed in the hope that it will be useful,
1564+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1565+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1566+   Lesser General Public License for more details.
1567+
1568+   You should have received a copy of the GNU Lesser General Public
1569+   License along with this library; if not, write to the
1570+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1571+   Boston, MA 02111-1307, USA.
1572+*/
1573+
1574+#ifndef __DAVINCI_GFXDRIVER_H__
1575+#define __DAVINCI_GFXDRIVER_H__
1576+
1577+#include <sys/ioctl.h>
1578+#include <davincifb.h>
1579+
1580+#include <core/surface_buffer.h>
1581+
1582+#include "davincifb.h"
1583+
1584+#include "davinci_c64x.h"
1585+
1586+
1587+typedef struct {
1588+     /* validation flags */
1589+     int                       v_flags;
1590+
1591+     /* cached/computed values */
1592+     void                     *dst_addr;
1593+     unsigned long             dst_phys;
1594+     unsigned int              dst_size;
1595+     unsigned long             dst_pitch;
1596+     DFBSurfacePixelFormat     dst_format;
1597+     unsigned long             dst_bpp;
1598+
1599+     void                     *src_addr;
1600+     unsigned long             src_phys;
1601+     unsigned long             src_pitch;
1602+     DFBSurfacePixelFormat     src_format;
1603+     unsigned long             src_bpp;
1604+
1605+     unsigned long             source_mult;
1606+
1607+     unsigned long             fillcolor;
1608+
1609+     int                       blit_blend_sub_function;
1610+     int                       draw_blend_sub_function;
1611+
1612+     DFBColor                  color;
1613+     unsigned long             color_argb;
1614+     unsigned long             colorkey;
1615+
1616+     DFBSurfaceBlittingFlags   blitting_flags;
1617+
1618+     DFBRegion                 clip;
1619+
1620+     /** Add shared data here... **/
1621+     struct fb_fix_screeninfo  fix[4];
1622+
1623+     CoreSurfacePool          *osd_pool;
1624+     CoreSurfacePool          *video_pool;
1625+
1626+     bool                      synced;
1627+} DavinciDeviceData;
1628+
1629+
1630+typedef struct {
1631+     int                       num;
1632+     int                       fd;
1633+     void                     *mem;
1634+     int                       size;
1635+} DavinciFB;
1636+
1637+typedef struct {
1638+     DavinciDeviceData        *ddev;
1639+
1640+     CoreDFB                  *core;
1641+
1642+     CoreScreen               *screen;
1643+     CoreLayer                *osd;
1644+     CoreLayer                *video;
1645+
1646+     DavinciFB                 fb[4];
1647+
1648+     DavinciC64x               c64x;
1649+     bool                      c64x_present;
1650+
1651+     DavinciC64xTasks          tasks;
1652+} DavinciDriverData;
1653+
1654+
1655+static inline DFBResult
1656+davincifb_pan_display( const DavinciFB             *fb,
1657+                       struct fb_var_screeninfo    *var,
1658+                       const CoreSurfaceBufferLock *lock,
1659+                       DFBSurfaceFlipFlags          flags,
1660+                       int                          x,
1661+                       int                          y )
1662+{
1663+     int ret;
1664+
1665+     if (lock) {
1666+#ifdef FBIO_SET_START
1667+          CoreSurfaceBuffer   *buffer = lock->buffer;
1668+          struct fb_set_start  set_start;
1669+
1670+          /* physical mode */
1671+          set_start.offset   = -1;
1672+          set_start.sync     = (flags & DSFLIP_ONSYNC) ? 1 : 0;
1673+
1674+          /* life's so easy */
1675+          set_start.physical = lock->phys + DFB_BYTES_PER_LINE( buffer->format, x ) + y * lock->pitch;
1676+
1677+          ret = ioctl( fb->fd, FBIO_SET_START, &set_start );
1678+          if (ret < 0)
1679+               D_DEBUG( "FBIO_SET_START (0x%08lx, sync %llu) failed!\n",
1680+                         set_start.physical, set_start.sync );
1681+
1682+          if (ret == 0) {
1683+               if (flags & DSFLIP_WAIT)
1684+                    ioctl( fb->fd, FBIO_WAITFORVSYNC );
1685+
1686+               return DFB_OK;
1687+          }
1688+
1689+          /* fallback */
1690+#endif
1691+          var->xoffset = x;                  /* poor version */
1692+          var->yoffset = y + lock->offset / lock->pitch;
1693+     }
1694+     else {
1695+          var->xoffset = x;
1696+          var->yoffset = y;
1697+     }
1698+
1699+     var->activate = /*(flags & DSFLIP_ONSYNC) ? FB_ACTIVATE_VBL :*/ FB_ACTIVATE_NOW;
1700+
1701+     ret = ioctl( fb->fd, FBIOPAN_DISPLAY, var );
1702+     if (ret)
1703+          D_PERROR( "Davinci/FB: FBIOPAN_DISPLAY (fb%d - %d,%d) failed!\n",
1704+                    fb->num, var->xoffset, var->yoffset );
1705+
1706+     if (flags & DSFLIP_WAIT)
1707+          ioctl( fb->fd, FBIO_WAITFORVSYNC );
1708+
1709+     return DFB_OK;
1710+}
1711+
1712+#endif
1713diff -puNr -Naur directfb-1.6.3-orig/tests/voodoo/voodoo_test.h directfb-1.6.3/tests/voodoo/voodoo_test.h
1714--- directfb-1.6.3-orig/tests/voodoo/voodoo_test.h	1970-01-01 01:00:00.000000000 +0100
1715+++ directfb-1.6.3/tests/voodoo/voodoo_test.h	2013-04-07 21:33:31.824408024 +0200
1716@@ -0,0 +1,10 @@
1717+#ifndef __VOODOO_TEST_H__
1718+#define __VOODOO_TEST_H__
1719+
1720+typedef enum {
1721+     VOODOO_TEST_INCREASE,
1722+     VOODOO_TEST_QUERY
1723+} VoodooTestCall;
1724+
1725+#endif
1726+
1727