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