Help - Search - Members - Calendar
Full Version: Iodata Cfxga Card Under Pdaxrom
OESF Forums > Distros, Development, and Model Specific Forums > Distro Support and Discussion > pdaXrom
daniel3000
Hello,

does anyone use the IODATA CF-XGA card successfully under pdaXrom 1.1.0beta3?
Anyone willing to help to make it work?
I tried with different versions of the cfxga-mirror tool available on the Internet but to no avail.

The "cfxga-mirror" tool which is shipped with pdaXrom 1.1.0beta3 and installed under /usr/bin generates a disturbed
image on the external monitor (rotated by 90 degrees, ghosted four times and interlaced).
I have not found the sources for that. Does anyone have them?

So I downloaded the "cfxgamirror" and "cfxgamirror2" sources, the first one from trisoft, the other one from a Japanese page.

cfxgamirror needed a little change in order to generate a good image on the monitor. Otherwise it generated also a disturbed image, but different than
"cfxga-mirror".
cfxgamirror2 did it fine without the change.

BUT: Both of these versions crash the Zaurus after some seconds if used under X.
If used under console without X (i.e. directly after booting) they work fine.
The pre-installed "cfxga-mirror" does not crash, at least not as fast as the others.

Also, if I start them under console without X, then terminate them, and then want to start X, I get this error and X doesn't start until I reboot:

CODE
#startx
Loading /etc/sysconfig/keyboard/kernel.map

_XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
_XSERVTransOpen: transport open failed for inet6/zaurus:0
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6
XIO:  fatal IO error 104 (Conection reset by peer) on X server ":0.0"
     after 0 requests (0 known processed) with 0 events remaining.


Below is the source code of cfxgamirror2.c which causes that problems.

Does anyone have a clue why:

1. the tool crashes the Zaurus
2. ...only when in X
3. startx cannot be executed after the tool ran under console
(even ejecting the card and/or unloading memory_cs.o does not help for startx)
4. how I can make this card work well under pdaXrom?

Currently I am trying to track down the position in the source where the zaurus crashes using printf commands.
Will update this thread on each result.

Any help or hint greatly appreciated!

Thanks a lot!
daniel


here comes cfxgamirror2.c:

CODE
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <ctype.h>
#include <fcntl.h>
#include "cfxga.h"

#define SCREEN_WIDTH    640
#define SCREEN_HEIGHT   480

