annotate src/video/ps3/spulibs/spu_common.h @ 4324:1496aa09e41e SDL-1.2

Steven Noonan to sdl While trying to build the SDLMain.m included with SDL 1.2.14, with #define SDL_USE_NIB_FILE 1: /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m: In function '-[SDLMain fixMenu:withAppName:]': /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:122: warning: 'sizeToFit' is deprecated (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSMenu.h:281) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m: In function 'main': /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376: warning: 'poseAsClass:' is deprecated (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376: error: 'poseAsClass:' is unavailable (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:377: warning: passing argument 2 of 'NSApplicationMain' from incompatible pointer type Eric Wing to Sam I don't have time today to look at this in detail, but the problem is definitely the poseAsClass: method. This was deprecated in Obj-C 2.0 and not retained in 64-bit. I've never used this method and it has always been limited to esoteric uses. I think this is why Apple wanted to dump it (among complicating some other things they do). I have read about others getting bit by this when migrating. Long story short, there really isn't a migration path for this method. The question that then must be asked is why are we using it (what does it accomplish), and then figure out the 'proper' way of accomplishing that. Glancing at SDLMain.m, it's not obvious to me why it is there or what it is really accomplishing. My only speculation is that NSApplicationMain hardcodes something to look for NSApplication and a subclass (SDLApplication) fails for some reason (assuming that the original coder did this for good reason). Three thoughts come to mind. 1) The Info.plist has properties to control things related to the startup class and nib. NSPrincipalClass, NSMainNibFile Maybe principle class needs to be SDLApplication and we can delete the poseAs 2) I was told that 10.6 introduced new APIs to make programatic NIB wrangling and avoidance easier. Unfortunately, I don't know the specifics. 3) Instead of subclassing NSApplication in SDLMain.m, maybe we can just add a category. It looks like the following is the only thing that is done (quick glance): @interface SDLApplication : NSApplication @end @implementation SDLApplication /* Invoked from the Quit menu item */ - (void)terminate:(id)sender { /* Post a SDL_QUIT event */ SDL_Event event; event.type = SDL_QUIT; SDL_PushEvent(&event); } @end So instead, we change this to: (warning written in mail and untested) @interface NSApplication (SDLApplication) - (void) terminate:(id)sender; @end @implementation NSApplication (SDLApplication) /* Invoked from the Quit menu item */ - (void)terminate:(id)sender { /* Post a SDL_QUIT event */ SDL_Event event; event.type = SDL_QUIT; SDL_PushEvent(&event); } @end Then everywhere SDLApplication is used, we change it to NSApplication (and remove the poseAsClass line). Perhaps you could ask the bug reporter to try this solution (#3). And if that fails, maybe try #1. -Eric Steven Noonan to Sam The suggested change (diff below) seems to work fine. - Steven
author Sam Lantinga <slouken@libsdl.org>
date Mon, 12 Oct 2009 21:07:12 +0000
parents 3b8ac3d311a2
children
rev   line source
4165
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 * SDL - Simple DirectMedia Layer
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 * CELL BE Support for PS3 Framebuffer
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 * Copyright (C) 2008, 2009 International Business Machines Corporation
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 *
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 * This library is free software; you can redistribute it and/or modify it
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 * under the terms of the GNU Lesser General Public License as published
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 * by the Free Software Foundation; either version 2.1 of the License, or
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 * (at your option) any later version.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 *
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 * This library is distributed in the hope that it will be useful, but
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14 * Lesser General Public License for more details.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 *
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 * License along with this library; if not, write to the Free Software
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 * USA
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 *
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 * Martin Lowinski <lowinski [at] de [dot] ibm [ibm] com>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 * Dirk Herrendoerfer <d.herrendoerfer [at] de [dot] ibm [dot] com>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 * SPE code based on research by:
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 * Rene Becker
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 * Thimo Emmerich
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 /* Common definitions/makros for SPUs */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #ifndef _SPU_COMMON_H
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #define _SPU_COMMON_H
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #include <stdio.h>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #include <stdint.h>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include <string.h>
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 /* Tag management */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 #define DMA_WAIT_TAG(_tag) \
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 mfc_write_tag_mask(1<<(_tag)); \
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 mfc_read_tag_status_all();
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 /* SPU mailbox messages */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 #define SPU_READY 0
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 #define SPU_START 1
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 #define SPU_FIN 2
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 #define SPU_EXIT 3
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 /* Tags */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 #define RETR_BUF 0
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 #define STR_BUF 1
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 #define TAG_INIT 2
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 /* Buffersizes */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 #define MAX_HDTV_WIDTH 1920
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 #define MAX_HDTV_HEIGHT 1080
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 /* One stride of HDTV */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 #define BUFFER_SIZE 7680
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 /* fb_writer ppu/spu exchange parms */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 struct fb_writer_parms_t {
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 uint8_t *data;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 uint8_t *center;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 uint32_t out_line_stride;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 uint32_t in_line_stride;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 uint32_t bounded_input_height;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 uint32_t bounded_input_width;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 uint32_t fb_pixel_size;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 /* This padding is to fulfill the need for 16 byte alignment. On parm change, update! */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 char padding[4];
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 } __attribute__((aligned(128)));
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 /* yuv2rgb ppu/spu exchange parms */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 struct yuv2rgb_parms_t {
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 uint8_t* y_plane;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 uint8_t* v_plane;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 uint8_t* u_plane;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 uint8_t* dstBuffer;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 unsigned int src_pixel_width;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 unsigned int src_pixel_height;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 /* This padding is to fulfill the need for 16 byte alignment. On parm change, update! */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 char padding[128 - ((4 * sizeof(uint8_t *) + 2 * sizeof(unsigned int)) & 0x7F)];
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 } __attribute__((aligned(128)));
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 /* bilin_scaler ppu/spu exchange parms */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 struct scale_parms_t {
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 uint8_t* y_plane;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 uint8_t* v_plane;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 uint8_t* u_plane;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 uint8_t* dstBuffer;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 unsigned int src_pixel_width;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 unsigned int src_pixel_height;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 unsigned int dst_pixel_width;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 unsigned int dst_pixel_height;
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 /* This padding is to fulfill the need for 16 byte alignment. On parm change, update! */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 char padding[128 - ((4 * sizeof(uint8_t *) + 4 * sizeof(unsigned int)) & 0x7F)];
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 } __attribute__((aligned(128)));
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 #endif /* _SPU_COMMON_H */
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108