comparison src/video/photon/SDL_ph_video.c @ 886:05c551e5bc64

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.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 06 May 2004 15:55:06 +0000
parents 4bc7e16a13ed
children 4ab6d1fd028f
comparison
equal deleted inserted replaced
885:9f6ad2286011 886:05c551e5bc64
81 } 81 }
82 } 82 }
83 return 1; 83 return 1;
84 } 84 }
85 85
86 static SDL_VideoDevice *ph_CreateDevice(int devindex) 86 static SDL_VideoDevice* ph_CreateDevice(int devindex)
87 { 87 {
88 SDL_VideoDevice *device; 88 SDL_VideoDevice* device;
89 89
90 /* Initialize all variables that we clean on shutdown */ 90 /* Initialize all variables that we clean on shutdown */
91 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); 91 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice));
92 if (device) { 92 if (device)
93 {
93 memset(device, 0, (sizeof *device)); 94 memset(device, 0, (sizeof *device));
94 device->hidden = (struct SDL_PrivateVideoData *) 95 device->hidden = (struct SDL_PrivateVideoData*)malloc((sizeof *device->hidden));
95 malloc((sizeof *device->hidden));
96 device->gl_data = NULL; 96 device->gl_data = NULL;
97 } 97 }
98 if ((device == NULL) || (device->hidden == NULL)) { 98 if ((device == NULL) || (device->hidden == NULL))
99 {
99 SDL_OutOfMemory(); 100 SDL_OutOfMemory();
100 ph_DeleteDevice(device); 101 ph_DeleteDevice(device);
101 return(0); 102 return NULL;
102 } 103 }
103 memset(device->hidden, 0, (sizeof *device->hidden)); 104 memset(device->hidden, 0, (sizeof *device->hidden));
104 105
105 /* Set the driver flags */ 106 /* Set the driver flags */
106 device->handles_any_size = 1; /* JB not true for fullscreen */ 107 device->handles_any_size = 1;
107 108
108 /* Set the function pointers */ 109 /* Set the function pointers */
109 device->CreateYUVOverlay = ph_CreateYUVOverlay; 110 device->CreateYUVOverlay = ph_CreateYUVOverlay;
110 device->VideoInit = ph_VideoInit; 111 device->VideoInit = ph_VideoInit;
111 device->ListModes = ph_ListModes; 112 device->ListModes = ph_ListModes;
112 device->SetVideoMode = ph_SetVideoMode; 113 device->SetVideoMode = ph_SetVideoMode;
113 device->ToggleFullScreen = ph_ToggleFullScreen; 114 device->ToggleFullScreen = ph_ToggleFullScreen;
114 device->UpdateMouse = ph_UpdateMouse; 115 device->UpdateMouse = ph_UpdateMouse;
115 device->SetColors = ph_SetColors; 116 device->SetColors = ph_SetColors;
116 device->UpdateRects = NULL; /* set up in ph_SetupUpdateFunction */ 117 device->UpdateRects = NULL; /* set up in ph_SetupUpdateFunction */
117 device->VideoQuit = ph_VideoQuit; 118 device->VideoQuit = ph_VideoQuit;
118 device->AllocHWSurface = ph_AllocHWSurface; 119 device->AllocHWSurface = ph_AllocHWSurface;
119 device->CheckHWBlit = ph_CheckHWBlit; 120 device->CheckHWBlit = ph_CheckHWBlit;
120 device->FillHWRect = ph_FillHWRect; 121 device->FillHWRect = ph_FillHWRect;
121 device->SetHWColorKey = ph_SetHWColorKey; 122 device->SetHWColorKey = ph_SetHWColorKey;
252 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_FFRONT | Ph_WM_MAX | Ph_WM_TOFRONT | Ph_WM_CONSWITCH); 253 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_FFRONT | Ph_WM_MAX | Ph_WM_TOFRONT | Ph_WM_CONSWITCH);
253 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISFOCUS | Ph_WM_STATE_ISALTKEY); 254 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISFOCUS | Ph_WM_STATE_ISALTKEY);
254 } 255 }
255 else 256 else
256 { 257 {
258 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_FFRONT | Ph_WM_CONSWITCH);
259 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISFRONT);
260 PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISALTKEY);
261
257 if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE) 262 if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE)
258 { 263 {
259 PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL); 264 PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL);
260 } 265 }
261 else 266 else
448 OCImage.CurrentFrameData = NULL; 453 OCImage.CurrentFrameData = NULL;
449 OCImage.FrameData0 = NULL; 454 OCImage.FrameData0 = NULL;
450 OCImage.FrameData1 = NULL; 455 OCImage.FrameData1 = NULL;
451 videomode_emulatemode = 0; 456 videomode_emulatemode = 0;
452 457
453 this->info.video_mem=hwcaps.currently_available_video_ram/1024;
454 this->info.wm_available = 1; 458 this->info.wm_available = 1;
455 this->info.hw_available = 1; 459
456 this->info.blit_fill = 1; 460 ph_UpdateHWInfo(this);
457 this->info.blit_hw = 1;
458 this->info.blit_hw_A = 0;
459 this->info.blit_hw_CC = 1;
460 461
461 return 0; 462 return 0;
462 } 463 }
463 464
464 static SDL_Surface* ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags) 465 static SDL_Surface* ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags)
465 { 466 {
466 PgHWCaps_t hwcaps;
467 const struct ColourMasks* mask; 467 const struct ColourMasks* mask;
468 468
469 /* Lock the event thread, in multi-threading environments */ 469 /* Lock the event thread, in multi-threading environments */
470 SDL_Lock_EventThread(); 470 SDL_Lock_EventThread();
471 471
556 } 556 }
557 557
558 /* Must call at least once for setup image planes */ 558 /* Must call at least once for setup image planes */
559 if (ph_SetupUpdateFunction(this, current, current->flags)==-1) 559 if (ph_SetupUpdateFunction(this, current, current->flags)==-1)
560 { 560 {
561 /* Error string was filled in the ph_SetupUpdateFunction() */
561 return NULL; 562 return NULL;
562 } 563 }
563 564
564 /* finish window drawing, if we are not in fullscreen, of course */ 565 /* finish window drawing, if we are not in fullscreen, of course */
565 if ((current->flags & SDL_FULLSCREEN) != SDL_FULLSCREEN) 566 if ((current->flags & SDL_FULLSCREEN) != SDL_FULLSCREEN)
571 PgFlush(); 572 PgFlush();
572 } 573 }
573 574
574 visualbpp=bpp; 575 visualbpp=bpp;
575 576
576 if (PgGetGraphicsHWCaps(&hwcaps) < 0) 577 ph_UpdateHWInfo(this);
577 {
578 SDL_SetError("ph_SetVideoMode(): GetGraphicsHWCaps function failed !\n");
579 return NULL;
580 }
581 this->info.video_mem=hwcaps.currently_available_video_ram/1024;
582 578
583 SDL_Unlock_EventThread(); 579 SDL_Unlock_EventThread();
584 580
585 /* We've done! */ 581 /* We've done! */
586 return (current); 582 return (current);