summaryrefslogtreecommitdiffstats
path: root/package/directfb/directfb-fix-missing-davinci-voodoo-header.patch
blob: 6ad4958f847be00a54cb567668374cce49663d76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
The archive of directfb-1.6.3 is still missing some header files against
the tagged git tree of directfb. The following files are missing.

gfxdrivers/davinci/davinci_c64x.h
gfxdrivers/davinci/davincifb.h
gfxdrivers/davinci/davinci_gfxdriver.h
tests/voodoo/voodoo_test.h

The headers of course are needed to be able to build every module of
directfb. The headers are taken from the git tree of directfb
http://git.directfb.org/?p=core/DirectFB.git;a=commit;h=38b784549bc59bb07c58bb29667cb658695d39a7,
tag DIRECTFB_1_6_3, SHA1ID 38b784549bc59bb07c58bb29667cb658695d39a7.

Signed-off-by: Carsten Schoenert <c.schoenert@gmail.com>

diff -puNr -Naur directfb-1.6.3-orig/gfxdrivers/davinci/davinci_c64x.h directfb-1.6.3/gfxdrivers/davinci/davinci_c64x.h
--- directfb-1.6.3-orig/gfxdrivers/davinci/davinci_c64x.h	1970-01-01 01:00:00.000000000 +0100
+++ directfb-1.6.3/gfxdrivers/davinci/davinci_c64x.h	2013-04-07 21:33:25.928530187 +0200
@@ -0,0 +1,935 @@
+/*
+   TI Davinci driver - C64X+ DSP Library
+
+   (c) Copyright 2008  directfb.org
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org> and
+              Olaf Dreesen <olaf@directfb.org>.
+
+   All rights reserved.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License
+   version 2 as published by the Free Software Foundation.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __DAVINCI_C64X_H__
+#define __DAVINCI_C64X_H__
+
+#include <unistd.h>
+
+#include <directfb.h>
+
+#include <direct/messages.h>
+#include <direct/trace.h>
+
+#include <linux/c64x.h>
+
+#define mb() __asm__ __volatile__ ("" : : : "memory")
+
+/**********************************************************************************************************************/
+
+typedef struct {
+     int                 magic;
+
+     int                 fd;
+     c64xTaskControl    *ctl;
+     void               *mem;
+
+     c64xTask           *QueueL;
+} DavinciC64x;
+
+typedef struct {
+     int                 magic;
+     unsigned int        max_tasks;
+     unsigned int        num_tasks;
+     c64xTask           *tasks;
+} DavinciC64xTasks;
+
+typedef enum {
+     C64X_TEF_NONE       = 0x0000,
+     C64X_TEF_RESET      = 0x0001
+} DavinciC64xEmitFlags;
+
+/**********************************************************************************************************************/
+
+DFBResult davinci_c64x_open    ( DavinciC64x *c64x );
+
+DFBResult davinci_c64x_close   ( DavinciC64x *c64x );
+
+DFBResult davinci_c64x_wait_low( DavinciC64x *c64x );
+
+/**********************************************************************************************************************/
+
+DFBResult davinci_c64x_tasks_init   ( DavinciC64xTasks *tasks,
+                                      unsigned int      size );
+
+DFBResult davinci_c64x_tasks_destroy( DavinciC64xTasks *tasks );
+
+/**********************************************************************************************************************/
+
+DFBResult davinci_c64x_emit_tasks( DavinciC64x          *c64x,
+                                   DavinciC64xTasks     *tasks,
+                                   DavinciC64xEmitFlags  flags );
+
+/**********************************************************************************************************************/
+
+static const char *state_names[] = { "DONE", "ERROR", "TODO", "RUNNING" };
+
+static inline c64xTask *
+c64x_get_task( DavinciC64x *c64x )
+{
+     c64xTaskControl *ctl   = c64x->ctl;
+     uint32_t         idx   = ctl->QL_arm;
+     uint32_t         next  = (idx + 1) & C64X_QUEUE_MASK;
+     c64xTask        *task  = &c64x->QueueL[idx];
+     int              loops = 0;
+     uint32_t         idle  = 0;
+
+     /* Wait for the entry (and next) to be processed by the DSP (rare case). */
+     while (task->c64x_flags & C64X_FLAG_TODO || ctl->QL_dsp == next) {
+          if (loops > 666 || (idle && ctl->idlecounter - idle > 666)) {
+               c64xTask *dsp_task = &c64x->QueueL[ctl->QL_dsp];
+
+               D_PERROR( "Davinci/C64X+: Blocked! [DSP %d / %d (%s), ARM %d / %d (%s)]\n",
+                         ctl->QL_dsp,
+                         (dsp_task->c64x_function >> 2) & 0x3fff,
+                         state_names[dsp_task->c64x_function & 3],
+                         ctl->QL_arm,
+                         (task->c64x_function >> 2) & 0x3fff,
+                         state_names[task->c64x_function & 3] );
+
+               break;
+          }
+
+          idle = ctl->idlecounter;
+
+          /* Queue is full, waiting 10-20ms should not be too bad. */
+          if (loops++ > 10)
+               usleep( 5000 );
+     }
+
+     return task;
+}
+
+static inline void
+c64x_submit_task( DavinciC64x *c64x, c64xTask *task )
+{
+     c64xTaskControl *ctl  = c64x->ctl;
+     uint32_t         idx  = ctl->QL_arm;
+     uint32_t         next = (idx + 1) & C64X_QUEUE_MASK;
+
+     mb();
+
+     ctl->QL_arm = next;
+
+     mb();
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+davinci_c64x_wb_inv_range( DavinciC64x   *c64x,
+                           unsigned long  start,
+                           u32            length,
+                           u32            func )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = start;
+     task->c64x_arg[1] = length;
+     task->c64x_arg[2] = func;
+
+     task->c64x_function = C64X_WB_INV_RANGE | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_write_back_all( DavinciC64x *c64x )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_function = C64X_WRITE_BACK_ALL | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+davinci_c64x_load_block__L( DavinciC64xTasks *tasks,
+                            unsigned long     words,
+                            u32               num,
+                            u32               flags )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = words;
+     task->c64x_arg[1] = num;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_LOAD_BLOCK | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_load_block( DavinciC64x   *c64x,
+                         unsigned long  words,
+                         u32            num,
+                         u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = words;
+     task->c64x_arg[1] = num;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_LOAD_BLOCK | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_fetch_uyvy( DavinciC64x   *c64x,
+                         unsigned long  dest,
+                         unsigned long  source,
+                         u32            pitch,
+                         u32            height,
+                         u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = source;
+     task->c64x_arg[2] = pitch;
+     task->c64x_arg[3] = height;
+     task->c64x_arg[4] = flags;
+
+     task->c64x_function = C64X_FETCH_UYVY | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_mc( DavinciC64x   *c64x,
+                 unsigned long  dest,
+                 u32            dpitch,
+                 unsigned long  source0,
+                 unsigned long  source1,
+                 u32            spitch,
+                 u32            height,
+                 int            func )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = source0;
+     task->c64x_arg[3] = source1;
+     task->c64x_arg[4] = spitch;
+     task->c64x_arg[5] = height;
+
+     task->c64x_function = func | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_put_idct_uyvy_16x16__L( DavinciC64xTasks *tasks,
+                                     unsigned long     dest,
+                                     u32               pitch,
+                                     u32               flags )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_IDCT_UYVY_16x16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_put_idct_uyvy_16x16( DavinciC64x   *c64x,
+                                  unsigned long  dest,
+                                  u32            pitch,
+                                  u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_IDCT_UYVY_16x16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_put_mc_uyvy_16x16__L( DavinciC64xTasks *tasks,
+                                   unsigned long     dest,
+                                   u32               pitch,
+                                   u32               flags )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_MC_UYVY_16x16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_put_mc_uyvy_16x16( DavinciC64x   *c64x,
+                                unsigned long  dest,
+                                u32            pitch,
+                                u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_MC_UYVY_16x16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_put_sum_uyvy_16x16__L( DavinciC64xTasks *tasks,
+                                    unsigned long     dest,
+                                    u32               pitch,
+                                    u32               flags )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_SUM_UYVY_16x16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_put_sum_uyvy_16x16( DavinciC64x   *c64x,
+                                 unsigned long  dest,
+                                 u32            pitch,
+                                 u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = flags;
+
+     task->c64x_function = C64X_PUT_SUM_UYVY_16x16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_dva_begin_frame__L( DavinciC64xTasks *tasks,
+                                 u32               pitch,
+                                 unsigned long     current,
+                                 unsigned long     past,
+                                 unsigned long     future,
+                                 u32               flags )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = pitch;
+     task->c64x_arg[1] = current;
+     task->c64x_arg[2] = past;
+     task->c64x_arg[3] = future;
+     task->c64x_arg[4] = flags;
+
+     task->c64x_function = C64X_DVA_BEGIN_FRAME | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_dva_begin_frame( DavinciC64x   *c64x,
+                              u32            pitch,
+                              unsigned long  current,
+                              unsigned long  past,
+                              unsigned long  future,
+                              u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = pitch;
+     task->c64x_arg[1] = current;
+     task->c64x_arg[2] = past;
+     task->c64x_arg[3] = future;
+     task->c64x_arg[4] = flags;
+
+     task->c64x_function = C64X_DVA_BEGIN_FRAME | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_dva_motion_block__L( DavinciC64xTasks *tasks,
+                                  unsigned long     macroblock )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = macroblock;
+
+     task->c64x_function = C64X_DVA_MOTION_BLOCK | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_dva_motion_block( DavinciC64x   *c64x,
+                               unsigned long  macroblock )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = macroblock;
+
+     task->c64x_function = C64X_DVA_MOTION_BLOCK | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+davinci_c64x_dva_idct( DavinciC64x   *c64x,
+				   unsigned long  dest,
+				   u32            pitch,
+				   unsigned long  source )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = source;
+
+     task->c64x_function = C64X_DVA_IDCT | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+/**********************************************************************************************************************/
+
+static inline void
+davinci_c64x_put_uyvy_16x16( DavinciC64x   *c64x,
+                             unsigned long  dest,
+                             u32            pitch,
+                             unsigned long  source,
+                             u32            flags )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = source;
+     task->c64x_arg[3] = flags;
+
+     task->c64x_function = C64X_PUT_UYVY_16x16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_dither_argb__L( DavinciC64xTasks *tasks,
+                             unsigned long     dst_rgb,
+                             unsigned long     dst_alpha,
+                             u32               dst_pitch,
+                             unsigned long     source,
+                             u32               src_pitch,
+                             u32               width,
+                             u32               height )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dst_rgb;
+     task->c64x_arg[1] = dst_alpha;
+     task->c64x_arg[2] = dst_pitch;
+     task->c64x_arg[3] = source;
+     task->c64x_arg[4] = src_pitch;
+     task->c64x_arg[5] = width;
+     task->c64x_arg[6] = height;
+
+     task->c64x_function = C64X_DITHER_ARGB | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_dither_argb( DavinciC64x   *c64x,
+                          unsigned long  dst_rgb,
+                          unsigned long  dst_alpha,
+                          u32            dst_pitch,
+                          unsigned long  source,
+                          u32            src_pitch,
+                          u32            width,
+                          u32            height )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dst_rgb;
+     task->c64x_arg[1] = dst_alpha;
+     task->c64x_arg[2] = dst_pitch;
+     task->c64x_arg[3] = source;
+     task->c64x_arg[4] = src_pitch;
+     task->c64x_arg[5] = width;
+     task->c64x_arg[6] = height;
+
+     task->c64x_function = C64X_DITHER_ARGB | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_fill_16__L( DavinciC64xTasks *tasks,
+                         unsigned long     dest,
+                         u32               pitch,
+                         u32               width,
+                         u32               height,
+                         u32               value )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = width;
+     task->c64x_arg[3] = height;
+     task->c64x_arg[4] = value;
+
+     task->c64x_function = C64X_FILL_16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_fill_16( DavinciC64x   *c64x,
+                      unsigned long  dest,
+                      u32            pitch,
+                      u32            width,
+                      u32            height,
+                      u32            value )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = width;
+     task->c64x_arg[3] = height;
+     task->c64x_arg[4] = value;
+
+     task->c64x_function = C64X_FILL_16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_fill_32__L( DavinciC64xTasks *tasks,
+                         unsigned long     dest,
+                         u32               pitch,
+                         u32               width,
+                         u32               height,
+                         u32               value )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = width;
+     task->c64x_arg[3] = height;
+     task->c64x_arg[4] = value;
+
+     task->c64x_function = C64X_FILL_32 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_fill_32( DavinciC64x   *c64x,
+                      unsigned long  dest,
+                      u32            pitch,
+                      u32            width,
+                      u32            height,
+                      u32            value )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = pitch;
+     task->c64x_arg[2] = width;
+     task->c64x_arg[3] = height;
+     task->c64x_arg[4] = value;
+
+     task->c64x_function = C64X_FILL_32 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_blit_16__L( DavinciC64xTasks *tasks,
+                         unsigned long     dest,
+                         u32               dpitch,
+                         unsigned long     src,
+                         u32               spitch,
+                         u32               width,
+                         u32               height )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width;
+     task->c64x_arg[5] = height;
+
+     task->c64x_function = C64X_COPY_16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_blit_16( DavinciC64x   *c64x,
+                      unsigned long  dest,
+                      u32            dpitch,
+                      unsigned long  src,
+                      u32            spitch,
+                      u32            width,
+                      u32            height )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width;
+     task->c64x_arg[5] = height;
+
+     task->c64x_function = C64X_COPY_16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_blit_32__L( DavinciC64xTasks *tasks,
+                         unsigned long     dest,
+                         u32               dpitch,
+                         unsigned long     src,
+                         u32               spitch,
+                         u32               width,
+                         u32               height )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width;
+     task->c64x_arg[5] = height;
+
+     task->c64x_function = C64X_COPY_32 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_blit_32( DavinciC64x   *c64x,
+                      unsigned long  dest,
+                      u32            dpitch,
+                      unsigned long  src,
+                      u32            spitch,
+                      u32            width,
+                      u32            height )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width;
+     task->c64x_arg[5] = height;
+
+     task->c64x_function = C64X_COPY_32 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_stretch_32__L( DavinciC64xTasks *tasks,
+                            unsigned long     dest,
+                            u32               dpitch,
+                            unsigned long     src,
+                            u32               spitch,
+                            u32               dw,
+                            u32               dh,
+                            u32               sw,
+                            u32               sh,
+                            const DFBRegion  *clip )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = src;
+     task->c64x_arg[2] = dpitch   | (spitch   << 16);
+     task->c64x_arg[3] = dh       | (dw       << 16);
+     task->c64x_arg[4] = sh       | (sw       << 16);
+     task->c64x_arg[5] = clip->x2 | (clip->y2 << 16);
+     task->c64x_arg[6] = clip->x1 | (clip->y1 << 16);
+
+     if (sw > dw && sh > dh)
+          task->c64x_function = C64X_STRETCH_32_down | C64X_FLAG_TODO;
+     else
+          task->c64x_function = C64X_STRETCH_32_up | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_stretch_32( DavinciC64x     *c64x,
+                         unsigned long    dest,
+                         u32              dpitch,
+                         unsigned long    src,
+                         u32              spitch,
+                         u32              dw,
+                         u32              dh,
+                         u32              sw,
+                         u32              sh,
+                         const DFBRegion *clip )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = src;
+     task->c64x_arg[2] = dpitch   | (spitch   << 16);
+     task->c64x_arg[3] = dh       | (dw       << 16);
+     task->c64x_arg[4] = sh       | (sw       << 16);
+     task->c64x_arg[5] = clip->x2 | (clip->y2 << 16);
+     task->c64x_arg[6] = clip->x1 | (clip->y1 << 16);
+
+     if (sw > dw && sh > dh)
+          task->c64x_function = C64X_STRETCH_32_down | C64X_FLAG_TODO;
+     else
+          task->c64x_function = C64X_STRETCH_32_up | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_blit_blend_32__L( DavinciC64xTasks *tasks,
+                               u32               sub_func,
+                               unsigned long     dest,
+                               u32               dpitch,
+                               unsigned long     src,
+                               u32               spitch,
+                               u32               width,
+                               u32               height,
+                               u32               argb,
+                               u8                alpha )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width | (height << 16);
+     task->c64x_arg[5] = argb;
+     task->c64x_arg[6] = alpha;
+
+     task->c64x_function = (sub_func << 16) | C64X_BLEND_32 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_blit_blend_32( DavinciC64x   *c64x,
+                            u32            sub_func,
+                            unsigned long  dest,
+                            u32            dpitch,
+                            unsigned long  src,
+                            u32            spitch,
+                            u32            width,
+                            u32            height,
+                            u32            argb,
+                            u8             alpha )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = dpitch;
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = spitch;
+     task->c64x_arg[4] = width | (height << 16);
+     task->c64x_arg[5] = argb;
+     task->c64x_arg[6] = alpha;
+
+     task->c64x_function = (sub_func << 16) | C64X_BLEND_32 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_blit_keyed_16__L( DavinciC64xTasks *tasks,
+                               unsigned long     dest,
+                               u32               dpitch,
+                               unsigned long     src,
+                               u32               spitch,
+                               u32               width,
+                               u32               height,
+                               u32               key,
+                               u32               mask )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = width;
+     task->c64x_arg[4] = height;
+     task->c64x_arg[5] = key;
+     task->c64x_arg[6] = mask;
+
+     task->c64x_function = C64X_COPY_KEYED_16 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_blit_keyed_16( DavinciC64x   *c64x,
+                            unsigned long  dest,
+                            u32            dpitch,
+                            unsigned long  src,
+                            u32            spitch,
+                            u32            width,
+                            u32            height,
+                            u32            key,
+                            u32            mask )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = width;
+     task->c64x_arg[4] = height;
+     task->c64x_arg[5] = key;
+     task->c64x_arg[6] = mask;
+
+     task->c64x_function = C64X_COPY_KEYED_16 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+static inline void
+davinci_c64x_blit_keyed_32__L( DavinciC64xTasks *tasks,
+                               unsigned long     dest,
+                               u32               dpitch,
+                               unsigned long     src,
+                               u32               spitch,
+                               u32               width,
+                               u32               height,
+                               u32               key,
+                               u32               mask )
+{
+     c64xTask *task = &tasks->tasks[tasks->num_tasks];
+
+     D_ASSERT( tasks->num_tasks < tasks->max_tasks );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = width;
+     task->c64x_arg[4] = height;
+     task->c64x_arg[5] = key;
+     task->c64x_arg[6] = mask;
+
+     task->c64x_function = C64X_COPY_KEYED_32 | C64X_FLAG_TODO;
+
+     tasks->num_tasks++;
+}
+
+static inline void
+davinci_c64x_blit_keyed_32( DavinciC64x   *c64x,
+                            unsigned long  dest,
+                            u32            dpitch,
+                            unsigned long  src,
+                            u32            spitch,
+                            u32            width,
+                            u32            height,
+                            u32            key,
+                            u32            mask )
+{
+     c64xTask *task = c64x_get_task( c64x );
+
+     task->c64x_arg[0] = dest;
+     task->c64x_arg[1] = (dpitch << 16) | (spitch & 0xffff);
+     task->c64x_arg[2] = src;
+     task->c64x_arg[3] = width;
+     task->c64x_arg[4] = height;
+     task->c64x_arg[5] = key;
+     task->c64x_arg[6] = mask;
+
+     task->c64x_function = C64X_COPY_KEYED_32 | C64X_FLAG_TODO;
+
+     c64x_submit_task( c64x, task );
+}
+
+#endif
+
diff -puNr -Naur directfb-1.6.3-orig/gfxdrivers/davinci/davincifb.h directfb-1.6.3/gfxdrivers/davinci/davincifb.h
--- directfb-1.6.3-orig/gfxdrivers/davinci/davincifb.h	1970-01-01 01:00:00.000000000 +0100
+++ directfb-1.6.3/gfxdrivers/davinci/davincifb.h	2013-04-07 21:33:21.488622184 +0200
@@ -0,0 +1,581 @@
+/* 
+ * Copyright (C) 2006 Texas Instruments Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option)any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * File: davincifb.h	
+ */
+
+#ifndef DAVINVI_VPBE_H
+#define DAVINVI_VPBE_H
+
+/* include Linux files */
+#include <linux/fb.h>
+
+/* define the custom FBIO_WAITFORVSYNC ioctl */
+#define FBIO_WAITFORVSYNC	_IOW('F', 0x20, u_int32_t)
+#define FBIO_SETATTRIBUTE       _IOW('F', 0x21, struct fb_fillrect)
+
+/* Backported IOCTLS. */
+#define FBIO_SETPOSX                            _IOW('F', 0x22, u_int32_t)
+#define FBIO_SETPOSY                            _IOW('F', 0x23, u_int32_t)
+#define FBIO_SETZOOM            		_IOW('F', 0x24, struct zoom_params)
+#define FBIO_GETSTD                             _IOR('F', 0x25, u_int32_t)
+#define FBIO_RESIZER		                _IOW('F', 0x26, struct vpfe_resizer_params)
+#define FBIO_SYNC		                _IOW('F', 0x27, u_int32_t)
+
+typedef struct zoom_params {
+	u_int32_t window_id;
+	u_int32_t zoom_h;
+	u_int32_t zoom_v;
+} zoom_params_t;
+
+typedef struct vpfe_resizer_params
+{
+	u_int32_t rsz_cnt;	//busy-lock
+	u_int32_t out_size;	//busy-lock
+	u_int32_t in_start;	//busy-lock
+	u_int32_t in_size;	//busy-lock
+	u_int32_t sdr_inadd;	//shadowed
+	u_int32_t sdr_inoff;	//shadowed
+	u_int32_t sdr_outadd;	//shadowed
+	u_int32_t sdr_outoff;	//shadowed
+	u_int32_t hfilt[16];	//busy-lock
+	u_int32_t vfilt[16];	//busy-lock
+	u_int32_t yenh;		//busy-lock
+} vpfe_resizer_params_t;
+
+typedef struct fb_set_start {
+	int		offset;		/* offset from smem_start */
+	unsigned long	physical;	/* absolute physical address when offset < 0 */
+
+	u_int64_t	sync;		/* input:  target sync counter for change or 0 for no sync at all,
+					   output: sync counter of actual change or 0 if still pending */
+} fb_set_start_t;
+
+
+#ifdef _IOC_TYPECHECK
+#undef _IOC_TYPECHECK
+#define _IOC_TYPECHECK(x)     (sizeof(x))
+#endif
+
+#define	RAM_CLUT_SIZE	256*3
+#define FBIO_ENABLE_DISABLE_WIN		\
+	_IOW('F', 0x30, unsigned char)
+#define FBIO_SET_BITMAP_BLEND_FACTOR	\
+	_IOW('F', 0x31, vpbe_bitmap_blend_params_t)
+#define FBIO_SET_BITMAP_WIN_RAM_CLUT    \
+	_IOW('F', 0x32, unsigned char)*RAM_CLUT_SIZE)
+#define FBIO_ENABLE_DISABLE_ATTRIBUTE_WIN \
+	_IOW('F', 0x33, unsigned int)
+#define FBIO_GET_BLINK_INTERVAL		\
+	_IOR('F', 0x34, vpbe_blink_option_t)
+#define FBIO_SET_BLINK_INTERVAL         \
+	_IOW('F', 0x35, vpbe_blink_option_t)
+#define FBIO_GET_VIDEO_CONFIG_PARAMS    \
+	_IOR('F', 0x36, vpbe_video_config_params_t)
+#define FBIO_SET_VIDEO_CONFIG_PARAMS    \
+	_IOW('F', 0x37, vpbe_video_config_params_t)
+#define FBIO_GET_BITMAP_CONFIG_PARAMS   \
+	_IOR('F', 0x38, vpbe_bitmap_config_params_t)
+#define FBIO_SET_BITMAP_CONFIG_PARAMS   \
+	_IOW('F', 0x39, vpbe_bitmap_config_params_t)
+#define FBIO_SET_DCLK                   \
+	_IOW('F', 0x40, vpbe_dclk_t)
+#define FBIO_SET_INTERFACE		\
+	_IOW('F', 0x41, unsigned char)
+#define FBIO_GET_INTERFACE		\
+	_IOR('F', 0x42, unsigned char)
+#define FBIO_QUERY_TIMING		\
+	_IOWR('F', 0x43, struct vpbe_mode_info)
+#define FBIO_SET_TIMING			\
+	_IOW('F', 0x44, struct vpbe_fb_videomode)
+#define FBIO_GET_TIMING                 \
+	_IOR('F', 0x45, struct vpbe_fb_videomode)
+#define FBIO_SET_VENC_CLK_SOURCE	\
+	_IOW('F', 0x46, unsigned char)
+#define FBIO_SET_BACKG_COLOR            \
+	_IOW('F', 0x47, vpbe_backg_color_t)
+#define FBIO_ENABLE_DISPLAY		\
+	_IOW('F', 0x48, unsigned char)
+#define FBIO_SETPOS            		\
+	_IOW('F', 0x49, u_int32_t)
+#define FBIO_SET_CURSOR         	\
+	_IOW('F', 0x50, struct fb_cursor)
+#define FBIO_SET_START     		\
+	_IOW('F', 0x66, struct fb_set_start)
+
+/* 
+ * Defines and Constants
+ */
+#ifdef __KERNEL__
+#define DAVINCIFB_DEVICE "davincifb"
+#define DAVINCIFB_DRIVER "davincifb"
+
+#define MULTIPLE_BUFFERING      1
+
+#ifdef MULTIPLE_BUFFERING
+#define DOUBLE_BUF      2
+#define TRIPLE_BUF      3
+#else
+#define DOUBLE_BUF      1
+#define TRIPLE_BUF      1
+#endif
+
+/* usage:	if (is_win(info->fix.id, OSD0)) ... */
+#define is_win(name, x) ((strcmp(name, x ## _FBNAME) == 0) ? 1 : 0)
+
+/*
+ * display controller register I/O routines
+ */
+u32 dispc_reg_in(u32 offset);
+u32 dispc_reg_out(u32 offset, u32 val);
+u32 dispc_reg_merge(u32 offset, u32 val, u32 mask);
+
+#endif				/*__KERNEL__*/
+
+/*  Error return codes  */
+#define VPBE_INVALID_PARA_VALUE         700
+#define VPBE_WRONG_WINDOW_ID            701
+#define VPBE_CURRENTLY_IN_REQUIRED_MODE 702
+#define VPBE_INSUFFICIENT_CLUT_VALUES   703
+#define VPBE_CLUT_WRITE_TIMEOUT         704
+#define VPBE_VID0_BUF_ADR_NULL          705
+#define VPBE_WINDOW_NOT_DISABLED        706
+#define VPBE_WINDOW_NOT_ENABLED         707
+
+#ifndef __KERNEL__
+/*  Window ID definations */
+#define OSD0      0
+#define VID0      1
+#define OSD1      2
+#define VID1      3
+#endif
+
+/* There are 4 framebuffers, each represented by an fb_info and
+ * a dm_win_info structure */
+#define OSD0_FBNAME "dm_osd0_fb"
+#define OSD1_FBNAME "dm_osd1_fb"
+#define VID0_FBNAME "dm_vid0_fb"
+#define VID1_FBNAME "dm_vid1_fb"
+
+/*  FIXME: Digital LCD RGB matrix coefficients */
+#define DLCD_DGY_VAL    0
+#define DLCD_DRV_VAL    0
+#define DLCD_DGU_VAL    0
+#define DLCD_DBU_VAL		0
+
+/* Defines for bitmap format */
+#define VPBE_BITMAP_BIT_1	1
+#define VPBE_BITMAP_BIT_2	2
+#define VPBE_BITMAP_BIT_4	4
+#define VPBE_BITMAP_BIT_8	8
+#define VPBE_BITMAP_RGB565	16
+#define VPBE_VIDEO_YUV422 	16
+#define VPBE_VIDEO_RGB888 	24
+
+/* Defines foe cursor parameter validation*/
+#define MAX_CURSOR_WIDTH	0x3FF
+#define MAX_CURSOR_HEIGHT	0x1FF
+#define MAX_CURSOR_LINEWIDTH    7
+
+#define BASEX		0x80
+#define BASEY		0x12
+#define BASEX_DLCD		0x59
+#define BASEY_DLCD		0x22
+
+/*
+ * Enumerations 
+ */
+/*  Enum for blending factor  */
+typedef enum vpbe_blend_factor {
+	OSD_CONTRIBUTION_ZERO = 0,
+	OSD_CONTRIBUTION_1_BY_8 = 1,
+	OSD_CONTRIBUTION_2_BY_8 = 2,
+	OSD_CONTRIBUTION_3_BY_8 = 3,
+	OSD_CONTRIBUTION_4_BY_8 = 4,
+	OSD_CONTRIBUTION_5_BY_8 = 5,
+	OSD_CONTRIBUTION_6_BY_8 = 6,
+	OSD_CONTRIBUTION_ONE = 7
+} vpbe_blend_factor_t;
+
+/*  Enum for Boolean variables  */
+typedef enum {
+	SET_0 = 0,
+	SET_1 = 1
+} CB_CR_ORDER, ATTRIBUTE, ROM_RAM_CLUT;
+
+/*  Defines for Display Interface */
+#define  PRGB		0
+#define  COMPOSITE      1
+#define  SVIDEO    	2
+#define  COMPONENT 	3
+#define  RGB       	4
+#define  YCC16     	5
+#define  YCC8      	6
+#define  SRGB      	7
+#define  EPSON     	8
+#define  CASIO1G   	9
+#define  UDISP     	10
+#define  STN       	11
+#define VPBE_MAX_INTERFACES	12
+
+/*  Defines for Display Mode */
+#define  LCD    0
+#define  NTSC	1
+#define  PAL    2
+#define  P525   3
+#define  P625   4
+
+#define DEFAULT_MODE 0
+#define  P480   0
+#define  P400   1
+#define  P350   2
+#define NON_EXISTING_MODE 255
+/*  Enable/Disable enum */
+typedef enum {
+	VPBE_DISABLE = 0,
+	VPBE_ENABLE = 1
+} ATTENUATION, TRANSPARENCY, EXPANSION, BLINKING;
+
+typedef enum clk_source {
+	CLK_SOURCE_CLK27 = 0,
+	CLK_SOURCE_CLK54 = 1,
+	CLK_SOURCE_VPBECLK = 2
+} CLK_SOURCE;
+
+/*
+ * Structures and Union Definitions
+ */
+
+/*  Structure for transparency and the blending factor for the bitmap window  */
+typedef struct vpbe_bitmap_blend_params {
+	unsigned int colorkey;	/* color key to be blend */
+	unsigned int enable_colorkeying;	/* enable color keying */
+	unsigned int bf;	/* valid range from 0 to 7 only. */
+} vpbe_bitmap_blend_params_t;
+
+/*  Structure for window expansion  */
+typedef struct vpbe_win_expansion {
+	EXPANSION horizontal;
+	EXPANSION vertical;	/* 1: Enable 0:disable */
+} vpbe_win_expansion_t;
+
+/*  Structure for OSD window blinking options */
+typedef struct vpbe_blink_option {
+	BLINKING blinking;	/* 1: Enable blinking 0: Disable */
+	unsigned int interval;	/* Valid only if blinking is 1 */
+} vpbe_blink_option_t;
+
+/*  Structure for DCLK parameters */
+typedef struct vpbe_dclk {
+	unsigned char dclk_pattern_width;
+	unsigned int dclk_pattern0;
+	unsigned int dclk_pattern1;
+	unsigned int dclk_pattern2;
+	unsigned int dclk_pattern3;
+} vpbe_dclk_t;
+
+/*  Structure for display format  */
+typedef struct vpbe_display_format {
+	unsigned char interface;	/* Output interface type */
+	unsigned char mode;	/* output mode */
+} vpbe_display_format_t;
+
+/*  Structure for background color  */
+typedef struct vpbe_backg_color {
+	unsigned char clut_select;	/* 2: RAM CLUT 1:ROM1 CLUT 0:ROM0 CLUT */
+	unsigned char color_offset;	/* index of color */
+} vpbe_backg_color_t;
+
+/*  Structure for Video window configurable parameters  */
+typedef struct vpbe_video_config_params {
+	CB_CR_ORDER cb_cr_order;	/*Cb/Cr order in input data for a pixel. */
+	/*    0: cb cr  1:  cr cb */
+	vpbe_win_expansion_t exp_info;	/* HZ/VT Expansion enable disable */
+} vpbe_video_config_params_t;
+
+/*Union of structures giving the CLUT index for the 1, 2, 4 bit bitmap values.*/
+typedef union vpbe_clut_idx {
+	struct _for_4bit_bimap {
+		unsigned char bitmap_val_0;
+		unsigned char bitmap_val_1;
+		unsigned char bitmap_val_2;
+		unsigned char bitmap_val_3;
+		unsigned char bitmap_val_4;
+		unsigned char bitmap_val_5;
+		unsigned char bitmap_val_6;
+		unsigned char bitmap_val_7;
+		unsigned char bitmap_val_8;
+		unsigned char bitmap_val_9;
+		unsigned char bitmap_val_10;
+		unsigned char bitmap_val_11;
+		unsigned char bitmap_val_12;
+		unsigned char bitmap_val_13;
+		unsigned char bitmap_val_14;
+		unsigned char bitmap_val_15;
+	} for_4bit_bimap;
+	struct _for_2bit_bimap {
+		unsigned char bitmap_val_0;
+		unsigned char dummy0[4];
+		unsigned char bitmap_val_1;
+		unsigned char dummy1[4];
+		unsigned char bitmap_val_2;
+		unsigned char dummy2[4];
+		unsigned char bitmap_val_3;
+	} for_2bit_bimap;
+	struct _for_1bit_bimap {
+		unsigned char bitmap_val_0;
+		unsigned char dummy0[14];
+		unsigned char bitmap_val_1;
+	} for_1bit_bimap;
+} vpbe_clut_idx_t;
+
+/*  Structure for bitmap window configurable parameters */
+typedef struct vpbe_bitmap_config_params {
+	/* Only for bitmap width = 1,2,4 bits */
+	vpbe_clut_idx_t clut_idx;
+	/* Attenuation value for YUV o/p for bitmap window */
+	unsigned char attenuation_enable;
+	/* 0: ROM DM270, 1:ROM DM320, 2:RAM CLUT */
+	unsigned char clut_select;
+} vpbe_bitmap_config_params_t;
+
+/*  Unioun for video/OSD configuration parameters  */
+typedef union vpbe_conf_params {
+
+	struct vpbe_video_params {
+		CB_CR_ORDER cb_cr_order;
+		/* HZ/VT Expansion enable disable */
+		vpbe_win_expansion_t exp_info;
+	} video_params;
+
+	struct vpbe_bitmap_params {
+		/* Attenuation value for YUV o/p */
+		ATTENUATION attenuation_enable;
+		/* 0: ROM DM270, 1: ROM DM320, 2:RAM CLUT */
+		unsigned char clut_select;
+		/* Only for bitmap width = 1,2,4 bits */
+		vpbe_clut_idx_t clut_idx;
+		/* 0: OSD window is bitmap window */
+		/* 1: OSD window is attribute window */
+		ATTRIBUTE enable_attribute;
+		/* To hold bps value. 
+		   Used to switch back from attribute to bitmap. */
+		unsigned int stored_bits_per_pixel;
+		/* Blending information */
+		vpbe_bitmap_blend_params_t blend_info;
+		/* OSD Blinking information */
+		vpbe_blink_option_t blink_info;
+	} bitmap_params;
+
+} vpbe_conf_params_t;
+
+typedef struct vpbe_video_params vpbe_video_params_t;
+typedef struct vpbe_bitmap_params vpbe_bitmap_params_t;
+
+/* Structure to hold window position */
+typedef struct vpbe_window_position {
+	unsigned int xpos;	/* X position of the window */
+	unsigned int ypos;	/* Y position of the window */
+} vpbe_window_position_t;
+
+#ifdef __KERNEL__
+/*  Structure for each window */
+typedef struct vpbe_dm_win_info {
+	struct fb_info info;
+	vpbe_window_position_t win_pos;	/* X,Y position of window */
+	/* Size of window is already there in var_info structure. */
+
+	dma_addr_t fb_base_phys;	/*framebuffer area */
+	unsigned int fb_base;	/*window memory pointer */
+	unsigned int fb_size;	/*memory size */
+	unsigned int pseudo_palette[17];
+	int alloc_fb_mem;
+	/*flag to identify if framebuffer area is fixed or not */
+	unsigned long sdram_address;
+	struct vpbe_dm_info *dm;
+	unsigned char window_enable;	/*Additions for all windows */
+	zoom_params_t zoom;	/*Zooming parameters */
+	unsigned char field_frame_select;	/*To select Field or frame */
+	unsigned char numbufs;	/*Number of buffers valid 2 or 3 */
+	vpbe_conf_params_t conf_params;
+	/*window configuration parameter union pointer */
+} vpbe_dm_win_info_t;
+#endif				/*__KERNEL__*/
+
+/*
+ *  Videmode structure for display interface and mode settings
+ */
+typedef struct vpbe_fb_videomode {
+	unsigned char name[10];	/* Mode name ( NTSC , PAL) */
+	unsigned int vmode;	/* FB_MODE_INTERLACED or FB_MODE_NON_INTERLACED */
+	unsigned int xres;	/* X Resolution of the display */
+	unsigned int yres;	/* Y Resolution of the display */
+	unsigned int fps;	/* frames per second */
+	/* Timing Parameters applicable for std = 0 only */
+	unsigned int left_margin;
+	unsigned int right_margin;
+	unsigned int upper_margin;
+	unsigned int lower_margin;
+	unsigned int hsync_len;
+	unsigned int vsync_len;
+	unsigned int sync;	/* 0: hsync -ve/vsync -ve */
+	/*1: hsync -ve/vsync +ve */
+	/*2: hsync +ve/vsync -ve */
+	/*3: hsync +ve/vsync +ve */
+	unsigned int basepx;	/* Display x,y start position */
+	unsigned int basepy;
+/*  1= Mode s available in modelist 0=Mode is not available in modelist */
+	unsigned int std;
+} vpbe_fb_videomode_t;
+
+/* Structure to interface videomode to application*/
+typedef struct vpbe_mode_info {
+	vpbe_fb_videomode_t vid_mode;
+	unsigned char interface;
+	unsigned char mode_idx;
+} vpbe_mode_info_t;
+
+#ifdef __KERNEL__
+/* 
+ * Structure for the driver holding information of windows, 
+ *  memory base addresses etc.
+ */
+typedef struct vpbe_dm_info {
+	vpbe_dm_win_info_t *osd0;
+	vpbe_dm_win_info_t *osd1;
+	vpbe_dm_win_info_t *vid0;
+	vpbe_dm_win_info_t *vid1;
+
+/* to map the registers */
+	dma_addr_t mmio_base_phys;
+	unsigned int mmio_base;
+	unsigned int mmio_size;
+
+	wait_queue_head_t vsync_wait;
+	unsigned int vsync_cnt;
+	int timeout;
+
+	/* this is the function that configures the output device (NTSC/PAL/LCD)
+	 * for the required output format (composite/s-video/component/rgb)
+	 */
+	void (*output_device_config) (void);
+
+	struct device *dev;
+
+	vpbe_backg_color_t backg;	/* background color */
+	vpbe_dclk_t dclk;	/*DCLK parameters */
+	vpbe_display_format_t display;	/*Display interface and mode */
+	vpbe_fb_videomode_t videomode;	/*Cuurent videomode */
+	char ram_clut[256][3];	/*RAM CLUT array */
+	struct fb_cursor cursor;	/* cursor config params from fb.h */
+/*Flag that indicates whether any of the display is enabled or not*/
+	int display_enable;
+} vpbe_dm_info_t;
+
+/*
+ * Functions Definitions for 'davincifb' module
+ */
+int vpbe_mem_alloc_window_buf(vpbe_dm_win_info_t *);
+int vpbe_mem_release_window_buf(vpbe_dm_win_info_t *);
+void init_display_function(vpbe_display_format_t *);
+int vpbe_mem_alloc_struct(vpbe_dm_win_info_t **);
+void set_vid0_default_conf(void);
+void set_vid1_default_conf(void);
+void set_osd0_default_conf(void);
+void set_osd1_default_conf(void);
+void set_cursor_default_conf(void);
+void set_dm_default_conf(void);
+void set_win_enable(char *, unsigned int);
+int within_vid0_limits(u32, u32, u32, u32);
+void vpbe_set_display_default(void);
+#ifdef __KERNEL__
+void set_win_position(char *, u32, u32, u32, u32);
+void change_win_param(int);
+void set_interlaced(char *, unsigned int);
+#endif /* __KERNEL__ */
+
+/*
+ *	Function definations for 'osd' module
+ */
+
+int vpbe_enable_window(vpbe_dm_win_info_t *);
+int vpbe_disable_window(vpbe_dm_win_info_t *);
+int vpbe_vid_osd_select_field_frame(u8 *, u8);
+int vpbe_bitmap_set_blend_factor(u8 *, vpbe_bitmap_blend_params_t *);
+int vpbe_bitmap_set_ram_clut(void);
+int vpbe_enable_disable_attribute_window(u32);
+int vpbe_get_blinking(u8 *, vpbe_blink_option_t *);
+int vpbe_set_blinking(u8 *, vpbe_blink_option_t *);
+int vpbe_set_vid_params(u8 *, vpbe_video_config_params_t *);
+int vpbe_get_vid_params(u8 *, vpbe_video_config_params_t *);
+int vpbe_bitmap_get_params(u8 *, vpbe_bitmap_config_params_t *);
+int vpbe_bitmap_set_params(u8 *, vpbe_bitmap_config_params_t *);
+int vpbe_set_cursor_params(struct fb_cursor *);
+int vpbe_set_vid_expansion(vpbe_win_expansion_t *);
+int vpbe_set_dclk(vpbe_dclk_t *);
+int vpbe_set_display_format(vpbe_display_format_t *);
+int vpbe_set_backg_color(vpbe_backg_color_t *);
+int vpbe_set_interface(u8);
+int vpbe_query_mode(vpbe_mode_info_t *);
+int vpbe_set_mode(struct vpbe_fb_videomode *);
+int vpbe_set_venc_clk_source(u8);
+void set_vid0_default_conf(void);
+void set_osd0_default_conf(void);
+void set_vid1_default_conf(void);
+void set_osd1_default_conf(void);
+void set_cursor_default_conf(void);
+void set_dm_default_conf(void);
+/*
+ * Function definations for 'venc' module
+ */
+
+void davincifb_ntsc_composite_config(void);
+void davincifb_ntsc_svideo_config(void);
+void davincifb_ntsc_component_config(void);
+void davincifb_pal_composite_config(void);
+void davincifb_pal_svideo_config(void);
+void davincifb_pal_component_config(void);
+
+void vpbe_davincifb_ntsc_rgb_config(void);
+void vpbe_davincifb_pal_rgb_config(void);
+void vpbe_davincifb_525p_component_config(void);
+void vpbe_davincifb_625p_component_config(void);
+
+void vpbe_enable_venc(int);
+void vpbe_enable_dacs(int);
+/*
+ * Function definations for 'dlcd' module
+ */
+void vpbe_davincifb_480p_prgb_config(void);
+void vpbe_davincifb_400p_prgb_config(void);
+void vpbe_davincifb_350p_prgb_config(void);
+void vpbe_set_display_timing(struct vpbe_fb_videomode *);
+
+void vpbe_enable_lcd(int);
+/*
+ * Following functions are not implemented
+ */
+void vpbe_davincifb_default_ycc16_config(void);
+void vpbe_davincifb_default_ycc8_config(void);
+void vpbe_davincifb_default_srgb_config(void);
+void vpbe_davincifb_default_epson_config(void);
+void vpbe_davincifb_default_casio_config(void);
+void vpbe_davincifb_default_UDISP_config(void);
+void vpbe_davincifb_default_STN_config(void);
+#endif				/*__KERNEL__*/
+
+#endif				/* End of #ifndef DAVINCI_VPBE_H */
diff -puNr -Naur directfb-1.6.3-orig/gfxdrivers/davinci/davinci_gfxdriver.h directfb-1.6.3/gfxdrivers/davinci/davinci_gfxdriver.h
--- directfb-1.6.3-orig/gfxdrivers/davinci/davinci_gfxdriver.h	1970-01-01 01:00:00.000000000 +0100
+++ directfb-1.6.3/gfxdrivers/davinci/davinci_gfxdriver.h	2013-04-07 21:33:19.560662133 +0200
@@ -0,0 +1,169 @@
+/*
+   TI Davinci driver - Graphics Driver
+
+   (c) Copyright 2007  Telio AG
+
+   Written by Denis Oliver Kropp <dok@directfb.org>
+
+   Code is derived from VMWare driver.
+
+   (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
+   (c) Copyright 2000-2004  Convergence (integrated media) GmbH
+
+   All rights reserved.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __DAVINCI_GFXDRIVER_H__
+#define __DAVINCI_GFXDRIVER_H__
+
+#include <sys/ioctl.h>
+#include <davincifb.h>
+
+#include <core/surface_buffer.h>
+
+#include "davincifb.h"
+
+#include "davinci_c64x.h"
+
+
+typedef struct {
+     /* validation flags */
+     int                       v_flags;
+
+     /* cached/computed values */
+     void                     *dst_addr;
+     unsigned long             dst_phys;
+     unsigned int              dst_size;
+     unsigned long             dst_pitch;
+     DFBSurfacePixelFormat     dst_format;
+     unsigned long             dst_bpp;
+
+     void                     *src_addr;
+     unsigned long             src_phys;
+     unsigned long             src_pitch;
+     DFBSurfacePixelFormat     src_format;
+     unsigned long             src_bpp;
+
+     unsigned long             source_mult;
+
+     unsigned long             fillcolor;
+
+     int                       blit_blend_sub_function;
+     int                       draw_blend_sub_function;
+
+     DFBColor                  color;
+     unsigned long             color_argb;
+     unsigned long             colorkey;
+
+     DFBSurfaceBlittingFlags   blitting_flags;
+
+     DFBRegion                 clip;
+
+     /** Add shared data here... **/
+     struct fb_fix_screeninfo  fix[4];
+
+     CoreSurfacePool          *osd_pool;
+     CoreSurfacePool          *video_pool;
+
+     bool                      synced;
+} DavinciDeviceData;
+
+
+typedef struct {
+     int                       num;
+     int                       fd;
+     void                     *mem;
+     int                       size;
+} DavinciFB;
+
+typedef struct {
+     DavinciDeviceData        *ddev;
+
+     CoreDFB                  *core;
+
+     CoreScreen               *screen;
+     CoreLayer                *osd;
+     CoreLayer                *video;
+
+     DavinciFB                 fb[4];
+
+     DavinciC64x               c64x;
+     bool                      c64x_present;
+
+     DavinciC64xTasks          tasks;
+} DavinciDriverData;
+
+
+static inline DFBResult
+davincifb_pan_display( const DavinciFB             *fb,
+                       struct fb_var_screeninfo    *var,
+                       const CoreSurfaceBufferLock *lock,
+                       DFBSurfaceFlipFlags          flags,
+                       int                          x,
+                       int                          y )
+{
+     int ret;
+
+     if (lock) {
+#ifdef FBIO_SET_START
+          CoreSurfaceBuffer   *buffer = lock->buffer;
+          struct fb_set_start  set_start;
+
+          /* physical mode */
+          set_start.offset   = -1;
+          set_start.sync     = (flags & DSFLIP_ONSYNC) ? 1 : 0;
+
+          /* life's so easy */
+          set_start.physical = lock->phys + DFB_BYTES_PER_LINE( buffer->format, x ) + y * lock->pitch;
+
+          ret = ioctl( fb->fd, FBIO_SET_START, &set_start );
+          if (ret < 0)
+               D_DEBUG( "FBIO_SET_START (0x%08lx, sync %llu) failed!\n",
+                         set_start.physical, set_start.sync );
+
+          if (ret == 0) {
+               if (flags & DSFLIP_WAIT)
+                    ioctl( fb->fd, FBIO_WAITFORVSYNC );
+
+               return DFB_OK;
+          }
+
+          /* fallback */
+#endif
+          var->xoffset = x;                  /* poor version */
+          var->yoffset = y + lock->offset / lock->pitch;
+     }
+     else {
+          var->xoffset = x;
+          var->yoffset = y;
+     }
+
+     var->activate = /*(flags & DSFLIP_ONSYNC) ? FB_ACTIVATE_VBL :*/ FB_ACTIVATE_NOW;
+
+     ret = ioctl( fb->fd, FBIOPAN_DISPLAY, var );
+     if (ret)
+          D_PERROR( "Davinci/FB: FBIOPAN_DISPLAY (fb%d - %d,%d) failed!\n",
+                    fb->num, var->xoffset, var->yoffset );
+
+     if (flags & DSFLIP_WAIT)
+          ioctl( fb->fd, FBIO_WAITFORVSYNC );
+
+     return DFB_OK;
+}
+
+#endif
diff -puNr -Naur directfb-1.6.3-orig/tests/voodoo/voodoo_test.h directfb-1.6.3/tests/voodoo/voodoo_test.h
--- directfb-1.6.3-orig/tests/voodoo/voodoo_test.h	1970-01-01 01:00:00.000000000 +0100
+++ directfb-1.6.3/tests/voodoo/voodoo_test.h	2013-04-07 21:33:31.824408024 +0200
@@ -0,0 +1,10 @@
+#ifndef __VOODOO_TEST_H__
+#define __VOODOO_TEST_H__
+
+typedef enum {
+     VOODOO_TEST_INCREASE,
+     VOODOO_TEST_QUERY
+} VoodooTestCall;
+
+#endif
+