int main(int argc, char *argv[])
{
   unsigned short *scrnbuf, *sb2;
   unsigned long rez;
   int fd, fbfd, center=0;
   struct cfxgaset desc = { 0, 0, 640, 480, 16, 1280, NULL };
   struct cfxgaget info;


   fd = open("/dev/cfxga0a", O_RDWR);
   if(fd < 0)
   {
    printf("No CFXGA card\n");
    return -1;
   }

   if(argc == 1 || argc>3 ||
      (!isdigit(argv[1][0])&&!isdigit(argv[argc-1][0])))
   {
    int i;
    
    printf("usage: cfxgamirror [-c] <mode>\n Available modes:\n");
    // display data for all modes
    ioctl(fd, CFXGANUMMODES, &rez);
    for(i = 0; i < rez; i++)
    {
    info.mode = i;
    ioctl(fd, CFXGAGETMODE, &info);
    printf("%2ld: W=%ld H=%ld vf=%-2ld d=%ld hf=%ld vid=%02lx\n", info.mode, info.width, info.height, info.vfreq,
      info.depth, info.hfreq, info.appl);
    }
    printf("must assign mode number\n");
    printf("-c  :  display to center and no scaling\n");
    close(fd);
    return 1;
   }
   if (argv[1][0]=='-'&&argv[1][1]=='c')
       center = 1;
   
   
   rez = atoi(argv[argc-1]);
   // get mode stats
   info.mode = rez;
   ioctl(fd, CFXGAGETMODE, &info);

   // display mode specs
   printf("%2ld: W=%ld H=%ld vf=%-2ld d=%ld hf=%ld vid=%02lx\n", info.mode, info.width, info.height, info.vfreq, info.depth,
         info.hfreq, info.appl);
   if (center==0)
   {
       desc.height = info.height;
       desc.width = info.width;
   }
   else
   {
       desc.left = (info.width - desc.width) / 2;
       desc.top = (info.height - desc.height) / 2;
       desc.height = SCREEN_HEIGHT;
       desc.width = SCREEN_WIDTH;
   }
   desc.stride = desc.width*2;
   // set mode
   ioctl(fd, CFXGASETMODE, &rez);
   // clear screen
   ioctl(fd, CFXGACLEAR, NULL);
   // map screen buffer
   fbfd = open("/dev/fb0", O_RDONLY);    // I'm not sure when I can close this
   sb2 = mmap(0, SCREEN_WIDTH * SCREEN_HEIGHT * 2, PROT_READ, MAP_PRIVATE, fbfd, 0);
   
   // close(fbfd);  /* comment by daniel3000: I tried this here, but it does not make a difference at all. */
   
   // a normal malloc or global may work, but to be safe...
   scrnbuf = mmap(0, desc.width * desc.height * 2, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
   desc.image = scrnbuf;

   // update the image a little slower than every second
   for(;;)
   {
       static int sum;
       int i,j,x,y,dx,dy,cx,cy,cksum;
    unsigned short *dst,*src;
       
       dx = desc.width - SCREEN_WIDTH;
       dy = desc.height - SCREEN_HEIGHT;        
       cksum = 0;
       dst = scrnbuf;
       y = SCREEN_HEIGHT-1;
       for(cy=i=0;i<desc.height;i++,y--)
       {
           src = sb2+y;
           for(x=cx=j=0;j<desc.width;j++,dst++)
           {
               cksum+=(*dst=src[x]);
               cx += dx;
               if (cx>=desc.width)
               {
                   cx -= desc.width;
                   x -= SCREEN_HEIGHT;
               }
               x += SCREEN_HEIGHT;
           }
           cy += dy;
           if (cy>=desc.height)
           {
               cy-=desc.height;
               y++;
           }
       }
    // send to VGA chip
    if (sum!=cksum)
    {
                 ioctl(fd, CFXGAWRITERECT, &desc);
                 sum = cksum;
               }
    sleep(1);
   }
}
daniel3000
Update:
Found the sources of "cfxga-mirror" which is preinstalled in pdaXrom under:
http://mail.pdaxrom.org/download/1.1.0beta3/src/

However, I cannot compile them using make becasue the cfxga_cs.o module is to be conpiled too which need kernel sources.

However, I can compile the cfxga-mirror.cpp source file seperately.
Will try around with that one.

Question:
What's this cfxga_cs.o module?
It is also available under pdaXrom and loadable using modprobe, but the card is always recognized as "anonymous memory" which is bound to "memory_cs.o".
I tried modifying /etc/pcmcia/config so that Anonymous memory is bound to cfxga_cs instead, but this does not work.

Do I need this module?
How do I load it then?

Thanks
daniel
daniel3000
Now I seem to be at a dead end with my limited low-level programming knowledge and definitely need some help!

I have one program which generates a good image but crashes (cfxgamirror(2).c).

And I have one program which is stable but generates a garbled image (cfxga-mirror.cpp).


The difference is that the C programs use ioctl write function 5 (write from memory, i.e. framebuffer data is first copied to memory and then to the memory of the card),
and the CPP program uses function 6, which is direct copying the data from /dev/fb0 to the card memory:

CODE
[API List]
1. CFXGA_GET_STATUS    Get a status of CFXGA. Check the physical card and a driver version.
2. CFXGA_GET_RESONUM    Return supported resolution numbers.
3. CFXGA_GET_RESOINFO    List up suppoted resolutions info.
4. CFXGA_SET_RESO  Set up a resolution
5. CFXGA_COPY_FB  Copy data from memory to frame buffer
6. CFXGA_COPY_FB2  Copy data from assigned physical address to frame buffer
7. CFXGA_CLEAR_SCREEN@    Display clear
8. CFXGA_SCREEN_OFF    Display off



CPP (source see below appended to this posting):
I have tried to adjust a lot of parameters (UseFB0Copy.*) for function 6 in the cpp program, but to no avail.
The only things I have not touched are the physical address and offset, as I don't know how they are handled at all and what they exactly mean. So they could still be the reason for the display problems.

C (source see above in first posting):
I have tried to pin down the position where the program crashes the Zaurus.
It crashes it only if X is running, not on console. And it crashes at many different positions, mostly within the last for(;;) loop. So I assume the reason for the total system crash is one of the ioctl calls, which may need some variable time so the crash does not happen always at the same position within the program.
It is very probably that if it is a ioctl call, it is the one which copies the data to the card memory, because this is the only one which is called periodically once the program is running. And sometimes the crash happens only after the screen has been updated quite a lot of times.

I think one way to pin down the reason for crashing could be to find out what the X server error messages mean which I gave in Post #1. Any clue?
I think the critical error message is the XIO: fatal IO error 104. The others should not do any harm and I think I have seen them before.

Or maybe combining the two programs may help, i.e. taking the CPP program and modifying it to use function 5 instead of 6. However, I have almost no C++ skills so this would be a major task for me probably.

I would be willing to pay for help, if the result is satisfactory.
Anyone interested in assisting me?
I need a working solution until Friday! biggrin.gif

I have attached the two source trees, one includes the API description:
Click to view attachment

(don't worry about the cfxga_cs module in one of the directories. Simply compile with
g++ -o testbin cfxga-mirror.cpp
make will give errors if pcmcia sources are not installed)

Thanks for any help!

daniel
daniel3000
Found the data sheet of the used chip here
(it is the S1D13806 chip).
daniel3000
and here are "screen-shots" of the stable version(taken with camera from computer monitor).

The first one is how the original version of cfxga-mirror.cpp (pre-installed version) produces the image and the second shot is with UseFBOCopy.swivel = 1 instead.

The three / four "ghosted" images are not identical to each other. If they were stacked, they would probably add up to a complete image. You can see it when you have a look at the red and blue console icons in the upper right window corner.

Maybe from that pattern someone can see what parameter is wrong? unsure.gif



Hrw
Months ago I tried to write something working for that card. It was hard to debug because user of card was in US and lack camera but I got only 480x480 output from his Tosa (SL-6000). My program used CFXGA_COPY_FB2.

BTW - with USB host machine I would serach for USB VGA card rather.
daniel3000
Hi Hrw,

thanks for the info.
Due to lack of supply for the IODATA cards I also would rather like to find a good and working USB solution.

Is there any known solution with a linux tool available?
Maybe even tested on Zaurus already?

Bandwidth should not be the problem, if only used for presentations or slide shows. However, if it should allow a "larger screen" for work or even video, bandwidth is probably a big issue.
For me, low bandwidth would be enough.

However, could I have a look at what you wrote for 480x480?
That would be better than nothing and maybe lead to another solution.

Thanks a lot
Daniel
Meanie
QUOTE(daniel3000 @ Oct 11 2006, 06:41 PM)
Hi Hrw,

thanks for the info.
Due to lack of supply for the IODATA cards I also would rather like to find a good and working USB solution.

Is there any known solution with a linux tool available?
Maybe even tested on Zaurus already?

Bandwidth should not be the problem, if only used for presentations or slide shows. However, if it should allow a "larger screen" for work or even video, bandwidth is probably a big issue.
For me, low bandwidth would be enough.

However, could I have a look at what you wrote for 480x480?
That would be better than nothing and maybe lead to another solution.

Thanks a lot
Daniel
*


I got a USB to VGA dongle and it basically works on my Zaurus for short presentations. However, it suffers from instability which I am sure if I had the time and was a bit more motivated I could debug and fix it since the source for the application and the driver is freely available.
It currently is compiled for Sharp ROM so it could probably be easily ported to OPIE.
I am sure that there would be an app for X11 out there as well that could be used for pdaXrom. The important thing is to get the driver debugged and stable.
daniel3000
QUOTE(Meanie @ Oct 11 2006, 01:36 PM)
I got a USB to VGA dongle and it basically works on my Zaurus for short presentations. However, it suffers from instability which I am sure if I had the time and was a bit more motivated I could debug and fix it since the source for the application and the driver is freely available.
It currently is compiled for Sharp ROM so it could probably be easily ported to OPIE.
I am sure that there would be an app for X11 out there as well that could be used for pdaXrom. The important thing is to get the driver debugged and stable.
*


Hi Meanie,

which model of USB VGA adapter is it? Is it still available and will be in the future?
How can I motivate you to debug it? biggrin.gif

daniel
Reaper
Well, I can't help much, but maybe you'll find it useful. I have Pretec CompactPresenter card and once I've been able to use it with Cacko. I'd had to do several things before I got it worked because of its partial incompatibility with CFXGA. What I did:

1) Downloaded memory_cs.o from I-O-Data and put it into /lib/modules/2.4.18-rmk7-pxa3/embedix/pcmcia;

2) Corrected video mode (the problem you had with distortion - that's it, very high refresh rate, check your monitor's rate counter) by editing /home/QtPalmtop/bin/mirror.sh symlink from /usr/QtPalmtop.rom/bin/mirror.sh to /home/root/mirror.sh (you should copy file from /home/QtPalmtop/bin/ to /home/root and edit it - just replace "cfxgamirror 0" with "cfxgamirror 1").

3) Presentation used its own porgramming of VGA card, so after starting it I had to set its video output to anywhere else but VGA (composite or S-video), set mode 640x480 and run mirror program again.

I'd be very glad to try any solutions suggested because I'd like very much to use my C3000 with CompactPresenter under pdaX.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.