-
Notifications
You must be signed in to change notification settings - Fork 107
/
dm9x0.patch
1817 lines (1713 loc) · 64.2 KB
/
dm9x0.patch
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
diff --git a/.github/workflows/buildbot.yml b/.github/workflows/buildbot.yml
index 0db1c7f0853..e46e714b074 100644
--- a/.github/workflows/buildbot.yml
+++ b/.github/workflows/buildbot.yml
@@ -2,7 +2,7 @@ name: buildbot
on:
push:
- branches: [ Developer ]
+ branches: [ Developer, dm9x0 ]
workflow_dispatch:
diff --git a/.github/workflows/enigma2.yml b/.github/workflows/enigma2.yml
index c681dd91b34..c955896a3ff 100644
--- a/.github/workflows/enigma2.yml
+++ b/.github/workflows/enigma2.yml
@@ -2,12 +2,12 @@ name: Enigma2 Python 3
on:
push:
- branches: [ Release, Developer, FCC ]
+ branches: [ Release, Developer, FCC, dm9x0 ]
paths-ignore:
- '**/README'
- '**/DOCS'
pull_request:
- branches: [Release, Developer, FCC ]
+ branches: [Release, Developer, FCC, dm9x0 ]
paths-ignore:
- '**/README'
- '**/DOCS'
diff --git a/CI/build.sh b/CI/build.sh
index e340647b4e3..f58eeae85cd 100755
--- a/CI/build.sh
+++ b/CI/build.sh
@@ -13,7 +13,7 @@ commit_files() {
rm -rf *.pyc
rm -rf *.pyo
rm -rf *.mo
- git checkout Developer
+ git checkout dm9x0
./CI/chmod.sh
./CI/dos2unix.sh
./CI/PEP8.sh
@@ -21,7 +21,7 @@ commit_files() {
upload_files() {
git remote add upstream https://${GITHUB_TOKEN}@github.com/OpenViX/enigma2.git > /dev/null 2>&1
- git push --quiet upstream Developer || echo "failed to push with error $?"
+ git push --quiet upstream dm9x0 || echo "failed to push with error $?"
}
setup_git
diff --git a/configure.ac b/configure.ac
index 094c1ff5691..05988050c51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,6 +91,8 @@ AM_CONDITIONAL(DM800, test "$BOXTYPE" == "dm800")
AM_CONDITIONAL(DM8000, test "$BOXTYPE" == "dm8000")
AM_CONDITIONAL(DM800SE, test "$BOXTYPE" == "dm800se")
AM_CONDITIONAL(DM800SEV2, test "$BOXTYPE" == "dm800sev2")
+AM_CONDITIONAL(DM900, test "$BOXTYPE" == "dm900")
+AM_CONDITIONAL(DM920, test "$BOXTYPE" == "dm920")
AM_CONDITIONAL(E3HD, test "$BOXTYPE" == "e3hd")
AM_CONDITIONAL(EBOX5000, test "$BOXTYPE" == "ebox5000")
AM_CONDITIONAL(EBOX5100, test "$BOXTYPE" == "ebox5100")
@@ -306,6 +308,17 @@ if test x"$withcolorlcd220" != xno ; then
fi
AM_CONDITIONAL(HAVE_COLORLCD220, test x"$withcolorlcd220" != xno)
+AC_ARG_WITH(colorlcd390,
+ AS_HELP_STRING([--with-colorlcd390], [use 390x240 16bpp color display, yes or no]),
+ [[withcolorlcd390=$withval]],
+ [[withcolorlcd390=no]]
+)
+if test x"$withcolorlcd390" != xno ; then
+ AC_DEFINE(HAVE_COLORLCD390, 1,[Define when using a 390x240 color display device])
+fi
+
+AM_CONDITIONAL(HAVE_COLORLCD390, test x"$withcolorlcd390" != xno)
+
AC_ARG_WITH(colorlcd400,
AS_HELP_STRING([--with-colorlcd400], [use 400x176 16bpp color display, yes or no]),
[[withcolorlcd400=$withval]],
@@ -402,6 +415,14 @@ if test `echo "$BOXTYPE" | cut -b 1-2` == "vu"; then
AC_DEFINE(FORCE_ADVANCED_REMOTE, 1,[define to fixup the input device identification when the remote control is actually an 'advanced' remote (with play/forward/rewind keys)])
fi
+if test "$BOXTYPE" == "dm900" -o "$BOXTYPE" == "dm920"; then
+ AC_DEFINE(CONFIG_ION, 1,[define BOX use ION Allocator])
+ AC_DEFINE(HAVE_HDMIIN_DM, 1,[has hdmi in dm])
+ AC_DEFINE(LCD_DM900_Y_OFFSET, 4,[define LCD Y offset for dm900 and dm920])
+ AC_DEFINE(DREAMBOX_DUAL_TUNER, 1,[define it is dreambox dual tuner present])
+ AC_DEFINE(FORCE_NO_BLENDING_ACCELERATION, 1,[define when the framebuffer acceleration does not have alphablending support, though the autodetection might indicate that it does])
+fi
+
if test `echo "$BOXTYPE" | cut -b 1-2` == "gb"; then
AC_DEFINE(KEY_PLAY_ACTUALLY_IS_KEY_PLAYPAUSE, 1,[define when rc sends a KEY_PLAY event for its KEY_PLAYPAUSE key])
AC_DEFINE(FORCE_NO_BLENDING_ACCELERATION, 1,[define when the framebuffer acceleration does not have alphablending support, though the autodetection might indicate that it does])
@@ -586,6 +607,7 @@ data/7segment/Makefile
data/display96/Makefile
data/display128/Makefile
data/display220/Makefile
+data/display390/Makefile
data/display400/Makefile
data/display480/Makefile
data/display720/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index 72c31ec8d3a..123c4f64f6e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -41,6 +41,10 @@ if HAVE_COLORLCD220
SUBDIRS += display220
endif
+if HAVE_COLORLCD390
+SUBDIRS += display390
+endif
+
if HAVE_COLORLCD400
SUBDIRS += display400
endif
diff --git a/data/display400/skin_display.xml b/data/display400/skin_display.xml
index 55d0d8a26e7..6d45e70db6f 100644
--- a/data/display400/skin_display.xml
+++ b/data/display400/skin_display.xml
@@ -238,24 +238,13 @@
<!-- standby -->
<screen name="StandbySummary" position="0,0" size="400,240">
- <widget source="global.CurrentTime" render="Label" position="0,0" size="400,36" font="FdLcD;35" halign="right" noWrap="1" foregroundColor="blue">
- <convert type="ClockToText">FullDate</convert>
+ <widget source="global.CurrentTime" render="Label" position="0,5" size="380,60" font="FdLcD;60" noWrap="1" foregroundColor="yellow" halign="center">
+ <convert type="ClockToText">ShortDate</convert>
</widget>
- <widget source="global.CurrentTime" render="Label" position="0,38" size="400,160" font="FdLcD;150" halign="center" noWrap="1" foregroundColor="blue">
+ <widget source="global.CurrentTime" render="Label" position="0,100" size="380,140" font="FdLcD;120" noWrap="1" foregroundColor="lightcyan" halign="center">
<convert type="ClockToText">Format:%H:%M</convert>
</widget>
- <widget source="global.OnlineStableUpdateState" render="Pixmap" pixmap="update_stable.png" position="280,207" size="30,30">
- <convert type="ConditionalShowHide"/>
- </widget>
- <widget source="global.OnlineUnstableUpdateState" render="Pixmap" pixmap="update_unstable.png" position="280,207" size="30,30">
- <convert type="ConditionalShowHide"/>
- </widget>
- <widget source="session.RecordState" render="Pixmap" pixmap="rec.png" position="350,207" size="50,26">
- <convert type="ConditionalShowHide"/>
- </widget>
- <panel name="SummaryTunerStatusPanel" />
</screen>
-
<!-- Plugin browser -->
<screen name="PluginBrowserSummary" position="0,0" size="400,240">
<widget source="parent.Title" render="Label" position="0,38" size="400,26" font="FdLcD;24" halign="left" noWrap="1" />
diff --git a/interfaces/ion.h b/interfaces/ion.h
new file mode 100644
index 00000000000..6370495f8d0
--- /dev/null
+++ b/interfaces/ion.h
@@ -0,0 +1,204 @@
+/*
+ * drivers/staging/android/uapi/ion.h
+ *
+ * Copyright (C) 2011 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ *
+ */
+
+#ifndef _UAPI_LINUX_ION_H
+#define _UAPI_LINUX_ION_H
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+typedef int ion_user_handle_t;
+
+/**
+ * enum ion_heap_types - list of all possible types of heaps
+ * @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc
+ * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
+ * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
+ * carveout heap, allocations are physically
+ * contiguous
+ * @ION_HEAP_TYPE_DMA: memory allocated via DMA API
+ * @ION_NUM_HEAPS: helper for iterating over heaps, a bit mask
+ * is used to identify the heaps, so only 32
+ * total heap types are supported
+ */
+enum ion_heap_type {
+ ION_HEAP_TYPE_SYSTEM,
+ ION_HEAP_TYPE_SYSTEM_CONTIG,
+ ION_HEAP_TYPE_CARVEOUT,
+ ION_HEAP_TYPE_CHUNK,
+ ION_HEAP_TYPE_DMA,
+ ION_HEAP_TYPE_CUSTOM, /* must be last so device specific heaps always
+ are at the end of this enum */
+ ION_NUM_HEAPS = 16,
+};
+
+#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
+#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
+#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
+#define ION_HEAP_TYPE_DMA_MASK (1 << ION_HEAP_TYPE_DMA)
+
+#define ION_NUM_HEAP_IDS sizeof(unsigned int) * 8
+
+/**
+ * allocation flags - the lower 16 bits are used by core ion, the upper 16
+ * bits are reserved for use by the heaps themselves.
+ */
+#define ION_FLAG_CACHED 1 /* mappings of this buffer should be
+ cached, ion will do cache
+ maintenance when the buffer is
+ mapped for dma */
+#define ION_FLAG_CACHED_NEEDS_SYNC 2 /* mappings of this buffer will created
+ at mmap time, if this is set
+ caches must be managed manually */
+
+/**
+ * DOC: Ion Userspace API
+ *
+ * create a client by opening /dev/ion
+ * most operations handled via following ioctls
+ *
+ */
+
+/**
+ * struct ion_allocation_data - metadata passed from userspace for allocations
+ * @len: size of the allocation
+ * @align: required alignment of the allocation
+ * @heap_id_mask: mask of heap ids to allocate from
+ * @flags: flags passed to heap
+ * @handle: pointer that will be populated with a cookie to use to
+ * refer to this allocation
+ *
+ * Provided by userspace as an argument to the ioctl
+ */
+struct ion_allocation_data {
+ size_t len;
+ size_t align;
+ unsigned int heap_id_mask;
+ unsigned int flags;
+ ion_user_handle_t handle;
+};
+
+/**
+ * struct ion_fd_data - metadata passed to/from userspace for a handle/fd pair
+ * @handle: a handle
+ * @fd: a file descriptor representing that handle
+ *
+ * For ION_IOC_SHARE or ION_IOC_MAP userspace populates the handle field with
+ * the handle returned from ion alloc, and the kernel returns the file
+ * descriptor to share or map in the fd field. For ION_IOC_IMPORT, userspace
+ * provides the file descriptor and the kernel returns the handle.
+ */
+struct ion_fd_data {
+ ion_user_handle_t handle;
+ int fd;
+};
+
+/**
+ * struct ion_handle_data - a handle passed to/from the kernel
+ * @handle: a handle
+ */
+struct ion_handle_data {
+ ion_user_handle_t handle;
+};
+
+/**
+ * struct ion_custom_data - metadata passed to/from userspace for a custom ioctl
+ * @cmd: the custom ioctl function to call
+ * @arg: additional data to pass to the custom ioctl, typically a user
+ * pointer to a predefined structure
+ *
+ * This works just like the regular cmd and arg fields of an ioctl.
+ */
+struct ion_custom_data {
+ unsigned int cmd;
+ unsigned long arg;
+};
+
+struct ion_phys_data {
+ ion_user_handle_t handle;
+ unsigned long addr;
+ size_t len;
+};
+
+#define ION_IOC_MAGIC 'I'
+
+/**
+ * DOC: ION_IOC_ALLOC - allocate memory
+ *
+ * Takes an ion_allocation_data struct and returns it with the handle field
+ * populated with the opaque handle for the allocation.
+ */
+#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \
+ struct ion_allocation_data)
+
+/**
+ * DOC: ION_IOC_FREE - free memory
+ *
+ * Takes an ion_handle_data struct and frees the handle.
+ */
+#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
+
+/**
+ * DOC: ION_IOC_MAP - get a file descriptor to mmap
+ *
+ * Takes an ion_fd_data struct with the handle field populated with a valid
+ * opaque handle. Returns the struct with the fd field set to a file
+ * descriptor open in the current address space. This file descriptor
+ * can then be used as an argument to mmap.
+ */
+#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
+
+/**
+ * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation
+ *
+ * Takes an ion_fd_data struct with the handle field populated with a valid
+ * opaque handle. Returns the struct with the fd field set to a file
+ * descriptor open in the current address space. This file descriptor
+ * can then be passed to another process. The corresponding opaque handle can
+ * be retrieved via ION_IOC_IMPORT.
+ */
+#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
+
+/**
+ * DOC: ION_IOC_IMPORT - imports a shared file descriptor
+ *
+ * Takes an ion_fd_data struct with the fd field populated with a valid file
+ * descriptor obtained from ION_IOC_SHARE and returns the struct with the handle
+ * filed set to the corresponding opaque handle.
+ */
+#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
+
+/**
+ * DOC: ION_IOC_SYNC - syncs a shared file descriptors to memory
+ *
+ * Deprecated in favor of using the dma_buf api's correctly (syncing
+ * will happend automatically when the buffer is mapped to a device).
+ * If necessary should be used after touching a cached buffer from the cpu,
+ * this will make the buffer in memory coherent.
+ */
+#define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
+
+/**
+ * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
+ *
+ * Takes the argument of the architecture specific ioctl to call and
+ * passes appropriate userdata for that ioctl
+ */
+#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
+
+#define ION_IOC_PHYS _IOWR(ION_IOC_MAGIC, 8, struct ion_phys_data)
+
+#endif /* _UAPI_LINUX_ION_H */
diff --git a/lib/driver/avswitch.cpp b/lib/driver/avswitch.cpp
index 955c6c59fd7..7d601b56f40 100644
--- a/lib/driver/avswitch.cpp
+++ b/lib/driver/avswitch.cpp
@@ -255,7 +255,12 @@ int eAVSwitch::getResolutionY(int defaultVal, int flags) const
int eAVSwitch::getFrameRate(int defaultVal, int flags) const
{
+#ifdef DREAMBOX
+ const char *fileName = "/proc/stb/vmpeg/0/fallback_framerate";
+#else
const char *fileName = "/proc/stb/vmpeg/0/framerate";
+#endif
+
int value = 0;
int ret = CFile::parseInt(&value, fileName, __MODULE__, flags);
if (ret != 0)
diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp
index 95f5609dd9c..4fb21ec1667 100644
--- a/lib/dvb/decoder.cpp
+++ b/lib/dvb/decoder.cpp
@@ -147,7 +147,11 @@ int eDVBAudio::startPid(int pid, int type)
bypass = 0x40;
break;
case aDDP:
+#ifdef DREAMBOX
+ bypass = 7;
+#else
bypass = 0x22;
+#endif
break;
}
@@ -341,7 +345,11 @@ eDVBVideo::eDVBVideo(eDVBDemux *demux, int dev, bool fcc_enable)
#define VIDEO_STREAMTYPE_MPEG4_Part2 4
#define VIDEO_STREAMTYPE_VC1_SM 5
#define VIDEO_STREAMTYPE_MPEG1 6
+#ifdef DREAMBOX
+#define VIDEO_STREAMTYPE_H265_HEVC 22
+#else
#define VIDEO_STREAMTYPE_H265_HEVC 7
+#endif
#define VIDEO_STREAMTYPE_AVS 16
#define VIDEO_STREAMTYPE_AVS2 40
diff --git a/lib/dvb/fbc.cpp b/lib/dvb/fbc.cpp
index 6d8b06d3cc2..56a4c4f98d3 100644
--- a/lib/dvb/fbc.cpp
+++ b/lib/dvb/fbc.cpp
@@ -13,6 +13,24 @@
int eFBCTunerManager::ReadProcInt(int fe_index, const std::string & entry)
{
+#ifdef DREAMBOX
+ std::string value;
+ std::stringstream path;
+ std::ifstream file;
+
+ path << "/proc/stb/frontend/" << fe_index << "/" << entry;
+ file.open(path.str().c_str());
+
+ if(!file.is_open())
+ return(-1);
+
+ file >> value;
+
+ if(file.bad() || file.fail())
+ return(-1);
+ eDebug("[eFBCTunerManager::ReadProcInt] val: %s", value.c_str());
+ return(value == "A" ? 0 : 1);
+#else
int value;
std::stringstream path;
std::ifstream file;
@@ -29,6 +47,7 @@ int eFBCTunerManager::ReadProcInt(int fe_index, const std::string & entry)
return(-1);
return(value);
+#endif
}
void eFBCTunerManager::WriteProcInt(int fe_index, const std::string & entry, int value)
@@ -45,6 +64,41 @@ void eFBCTunerManager::WriteProcInt(int fe_index, const std::string & entry, int
file << value;
}
+void eFBCTunerManager::WriteProcStr(int fe_index, const std::string & entry, int value)
+{
+ std::stringstream path;
+ std::ofstream file;
+
+ path << "/proc/stb/frontend/" << fe_index << "/" << entry;
+ file.open(path.str().c_str());
+
+ if(!file.is_open())
+ return;
+ eDebug("[eFBCTunerManager::WriteProcStr] val: %d", value);
+ file << (value == 0 ? "A" : "B");
+}
+
+#ifdef DREAMBOX
+void eFBCTunerManager::LoadConnectChoices(int fe_index, std::string &choices)
+{
+ std::stringstream path;
+ std::ifstream file;
+ std::string line;
+ std::string::const_iterator it;
+ int fbc_id;
+
+ path << "/proc/stb/frontend/" << fe_index << "/input_choices";
+ file.open(path.str().c_str());
+
+ if(!file.is_open())
+ return;
+
+ file >> choices;
+
+ if(file.bad() || file.fail())
+ return;
+}
+#else
void eFBCTunerManager::LoadConnectChoices(int fe_index, connect_choices_t &choices)
{
std::stringstream path;
@@ -77,6 +131,7 @@ void eFBCTunerManager::LoadConnectChoices(int fe_index, connect_choices_t &choic
}
}
}
+#endif
DEFINE_REF(eFBCTunerManager);
@@ -93,7 +148,7 @@ eFBCTunerManager::eFBCTunerManager(ePtr<eDVBResourceManager> res_mgr)
eSmartPtrList<eDVBRegisteredFrontend> &frontends = m_res_mgr->m_frontend;
eSmartPtrList<eDVBRegisteredFrontend> &frontends_simulate = m_res_mgr->m_simulate_frontend;
tuner_t tuner;
- int fe_id, fbc_prev_set_id;
+ int fe_id, fbc_prev_set_id;
if(!m_instance)
m_instance = this;
@@ -109,22 +164,34 @@ eFBCTunerManager::eFBCTunerManager(ePtr<eDVBResourceManager> res_mgr)
continue; // ignore DVB-C/T FBC tuners because they need no special treatment
fe_id = FESlotID(it);
- tuner.set_id = ReadProcInt(fe_id, "fbc_set_id");
+#ifdef DREAMBOX
+ tuner.set_id = ReadProcInt(fe_id, "input");
+#else
+ tuner.set_id = ReadProcInt(fe_id, "fbc_set_id");
+#endif
if(tuner.set_id >= 0)
{
if(fbc_prev_set_id != tuner.set_id)
{
fbc_prev_set_id = tuner.set_id;
+#ifdef DREAMBOX
+ LoadConnectChoices(fe_id, tuner.input_choices);
+#else
LoadConnectChoices(fe_id, tuner.connect_choices);
+#endif
tuner.id = 0;
}
-
+#ifdef DREAMBOX
+ tuner.is_root = tuner.id < 2;
+#else
if(tuner.id < (int)tuner.connect_choices.size())
tuner.is_root = tuner.connect_choices.test(tuner.id);
else
tuner.is_root = false;
+#endif
+
tuner.default_id = tuner.is_root ? tuner.id : 0;
m_tuners[fe_id] = tuner;
SetProcFBCID(fe_id, tuner.default_id, false);
@@ -141,8 +208,14 @@ eFBCTunerManager::eFBCTunerManager(ePtr<eDVBResourceManager> res_mgr)
if (!(it->m_frontend->supportsDeliverySystem(SYS_DVBS, false) || it->m_frontend->supportsDeliverySystem(SYS_DVBS2, false)))
continue;
+#ifdef DREAMBOX
+ if(ReadProcInt(FESlotID(it), "input") >= 0)
+ it->m_frontend->set_FBCTuner(true);
+#else
if(ReadProcInt(FESlotID(it), "fbc_set_id") >= 0)
it->m_frontend->set_FBCTuner(true);
+#endif
+
}
}
@@ -154,8 +227,12 @@ eFBCTunerManager::~eFBCTunerManager()
void eFBCTunerManager::SetProcFBCID(int fe_id, int fbc_connect, bool fbc_is_linked)
{
+#ifdef DREAMBOX
+ WriteProcStr(fe_id, "input", fbc_connect);
+#else
WriteProcInt(fe_id, "fbc_connect", fbc_connect);
WriteProcInt(fe_id, "fbc_link", fbc_is_linked ? 1 : 0);
+#endif
}
int eFBCTunerManager::FESlotID(eDVBRegisteredFrontend *fe)
@@ -412,7 +489,7 @@ int eFBCTunerManager::IsCompatibleWith(ePtr<iDVBFrontendParameters> &feparm, eDV
if(IsSCR(*it))
continue;
-
+
// temporarily add this leaf to the current "linked" chain, at the tail
fe_insert_point = GetTail(*it);
diff --git a/lib/dvb/fbc.h b/lib/dvb/fbc.h
index a479961086a..b70f9b7dfc9 100644
--- a/lib/dvb/fbc.h
+++ b/lib/dvb/fbc.h
@@ -25,6 +25,7 @@ private:
int id;
int default_id;
connect_choices_t connect_choices;
+ std::string input_choices;
} tuner_t;
typedef std::map<int, tuner_t> tuners_t;
@@ -42,7 +43,12 @@ private:
static int ReadProcInt(int, const std::string &);
static void WriteProcInt(int, const std::string &, int);
+ static void WriteProcStr(int, const std::string &, int);
+#ifdef DREAMBOX
+ static void LoadConnectChoices(int, std::string &);
+#else
static void LoadConnectChoices(int, connect_choices_t &);
+#endif
static void SetProcFBCID(int, int, bool);
static int FESlotID(eDVBRegisteredFrontend *);
static bool IsLinked(eDVBRegisteredFrontend *);
diff --git a/lib/dvb_ci/dvbci.cpp b/lib/dvb_ci/dvbci.cpp
index a4681b1ff39..a744ae6a70b 100644
--- a/lib/dvb_ci/dvbci.cpp
+++ b/lib/dvb_ci/dvbci.cpp
@@ -6,6 +6,7 @@
#include <fstream>
#include <sstream>
#include <iomanip>
+#include <string>
#include <lib/base/init.h>
#include <lib/base/init_num.h>
@@ -33,6 +34,78 @@ eDVBCIInterfaces *eDVBCIInterfaces::instance = 0;
pthread_mutex_t eDVBCIInterfaces::m_pmt_handler_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
pthread_mutex_t eDVBCIInterfaces::m_slot_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+static char* readInputCI(int NimNumber)
+{
+ char id1[] = "NIM Socket";
+ char id2[] = "Input_Name";
+ char keys1[] = "1234567890";
+ char keys2[] = "12ABCDabcd";
+ char *inputName = 0;
+ char buf[256];
+ FILE *f;
+
+ f = fopen("/proc/bus/nim_sockets", "rt");
+ if (f)
+ {
+ while (fgets(buf, sizeof(buf), f))
+ {
+ char *p = strcasestr(buf, id1);
+ if (!p)
+ continue;
+
+ p += strlen(id1);
+ p += strcspn(p, keys1);
+ if (*p && strtol(p, 0, 0) == NimNumber)
+ break;
+ }
+
+ while (fgets(buf, sizeof(buf), f))
+ {
+ if (strcasestr(buf, id1))
+ break;
+
+ char *p = strcasestr(buf, id2);
+ if (!p)
+ continue;
+
+ p = strchr(p + strlen(id2), ':');
+ if (!p)
+ continue;
+
+ p++;
+ p += strcspn(p, keys2);
+ size_t len = strspn(p, keys2);
+ if (len > 0)
+ {
+ inputName = strndup(p, len);
+ break;
+ }
+ }
+
+ fclose(f);
+ }
+
+ return inputName;
+}
+
+static std::string getTunerLetterDM(int NimNumber)
+{
+ char *srcCI = readInputCI(NimNumber);
+ if (srcCI) {
+ std::string ret = std::string(srcCI);
+ free(srcCI);
+ if (ret.size() == 1){
+ int corr = 1;
+ if (NimNumber > 7) {
+ corr = -7;
+ }
+ return ret + std::to_string(NimNumber + corr);
+ }
+ return ret;
+ }
+ return eDVBCISlot::getTunerLetter(NimNumber);
+}
+
eDVBCIInterfaces::eDVBCIInterfaces()
: m_messagepump_thread(this,1, "dvbci"), m_messagepump_main(eApp,1, "dvbci"), m_runTimer(eTimer::create(this))
{
@@ -69,7 +142,11 @@ eDVBCIInterfaces::eDVBCIInterfaces()
}
for (eSmartPtrList<eDVBCISlot>::iterator it(m_slots.begin()); it != m_slots.end(); ++it)
+#ifdef DREAMBOX_DUAL_TUNER
+ it->setSource(getTunerLetterDM(0));
+#else
it->setSource("A");
+#endif
for (int tuner_no = 0; tuner_no < 26; ++tuner_no) // NOTE: this assumes tuners are A .. Z max.
{
@@ -80,7 +157,11 @@ eDVBCIInterfaces::eDVBCIInterfaces()
if(::access(path.str().c_str(), R_OK) < 0)
break;
+#ifdef DREAMBOX_DUAL_TUNER
+ setInputSource(tuner_no, getTunerLetterDM(tuner_no));
+#else
setInputSource(tuner_no, eDVBCISlot::getTunerLetter(tuner_no));
+#endif
}
eDebug("[CI] done, found %d common interface slots", num_ci);
@@ -310,7 +391,11 @@ void eDVBCIInterfaces::ciRemoved(eDVBCISlot *slot)
if (slot->linked_next)
slot->linked_next->setSource(slot->current_source);
else // last CI in chain
+#ifdef DREAMBOX_DUAL_TUNER
+ setInputSource(slot->current_tuner, getTunerLetterDM(slot->current_tuner));
+#else
setInputSource(slot->current_tuner, eDVBCISlot::getTunerLetter(slot->current_tuner));
+#endif
slot->linked_next = 0;
slot->use_count=0;
slot->plugged=true;
@@ -581,7 +666,11 @@ void eDVBCIInterfaces::recheckPMTHandlers()
if (tunernum != -1)
{
setInputSource(tunernum, ci_source.str());
+#ifdef DREAMBOX_DUAL_TUNER
+ ci_it->setSource(getTunerLetterDM(tunernum));
+#else
ci_it->setSource(eDVBCISlot::getTunerLetter(tunernum));
+#endif
}
else
{
@@ -711,7 +800,11 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler)
{
case finish_use_tuner_a:
{
+#ifdef DREAMBOX_DUAL_TUNER
+ finish_source = getTunerLetterDM(0);
+#else
finish_source = "A";
+#endif
break;
}
@@ -734,7 +827,11 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler)
if(finish_source == "")
{
eDebug("[CI] warning: CI streaming finish mode not set, assuming \"tuner A\"");
+#ifdef DREAMBOX_DUAL_TUNER
+ finish_source = getTunerLetterDM(0);
+#else
finish_source = "A";
+#endif
}
slot->setSource(finish_source);
@@ -746,7 +843,11 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler)
if (slot->linked_next)
slot->linked_next->setSource(slot->current_source);
else
+#ifdef DREAMBOX_DUAL_TUNER
+ setInputSource(slot->current_tuner, getTunerLetterDM(slot->current_tuner));
+#else
setInputSource(slot->current_tuner, eDVBCISlot::getTunerLetter(slot->current_tuner));
+#endif
if (base_slot != slot)
{
@@ -1134,7 +1235,11 @@ void eDVBCIInterfaces::setCIPlusRouting(int slotid)
new_input_source << "CI" << slot->getSlotID();
setInputSource(tunernum, new_input_source.str());
+#ifdef DREAMBOX_DUAL_TUNER
+ slot->setSource(getTunerLetterDM(tunernum));
+#else
slot->setSource(eDVBCISlot::getTunerLetter(tunernum));
+#endif
slot->setCIPlusRoutingParameter(tunernum, ciplus_routing_input, ciplus_routing_ci_input);
eDebug("[CI] CIRouting active slotid=%d tuner=%d old_input=%s old_ci_input=%s", slotid, tunernum, ciplus_routing_input.c_str(), ciplus_routing_ci_input.c_str());
diff --git a/lib/dvb_ci/dvbci.h b/lib/dvb_ci/dvbci.h
index 511944b9770..5d11f624b45 100644
--- a/lib/dvb_ci/dvbci.h
+++ b/lib/dvb_ci/dvbci.h
@@ -110,8 +110,8 @@ class eDVBCISlot: public iObject, public sigc::trackable
int setClockRate(const std::string &rate);
void determineCIVersion();
int setEnabled(bool);
- static std::string getTunerLetter(int tuner_no) { return std::string(1, char(65 + tuner_no)); }
public:
+ static std::string getTunerLetter(int tuner_no) { return std::string(1, char(65 + tuner_no)); }
enum {stateRemoved, stateInserted, stateInvalid, stateResetted, stateDisabled};
enum {versionUnknown = -1, versionCI = 0, versionCIPlus1 = 1, versionCIPlus2 = 2};
eDVBCISlot(eMainloop *context, int nr);
diff --git a/lib/gdi/epng.cpp b/lib/gdi/epng.cpp
index 449ccc9c14e..8745975b723 100644
--- a/lib/gdi/epng.cpp
+++ b/lib/gdi/epng.cpp
@@ -3,10 +3,15 @@
#include <png.h>
#include <stdio.h>
#include <lib/base/cfile.h>
-#include <lib/base/estring.h>
+#include <lib/base/wrappers.h>
#include <lib/gdi/epng.h>
#include <lib/gdi/pixmapcache.h>
#include <unistd.h>
+#include <lib/base/estring.h>
+
+#include <map>
+#include <string>
+#include <lib/base/elock.h>
extern "C" {
#include <jpeglib.h>
@@ -123,7 +128,7 @@ int loadPNG(ePtr<gPixmap> &result, const char *filename, int accel, int cached)
result = new gPixmap(width, height, bit_depth * channels, cached ? PixmapCache::PixmapDisposed : NULL, accel);
gUnmanagedSurface *surface = result->surface;
-
+
png_bytep *rowptr = new png_bytep[height];
for (unsigned int i = 0; i < height; i++)
rowptr[i] = ((png_byte*)(surface->data)) + i * surface->stride;
@@ -131,6 +136,18 @@ int loadPNG(ePtr<gPixmap> &result, const char *filename, int accel, int cached)
delete [] rowptr;
+ if (color_type == PNG_COLOR_TYPE_RGBA || color_type == PNG_COLOR_TYPE_GA)
+ surface->transparent = true;
+ else
+ {
+ png_bytep trans_alpha = NULL;
+ int num_trans = 0;
+ png_color_16p trans_color = NULL;
+
+ png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color);
+ surface->transparent = (trans_alpha != NULL);
+ }
+
int num_palette = -1, num_trans = -1;
if (color_type == PNG_COLOR_TYPE_PALETTE) {
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE)) {
@@ -204,8 +221,8 @@ int loadJPG(ePtr<gPixmap> &result, const char *filename, ePtr<gPixmap> alpha, in
if (cached && (result = PixmapCache::Get(filename)))
return 0;
- struct jpeg_decompress_struct cinfo = {};
- struct my_error_mgr jerr = {};
+ struct jpeg_decompress_struct cinfo;
+ struct my_error_mgr jerr;
JSAMPARRAY buffer;
int row_stride;
CFile infile(filename, "rb");
@@ -248,13 +265,13 @@ int loadJPG(ePtr<gPixmap> &result, const char *filename, ePtr<gPixmap> alpha, in
}
if (grayscale)
{
- eWarning("[loadJPG] no support for grayscale + alpha at the moment");
+ eWarning("[loadJPG] we don't support grayscale + alpha at the moment");
alpha = 0;
}
}
result = new gPixmap(cinfo.output_width, cinfo.output_height, grayscale ? 8 : 32, cached ? PixmapCache::PixmapDisposed : NULL);
-
+ result->surface->transparent = false;
row_stride = cinfo.output_width * cinfo.output_components;
buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
while (cinfo.output_scanline < cinfo.output_height) {
@@ -480,14 +497,12 @@ int loadImage(ePtr<gPixmap> &result, const char *filename, int accel, int width,
return loadSVG(result, filename, cached == -1 ? 1 : cached, width, height, scale, keepAspect, align);
else if (endsWith(filename, ".jpg"))
return loadJPG(result, filename, cached == -1 ? 0 : cached);
-
return 0;
}
int savePNG(const char *filename, gPixmap *pixmap)
{
int result;
-
{
eDebug("[ePNG] saving to %s",filename);
CFile fp(filename, "wb");
diff --git a/lib/gdi/fb.cpp b/lib/gdi/fb.cpp
index 66c1e5e56a8..99b7f599ed0 100644
--- a/lib/gdi/fb.cpp
+++ b/lib/gdi/fb.cpp
@@ -13,9 +13,19 @@
#define FBIO_WAITFORVSYNC _IOW('F', 0x20, uint32_t)
#endif
-#ifndef FBIO_BLIT
+#ifdef CONFIG_ION
+
+#include <lib/gdi/accel.h>
+#include <interfaces/ion.h>
+#define ION_HEAP_TYPE_BMEM (ION_HEAP_TYPE_CUSTOM + 1)
+#define ION_HEAP_ID_MASK (1 << ION_HEAP_TYPE_BMEM)
+#define ACCEL_MEM_SIZE (32*1024*1024)
+
+#elif !defined(FBIO_BLIT)
+
#define FBIO_SET_MANUAL_BLIT _IOW('F', 0x21, __u8)
#define FBIO_BLIT 0x22
+
#endif
fbClass *fbClass::instance;
@@ -38,6 +48,10 @@ fbClass::fbClass(const char *fb)
cmap.green=green;
cmap.blue=blue;
cmap.transp=trans;
+
+#ifdef CONFIG_ION
+ int ion;
+#endif
fbFd=open(fb, O_RDWR);
if (fbFd<0)
@@ -60,15 +74,96 @@ fbClass::fbClass(const char *fb)
goto nolfb;
}
- available=fix.smem_len;
+ available = fix.smem_len;
m_phys_mem = fix.smem_start;
eDebug("[fb] %s: %dk video mem", fb, available/1024);
+#if defined(CONFIG_ION)
+ /* allocate accel memory here... its independent from the framebuffer */
+ ion = open("/dev/ion", O_RDWR | O_CLOEXEC);
+ if (ion >= 0)
+ {
+ struct ion_allocation_data alloc_data;
+ struct ion_fd_data share_data;
+ struct ion_handle_data free_data;
+ struct ion_phys_data phys_data;
+ int ret;
+ unsigned char *lion;
+
+ eDebug("[fb] Using ION allocator");
+
+ memset(&alloc_data, 0, sizeof(alloc_data));
+ alloc_data.len = ACCEL_MEM_SIZE;
+ alloc_data.align = 4096; // 4k aligned
+ alloc_data.heap_id_mask = ION_HEAP_ID_MASK;
+ ret = ioctl(ion, ION_IOC_ALLOC, &alloc_data);
+ if (ret < 0)
+ {
+ eDebug("[fb] ION_IOC_ALLOC failed");
+ eFatal("[fb] failed to allocate accel memory!!!");
+ return;
+ }
+
+ memset(&phys_data, 0, sizeof(phys_data));
+ phys_data.handle = alloc_data.handle;
+ ret = ioctl(ion, ION_IOC_PHYS, &phys_data);
+ if (ret < 0)
+ {
+ eDebug("[fb] ION_IOC_PHYS failed");
+ goto err_ioc_free;
+ }
+
+ memset(&share_data, 0, sizeof(share_data));
+ share_data.handle = alloc_data.handle;
+ ret = ioctl(ion, ION_IOC_SHARE, &share_data);
+ if (ret < 0)
+ {
+ eDebug("[fb] ION_IOC_SHARE failed");
+ goto err_ioc_free;
+ }
+
+ memset(&free_data, 0, sizeof(free_data));
+ free_data.handle = alloc_data.handle;
+ if (ioctl(ion, ION_IOC_FREE, &free_data) < 0)
+ eDebug("[fb] ION_IOC_FREE failed");
+
+ m_accel_fd = share_data.fd;
+ lion=(unsigned char*)mmap(0, ACCEL_MEM_SIZE, PROT_WRITE|PROT_READ, MAP_SHARED, share_data.fd, 0);
+
+ if (lion)
+ {
+ eDebug("[fb] %dkB available for acceleration surfaces (via ION).", ACCEL_MEM_SIZE / 1024);
+ gAccel::getInstance()->setAccelMemorySpace(lion, phys_data.addr, ACCEL_MEM_SIZE);
+ }
+ else
+ {