README.NanoX
author Patrice Mandin <patmandin@gmail.com>
Thu, 19 Jan 2006 21:28:52 +0000
changeset 1257 448a9a64537b
parent 471 26dafefeebb2
permissions -rw-r--r--
[PATCH] SDL_GetVideoMode() does not find best mode, part 2

Following commit 1.51, I come accross a problem when SDL must choose between
several video modes that could suit the one asked.

If I ask 320x240 with this list:
768x480 768x240 640x400 640x200 384x480 384x240 320x400 320x200

The smallest selectables modes are 384x240 and 320x400. And SDL choose the later
in this list, but 384x240 is more suitable. So I added a check to compare
the pixel count (surface) of modes, and select the one which has the smallest
pixel count.

In my example, 384x240 has 92160 pixels, and 320x400 has 128000 pixels. So now
SDL will choose 384x240 for the asked 320x240 mode.
slouken@30
     1
  =================================================================
slouken@471
     2
  Patch version 0.9 of SDL(Simple DirectMedia Layer) for Nano-X API
slouken@30
     3
  =================================================================
slouken@30
     4
  
slouken@471
     5
  Authors: Hsieh-Fu Tsai, clare@setabox.com
slouken@471
     6
           Greg Haerr, greg@censoft.com
slouken@30
     7
slouken@471
     8
  This patch is against SDL version 1.2.4.
slouken@471
     9
  It enhances previous patch 0.8 by providing direct framebuffer
slouken@471
    10
  access as well as dynamic hardware pixel type support, not
slouken@471
    11
  requiring a compile-time option setting for different framebuffer
slouken@471
    12
  modes.
slouken@471
    13
  Tested against Microwindows version 0.89pre9.
slouken@30
    14
slouken@471
    15
  Older Microwindows versions
slouken@471
    16
  ===========================
slouken@471
    17
  If running on a version older than Microwindows 0.89pre9,
slouken@471
    18
  the following items might need to be patched in Microwindows.
slouken@30
    19
slouken@471
    20
  1. Patch src/nanox/client.c::GrClose()
slouken@30
    21
  It fixes the client side GrClose(). In the original version, 
slouken@30
    22
  GrOpen() can only be called once. When the GrOpen() is called at 
slouken@30
    23
  the second time, the program will terminate. In order to prevent
slouken@30
    24
  this situation, we need to insert "nxSocket = -1" after 
slouken@30
    25
  "close(nxSocket)" in GrClose(). If you do not have this problem,
slouken@30
    26
  you may skip this step. 
slouken@30
    27
slouken@471
    28
  2. Patch src/nanox/clientfb.c to return absolute x,y coordinates
slouken@471
    29
  when using GrGetWindowFBInfo().  Copy the version 0.89pre9
slouken@471
    30
  of src/nanox/clientfb.c to your system, or configure
slouken@471
    31
  using --disable-nanox-direct-fb.
slouken@471
    32
slouken@30
    33
  =============
slouken@30
    34
  Quick Install 
slouken@30
    35
  =============
slouken@30
    36
slouken@30
    37
  1. ./configure --disable-video-x11 --disable-video-fbcon \ 
slouken@30
    38
       --enable-video-nanox \ 
slouken@30
    39
       --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal] 
slouken@30
    40
  2. make clean 
slouken@30
    41
  3. make 
slouken@30
    42
  4. make install (as root) 
slouken@30
    43
slouken@30
    44
  ============
slouken@30
    45
  Nitty-gritty 
slouken@30
    46
  ============
slouken@30
    47
slouken@471
    48
  --enable-nanox-direct-fb       Use direct framebuffer access
slouken@30
    49
  --enable-nanox-debug           Show debug messages 
slouken@30
    50
  --enable-nanox-share-memory    Use shared-memory to speed up 
slouken@30
    51
slouken@471
    52
  When running multi-threaded applications using SDL, such
slouken@471
    53
  as SMPEG, set THREADSAFE=Y in Microwindows' config file,
slouken@471
    54
  to enable GrXXX() system call critical section support.
slouken@471
    55
slouken@30
    56
  =============================================
slouken@30
    57
  Some programs can be used to test this patch. 
slouken@30
    58
  =============================================
slouken@30
    59
slouken@30
    60
  1. http://www.cs.berkeley.edu/~weimer/atris (a tetris-like game) 
slouken@30
    61
  2. http://www.libsdl.org/projects/newvox/
slouken@30
    62
  3. http://www.libsdl.org/projects/xflame/
slouken@30
    63
  4. http://www.libsdl.org/projects/optimum/ 
slouken@30
    64
  5. http://www.gnugeneration.com/software/loop/ 
slouken@471
    65
  6: http://www.lokigames.com/development/smpeg.php3 (SMPEG version 0.4.4)
slouken@471
    66
slouken@30
    67
  =========
slouken@30
    68
  Todo List 
slouken@30
    69
  =========
slouken@30
    70
slouken@30
    71
  1. Create hardware surface
slouken@30
    72
  2. Create YUVOverlay on hardware
slouken@30
    73
  3. Use OpenGL
slouken@30
    74
  4. Gamma correction
slouken@30
    75
  5. Hide/Change mouse pointer
slouken@471
    76
  6. Better window movement control with direct fb access
slouken@471
    77
  7. Palette handling in 8bpp could be improved
slouken@30
    78
slouken@30
    79
  =====================
slouken@30
    80
  Supporting Institutes
slouken@30
    81
  =====================
slouken@30
    82
  
slouken@30
    83
  Many thanks to go to Setabox Co., Ltd. and CML (Communication and
slouken@30
    84
  Multimedia Laboratory, http://www.cmlab.csie.ntu.edu.tw/) in the 
slouken@30
    85
  Department of Computer Science and Information Engineering of 
slouken@30
    86
  National Taiwan University for supporting this porting project.
slouken@30
    87
  
slouken@471
    88
  Century Embedded Technologies (http://embedded.censoft.com)
slouken@471
    89
  for this patch.
slouken@471
    90
slouken@30
    91
  ===================
slouken@30
    92
  Contact Information
slouken@30
    93
  ===================
slouken@30
    94
slouken@30
    95
  Welcome to give me any suggestion and to report bugs.
slouken@30
    96
  My e-mail address : clare@setabox.com or niky@cmlab.csie.ntu.edu.tw
slouken@471
    97
                      or greg@censoft.com