Author Topic: Porting M5rc14 To Real Hardware  (Read 62399 times)

cortez

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • http://www.omegamoon.com
Porting M5rc14 To Real Hardware
« Reply #15 on: February 27, 2008, 04:40:38 am »
Quote from: Android Zaurus
My guess for now. Let the Android use drivers/video/pxafb.c not platform driver in arch/arm/mach-pxa. I'm working on another project for now and my Zaurus is configured for m3 Android. Later I'd like to try to build the kernel with CONFIG_FB_PXA=m and see what happens.

By the way, I found this wiki is very informational.

Android on OMAP - Embeddedlinux
http://elinux.org/Android_on_OMAP

Setting CONFIG_FB_PXA=m changes the behavior indeed... it turns the screen to white instead of black  
To be precise, the screen is white all the time, not only when switching to graphics mode, but also at startup and in console.
So, this seems not to be the solution either.

Look at the interesting part (sorry, it's a bit long) in the trace output below. It says "page flipping not supported (yres_virtual=640, requested=1280". I think this is the problem we're facing.

Code: [Select]
02:53:16.651373 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"SurfaceFlinger\'s main thread ready to run. Initializing graphics H/W...\", 72}], 3) = 88
02:53:16.655210 open("/dev/tty0", O_RDWR|O_SYNC|O_LARGEFILE) = 20
02:53:16.657091 ioctl(20, VT_GETSTATE, 0x43145e92) = 0
02:53:16.658640 ioctl(20, VIDIOC_QUERYCAP or VT_OPENQRY, 0x43145e9c) = 0
02:53:16.660192 ioctl(20, VIDIOC_G_COMP or VT_ACTIVATE, 0x2) = 0
02:53:16.676678 ioctl(20, VIDIOC_S_COMP or VT_WAITACTIVE, 0x2) = 0
02:53:16.678243 close(20)               = 0
02:53:16.679822 open("/dev/tty0", O_RDWR|O_SYNC|O_LARGEFILE) = 20
02:53:16.706815 ioctl(20, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
02:53:16.713156 ioctl(20, SNDCTL_TMR_START or TCSETS, {B38400 opost -isig -icanon -echo ...}) = 0
02:53:16.717340 ioctl(20, VIDIOC_ENUM_FMT or VT_SETMODE, 0x43145e8a) = 0
02:53:16.720475 sigaction(SIGUSR2, {0xacd132d1, [], 0}, NULL, 0xc4268) = 0
02:53:16.726764 sigaction(SIGSYS, {0xacd13335, [], 0}, NULL, 0xc4268) = 0
02:53:16.730505 sigprocmask(SIG_UNBLOCK, [USR2 SYS], NULL) = 0
02:53:16.733692 ioctl(20, KDSETMODE, 0x1) = 0
02:53:16.737202 open("libagl.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
02:53:16.739228 open("/system/lib/libagl.so", O_RDONLY|O_LARGEFILE) = 21
02:53:16.741405 lseek(21, -8, SEEK_END) = 96024
02:53:16.742915 read(21, "\\300\254PRE ", 8) = 8
02:53:16.780406 mmap2(0xacc00000, 98304, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 21, 0) = 0xacc00000
02:53:16.782040 close(21)               = 0
02:53:16.835776 mprotect(0xacc00000, 94208, PROT_READ|PROT_EXEC) = 0
02:53:16.838281 writev(4, [{"\5", 1}, {"\", 1}, {" not found in libagl.so\", 53}], 3) = 55
02:53:16.841546 access("/dev/hw3d", R_OK) = -1 ENOENT (No such file or directory)
02:53:16.843565 writev(4, [{"\5", 1}, {"\", 1}, {"can\'t access 3D hardware (No such file or directory)\", 53}], 3) = 55
02:53:16.847058 brk(0x142000)           = 0x142000
02:53:16.848999 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"EGL informations:\", 18}], 3) = 34
02:53:16.851889 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"# of configs : 4\", 17}], 3) = 33
02:53:16.854875 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"vendor    : Google Inc.\", 24}], 3) = 40
02:53:16.857839 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"version   : 1.2 Android META-EGL\", 33}], 3) = 49
02:53:16.860992 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"extensions: EGL_ANDROID_swap_rectangle EGL_ANDROID_copy_front_to_back EGL_ANDROID_get_render_buffer_address EGL_ANDROID_query_string_config\", 140}], 3) = 156
02:53:16.865904 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"ext/config: EGL_ANDROID_swap_rectangle EGL_ANDROID_copy_front_to_back EGL_ANDROID_get_render_buffer_address\", 108}], 3) = 124
02:53:16.870221 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"Client API: OpenGL ES\", 22}], 3) = 38
02:53:16.873291 open("/dev/graphics/fb0", O_RDWR|O_LARGEFILE) = 21
02:53:16.875388 ioctl(21, FBIOGET_FSCREENINFO, 0x43145d9c) = 0
02:53:16.876931 ioctl(21, FBIOGET_VSCREENINFO, 0x43145cfc) = 0
02:53:16.878477 ioctl(21, FBIOPUT_VSCREENINFO, 0x43145cfc) = 0
02:53:16.925453 writev(4, [{"\5", 1}, {"EGLDisplaySurface\", 18}, {"page flipping not supported (yres_virtual=640, requested=1280)\", 63}], 3) = 82
02:53:16.929119 ioctl(21, FBIOGET_VSCREENINFO, 0x43145cfc) = 0
02:53:16.930807 writev(4, [{"\4", 1}, {"EGLDisplaySurface\", 18}, {"using (fd=21)\nid           = PXA\nxres         = 480 px\nyres         = 640 px\nxres_virtual = 480 px\nyres_virtual = 640 px\nbpp          = 16\nr            = 11:5\ng            =  5:6\nb            =  0:5\n\", 200}], 3) = 219
02:53:16.967995 writev(4, [{"\4", 1}, {"EGLDisplaySurface\", 18}, {"width        = 51 mm (239.058823 dpi)\nheight       = 38 mm (427.789459 dpi)\nrefresh rate = 124.61 Hz\n\", 102}], 3) = 121
02:53:16.972517 ioctl(21, FBIOGET_FSCREENINFO, 0x43145d9c) = 0
02:53:16.974061 mmap2(NULL, 614400, PROT_READ|PROT_WRITE, MAP_SHARED, 21, 0) = 0x43146000
02:53:17.028820 mmap2(NULL, 618496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x431dc000
02:53:17.030696 mmap2(NULL, 618496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x43273000
02:53:17.032605 brk(0x143000)           = 0x143000
02:53:17.034701 brk(0x145000)           = 0x145000
02:53:17.036760 brk(0x146000)           = 0x146000
02:53:17.038532 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"OpenGL informations:\", 21}], 3) = 37
02:53:17.041493 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"vendor    : Google Inc.\", 24}], 3) = 40
02:53:17.046048 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"renderer  : Android PixelFlinger 1.0\", 37}], 3) = 53
02:53:17.049257 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"version   : OpenGL ES-CM 1.0\", 29}], 3) = 45
02:53:17.052344 writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"extensions: GL_OES_byte_coordinates GL_OES_fixed_point GL_OES_single_precision GL_OES_read_format GL_OES_compressed_paletted_texture GL_OES_draw_texture GL_OES_matrix_get GL_OES_query_matrix GL_ARB_te"..., 277}], 3) = 293
02:53:17.058395 access("/dev/hw3d", R_OK) = -1 ENOENT (No such file or directory)
02:53:17.060899 getpid()                = 2289
02:53:17.062402 getuid32()              = 0
02:53:17.063969 getpid()                = 2289
02:53:17.065639 open("/tmp/android-shared_heap.2289.0x145ab0", O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 22
02:53:17.068031 ftruncate(22, 19660800) = 0
02:53:17.069588 mmap2(NULL, 19660800, PROT_READ|PROT_WRITE, MAP_SHARED, 22, 0) = 0x4330a000
02:53:17.071229 unlink("/tmp/android-shared_heap.2289.0x145ab0") = 0
02:53:17.073566 getpid()                = 2289
02:53:17.075242 open("/tmp/android-shared_heap.2289.0x145df8", O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 23
02:53:17.077626 ftruncate(23, 4096)     = 0
02:53:17.079201 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 23, 0) = 0x445ca000
02:53:17.080843 unlink("/tmp/android-shared_heap.2289.0x145df8") = 0
02:53:17.083728 open("/tmp/android-SurfaceFlingerSynchro", O_WRONLY|O_NONBLOCK|O_LARGEFILE) = 24
02:53:17.086224 brk(0x147000)           = 0x147000
02:53:17.088069 mmap2(0x10000000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x445cb000
02:53:17.089681 mprotect(0x445cb000, 4096, PROT_NONE) = 0
02:53:17.091435 clone(child_stack=0x446caf80, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLO
E_DETACHED) = 2300
02:53:17.094168 mmap2(0x10000000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x446cb000
02:53:17.097904 mprotect(0x446cb000, 4096, PROT_NONE) = 0
02:53:17.101337 clone(child_stack=0x447caf80, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLO
E_DETACHED) = 2301
02:53:17.108176 futex(0x140d98, FUTEX_WAKE, 2147483647)                = 1
02:53:17.115013 futex(0x140d94, FUTEX_WAKE, 1)              = 0
02:53:17.122600 read(15, "\", 4096) = 1
02:53:17.333882 futex(0x140c04, FUTEX_WAKE, 1) = 0
02:53:17.344042 futex(0x445ca004, FUTEX_WAKE, 2147483647) = 0
02:53:17.352317 writev(4, [{"\6", 1}, {"SurfaceFlinger\", 15}, {"GL error 0x0500\", 16}], 3) = 32
[div align=\"center\"]== == == == == == == == == == == == == ==
www.omegamoon.com
Zaurus SL-C750 - Died in a dreadful coffee experiment, has a second life somewhere in the Czech Republic
Zaurus SL-C1000 - Multiboot Zubuntu, Debian, Fedora, Poky, Android and others
Zaurus SL-C3100 - Development device, currently Zubuntu 2.0
Zaurus SL-6000L - The fridge is running Zubuntu 1.0
Zaurus SL-C860 - Cacko, untouched since kindly donated, waiting for Zubuntu
== == == == == == == == == == == == == ==[/div]

Android Zaurus

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • http://androidzaurus.seesaa.net
Porting M5rc14 To Real Hardware
« Reply #16 on: February 27, 2008, 05:39:33 am »
Cortez,

Thanks for trying to make a module.

Quote from: cortez
It says "page flipping not supported (yres_virtual=640, requested=1280". I think this is the problem we're facing.

Gee. We need a double buffer capable driver. Means a bit of work to modify current pxafb driver code.

cortez

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • http://www.omegamoon.com
Porting M5rc14 To Real Hardware
« Reply #17 on: February 27, 2008, 07:10:59 am »
Would it be possible to make the second page (the second mmap2 call) point to the same address as the first?
That would mean patching (or rebuilding if source is available) libagl.
Anyone know a good ARM disassembler that could be used to find the right spot?

Code: [Select]
02:53:16.967995 writev(4, [{"\4", 1}, {"EGLDisplaySurface\", 18}, {"width        = 51 mm (239.058823 dpi)\nheight       = 38 mm (427.789459 dpi)\nrefresh rate = 124.61 Hz\n\", 102}], 3) = 121
02:53:16.972517 ioctl(21, FBIOGET_FSCREENINFO, 0x43145d9c) = 0
02:53:16.974061 mmap2(NULL, 614400, PROT_READ|PROT_WRITE, MAP_SHARED, 21, 0) = 0x43146000
02:53:17.028820 mmap2(NULL, 618496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x431dc000
02:53:17.030696 mmap2(NULL, 618496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x43273000
[div align=\"center\"]== == == == == == == == == == == == == ==
www.omegamoon.com
Zaurus SL-C750 - Died in a dreadful coffee experiment, has a second life somewhere in the Czech Republic
Zaurus SL-C1000 - Multiboot Zubuntu, Debian, Fedora, Poky, Android and others
Zaurus SL-C3100 - Development device, currently Zubuntu 2.0
Zaurus SL-6000L - The fridge is running Zubuntu 1.0
Zaurus SL-C860 - Cacko, untouched since kindly donated, waiting for Zubuntu
== == == == == == == == == == == == == ==[/div]

zaurick

  • Newbie
  • *
  • Posts: 17
    • View Profile
Porting M5rc14 To Real Hardware
« Reply #18 on: February 27, 2008, 08:29:33 am »
Quote from: cortez
Would it be possible to make the second page (the second mmap2 call) point to the same address as the first?
That would mean patching (or rebuilding if source is available) libagl.
Anyone know a good ARM disassembler that could be used to find the right spot?

Code: [Select]
02:53:16.967995 writev(4, [{"\4", 1}, {"EGLDisplaySurface\", 18}, {"width        = 51 mm (239.058823 dpi)\nheight       = 38 mm (427.789459 dpi)\nrefresh rate = 124.61 Hz\n\", 102}], 3) = 121
02:53:16.972517 ioctl(21, FBIOGET_FSCREENINFO, 0x43145d9c) = 0
02:53:16.974061 mmap2(NULL, 614400, PROT_READ|PROT_WRITE, MAP_SHARED, 21, 0) = 0x43146000
02:53:17.028820 mmap2(NULL, 618496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x431dc000
02:53:17.030696 mmap2(NULL, 618496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x43273000

Can we try starting android in QVGA mode ?
In that mode 320*240 it will be possible to have a double buffer for screen.
I think that the requested value yres*2 is calculated from the actual résolution from FSCREENINFO like it work in tomtom navigation software.

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3703
    • View Profile
Porting M5rc14 To Real Hardware
« Reply #19 on: February 27, 2008, 09:00:14 am »
ask the angstrom kernel guy, (richard purdie?), he added a feature we needed when getting tomtom to run on it, so hopefully that would avoid any bodges that would come back to haunt us.
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

cortez

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • http://www.omegamoon.com
Porting M5rc14 To Real Hardware
« Reply #20 on: February 27, 2008, 10:43:39 am »
I guess I need to adjust the default pxafb framebuffer code to see if this can be tweaked easily.
We'll see if this works  
[div align=\"center\"]== == == == == == == == == == == == == ==
www.omegamoon.com
Zaurus SL-C750 - Died in a dreadful coffee experiment, has a second life somewhere in the Czech Republic
Zaurus SL-C1000 - Multiboot Zubuntu, Debian, Fedora, Poky, Android and others
Zaurus SL-C3100 - Development device, currently Zubuntu 2.0
Zaurus SL-6000L - The fridge is running Zubuntu 1.0
Zaurus SL-C860 - Cacko, untouched since kindly donated, waiting for Zubuntu
== == == == == == == == == == == == == ==[/div]

Android Zaurus

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • http://androidzaurus.seesaa.net
Porting M5rc14 To Real Hardware
« Reply #21 on: February 27, 2008, 08:01:25 pm »
Is there anyone who is familliar with OpenEZX?
http://www.openezx.org/

Their wiki mentions double buffer support.
  • video/pxafb.c  MV file, changes for backlight timer, 18bpp/19bpp and double buffering support
http://wiki.openezx.org/CodeAnalysis

I looked around their svn, but I couldn't find paticullar patch or source code.

cortez

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • http://www.omegamoon.com
Porting M5rc14 To Real Hardware
« Reply #22 on: February 28, 2008, 04:09:44 pm »
I did it, it works! The problem was the unsupported page flipping in the frame buffer.
More info later, it needs some more tweaking before I can upload a new image.
Check out my blog for more info.
[div align=\"center\"]== == == == == == == == == == == == == ==
www.omegamoon.com
Zaurus SL-C750 - Died in a dreadful coffee experiment, has a second life somewhere in the Czech Republic
Zaurus SL-C1000 - Multiboot Zubuntu, Debian, Fedora, Poky, Android and others
Zaurus SL-C3100 - Development device, currently Zubuntu 2.0
Zaurus SL-6000L - The fridge is running Zubuntu 1.0
Zaurus SL-C860 - Cacko, untouched since kindly donated, waiting for Zubuntu
== == == == == == == == == == == == == ==[/div]

matthis

  • Full Member
  • ***
  • Posts: 217
    • View Profile
    • http://badaboum.bidibom.free.fr/mat/
Porting M5rc14 To Real Hardware
« Reply #23 on: February 29, 2008, 09:12:09 am »
>>More info later, it needs some more tweaking before I can upload a new image.
WOW~~! Looking forward to it!

Android Zaurus

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • http://androidzaurus.seesaa.net
Porting M5rc14 To Real Hardware
« Reply #24 on: March 02, 2008, 02:56:04 am »
Today I implemented my version of double buffer and pan in pxafb. It works. m5_rc14 booted up on my Zaurus finally. My patch is very primitive. Any suggestions make it better are very welcome.

o Android Zaurus: m5_rc14 works on my Zaurus C3000

Cortez,
Is your keyboard working correctly? Something funny with mine. I can't navigate on the menu by cursor keys. It's like a jumping around.

zaurick

  • Newbie
  • *
  • Posts: 17
    • View Profile
Porting M5rc14 To Real Hardware
« Reply #25 on: March 02, 2008, 05:36:20 am »
Quote from: Android Zaurus
Today I implemented my version of double buffer and pan in pxafb. It works. m5_rc14 booted up on my Zaurus finally. My patch is very primitive. Any suggestions make it better are very welcome.

o Android Zaurus: m5_rc14 works on my Zaurus C3000

 It works for me too.
Just a litle thing in your patch, your panning function only toggle FB base adresse.
The result can be inverted.
Normaly the base adresse is calculated with the var.yoffset value from var_screeninfo.
I'm going to work on that !

Thanks !

Android Zaurus

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • http://androidzaurus.seesaa.net
Porting M5rc14 To Real Hardware
« Reply #26 on: March 02, 2008, 07:24:52 am »
Quote from: zaurick
Normaly the base adresse is calculated with the var.yoffset value from var_screeninfo.
I'm going to work on that !

Big thanks from me. I'm not familliar with fb driver. Please make the patch better. I noticed that some long cycle flickerings while I tried a couple of times booting Android up. I guess I need exclusiveness to change DMA address.

matthis

  • Full Member
  • ***
  • Posts: 217
    • View Profile
    • http://badaboum.bidibom.free.fr/mat/
Porting M5rc14 To Real Hardware
« Reply #27 on: March 02, 2008, 08:58:51 am »
is touchscreen any better in this version?

cortez

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • http://www.omegamoon.com
Porting M5rc14 To Real Hardware
« Reply #28 on: March 02, 2008, 09:34:40 am »
Quote from: Android Zaurus
Today I implemented my version of double buffer and pan in pxafb. It works. m5_rc14 booted up on my Zaurus finally. My patch is very primitive. Any suggestions make it better are very welcome.

o Android Zaurus: m5_rc14 works on my Zaurus C3000

Cortez,
Is your keyboard working correctly? Something funny with mine. I can't navigate on the menu by cursor keys. It's like a jumping around.

The cursor keys are working, no problems there.
[div align=\"center\"]== == == == == == == == == == == == == ==
www.omegamoon.com
Zaurus SL-C750 - Died in a dreadful coffee experiment, has a second life somewhere in the Czech Republic
Zaurus SL-C1000 - Multiboot Zubuntu, Debian, Fedora, Poky, Android and others
Zaurus SL-C3100 - Development device, currently Zubuntu 2.0
Zaurus SL-6000L - The fridge is running Zubuntu 1.0
Zaurus SL-C860 - Cacko, untouched since kindly donated, waiting for Zubuntu
== == == == == == == == == == == == == ==[/div]

zaurick

  • Newbie
  • *
  • Posts: 17
    • View Profile
Porting M5rc14 To Real Hardware
« Reply #29 on: March 02, 2008, 03:46:15 pm »
Quote from: Android Zaurus
Quote from: zaurick
Normaly the base adresse is calculated with the var.yoffset value from var_screeninfo.
I'm going to work on that !

Big thanks from me. I'm not familliar with fb driver. Please make the patch better. I noticed that some long cycle flickerings while I tried a couple of times booting Android up. I guess I need exclusiveness to change DMA address.

Can you try to replace your fb_pan _display portion of code with this one :
Code: [Select]
+static int pxafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
+{
+       struct pxafb_info *fbi = (struct pxafb_info *)info;
+               fbi->dmadesc_fbhigh_cpu->fsadr = fbi->screen_dma + (var->xres * var->yoffset * var->bits_per_pixel/8);
+       return 0;
+}

It work for me.