Mercurial > sdl-ios-xcode
annotate src/video/ps3/SDL_ps3render.c @ 3144:0d8d1f870964 gsoc2009_ps3
Moved SPE-functions to SDL_ps3spe.c.
Added ActivateRenderer() and PS3_QueryTexturePixels().
Added yuv2rgb_spu but not yet in use.
author | Martin Lowinski <martin@goldtopf.org> |
---|---|
date | Wed, 10 Jun 2009 09:15:33 +0000 |
parents | 8fdabaa064c3 |
children | 9e902f423497 |
rev | line source |
---|---|
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
1 /* |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
3 Copyright (C) 1997-2009 Sam Lantinga |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
4 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
9 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
14 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
18 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
19 Sam Lantinga |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
21 */ |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
23 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
24 #include "SDL_video.h" |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
25 #include "../SDL_sysvideo.h" |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
26 #include "../SDL_yuv_sw_c.h" |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
27 #include "../SDL_renderer_sw.h" |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
28 |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
29 #include "SDL_ps3video.h" |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
30 #include "SDL_ps3spe_c.h" |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
31 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
32 #include <fcntl.h> |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
33 #include <stdlib.h> |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
34 #include <sys/ioctl.h> |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
35 #include <linux/kd.h> |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
36 #include <linux/fb.h> |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
37 #include <sys/mman.h> |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
38 #include <asm/ps3fb.h> |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
39 |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
40 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
41 /* Stores the executable name */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
42 extern spe_program_handle_t yuv2rgb_spu; |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
43 |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
44 /* SDL surface based renderer implementation */ |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
45 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
46 static SDL_Renderer *SDL_PS3_CreateRenderer(SDL_Window * window, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
47 Uint32 flags); |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
48 static int SDL_PS3_ActivateRenderer(SDL_Renderer * renderer); |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
49 static int SDL_PS3_RenderPoint(SDL_Renderer * renderer, int x, int y); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
50 static int SDL_PS3_RenderLine(SDL_Renderer * renderer, int x1, int y1, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
51 int x2, int y2); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
52 static int SDL_PS3_RenderFill(SDL_Renderer * renderer, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
53 const SDL_Rect * rect); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
54 static int SDL_PS3_RenderCopy(SDL_Renderer * renderer, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
55 SDL_Texture * texture, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
56 const SDL_Rect * srcrect, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
57 const SDL_Rect * dstrect); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
58 static void SDL_PS3_RenderPresent(SDL_Renderer * renderer); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
59 static void SDL_PS3_DestroyRenderer(SDL_Renderer * renderer); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
60 |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
61 /* Texture */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
62 static int PS3_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
63 static int PS3_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, void **pixels, int *pitch); |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
64 static void PS3_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
65 |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
66 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
67 SDL_RenderDriver SDL_PS3_RenderDriver = { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
68 SDL_PS3_CreateRenderer, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
69 { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
70 "ps3", |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
71 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTVSYNC | |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
72 SDL_RENDERER_PRESENTFLIP2) |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
73 /* (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
74 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
75 SDL_RENDERER_PRESENTDISCARD) */, |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
76 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
77 }; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
78 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
79 typedef struct |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
80 { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
81 int current_screen; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
82 SDL_Surface *screens[3]; |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
83 SDL_VideoDisplay *display; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
84 uint8_t *center[2]; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
85 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
86 /* width of input (bounded by writeable width) */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
87 unsigned int bounded_width; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
88 /* height of input (bounded by writeable height) */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
89 unsigned int bounded_height; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
90 /* offset from the left side (used for centering) */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
91 unsigned int offset_left; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
92 /* offset from the upper side (used for centering) */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
93 unsigned int offset_top; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
94 /* width of screen which is writeable */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
95 unsigned int wr_width; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
96 /* width of screen which is writeable */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
97 unsigned int wr_height; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
98 /* size of a screen line: width * bpp/8 */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
99 unsigned int line_length; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
100 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
101 /* Use two buffers in fb? res < 720p */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
102 unsigned int double_buffering; |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
103 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
104 /* SPE threading stuff */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
105 spu_data_t * converter_thread_data; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
106 /* YUV converting transfer data */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
107 volatile struct yuv2rgb_parms_t * converter_parms __attribute__((aligned(128))); |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
108 } SDL_PS3_RenderData; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
109 |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
110 typedef struct |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
111 { |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
112 int pitch; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
113 int bpp; |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
114 volatile void *pixels __attribute__((aligned(128))); |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
115 } PS3_TextureData; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
116 |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
117 SDL_Renderer * |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
118 SDL_PS3_CreateRenderer(SDL_Window * window, Uint32 flags) |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
119 { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
120 deprintf(1, "SDL_PS3_CreateRenderer()\n"); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
121 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
122 SDL_DisplayMode *displayMode = &display->current_mode; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
123 SDL_Renderer *renderer; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
124 SDL_PS3_RenderData *data; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
125 int i, n; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
126 int bpp; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
127 Uint32 Rmask, Gmask, Bmask, Amask; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
128 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
129 if (!SDL_PixelFormatEnumToMasks |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
130 (displayMode->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
131 SDL_SetError("Unknown display format"); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
132 return NULL; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
133 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
134 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
135 renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
136 if (!renderer) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
137 SDL_OutOfMemory(); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
138 return NULL; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
139 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
140 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
141 data = (SDL_PS3_RenderData *) SDL_malloc(sizeof(*data)); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
142 if (!data) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
143 SDL_PS3_DestroyRenderer(renderer); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
144 SDL_OutOfMemory(); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
145 return NULL; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
146 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
147 SDL_zerop(data); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
148 |
3143
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
149 //renderer->CreateTexture = PS3_CreateTexture; |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
150 //renderer->DestroyTexture = PS3_DestroyTexture; |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
151 //renderer->QueryTexturePixels = PS3_QueryTexturePixels; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
152 renderer->ActivateRenderer = SDL_PS3_ActivateRenderer; |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
153 renderer->RenderPoint = SDL_PS3_RenderPoint; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
154 renderer->RenderLine = SDL_PS3_RenderLine; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
155 renderer->RenderFill = SDL_PS3_RenderFill; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
156 renderer->RenderCopy = SDL_PS3_RenderCopy; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
157 renderer->RenderPresent = SDL_PS3_RenderPresent; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
158 renderer->DestroyRenderer = SDL_PS3_DestroyRenderer; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
159 renderer->info.name = SDL_PS3_RenderDriver.info.name; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
160 renderer->info.flags = 0; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
161 renderer->window = window->id; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
162 renderer->driverdata = data; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
163 Setup_SoftwareRenderer(renderer); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
164 |
3143
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
165 deprintf(1, "window->w = %u\n", window->w); |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
166 deprintf(1, "window->h = %u\n", window->h); |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
167 |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
168 data->double_buffering = 0; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
169 |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
170 if (flags & SDL_RENDERER_PRESENTFLIP2) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
171 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
172 n = 2; |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
173 data->double_buffering = 1; |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
174 } else { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
175 renderer->info.flags |= SDL_RENDERER_PRESENTCOPY; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
176 n = 1; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
177 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
178 for (i = 0; i < n; ++i) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
179 data->screens[i] = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
180 SDL_CreateRGBSurface(0, window->w, window->h, bpp, Rmask, Gmask, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
181 Bmask, Amask); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
182 if (!data->screens[i]) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
183 SDL_PS3_DestroyRenderer(renderer); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
184 return NULL; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
185 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
186 /* Allocate aligned memory for pixels */ |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
187 SDL_free(data->screens[i]->pixels); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
188 data->screens[i]->pixels = (void *)memalign(16, data->screens[i]->h * data->screens[i]->pitch); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
189 if (!data->screens[i]->pixels) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
190 SDL_FreeSurface(data->screens[i]); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
191 SDL_OutOfMemory(); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
192 return NULL; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
193 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
194 SDL_memset(data->screens[i]->pixels, 0, data->screens[i]->h * data->screens[i]->pitch); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
195 SDL_SetSurfacePalette(data->screens[i], display->palette); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
196 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
197 data->current_screen = 0; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
198 |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
199 /* Create SPU parms structure */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
200 data->converter_parms = (struct yuv2rgb_parms_t *) memalign(16, sizeof(struct yuv2rgb_parms_t)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
201 if (data->converter_parms == NULL) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
202 SDL_PS3_DestroyRenderer(renderer); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
203 SDL_OutOfMemory(); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
204 return NULL; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
205 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
206 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
207 /* Set up the SPEs */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
208 data->converter_thread_data = (spu_data_t *) malloc(sizeof(spu_data_t)); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
209 if (data->converter_thread_data == NULL) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
210 SDL_PS3_DestroyRenderer(renderer); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
211 SDL_OutOfMemory(); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
212 return NULL; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
213 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
214 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
215 data->converter_thread_data->program = yuv2rgb_spu; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
216 data->converter_thread_data->program_name = "yuv2rgb_spu"; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
217 data->converter_thread_data->keepalive = 1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
218 data->converter_thread_data->booted = 0; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
219 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
220 SPE_Start(data->converter_thread_data); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
221 |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
222 return renderer; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
223 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
224 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
225 static int |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
226 SDL_PS3_ActivateRenderer(SDL_Renderer * renderer) |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
227 { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
228 deprintf(1, "PS3_ActivateRenderer()\n"); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
229 SDL_PS3_RenderData *data = (SDL_PS3_RenderData *) renderer->driverdata; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
230 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
231 return 0; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
232 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
233 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
234 static int |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
235 PS3_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
236 deprintf(1, "PS3_CreateTexture()\n"); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
237 PS3_TextureData *data; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
238 data = (PS3_TextureData *) SDL_calloc(1, sizeof(*data)); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
239 if (!data) { |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
240 SDL_OutOfMemory(); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
241 return -1; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
242 } |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
243 |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
244 data->bpp = SDL_BYTESPERPIXEL(texture->format); |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
245 data->pitch = (texture->w * SDL_BYTESPERPIXEL(texture->format)); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
246 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
247 data->pixels = NULL; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
248 data->pixels = (void *)memalign(16, texture->h * data->pitch); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
249 if (!data->pixels) { |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
250 PS3_DestroyTexture(renderer, texture); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
251 SDL_OutOfMemory(); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
252 return -1; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
253 } |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
254 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
255 texture->driverdata = data; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
256 return 0; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
257 } |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
258 |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
259 static int |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
260 PS3_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
261 void **pixels, int *pitch) |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
262 { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
263 PS3_TextureData *data = (PS3_TextureData *) texture->driverdata; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
264 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
265 *pixels = (void *)data->pixels; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
266 *pitch = data->pitch; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
267 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
268 return 0; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
269 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
270 |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
271 static void |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
272 PS3_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
273 { |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
274 deprintf(1, "PS3_DestroyTexture()\n"); |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
275 PS3_TextureData *data = (PS3_TextureData *) texture->driverdata; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
276 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
277 if (!data) { |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
278 return; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
279 } |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
280 |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
281 free((void *)data->pixels); |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
282 } |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
283 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
284 static int |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
285 SDL_PS3_RenderPoint(SDL_Renderer * renderer, int x, int y) |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
286 { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
287 SDL_PS3_RenderData *data = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
288 (SDL_PS3_RenderData *) renderer->driverdata; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
289 SDL_Surface *target = data->screens[data->current_screen]; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
290 int status; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
291 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
292 if (renderer->blendMode == SDL_BLENDMODE_NONE || |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
293 renderer->blendMode == SDL_BLENDMODE_MASK) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
294 Uint32 color = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
295 SDL_MapRGBA(target->format, renderer->r, renderer->g, renderer->b, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
296 renderer->a); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
297 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
298 status = SDL_DrawPoint(target, x, y, color); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
299 } else { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
300 status = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
301 SDL_BlendPoint(target, x, y, renderer->blendMode, renderer->r, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
302 renderer->g, renderer->b, renderer->a); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
303 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
304 return status; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
305 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
306 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
307 static int |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
308 SDL_PS3_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
309 { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
310 SDL_PS3_RenderData *data = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
311 (SDL_PS3_RenderData *) renderer->driverdata; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
312 SDL_Surface *target = data->screens[data->current_screen]; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
313 int status; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
314 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
315 if (renderer->blendMode == SDL_BLENDMODE_NONE || |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
316 renderer->blendMode == SDL_BLENDMODE_MASK) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
317 Uint32 color = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
318 SDL_MapRGBA(target->format, renderer->r, renderer->g, renderer->b, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
319 renderer->a); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
320 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
321 status = SDL_DrawLine(target, x1, y1, x2, y2, color); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
322 } else { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
323 status = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
324 SDL_BlendLine(target, x1, y1, x2, y2, renderer->blendMode, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
325 renderer->r, renderer->g, renderer->b, renderer->a); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
326 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
327 return status; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
328 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
329 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
330 static int |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
331 SDL_PS3_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect) |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
332 { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
333 deprintf(1, "SDL_PS3_RenderFill()\n"); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
334 SDL_PS3_RenderData *data = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
335 (SDL_PS3_RenderData *) renderer->driverdata; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
336 SDL_Surface *target = data->screens[data->current_screen]; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
337 SDL_Rect real_rect = *rect; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
338 int status; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
339 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
340 if (renderer->blendMode == SDL_BLENDMODE_NONE) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
341 Uint32 color = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
342 SDL_MapRGBA(target->format, renderer->r, renderer->g, renderer->b, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
343 renderer->a); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
344 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
345 status = SDL_FillRect(target, &real_rect, color); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
346 } else { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
347 status = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
348 SDL_BlendRect(target, &real_rect, renderer->blendMode, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
349 renderer->r, renderer->g, renderer->b, renderer->a); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
350 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
351 return status; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
352 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
353 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
354 static int |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
355 SDL_PS3_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
356 const SDL_Rect * srcrect, const SDL_Rect * dstrect) |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
357 { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
358 deprintf(1, "SDL_PS3_RenderCopy()\n"); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
359 SDL_PS3_RenderData *data = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
360 (SDL_PS3_RenderData *) renderer->driverdata; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
361 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
362 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
363 //PS3_TextureData *txdata = (PS3_TextureData *) texture->driverdata; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
364 SDL_SW_YUVTexture *txdata = (SDL_SW_YUVTexture *) texture->driverdata; |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
365 SDL_VideoData *devdata = display->device->driverdata; |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
366 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
367 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
368 deprintf(1, "SDL_ISPIXELFORMAT_FOURCC = true\n"); |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
369 SDL_Surface *target = data->screens[data->current_screen]; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
370 void *pixels = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
371 (Uint8 *) target->pixels + dstrect->y * target->pitch + |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
372 dstrect->x * target->format->BytesPerPixel; |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
373 #if 0 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
374 /* Not yet tested */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
375 Uint8 *lum, *Cr, *Cb; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
376 SDL_SW_YUVTexture *swdata = (SDL_SW_YUVTexture *) texture->driverdata; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
377 switch (swdata->format) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
378 case SDL_PIXELFORMAT_YV12: |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
379 lum = swdata->planes[0]; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
380 Cr = swdata->planes[1]; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
381 Cb = swdata->planes[2]; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
382 break; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
383 case SDL_PIXELFORMAT_IYUV: |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
384 lum = swdata->planes[0]; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
385 Cr = swdata->planes[2]; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
386 Cb = swdata->planes[1]; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
387 break; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
388 default: |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
389 return -1; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
390 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
391 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
392 data->converter_parms->src_pixel_width = dstrect->w; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
393 data->converter_parms->src_pixel_height = dstrect->h; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
394 data->converter_parms->dstBuffer = (Uint8 *)pixels; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
395 data->converter_thread_data->argp = (void *)data->converter_parms; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
396 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
397 /* Convert YUV overlay to RGB */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
398 SPE_SendMsg(data->converter_thread_data, SPU_START); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
399 SPE_SendMsg(data->converter_thread_data, (unsigned int)data->converter_thread_data->argp); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
400 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
401 return 0; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
402 #else |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
403 return SDL_SW_CopyYUVToRGB((SDL_SW_YUVTexture *) texture->driverdata, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
404 srcrect, display->current_mode.format, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
405 dstrect->w, dstrect->h, pixels, |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
406 target->pitch); |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
407 #endif |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
408 } else { |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
409 deprintf(1, "SDL_ISPIXELFORMAT_FOURCC = false\n"); |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
410 SDL_Surface *surface = (SDL_Surface *) texture->driverdata; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
411 SDL_Surface *target = data->screens[data->current_screen]; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
412 SDL_Rect real_srcrect = *srcrect; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
413 SDL_Rect real_dstrect = *dstrect; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
414 |
3143
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
415 deprintf(1, "surface->w = %u\n", surface->w); // FIXME: surface->w changes to 32 |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
416 deprintf(1, "surface->h = %u\n", surface->h); |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
417 |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
418 deprintf(1, "srcrect->w = %u\n", srcrect->w); |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
419 deprintf(1, "srcrect->h = %u\n", srcrect->h); |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
420 deprintf(1, "dstrect->w = %u\n", dstrect->w); |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
421 deprintf(1, "dstrect->h = %u\n", dstrect->h); |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
422 |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
423 //deprintf(1, "txdata->bpp = %u\n", txdata->bpp); |
3143
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
424 deprintf(1, "texture->format (bpp) = %u\n", SDL_BYTESPERPIXEL(texture->format)); |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
425 |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
426 /* For testing, align pixels */ |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
427 void *pixels = (void *)memalign(16, window->h * window->w * 4); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
428 SDL_memcpy(pixels, surface->pixels, window->h * window->w * 4); |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
429 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
430 /* Get screeninfo */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
431 struct fb_fix_screeninfo fb_finfo; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
432 if (ioctl(devdata->fbdev, FBIOGET_FSCREENINFO, &fb_finfo)) { |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
433 SDL_SetError("[PS3] Can't get fixed screeninfo"); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
434 return -1; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
435 } |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
436 struct fb_var_screeninfo fb_vinfo; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
437 if (ioctl(devdata->fbdev, FBIOGET_VSCREENINFO, &fb_vinfo)) { |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
438 SDL_SetError("[PS3] Can't get VSCREENINFO"); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
439 return -1; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
440 } |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
441 /* 16 and 15 bpp is reported as 16 bpp */ |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
442 //txdata->bpp = fb_vinfo.bits_per_pixel; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
443 //if (txdata->bpp == 16) |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
444 // txdata->bpp = fb_vinfo.red.length + fb_vinfo.green.length + fb_vinfo.blue.length; |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
445 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
446 /* Adjust centering */ |
3143
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
447 data->bounded_width = window->w < fb_vinfo.xres ? window->w : fb_vinfo.xres; |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
448 data->bounded_height = window->h < fb_vinfo.yres ? window->h : fb_vinfo.yres; |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
449 data->offset_left = (fb_vinfo.xres - data->bounded_width) >> 1; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
450 data->offset_top = (fb_vinfo.yres - data->bounded_height) >> 1; |
3143
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
451 data->center[0] = devdata->frame_buffer + data->offset_left * /*txdata->bpp/8*/ 4 + |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
452 data->offset_top * fb_finfo.line_length; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
453 data->center[1] = data->center[0] + fb_vinfo.yres * fb_finfo.line_length; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
454 |
3143
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
455 deprintf(1, "offset_left = %u\n", data->offset_left); |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
456 deprintf(1, "offset_top = %u\n", data->offset_top); |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
457 |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
458 /* Set SPU parms for copying the surface to framebuffer */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
459 devdata->fb_parms->data = (unsigned char *)pixels; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
460 devdata->fb_parms->center = data->center[data->current_screen]; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
461 devdata->fb_parms->out_line_stride = fb_finfo.line_length; |
3143
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
462 devdata->fb_parms->in_line_stride = dstrect->w * /*txdata->bpp / 8*/4; |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
463 devdata->fb_parms->bounded_input_height = data->bounded_height; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
464 devdata->fb_parms->bounded_input_width = data->bounded_width; |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
465 //devdata->fb_parms->fb_pixel_size = txdata->bpp / 8; |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
466 devdata->fb_parms->fb_pixel_size = SDL_BYTESPERPIXEL(texture->format); |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
467 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
468 deprintf(3, "[PS3->SPU] fb_thread_data->argp = 0x%x\n", devdata->fb_thread_data->argp); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
469 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
470 /* Copying.. */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
471 SPE_SendMsg(devdata->fb_thread_data, SPU_START); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
472 SPE_SendMsg(devdata->fb_thread_data, (unsigned int)devdata->fb_thread_data->argp); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
473 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
474 SPE_WaitForMsg(devdata->fb_thread_data, SPU_FIN); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
475 free(pixels); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
476 |
3143
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
477 return 0; |
8fdabaa064c3
Fixed centering. Added debug msgs for RenderCopy().
Martin Lowinski <martin@goldtopf.org>
parents:
3142
diff
changeset
|
478 //return SDL_LowerBlit(surface, &real_srcrect, target, &real_dstrect); |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
479 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
480 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
481 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
482 static void |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
483 SDL_PS3_RenderPresent(SDL_Renderer * renderer) |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
484 { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
485 deprintf(1, "SDL_PS3_RenderPresent()\n"); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
486 static int frame_number; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
487 SDL_PS3_RenderData *data = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
488 (SDL_PS3_RenderData *) renderer->driverdata; |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
489 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
490 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
491 SDL_VideoData *devdata = display->device->driverdata; |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
492 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
493 /* Send the data to the display */ |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
494 if (SDL_getenv("SDL_VIDEO_PS3_SAVE_FRAMES")) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
495 char file[128]; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
496 SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp", |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
497 renderer->window, ++frame_number); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
498 SDL_SaveBMP(data->screens[data->current_screen], file); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
499 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
500 |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
501 /* Wait for vsync */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
502 if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) { |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
503 unsigned long crt = 0; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
504 deprintf(1, "[PS3] Wait for vsync\n"); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
505 ioctl(devdata->fbdev, FBIO_WAITFORVSYNC, &crt); |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
506 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
507 |
3142
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
508 /* Page flip */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
509 deprintf(1, "[PS3] Page flip to buffer #%u 0x%x\n", data->current_screen, data->center[data->current_screen]); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
510 ioctl(devdata->fbdev, PS3FB_IOCTL_FSEL, (unsigned long)&data->current_screen); |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
511 |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
512 /* Update the flipping chain, if any */ |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
513 if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2 && data->double_buffering) { |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
514 data->current_screen = (data->current_screen + 1) % 2; |
c146645a770e
Roughly working framebuffer.
Martin Lowinski <martin@goldtopf.org>
parents:
3141
diff
changeset
|
515 } |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
516 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
517 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
518 static void |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
519 SDL_PS3_DestroyRenderer(SDL_Renderer * renderer) |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
520 { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
521 deprintf(1, "SDL_PS3_DestroyRenderer()\n"); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
522 SDL_PS3_RenderData *data = |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
523 (SDL_PS3_RenderData *) renderer->driverdata; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
524 int i; |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
525 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
526 if (data) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
527 for (i = 0; i < SDL_arraysize(data->screens); ++i) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
528 if (data->screens[i]) { |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
529 SDL_FreeSurface(data->screens[i]); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
530 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
531 } |
3144
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
532 |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
533 /* Shutdown SPE and related resources */ |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
534 if (data->converter_parms) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
535 free((void *)data->converter_parms); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
536 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
537 if (data->converter_thread_data) { |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
538 SPE_Shutdown(data->converter_thread_data); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
539 free((void *)data->converter_thread_data); |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
540 } |
0d8d1f870964
Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents:
3143
diff
changeset
|
541 |
3141
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
542 SDL_free(data); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
543 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
544 SDL_free(renderer); |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
545 } |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
546 |
3df74541339b
Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff
changeset
|
547 /* vi: set ts=4 sw=4 expandtab: */ |