Subversion Repositories ps3ware

Rev

Rev 189 | Rev 201 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
111 ironpeter 1
/*
2
 * PS3 GPU blitting test program
3
 *
4
 * Copyright 2007 Vivien Chappelier <vivien.chappelier@free.fr>
5
 * Copyright 2007 Peter Popov <IronSPeter@gmail.com>
6
 *
7
 */
8
 
9
#include <linux/types.h>
10
#include <linux/fb.h>
11
#include <asm/ps3fb.h>
12
 
13
#define dbg(...)
14
 
15
#define DEV_MEM         "/dev/mem"
16
#define DEV_VFB         "/dev/fb0"
189 glaurung 17
#define DEV_RSX         "/dev/fb1"
18
#define OFFSET_VRAM     0x00000000
19
#define OFFSET_IOIF     0x10000000
20
#define OFFSET_FIFO     0x20000000
21
#define OFFSET_CTRL     0x30000000
22
#define OFFSET_REPORTS  0x0fe00000
111 ironpeter 23
 
24
#define barrier() asm volatile ("" : : : "memory");
25
#define OUT_RING(data) *(ptr)++ = (data)
26
#define OUT_RINGf(data) { union f2i temp; temp.f = data;  *(ptr)++ = temp.i; }
27
#define BEGIN_RING(chan, tag, size)   OUT_RING(((size) << 18) | ((chan) << 13) | (tag))
28
 
29
 
30
union f2i
31
{
32
  float f;
33
  uint32_t i;
34
};
35
 
36
 
37
struct resource
38
{
39
  void *virt;
40
  size_t len;
41
};
42
 
43
struct gpu
44
{
189 glaurung 45
  int init;
46
  int fb_fd;
47
  int rsx_fd;
48
  int hw_id;
49
  uint32_t ioif;
50
  struct ps3fb_ioctl_res res;
111 ironpeter 51
  struct resource xram;
52
  struct resource vram;
53
  struct resource fifo;
54
  struct resource ctrl;
189 glaurung 55
  struct resource reports;
111 ironpeter 56
};
57
 
58
 
184 ironpeter 59
typedef enum
60
{
61
        Z16 = 0x20,
62
        Z24S8 = 0x40,
63
}
64
type_depth_t;
65
 
66
typedef struct
67
{
68
        uint8_t clearR;
69
        uint8_t clearG;
70
        uint8_t clearB;
71
        uint8_t clearA;
72
        uint8_t clearD;
73
        uint32_t rgba;
74
        uint32_t depth;
75
 
76
 
77
}
78
clear_buffer_t;
79
 
80
 
81
 
82
typedef struct
83
{
84
        uint16_t width;
85
        uint16_t height;
86
        uint32_t pitchColor;
87
        uint32_t pitchDepth;
88
        uint32_t offsetColor;
89
        uint32_t offsetDepth;
90
        type_depth_t typeDepth;
91
 
92
}
93
setup_buffer_t;
94
 
95
int setup_and_voodoo( uint32_t dma_notifier, uint32_t dma_fb, uint32_t obj_3d, uint32_t *fifo_buffer, uint32_t hw_sub );
96
int clear_buffers( const clear_buffer_t *buffers, uint32_t *fifo, uint32_t hw_sub );
97
int setup_buffers( const setup_buffer_t *buffers, uint32_t *fifo, uint32_t hw_sub );
98
 
99
 
100
 
101
 
111 ironpeter 102
void fifo_push(struct gpu *gpu, int len);
103
void fifo_wait(struct gpu *gpu);
197 ironpeter 104
int sync_gpu(struct gpu *gpu );
189 glaurung 105
uint32_t hash_handle(int channel, uint32_t handle);
111 ironpeter 106
uint32_t endian( uint32_t v );
107
uint32_t endian_fp( uint32_t v );
189 glaurung 108
int gpu_init(struct gpu *gpu);
109
void gpu_cleanup(struct gpu *gpu);