relocate packages on recipes-base/recipes-enigma2/recipes-wlan.
[vuplus_openvuplus] / meta-openvuplus / recipes-vuplus / aio-grab / aio-grab / aio-grab_vuplus.patch
diff --git a/meta-openvuplus/recipes-vuplus/aio-grab/aio-grab/aio-grab_vuplus.patch b/meta-openvuplus/recipes-vuplus/aio-grab/aio-grab/aio-grab_vuplus.patch
new file mode 100644 (file)
index 0000000..1459e22
--- /dev/null
@@ -0,0 +1,94 @@
+diff --git a/main.c b/main.c
+index 190ff5f..08298e9 100644
+--- a/main.c
++++ b/main.c
+@@ -101,8 +101,8 @@ static void combine(unsigned char *output,
+                   const unsigned char *video, const unsigned char *osd,
+                   unsigned int xres, unsigned int yres);
+-enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM7400,BRCM7405};
+-static const char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm7400","Brcm7405"};
++enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM7400,BRCM7405,BRCM7335,BRCM7325};
++static const char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm7400","Brcm7405","Brcm7335","Brcm7325"};
+ static int stb_type=UNKNOWN;
+ static const char *file_getline(const char *filename)
+@@ -221,6 +221,22 @@ int main(int argc, char **argv) {
+                        !strcmp(line, "dm800se") ||
+                        !strcmp(line, "dm7020hd"))
+                       stb_type = BRCM7405;
++
++              // CPU Detection. idea from pl
++              if (line != NULL)
++                      free(line);
++              line = file_getline("/proc/stb/info/chipset");
++              if(line)
++              {
++                      if (!strcmp(line, "7335"))
++                              stb_type = BRCM7335;
++                      else if (!strcmp(line, "7325"))
++                              stb_type = BRCM7325;
++                      else if (!strcmp(line, "7405"))
++                              stb_type = BRCM7405;
++              }
++              free(line);
++              
+       } else if (strstr(line, "xilleonfb")) {
+               stb_type = XILLEON;
+       } else if (strstr(line, "Pallas FB")) {
+@@ -564,7 +580,7 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
+               return false;
+       }
+-      if (stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405)
++      if (stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405 || stb_type == BRCM7335 || stb_type == BRCM7325)
+       {
+               // grab brcm7401 pic from decoder memory
+               unsigned char *memory = mmap(0, 100, PROT_READ, MAP_SHARED, mem_fd, 0x10100000);
+@@ -609,7 +625,7 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
+               assert(chroma);
+               // grabbing luma & chroma plane from the decoder memory
+-              if (stb_type == BRCM7401 || stb_type == BRCM7405) {
++              if (stb_type == BRCM7401 || stb_type == BRCM7405 || stb_type == BRCM7325) {
+                       // on dm800/dm500hd we have direct access to the decoder memory
+                       memory = mmap(0, offset + stride*(ofs2+64), PROT_READ, MAP_SHARED, mem_fd, adr);
+                       if (memory == MAP_FAILED) {
+@@ -620,7 +636,7 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
+                       usleep(50000);  // we try to get a full picture, its not possible to get a sync from the decoder so we use a delay
+                                       // and hope we get a good timing. dont ask me why, but every DM800 i tested so far produced a good
+                                       // result with a 50ms delay
+-              } else if (stb_type == BRCM7400) { 
++              } else if (stb_type == BRCM7400 || stb_type == BRCM7335) {
+                       // on dm8000 we have to use dma, so dont change anything here until you really know what you are doing !
+                       
+                       unsigned int i = 0;
+@@ -640,6 +656,7 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
+                       volatile unsigned long *mem_dma;
+                       mem_dma = mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, 0x10c02000);
++                      mem_dma = mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, (stb_type==BRCM7400)? 0x10c02000:0x10c01000);
+                       if (mem_dma == MAP_FAILED) {
+                               perror("mmap");
+                               return false;
+@@ -676,7 +693,7 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
+               unsigned int chr_luma_stride = 0x40;
+               unsigned int sw;
+-              if (stb_type == BRCM7405)
++              if (stb_type == BRCM7405 || stb_type == BRCM7325)
+                       chr_luma_stride *= 2;
+               xsub=chr_luma_stride;
+@@ -711,9 +728,9 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
+                       }
+               }
+-              if (stb_type == BRCM7401 || stb_type == BRCM7405)
++              if (stb_type == BRCM7401 || stb_type == BRCM7405 || stb_type == BRCM7325)
+                       munmap(memory, offset + stride * (ofs2 + 64));
+-              else if (stb_type == BRCM7400) {
++              else if (stb_type == BRCM7400 || stb_type == BRCM7335) {
+                       memory -= 0x1000;
+                       munmap(memory, DMA_BLOCKSIZE + 0x1000);
+               }