annotate src/video/ps3/spulibs/spu_common.h @ 4847:4201864f77e7

Fixing variable naming style.
author egottlieb
date Tue, 10 Aug 2010 16:30:53 -0400
parents 94fb40a4a9a7
children
rev   line source
3257
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 * SDL - Simple DirectMedia Layer
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 * CELL BE Support for PS3 Framebuffer
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 * Copyright (C) 2008, 2009 International Business Machines Corporation
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 *
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 * This library is free software; you can redistribute it and/or modify it
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 * under the terms of the GNU Lesser General Public License as published
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 * by the Free Software Foundation; either version 2.1 of the License, or
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 * (at your option) any later version.
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 *
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 * This library is distributed in the hope that it will be useful, but
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14 * Lesser General Public License for more details.
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 *
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 * License along with this library; if not, write to the Free Software
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 * USA
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 *
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 * Martin Lowinski <lowinski [at] de [dot] ibm [ibm] com>
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 * Dirk Herrendoerfer <d.herrendoerfer [at] de [dot] ibm [dot] com>
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 * SPE code based on research by:
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 * Rene Becker
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 * Thimo Emmerich
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 /* Common definitions/makros for SPUs */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #ifndef _SPU_COMMON_H
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #define _SPU_COMMON_H
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #include <stdio.h>
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #include <stdint.h>
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include <string.h>
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 /* Tag management */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 #define DMA_WAIT_TAG(_tag) \
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 mfc_write_tag_mask(1<<(_tag)); \
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 mfc_read_tag_status_all();
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 /* SPU mailbox messages */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 #define SPU_READY 0
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 #define SPU_START 1
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 #define SPU_FIN 2
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 #define SPU_EXIT 3
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 /* Tags */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 #define RETR_BUF 0
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 #define STR_BUF 1
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 #define TAG_INIT 2
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 /* Buffersizes */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 #define MAX_HDTV_WIDTH 1920
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 #define MAX_HDTV_HEIGHT 1080
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 /* One stride of HDTV */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 #define BUFFER_SIZE 7680
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 /* fb_writer ppu/spu exchange parms */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 struct fb_writer_parms_t {
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 uint8_t *data;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 uint8_t *center;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 uint32_t out_line_stride;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 uint32_t in_line_stride;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 uint32_t bounded_input_height;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 uint32_t bounded_input_width;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 uint32_t fb_pixel_size;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 /* This padding is to fulfill the need for 16 byte alignment. On parm change, update! */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 char padding[4];
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 } __attribute__((aligned(128)));
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 /* yuv2rgb ppu/spu exchange parms */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 struct yuv2rgb_parms_t {
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 uint8_t* y_plane;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 uint8_t* v_plane;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 uint8_t* u_plane;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 uint8_t* dstBuffer;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 unsigned int src_pixel_width;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 unsigned int src_pixel_height;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 /* This padding is to fulfill the need for 16 byte alignment. On parm change, update! */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 char padding[128 - ((4 * sizeof(uint8_t *) + 2 * sizeof(unsigned int)) & 0x7F)];
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 } __attribute__((aligned(128)));
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 /* bilin_scaler ppu/spu exchange parms */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 struct scale_parms_t {
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 uint8_t* y_plane;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 uint8_t* v_plane;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 uint8_t* u_plane;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 uint8_t* dstBuffer;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 unsigned int src_pixel_width;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 unsigned int src_pixel_height;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 unsigned int dst_pixel_width;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 unsigned int dst_pixel_height;
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 /* This padding is to fulfill the need for 16 byte alignment. On parm change, update! */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 char padding[128 - ((4 * sizeof(uint8_t *) + 4 * sizeof(unsigned int)) & 0x7F)];
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 } __attribute__((aligned(128)));
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 #endif /* _SPU_COMMON_H */
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107
94fb40a4a9a7 Merged Martin's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108