Date: Sat, 24 Apr 2004 15:13:32 +0300
authorSam Lantinga <slouken@libsdl.org>
Thu, 06 May 2004 15:55:06 +0000
changeset 88605c551e5bc64
parent 885 9f6ad2286011
child 887 b4b64bb88f2f
Date: Sat, 24 Apr 2004 15:13:32 +0300
From: "Mike Gorchak"
Subject: SDL updates for the QNX6

1. Updated the README.QNX
2. Updated libtool scripts, which are shipped with SDL for QNX6 support.
3. Added some code to support the new QNX 6.3.0, which is in beta now.
4. Added code to detect the hw features, which driver supports.
5. Added hw alpha blits code.
6. Fixed bug when application switches to fullscreen more the 2 times. (afte\
r that window becames always stay on top).
7. Updated a bit README for the tests.
8. Added information about acceleration show in the testalpha.c test.
9. Added small fixes to the testoverlay2.c test.
10. Added alpha and cc+alpha blits benchmarks to the testvidinfo.c test.
README.QNX
acinclude.m4
config.sub
configure.in
ltmain.sh
src/video/photon/SDL_ph_events.c
src/video/photon/SDL_ph_image.c
src/video/photon/SDL_ph_video.c
src/video/photon/SDL_phyuv.c
test/README
test/testalpha.c
test/testoverlay2.c
test/testvidinfo.c
     1.1 --- a/README.QNX	Fri Apr 30 18:33:30 2004 +0000
     1.2 +++ b/README.QNX	Thu May 06 15:55:06 2004 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4 -README by Mike Gorchak <mike@malva.ua>, <lestat@i.com.ua>
     1.5 -Last changed at 14 Feb 2004.
     1.6 +README.QNX by Mike Gorchak <mike@malva.ua>, <lestat@i.com.ua>
     1.7 +Last changed at 24 Apr 2004.
     1.8  
     1.9  ======================================================================
    1.10  Table of Contents:
    1.11 @@ -19,8 +19,8 @@
    1.12  heavily tested yet.
    1.13      If you have QNX RtP version 6.1.0 or above you must  download  the
    1.14  Photon3D runtime from http://developers.qnx.com or install it from the
    1.15 -public repository or the  public CD, available  with  QNX. OS versions
    1.16 -below 6.1.0 are not supported.
    1.17 +public repository or from the public CD, available with QNX. OS versi-
    1.18 +ons below 6.1.0 are not supported.
    1.19      When creating an OpenGL context, software renderer mode is artifi-
    1.20  cially selected (QSSL made acceleration  only  for  Voodoo  boards  in
    1.21  fullscreen mode, sorry but I don't have this board  to  test  OpenGL -
    1.22 @@ -36,22 +36,23 @@
    1.23  ======================================================================
    1.24  2. Wheel and multi-button mouses:
    1.25  
    1.26 -    Photon emits  keyboard  events (key up and down)  when  the  mouse
    1.27 +    Photon emits  keyboard  events (key up and  down)  when the  mouse
    1.28  wheel is moved. The key_scan field appears valid, and it contains zero.
    1.29  That is a basic method of detecting  mouse  wheel events under Photon.
    1.30 -It looks like a hack, but it works for me :) on various PC  configura-
    1.31 +It looks like a hack, but it  works for me :) on various PC configura-
    1.32  tions.
    1.33  
    1.34  I've tested it on:
    1.35  
    1.36 -1. Genius Optical NetScroll/+ (1 wheel)
    1.37 -2. A4Tech Optical  GreatEye  WheelMouse,  model: WOP-35. (2 wheels + 2
    1.38 -   additional buttons). The wheel for vertical scrolling works as usu-
    1.39 -   al, but the second wheel for horizontal scrolling emits two sequen-
    1.40 -   tial events up or down, so it can provide faster scrolling than the
    1.41 -   first wheel. Additional buttons don't emit any events, but it looks
    1.42 -   like they're handled by photon in an unusual  way - like  click  to
    1.43 -   front, but works not with any window, looks like bug-o-feature :).
    1.44 +1. Genius Optical NetScroll/+ PS/2 (1 wheel)
    1.45 +2. A4Tech Optical GreatEye WheelMouse PS/2,  model: WOP-35.  (2 wheels
    1.46 +   + 2 additional buttons). The wheel for vertical scrolling  works as
    1.47 +   usual, but the second wheel for horizontal scrolling emits  two se-
    1.48 +   quential events up or down, so it can provide faster scrolling than
    1.49 +   the first wheel. Additional buttons don't emit  any  events, but it
    1.50 +   looks like they're handled by photon in an unusual way - like click
    1.51 +   to front, but works not with any window, looks like a fun bug-o-fe-
    1.52 +   ature :).
    1.53  
    1.54  ======================================================================
    1.55  3. CDROM handling issues:
    1.56 @@ -89,10 +90,12 @@
    1.57  de.m4 file (it comes after the ESD detection code up to the end of the
    1.58  file), because the libtool stuff in the acinclude.m4 file was very old
    1.59  in SDL distribution before the version 1.2.7 and doesn't knew anything
    1.60 -about QNX. SDL 1.2.7 distribution contain  the  new libtool.m4 script,
    1.61 +about QNX. SDL 1.2.7 distribution contains the  new libtool.m4 script,
    1.62  but anyway  it  is  broken :), Just  remove  it, then  run "libtoolize
    1.63 ---force --copy",  delete the file aclocal.m4 and after  that  run  the
    1.64 -autogen.sh script.
    1.65 +--force --copy",  delete the file aclocal.m4 if it is exists and after
    1.66 +that run the  autogen.sh script. SDL 1.2.8 contains  fixed libtool.m4,
    1.67 +ltmain.sh and config.sub files, so you  can  just  run  the autogen.sh
    1.68 +script.
    1.69  
    1.70  ======================================================================
    1.71  6. Some building issues:
    1.72 @@ -105,16 +108,19 @@
    1.73      Run the configure script without x11 support, e.g.:
    1.74  
    1.75      a) for OpenGL support:
    1.76 -    ./configure --prefix=/usr       \
    1.77 -                --disable-video-x11 \
    1.78 +    ./configure --prefix=/usr           \
    1.79 +                --disable-video-x11     \
    1.80                  --disable-shared
    1.81  
    1.82      b) without OpenGL support:
    1.83 -    ./configure --prefix=/usr       \
    1.84 -                --disable-video-x11 \
    1.85 -                --disable-shared    \
    1.86 +    ./configure --prefix=/usr           \
    1.87 +                --disable-video-x11     \
    1.88 +                --disable-shared        \
    1.89                  --disable-video-opengl
    1.90  
    1.91 +    And of course dont forget to specify --disable-debug, which  is on
    1.92 +by default, to disable debug and enable the expensive optimizations.
    1.93 +
    1.94      In the test directory also run the ./configure script without
    1.95  x11 support, e.g.:
    1.96  
    1.97 @@ -128,10 +134,10 @@
    1.98      Please note that the photon driver  is  sensible to the  following
    1.99  environmental variables:
   1.100  
   1.101 - * SDL_PHOTON_FULLSCREEN_REFRESH - this environment variable controls
   1.102 -the refresh rate in all fullscreen modes. Be carefull !!! Photon drivers
   1.103 -usually do not checking the maximum refresh rate, which video adapter or
   1.104 -monitor supports.
   1.105 + * SDL_PHOTON_FULLSCREEN_REFRESH - this environment variable  controls
   1.106 +the refresh  rate  in  all  fullscreen  modes. Be  carefull !!! Photon
   1.107 +drivers usually do not checking the maximum  refresh rate, which video
   1.108 +adapter or monitor supports.
   1.109  
   1.110   * SDL_VIDEO_WINDOW_POS - can be  set in the "X,Y" format.  If X and Y
   1.111  coordinates are bigger than the current desktop resolution, then  win-
   1.112 @@ -144,6 +150,6 @@
   1.113   * SDL_VIDEO_CENTERED - if this environmental variable exists then the
   1.114  window centering is perfomed in the current virtual console.
   1.115  
   1.116 -    The SDL_VIDEO_CENTERED enviromental variable has greater  priority
   1.117 -than the SDL_VIDEO_WINDOW_POS in case if both variables  are  supplied
   1.118 -to the application.
   1.119 +Notes: The SDL_VIDEO_CENTERED enviromental  variable  has greater pri-
   1.120 +ority than the SDL_VIDEO_WINDOW_POS in case if both variables are sup-
   1.121 +plied to the application.
     2.1 --- a/acinclude.m4	Fri Apr 30 18:33:30 2004 +0000
     2.2 +++ b/acinclude.m4	Thu May 06 15:55:06 2004 +0000
     2.3 @@ -1652,14 +1652,16 @@
     2.4    shlibpath_overrides_runpath=yes
     2.5    ;;
     2.6  
     2.7 -nto-qnx)
     2.8 -  version_type=linux
     2.9 +*qnx* | *nto*)
    2.10 +  version_type=qnx
    2.11    need_lib_prefix=no
    2.12    need_version=no
    2.13 -  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
    2.14 -  soname_spec='${libname}${release}${shared_ext}$major'
    2.15 +  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
    2.16 +  soname_spec='${libname}${release}.so$major'
    2.17    shlibpath_var=LD_LIBRARY_PATH
    2.18 -  shlibpath_overrides_runpath=yes
    2.19 +  shlibpath_overrides_runpath=no
    2.20 +  hardcode_into_libs=yes
    2.21 +  dynamic_linker='ldqnx.so'
    2.22    ;;
    2.23  
    2.24  openbsd*)
    2.25 @@ -2356,6 +2358,10 @@
    2.26    lt_cv_deplibs_check_method=pass_all
    2.27    ;;
    2.28  
    2.29 +*qnx* | *nto*)
    2.30 +  lt_cv_deplibs_check_method=pass_all
    2.31 +  ;;
    2.32 +
    2.33  # This must be Linux ELF.
    2.34  linux*)
    2.35    case $host_cpu in
    2.36 @@ -2382,10 +2388,6 @@
    2.37    lt_cv_file_magic_test_file=/usr/lib/libnls.so
    2.38    ;;
    2.39  
    2.40 -nto-qnx)
    2.41 -  lt_cv_deplibs_check_method=unknown
    2.42 -  ;;
    2.43 -
    2.44  openbsd*)
    2.45    lt_cv_file_magic_cmd=/usr/bin/file
    2.46    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
    2.47 @@ -3614,6 +3616,8 @@
    2.48      # FIXME: insert proper C++ library support
    2.49      _LT_AC_TAGVAR(ld_shlibs, $1)=no
    2.50      ;;
    2.51 +  *qnx* | *nto*)
    2.52 +    ;;
    2.53    *)
    2.54      # FIXME: insert proper C++ library support
    2.55      _LT_AC_TAGVAR(ld_shlibs, $1)=no
    2.56 @@ -4729,6 +4733,10 @@
    2.57  	;;
    2.58        esac
    2.59        ;;
    2.60 +    *qnx* | *nto*)
    2.61 +      # QNX uses GNU C++, but need to define -shared option too, otherwise it will coredumped.
    2.62 +      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
    2.63 +      ;;
    2.64      *)
    2.65        _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
    2.66        ;;
    2.67 @@ -4768,6 +4776,10 @@
    2.68        freebsd*)
    2.69  	# FreeBSD uses GNU C++
    2.70  	;;
    2.71 +      *qnx* | *nto*)
    2.72 +	# QNX uses GNU C++, but need to define -shared option too, otherwise it will coredumped.
    2.73 +        _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
    2.74 +        ;;
    2.75        hpux9* | hpux10* | hpux11*)
    2.76  	case $cc_basename in
    2.77  	  CC)
    2.78 @@ -4988,6 +5000,10 @@
    2.79  	;;
    2.80        esac
    2.81        ;;
    2.82 +    *qnx* | *nto*)
    2.83 +      # QNX uses GNU C++, but need to define -shared option too, otherwise it will coredumped.
    2.84 +      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
    2.85 +      ;;
    2.86  
    2.87      *)
    2.88        _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
    2.89 @@ -5028,6 +5044,11 @@
    2.90        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
    2.91        ;;
    2.92  
    2.93 +    *qnx* | *nto*)
    2.94 +      # QNX uses GNU C++, but need to define -shared option too, otherwise it will coredumped.
    2.95 +      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
    2.96 +      ;;
    2.97 +
    2.98      irix5* | irix6* | nonstopux*)
    2.99        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
   2.100        # PIC (with -KPIC) is the default.
     3.1 --- a/config.sub	Fri Apr 30 18:33:30 2004 +0000
     3.2 +++ b/config.sub	Thu May 06 15:55:06 2004 +0000
     3.3 @@ -1140,10 +1140,8 @@
     3.4  			;;
     3.5  		esac
     3.6  		;;
     3.7 -	-nto-qnx*)
     3.8 -		;;
     3.9  	-nto*)
    3.10 -		os=`echo $os | sed -e 's|nto|nto-qnx|'`
    3.11 +		os=-nto-qnx
    3.12  		;;
    3.13  	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
    3.14  	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
     4.1 --- a/configure.in	Fri Apr 30 18:33:30 2004 +0000
     4.2 +++ b/configure.in	Thu May 06 15:55:06 2004 +0000
     4.3 @@ -528,6 +528,14 @@
     4.4              SDL_EXTRADIRS="$SDL_EXTRADIRS hermes"
     4.5              SDL_EXTRALIBS="$SDL_EXTRALIBS hermes/libhermes.la"
     4.6              use_nasm=yes
     4.7 +            
     4.8 +            case "$target" in
     4.9 +                # this line is needed for QNX, because it's not defined the __ELF__
    4.10 +                *-*-qnx*) CFLAGS="$CFLAGS -D__ELF__"
    4.11 +                          ;;
    4.12 +
    4.13 +            esac
    4.14 +
    4.15          fi
    4.16      fi
    4.17  }
    4.18 @@ -2309,6 +2317,7 @@
    4.19          ARCH=qnx
    4.20          CheckDummyVideo
    4.21          CheckDiskAudio
    4.22 +        # CheckNASM
    4.23          CheckDLOPEN
    4.24          CheckNAS
    4.25          CheckPHOTON
     5.1 --- a/ltmain.sh	Fri Apr 30 18:33:30 2004 +0000
     5.2 +++ b/ltmain.sh	Thu May 06 15:55:06 2004 +0000
     5.3 @@ -2975,6 +2975,12 @@
     5.4  	  versuffix=".$current";
     5.5  	  ;;
     5.6  
     5.7 +        qnx)
     5.8 +          major=".$current"
     5.9 +          versuffix=".$current"
    5.10 +          deplibs_check_method="pass_all"
    5.11 +          ;;
    5.12 +
    5.13  	irix | nonstopux)
    5.14  	  major=`expr $current - $age + 1`
    5.15  
     6.1 --- a/src/video/photon/SDL_ph_events.c	Fri Apr 30 18:33:30 2004 +0000
     6.2 +++ b/src/video/photon/SDL_ph_events.c	Thu May 06 15:55:06 2004 +0000
     6.3 @@ -32,6 +32,7 @@
     6.4  #include <stdio.h>
     6.5  #include <setjmp.h>
     6.6  #include <sys/time.h>
     6.7 +#include <sys/neutrino.h>
     6.8  
     6.9  #include <Ph.h>
    6.10  #include <photon/PkKeyDef.h>
    6.11 @@ -235,7 +236,13 @@
    6.12              /* request to resize */
    6.13              else if (winEvent->event_f==Ph_WM_RESIZE)
    6.14              {
    6.15 -                SDL_PrivateResize(winEvent->size.w+1, winEvent->size.h+1);
    6.16 +                currently_maximized=0;
    6.17 +                #if (_NTO_VERSION < 630)
    6.18 +                   SDL_PrivateResize(winEvent->size.w+1, winEvent->size.h+1);
    6.19 +                #else
    6.20 +                   /* QNX 6.3.0 have this bug fixed */
    6.21 +                   SDL_PrivateResize(winEvent->size.w, winEvent->size.h);
    6.22 +                #endif /* _NTO_VERSION */
    6.23              }
    6.24              /* request to move */
    6.25              else if (winEvent->event_f==Ph_WM_MOVE)
     7.1 --- a/src/video/photon/SDL_ph_image.c	Fri Apr 30 18:33:30 2004 +0000
     7.2 +++ b/src/video/photon/SDL_ph_image.c	Thu May 06 15:55:06 2004 +0000
     7.3 @@ -152,8 +152,7 @@
     7.4                  break;
     7.5      }
     7.6  
     7.7 -    /* Currently only offscreen contexts with the same bit depth as the
     7.8 -     * display can be created. */
     7.9 +    /* Currently offscreen contexts with the same bit depth as display bpp only can be created */
    7.10      OCImage.offscreen_context = PdCreateOffscreenContext(0, screen->w, screen->h, Pg_OSC_MEM_PAGE_ALIGN);
    7.11  
    7.12      if (OCImage.offscreen_context == NULL)
    7.13 @@ -482,24 +481,57 @@
    7.14          return -1;
    7.15      }
    7.16  
    7.17 -    this->info.blit_hw = 1;
    7.18 +    if ((vmode.mode_capabilities1 & PgVM_MODE_CAP1_OFFSCREEN) == PgVM_MODE_CAP1_OFFSCREEN)
    7.19 +    {
    7.20 +        /* this is a special test for drivers which tries to lie about offscreen capability */
    7.21 +        if (hwcaps.currently_available_video_ram!=0)
    7.22 +        {
    7.23 +           this->info.hw_available = 1;
    7.24 +        }
    7.25 +        else
    7.26 +        {
    7.27 +           this->info.hw_available = 0;
    7.28 +        }
    7.29 +    }
    7.30 +    else
    7.31 +    {
    7.32 +        this->info.hw_available = 0;
    7.33 +    }
    7.34 +
    7.35 +    if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_RECTANGLE) == PgVM_MODE_CAP2_RECTANGLE)
    7.36 +    {
    7.37 +        this->info.blit_fill = 1;
    7.38 +    }
    7.39 +    else
    7.40 +    {
    7.41 +        this->info.blit_fill = 0;
    7.42 +    }
    7.43 +
    7.44 +    if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_BITBLT) == PgVM_MODE_CAP2_BITBLT)
    7.45 +    {
    7.46 +        this->info.blit_hw = 1;
    7.47 +    }
    7.48 +    else
    7.49 +    {
    7.50 +        this->info.blit_hw = 0;
    7.51 +    }
    7.52  
    7.53      if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND) == PgVM_MODE_CAP2_ALPHA_BLEND)
    7.54      {
    7.55 -       this->info.blit_hw_A = 1;
    7.56 +        this->info.blit_hw_A = 1;
    7.57      }
    7.58      else
    7.59      {
    7.60 -       this->info.blit_hw_A = 0;
    7.61 +        this->info.blit_hw_A = 0;
    7.62      }
    7.63      
    7.64      if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_CHROMA) == PgVM_MODE_CAP2_CHROMA)
    7.65      {
    7.66 -       this->info.blit_hw_CC = 1;
    7.67 +        this->info.blit_hw_CC = 1;
    7.68      }
    7.69      else
    7.70      {
    7.71 -       this->info.blit_hw_CC = 0;
    7.72 +        this->info.blit_hw_CC = 0;
    7.73      }
    7.74      
    7.75      return 0;
    7.76 @@ -748,6 +780,11 @@
    7.77      Uint32 truecolor;
    7.78      int ydisp=0;
    7.79  
    7.80 +    if (this->info.blit_fill!=1)
    7.81 +    {
    7.82 +       return -1;
    7.83 +    }
    7.84 +
    7.85      truecolor=ph_ExpandColor(this, surface, color);
    7.86      if (truecolor==0xFFFFFFFFUL)
    7.87      {
    7.88 @@ -885,6 +922,12 @@
    7.89              PgChromaOn();
    7.90          }
    7.91  
    7.92 +        if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA)
    7.93 +        {
    7.94 +            ph_SetHWAlpha(this, src, src->format->alpha);
    7.95 +            PgAlphaOn();
    7.96 +        }
    7.97 +
    7.98          if (dst == this->screen)
    7.99          {
   7.100              if (src == this->screen)
   7.101 @@ -916,6 +959,11 @@
   7.102              }
   7.103          }
   7.104  
   7.105 +        if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA)
   7.106 +        {
   7.107 +            PgAlphaOff();
   7.108 +        }
   7.109 +
   7.110          if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY)
   7.111          {
   7.112              PgChromaOff();
   7.113 @@ -935,6 +983,11 @@
   7.114  
   7.115  int ph_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key)
   7.116  {
   7.117 +    if (this->info.blit_hw_CC!=1)
   7.118 +    {
   7.119 +       return -1;
   7.120 +    }
   7.121 +
   7.122      if (surface->hwdata!=NULL)
   7.123      {
   7.124          surface->hwdata->colorkey=ph_ExpandColor(this, surface, key);
   7.125 @@ -950,7 +1003,14 @@
   7.126  
   7.127  int ph_SetHWAlpha(_THIS, SDL_Surface* surface, Uint8 alpha)
   7.128  {
   7.129 -    return -1;
   7.130 +    if (this->info.blit_hw_A!=1)
   7.131 +    {
   7.132 +       return -1;
   7.133 +    }
   7.134 +
   7.135 +    PgSetAlphaBlend(NULL, alpha);
   7.136 +
   7.137 +    return 0;
   7.138  }
   7.139  
   7.140  #ifdef HAVE_OPENGL
     8.1 --- a/src/video/photon/SDL_ph_video.c	Fri Apr 30 18:33:30 2004 +0000
     8.2 +++ b/src/video/photon/SDL_ph_video.c	Thu May 06 15:55:06 2004 +0000
     8.3 @@ -83,27 +83,28 @@
     8.4      return 1;
     8.5  }
     8.6  
     8.7 -static SDL_VideoDevice *ph_CreateDevice(int devindex)
     8.8 +static SDL_VideoDevice* ph_CreateDevice(int devindex)
     8.9  {
    8.10 -    SDL_VideoDevice *device;
    8.11 +    SDL_VideoDevice* device;
    8.12  
    8.13      /* Initialize all variables that we clean on shutdown */
    8.14      device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice));
    8.15 -    if (device) {
    8.16 +    if (device)
    8.17 +    {
    8.18          memset(device, 0, (sizeof *device));
    8.19 -        device->hidden = (struct SDL_PrivateVideoData *)
    8.20 -                malloc((sizeof *device->hidden));
    8.21 +        device->hidden = (struct SDL_PrivateVideoData*)malloc((sizeof *device->hidden));
    8.22          device->gl_data = NULL;
    8.23      }
    8.24 -    if ((device == NULL) || (device->hidden == NULL)) {
    8.25 +    if ((device == NULL) || (device->hidden == NULL))
    8.26 +    {
    8.27          SDL_OutOfMemory();
    8.28          ph_DeleteDevice(device);
    8.29 -        return(0);
    8.30 +        return NULL;
    8.31      }
    8.32      memset(device->hidden, 0, (sizeof *device->hidden));
    8.33  
    8.34      /* Set the driver flags */
    8.35 -    device->handles_any_size = 1; /* JB not true for fullscreen */
    8.36 +    device->handles_any_size = 1;
    8.37  
    8.38      /* Set the function pointers */
    8.39      device->CreateYUVOverlay = ph_CreateYUVOverlay;
    8.40 @@ -113,7 +114,7 @@
    8.41      device->ToggleFullScreen = ph_ToggleFullScreen;
    8.42      device->UpdateMouse = ph_UpdateMouse;
    8.43      device->SetColors = ph_SetColors;
    8.44 -    device->UpdateRects = NULL;         /* set up in ph_SetupUpdateFunction */
    8.45 +    device->UpdateRects = NULL;                        /* set up in ph_SetupUpdateFunction */
    8.46      device->VideoQuit = ph_VideoQuit;
    8.47      device->AllocHWSurface = ph_AllocHWSurface;
    8.48      device->CheckHWBlit = ph_CheckHWBlit;
    8.49 @@ -254,6 +255,10 @@
    8.50      }
    8.51      else
    8.52      {
    8.53 +        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_FFRONT | Ph_WM_CONSWITCH);
    8.54 +        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISFRONT);
    8.55 +        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISALTKEY);
    8.56 +
    8.57          if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE)
    8.58          {
    8.59              PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL);
    8.60 @@ -450,20 +455,15 @@
    8.61      OCImage.FrameData1 = NULL;
    8.62      videomode_emulatemode = 0;
    8.63      
    8.64 -    this->info.video_mem=hwcaps.currently_available_video_ram/1024;
    8.65      this->info.wm_available = 1;
    8.66 -    this->info.hw_available = 1;
    8.67 -    this->info.blit_fill = 1;
    8.68 -    this->info.blit_hw = 1;
    8.69 -    this->info.blit_hw_A = 0;
    8.70 -    this->info.blit_hw_CC = 1;
    8.71 +
    8.72 +    ph_UpdateHWInfo(this);
    8.73      
    8.74      return 0;
    8.75  }
    8.76  
    8.77  static SDL_Surface* ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags)
    8.78  {
    8.79 -    PgHWCaps_t hwcaps;
    8.80      const struct ColourMasks* mask;
    8.81  
    8.82      /* Lock the event thread, in multi-threading environments */
    8.83 @@ -558,6 +558,7 @@
    8.84      /* Must call at least once for setup image planes */
    8.85      if (ph_SetupUpdateFunction(this, current, current->flags)==-1)
    8.86      {
    8.87 +        /* Error string was filled in the ph_SetupUpdateFunction() */
    8.88          return NULL;
    8.89      }
    8.90  
    8.91 @@ -573,12 +574,7 @@
    8.92  
    8.93      visualbpp=bpp;
    8.94  
    8.95 -    if (PgGetGraphicsHWCaps(&hwcaps) < 0)
    8.96 -    {
    8.97 -        SDL_SetError("ph_SetVideoMode(): GetGraphicsHWCaps function failed !\n");
    8.98 -        return NULL;
    8.99 -    }
   8.100 -    this->info.video_mem=hwcaps.currently_available_video_ram/1024;
   8.101 +    ph_UpdateHWInfo(this);
   8.102  
   8.103      SDL_Unlock_EventThread();
   8.104  
     9.1 --- a/src/video/photon/SDL_phyuv.c	Fri Apr 30 18:33:30 2004 +0000
     9.2 +++ b/src/video/photon/SDL_phyuv.c	Thu May 06 15:55:06 2004 +0000
     9.3 @@ -42,7 +42,7 @@
     9.4  #define OVERLAY_STATE_UNINIT 0
     9.5  #define OVERLAY_STATE_ACTIVE 1
     9.6  
     9.7 -/* The functions used to manipulate software video overlays */
     9.8 +/* The functions are used to manipulate software video overlays */
     9.9  static struct private_yuvhwfuncs ph_yuvfuncs =
    9.10  {
    9.11      ph_LockYUVOverlay,
    10.1 --- a/test/README	Fri Apr 30 18:33:30 2004 +0000
    10.2 +++ b/test/README	Thu May 06 15:55:06 2004 +0000
    10.3 @@ -11,7 +11,7 @@
    10.4  	loopwave	Audio test -- loop playing a WAV file
    10.5  	testcdrom	Sample audio CD control program
    10.6  	testkeys	List the available keyboard keys
    10.7 -	testvidinfo	Show the pixel format of the display
    10.8 +	testvidinfo	Show the pixel format of the display and perfom the benchmark
    10.9  	checkkeys	Watch the key events to check the keyboard
   10.10  	testwin		Display a BMP image at various depths
   10.11  	graywin		Display a gray gradient and center mouse on spacebar
   10.12 @@ -22,4 +22,5 @@
   10.13  	threadwin	Test multi-threaded event handling
   10.14  	testgl		A very simple example of using OpenGL with SDL
   10.15  	testjoystick	List joysticks and watch joystick events
   10.16 -
   10.17 +	testoverlay	Tests the software/hardware overlay functionality.
   10.18 +	testoverlay2	Tests the overlay flickering/scaling during playback.
    11.1 --- a/test/testalpha.c	Fri Apr 30 18:33:30 2004 +0000
    11.2 +++ b/test/testalpha.c	Thu May 06 15:55:06 2004 +0000
    11.3 @@ -380,6 +380,37 @@
    11.4  		exit(1);
    11.5  	}
    11.6  
    11.7 +	/* Print out information about our surfaces */
    11.8 +	printf("Screen is at %d bits per pixel\n",screen->format->BitsPerPixel);
    11.9 +	if ( (screen->flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
   11.10 +		printf("Screen is in video memory\n");
   11.11 +	} else {
   11.12 +		printf("Screen is in system memory\n");
   11.13 +	}
   11.14 +	if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {
   11.15 +		printf("Screen has double-buffering enabled\n");
   11.16 +	}
   11.17 +	if ( (sprite->flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
   11.18 +		printf("Sprite is in video memory\n");
   11.19 +	} else {
   11.20 +		printf("Sprite is in system memory\n");
   11.21 +	}
   11.22 +
   11.23 +	/* Run a sample blit to trigger blit acceleration */
   11.24 +	{ SDL_Rect dst;
   11.25 +		dst.x = 0;
   11.26 +		dst.y = 0;
   11.27 +		dst.w = sprite->w;
   11.28 +		dst.h = sprite->h;
   11.29 +		SDL_BlitSurface(sprite, NULL, screen, &dst);
   11.30 +		SDL_FillRect(screen, &dst, 0);
   11.31 +	}
   11.32 +	if ( (sprite->flags & SDL_HWACCEL) == SDL_HWACCEL ) {
   11.33 +		printf("Sprite blit uses hardware alpha acceleration\n");
   11.34 +	} else {
   11.35 +		printf("Sprite blit dosn't uses hardware alpha acceleration\n");
   11.36 +	}
   11.37 +
   11.38  	/* Set a clipping rectangle to clip the outside edge of the screen */
   11.39  	{ SDL_Rect clip;
   11.40  		clip.x = 32;
    12.1 --- a/test/testoverlay2.c	Fri Apr 30 18:33:30 2004 +0000
    12.2 +++ b/test/testoverlay2.c	Thu May 06 15:55:06 2004 +0000
    12.3 @@ -254,13 +254,15 @@
    12.4  static void PrintUsage(char *argv0)
    12.5  {
    12.6      fprintf(stderr, "Usage: %s [arg] [arg] [arg] ...\n", argv0);
    12.7 -    fprintf(stderr, "Where 'arg' is one of:\n");
    12.8 +    fprintf(stderr, "\n");
    12.9 +    fprintf(stderr, "Where 'arg' is any of the following options:\n");
   12.10 +    fprintf(stderr, "\n");
   12.11      fprintf(stderr, "	-fps <frames per second>\n");
   12.12      fprintf(stderr, "	-format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n");
   12.13      fprintf(stderr, "	-scale <scale factor> (initial scale of the overlay)\n");
   12.14      fprintf(stderr, "	-help (shows this help)\n");
   12.15      fprintf(stderr, "\n");
   12.16 -    fprintf(stderr, "	Press ESC to exit, or SPACE to freeze the movie while application running.\n");
   12.17 +    fprintf(stderr, "Press ESC to exit, or SPACE to freeze the movie while application running.\n");
   12.18      fprintf(stderr, "\n");
   12.19  }
   12.20  
   12.21 @@ -466,6 +468,11 @@
   12.22      free(RawMooseData);
   12.23  
   12.24      overlay=SDL_CreateYUVOverlay(MOOSEPIC_W, MOOSEPIC_H, overlay_format, screen);
   12.25 +    if (!overlay)
   12.26 +    {
   12.27 +        fprintf(stderr, "Couldn't create overlay: %s\n", SDL_GetError());
   12.28 +        return 7;
   12.29 +    }
   12.30  
   12.31      printf("Created %dx%dx%d %s %s overlay\n",overlay->w,overlay->h,overlay->planes,
   12.32             overlay->hw_overlay?"hardware":"software",
    13.1 --- a/test/testvidinfo.c	Fri Apr 30 18:33:30 2004 +0000
    13.2 +++ b/test/testvidinfo.c	Thu May 06 15:55:06 2004 +0000
    13.3 @@ -11,7 +11,9 @@
    13.4  #define NUM_BLITS	10
    13.5  #define NUM_UPDATES	500
    13.6  
    13.7 -#define FLAG_MASK	(SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF)
    13.8 +#define FLAG_MASK	(SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF | \
    13.9 +                         SDL_SRCCOLORKEY | SDL_SRCALPHA | SDL_RLEACCEL  | \
   13.10 +                         SDL_RLEACCELOK)
   13.11  
   13.12  void PrintFlags(Uint32 flags)
   13.13  {
   13.14 @@ -30,9 +32,15 @@
   13.15  	if ( flags & SDL_SRCCOLORKEY ) {
   13.16  		printf(" | SDL_SRCCOLORKEY");
   13.17  	}
   13.18 +	if ( flags & SDL_SRCALPHA ) {
   13.19 +		printf(" | SDL_SRCALPHA");
   13.20 +	}
   13.21  	if ( flags & SDL_RLEACCEL ) {
   13.22  		printf(" | SDL_RLEACCEL");
   13.23  	}
   13.24 +	if ( flags & SDL_RLEACCELOK ) {
   13.25 +		printf(" | SDL_RLEACCELOK");
   13.26 +	}
   13.27  }
   13.28  
   13.29  int RunBlitTests(SDL_Surface *screen, SDL_Surface *bmp, int blitcount)
   13.30 @@ -117,6 +125,10 @@
   13.31  		printf("%d fills and flips in zero seconds!n", frames);
   13.32  	}
   13.33  
   13.34 +        /* clear the screen after fill test */
   13.35 +        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
   13.36 +	SDL_Flip(screen);
   13.37 +
   13.38  	while ( SDL_PollEvent(&event) ) {
   13.39  		if ( event.type == SDL_KEYDOWN )
   13.40  			return 0;
   13.41 @@ -142,6 +154,15 @@
   13.42  		printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
   13.43  	}
   13.44  
   13.45 +        /* clear the screen after blit test */
   13.46 +        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
   13.47 +	SDL_Flip(screen);
   13.48 +
   13.49 +	while ( SDL_PollEvent(&event) ) {
   13.50 +		if ( event.type == SDL_KEYDOWN )
   13.51 +			return 0;
   13.52 +	}
   13.53 +
   13.54          /* run the colorkeyed blit test */
   13.55  	bmpcc = SDL_LoadBMP("sample.bmp");
   13.56  	if ( ! bmpcc ) {
   13.57 @@ -164,6 +185,15 @@
   13.58  		printf("%d cc blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
   13.59  	}
   13.60  
   13.61 +        /* clear the screen after cc blit test */
   13.62 +        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
   13.63 +	SDL_Flip(screen);
   13.64 +
   13.65 +	while ( SDL_PollEvent(&event) ) {
   13.66 +		if ( event.type == SDL_KEYDOWN )
   13.67 +			return 0;
   13.68 +	}
   13.69 +
   13.70          /* run the generic blit test */
   13.71  	tmp = bmp;
   13.72  	bmp = SDL_DisplayFormat(bmp);
   13.73 @@ -186,6 +216,15 @@
   13.74  		printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
   13.75  	}
   13.76  
   13.77 +        /* clear the screen after blit test */
   13.78 +        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
   13.79 +	SDL_Flip(screen);
   13.80 +
   13.81 +	while ( SDL_PollEvent(&event) ) {
   13.82 +		if ( event.type == SDL_KEYDOWN )
   13.83 +			return 0;
   13.84 +	}
   13.85 +
   13.86          /* run the colorkeyed blit test */
   13.87  	tmp = bmpcc;
   13.88  	bmpcc = SDL_DisplayFormat(bmpcc);
   13.89 @@ -208,6 +247,81 @@
   13.90  		printf("%d cc blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
   13.91  	}
   13.92  
   13.93 +        /* clear the screen after cc blit test */
   13.94 +        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
   13.95 +	SDL_Flip(screen);
   13.96 +
   13.97 +	while ( SDL_PollEvent(&event) ) {
   13.98 +		if ( event.type == SDL_KEYDOWN )
   13.99 +			return 0;
  13.100 +	}
  13.101 +
  13.102 +        /* run the alpha blit test only if screen bpp>8 */
  13.103 +        if (bmp->format->BitsPerPixel>8)
  13.104 +        {
  13.105 +		SDL_FreeSurface(bmp);
  13.106 +                bmp = SDL_LoadBMP("sample.bmp");
  13.107 +		SDL_SetAlpha(bmp, SDL_SRCALPHA, 85); /* 85 - 33% alpha */
  13.108 +		tmp = bmp;
  13.109 +		bmp = SDL_DisplayFormat(bmp);
  13.110 +		SDL_FreeSurface(tmp);
  13.111 +		if ( ! bmp ) {
  13.112 +			printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
  13.113 +			return 0;
  13.114 +		}
  13.115 +		printf("Running display format alpha blit test: %dx%d at %d bpp, flags: ",
  13.116 +			bmp->w, bmp->h, bmp->format->BitsPerPixel);
  13.117 +		PrintFlags(bmp->flags);
  13.118 +		printf("\n");
  13.119 +		then = SDL_GetTicks();
  13.120 +		frames = RunBlitTests(screen, bmp, NUM_BLITS);
  13.121 +		now = SDL_GetTicks();
  13.122 +		seconds = (float)(now - then) / 1000.0f;
  13.123 +		if ( seconds > 0.0f ) {
  13.124 +			printf("%d alpha blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
  13.125 +		} else {
  13.126 +			printf("%d alpha blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
  13.127 +		}
  13.128 +	}
  13.129 +
  13.130 +        /* clear the screen after alpha blit test */
  13.131 +        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
  13.132 +	SDL_Flip(screen);
  13.133 +
  13.134 +	while ( SDL_PollEvent(&event) ) {
  13.135 +		if ( event.type == SDL_KEYDOWN )
  13.136 +			return 0;
  13.137 +	}
  13.138 +
  13.139 +        /* run the cc+alpha blit test only if screen bpp>8 */
  13.140 +        if (bmp->format->BitsPerPixel>8)
  13.141 +        {
  13.142 +		SDL_FreeSurface(bmpcc);
  13.143 +                bmpcc = SDL_LoadBMP("sample.bmp");
  13.144 +		SDL_SetAlpha(bmpcc, SDL_SRCALPHA, 85); /* 85 - 33% alpha */
  13.145 +                SDL_SetColorKey(bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL, *(Uint8 *)bmpcc->pixels);
  13.146 +		tmp = bmpcc;
  13.147 +		bmpcc = SDL_DisplayFormat(bmpcc);
  13.148 +		SDL_FreeSurface(tmp);
  13.149 +		if ( ! bmpcc ) {
  13.150 +			printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
  13.151 +			return 0;
  13.152 +		}
  13.153 +		printf("Running display format cc+alpha blit test: %dx%d at %d bpp, flags: ",
  13.154 +			bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
  13.155 +		PrintFlags(bmpcc->flags);
  13.156 +		printf("\n");
  13.157 +		then = SDL_GetTicks();
  13.158 +		frames = RunBlitTests(screen, bmpcc, NUM_BLITS);
  13.159 +		now = SDL_GetTicks();
  13.160 +		seconds = (float)(now - then) / 1000.0f;
  13.161 +		if ( seconds > 0.0f ) {
  13.162 +			printf("%d cc+alpha blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
  13.163 +		} else {
  13.164 +			printf("%d cc+alpha blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
  13.165 +		}
  13.166 +	}
  13.167 +
  13.168  	SDL_FreeSurface(bmpcc);
  13.169  	SDL_FreeSurface(bmp);
  13.170