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.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40887
This commit is contained in:
Sam Lantinga 2004-05-06 15:55:06 +00:00
parent 2ca2c6c186
commit edba2cc827
13 changed files with 336 additions and 80 deletions

View file

@ -32,6 +32,7 @@ static char rcsid =
#include <stdio.h>
#include <setjmp.h>
#include <sys/time.h>
#include <sys/neutrino.h>
#include <Ph.h>
#include <photon/PkKeyDef.h>
@ -235,7 +236,13 @@ static int ph_DispatchEvent(_THIS)
/* request to resize */
else if (winEvent->event_f==Ph_WM_RESIZE)
{
SDL_PrivateResize(winEvent->size.w+1, winEvent->size.h+1);
currently_maximized=0;
#if (_NTO_VERSION < 630)
SDL_PrivateResize(winEvent->size.w+1, winEvent->size.h+1);
#else
/* QNX 6.3.0 have this bug fixed */
SDL_PrivateResize(winEvent->size.w, winEvent->size.h);
#endif /* _NTO_VERSION */
}
/* request to move */
else if (winEvent->event_f==Ph_WM_MOVE)

View file

@ -152,8 +152,7 @@ int ph_SetupOCImage(_THIS, SDL_Surface *screen)
break;
}
/* Currently only offscreen contexts with the same bit depth as the
* display can be created. */
/* Currently offscreen contexts with the same bit depth as display bpp only can be created */
OCImage.offscreen_context = PdCreateOffscreenContext(0, screen->w, screen->h, Pg_OSC_MEM_PAGE_ALIGN);
if (OCImage.offscreen_context == NULL)
@ -482,24 +481,57 @@ int ph_UpdateHWInfo(_THIS)
return -1;
}
this->info.blit_hw = 1;
if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND) == PgVM_MODE_CAP2_ALPHA_BLEND)
if ((vmode.mode_capabilities1 & PgVM_MODE_CAP1_OFFSCREEN) == PgVM_MODE_CAP1_OFFSCREEN)
{
this->info.blit_hw_A = 1;
/* this is a special test for drivers which tries to lie about offscreen capability */
if (hwcaps.currently_available_video_ram!=0)
{
this->info.hw_available = 1;
}
else
{
this->info.hw_available = 0;
}
}
else
{
this->info.blit_hw_A = 0;
this->info.hw_available = 0;
}
if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_RECTANGLE) == PgVM_MODE_CAP2_RECTANGLE)
{
this->info.blit_fill = 1;
}
else
{
this->info.blit_fill = 0;
}
if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_BITBLT) == PgVM_MODE_CAP2_BITBLT)
{
this->info.blit_hw = 1;
}
else
{
this->info.blit_hw = 0;
}
if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND) == PgVM_MODE_CAP2_ALPHA_BLEND)
{
this->info.blit_hw_A = 1;
}
else
{
this->info.blit_hw_A = 0;
}
if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_CHROMA) == PgVM_MODE_CAP2_CHROMA)
{
this->info.blit_hw_CC = 1;
this->info.blit_hw_CC = 1;
}
else
{
this->info.blit_hw_CC = 0;
this->info.blit_hw_CC = 0;
}
return 0;
@ -748,6 +780,11 @@ int ph_FillHWRect(_THIS, SDL_Surface* surface, SDL_Rect* rect, Uint32 color)
Uint32 truecolor;
int ydisp=0;
if (this->info.blit_fill!=1)
{
return -1;
}
truecolor=ph_ExpandColor(this, surface, color);
if (truecolor==0xFFFFFFFFUL)
{
@ -885,6 +922,12 @@ int ph_HWAccelBlit(SDL_Surface* src, SDL_Rect* srcrect, SDL_Surface* dst, SDL_Re
PgChromaOn();
}
if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA)
{
ph_SetHWAlpha(this, src, src->format->alpha);
PgAlphaOn();
}
if (dst == this->screen)
{
if (src == this->screen)
@ -916,6 +959,11 @@ int ph_HWAccelBlit(SDL_Surface* src, SDL_Rect* srcrect, SDL_Surface* dst, SDL_Re
}
}
if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA)
{
PgAlphaOff();
}
if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY)
{
PgChromaOff();
@ -935,6 +983,11 @@ int ph_HWAccelBlit(SDL_Surface* src, SDL_Rect* srcrect, SDL_Surface* dst, SDL_Re
int ph_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key)
{
if (this->info.blit_hw_CC!=1)
{
return -1;
}
if (surface->hwdata!=NULL)
{
surface->hwdata->colorkey=ph_ExpandColor(this, surface, key);
@ -950,7 +1003,14 @@ int ph_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key)
int ph_SetHWAlpha(_THIS, SDL_Surface* surface, Uint8 alpha)
{
return -1;
if (this->info.blit_hw_A!=1)
{
return -1;
}
PgSetAlphaBlend(NULL, alpha);
return 0;
}
#ifdef HAVE_OPENGL

View file

@ -83,27 +83,28 @@ static int ph_Available(void)
return 1;
}
static SDL_VideoDevice *ph_CreateDevice(int devindex)
static SDL_VideoDevice* ph_CreateDevice(int devindex)
{
SDL_VideoDevice *device;
SDL_VideoDevice* device;
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice));
if (device) {
if (device)
{
memset(device, 0, (sizeof *device));
device->hidden = (struct SDL_PrivateVideoData *)
malloc((sizeof *device->hidden));
device->hidden = (struct SDL_PrivateVideoData*)malloc((sizeof *device->hidden));
device->gl_data = NULL;
}
if ((device == NULL) || (device->hidden == NULL)) {
if ((device == NULL) || (device->hidden == NULL))
{
SDL_OutOfMemory();
ph_DeleteDevice(device);
return(0);
return NULL;
}
memset(device->hidden, 0, (sizeof *device->hidden));
/* Set the driver flags */
device->handles_any_size = 1; /* JB not true for fullscreen */
device->handles_any_size = 1;
/* Set the function pointers */
device->CreateYUVOverlay = ph_CreateYUVOverlay;
@ -113,7 +114,7 @@ static SDL_VideoDevice *ph_CreateDevice(int devindex)
device->ToggleFullScreen = ph_ToggleFullScreen;
device->UpdateMouse = ph_UpdateMouse;
device->SetColors = ph_SetColors;
device->UpdateRects = NULL; /* set up in ph_SetupUpdateFunction */
device->UpdateRects = NULL; /* set up in ph_SetupUpdateFunction */
device->VideoQuit = ph_VideoQuit;
device->AllocHWSurface = ph_AllocHWSurface;
device->CheckHWBlit = ph_CheckHWBlit;
@ -254,6 +255,10 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags)
}
else
{
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_FFRONT | Ph_WM_CONSWITCH);
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISFRONT);
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISALTKEY);
if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE)
{
PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL);
@ -450,20 +455,15 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat* vformat)
OCImage.FrameData1 = NULL;
videomode_emulatemode = 0;
this->info.video_mem=hwcaps.currently_available_video_ram/1024;
this->info.wm_available = 1;
this->info.hw_available = 1;
this->info.blit_fill = 1;
this->info.blit_hw = 1;
this->info.blit_hw_A = 0;
this->info.blit_hw_CC = 1;
ph_UpdateHWInfo(this);
return 0;
}
static SDL_Surface* ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags)
{
PgHWCaps_t hwcaps;
const struct ColourMasks* mask;
/* Lock the event thread, in multi-threading environments */
@ -558,6 +558,7 @@ static SDL_Surface* ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int
/* Must call at least once for setup image planes */
if (ph_SetupUpdateFunction(this, current, current->flags)==-1)
{
/* Error string was filled in the ph_SetupUpdateFunction() */
return NULL;
}
@ -573,12 +574,7 @@ static SDL_Surface* ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int
visualbpp=bpp;
if (PgGetGraphicsHWCaps(&hwcaps) < 0)
{
SDL_SetError("ph_SetVideoMode(): GetGraphicsHWCaps function failed !\n");
return NULL;
}
this->info.video_mem=hwcaps.currently_available_video_ram/1024;
ph_UpdateHWInfo(this);
SDL_Unlock_EventThread();

View file

@ -42,7 +42,7 @@ static char rcsid =
#define OVERLAY_STATE_UNINIT 0
#define OVERLAY_STATE_ACTIVE 1
/* The functions used to manipulate software video overlays */
/* The functions are used to manipulate software video overlays */
static struct private_yuvhwfuncs ph_yuvfuncs =
{
ph_LockYUVOverlay,