xref: /openbmc/linux/arch/powerpc/include/asm/ps3gpu.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*2b72c9e3SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2d3352c9fSGeert Uytterhoeven /*
3d3352c9fSGeert Uytterhoeven  *  PS3 GPU declarations.
4d3352c9fSGeert Uytterhoeven  *
5d3352c9fSGeert Uytterhoeven  *  Copyright 2009 Sony Corporation
6d3352c9fSGeert Uytterhoeven  */
7d3352c9fSGeert Uytterhoeven 
8d3352c9fSGeert Uytterhoeven #ifndef _ASM_POWERPC_PS3GPU_H
9d3352c9fSGeert Uytterhoeven #define _ASM_POWERPC_PS3GPU_H
10d3352c9fSGeert Uytterhoeven 
11d3352c9fSGeert Uytterhoeven #include <linux/mutex.h>
12d3352c9fSGeert Uytterhoeven 
13d3352c9fSGeert Uytterhoeven #include <asm/lv1call.h>
14d3352c9fSGeert Uytterhoeven 
15d3352c9fSGeert Uytterhoeven 
16d3352c9fSGeert Uytterhoeven #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC	0x101
17d3352c9fSGeert Uytterhoeven #define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP	0x102
18d3352c9fSGeert Uytterhoeven 
19d3352c9fSGeert Uytterhoeven #define L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP	0x600
20d3352c9fSGeert Uytterhoeven #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT		0x601
21d3352c9fSGeert Uytterhoeven #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT_SYNC	0x602
22c204ff65SGeert Uytterhoeven #define L1GPU_CONTEXT_ATTRIBUTE_FB_CLOSE	0x603
23d3352c9fSGeert Uytterhoeven 
24d3352c9fSGeert Uytterhoeven #define L1GPU_FB_BLIT_WAIT_FOR_COMPLETION	(1ULL << 32)
25d3352c9fSGeert Uytterhoeven 
26d3352c9fSGeert Uytterhoeven #define L1GPU_DISPLAY_SYNC_HSYNC		1
27d3352c9fSGeert Uytterhoeven #define L1GPU_DISPLAY_SYNC_VSYNC		2
28d3352c9fSGeert Uytterhoeven 
29d3352c9fSGeert Uytterhoeven 
30d3352c9fSGeert Uytterhoeven /* mutex synchronizing GPU accesses and video mode changes */
31d3352c9fSGeert Uytterhoeven extern struct mutex ps3_gpu_mutex;
32d3352c9fSGeert Uytterhoeven 
33d3352c9fSGeert Uytterhoeven 
lv1_gpu_display_sync(u64 context_handle,u64 head,u64 ddr_offset)34d3352c9fSGeert Uytterhoeven static inline int lv1_gpu_display_sync(u64 context_handle, u64 head,
35d3352c9fSGeert Uytterhoeven 				       u64 ddr_offset)
36d3352c9fSGeert Uytterhoeven {
37d3352c9fSGeert Uytterhoeven 	return lv1_gpu_context_attribute(context_handle,
38d3352c9fSGeert Uytterhoeven 					 L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC,
39d3352c9fSGeert Uytterhoeven 					 head, ddr_offset, 0, 0);
40d3352c9fSGeert Uytterhoeven }
41d3352c9fSGeert Uytterhoeven 
lv1_gpu_display_flip(u64 context_handle,u64 head,u64 ddr_offset)42d3352c9fSGeert Uytterhoeven static inline int lv1_gpu_display_flip(u64 context_handle, u64 head,
43d3352c9fSGeert Uytterhoeven 				       u64 ddr_offset)
44d3352c9fSGeert Uytterhoeven {
45d3352c9fSGeert Uytterhoeven 	return lv1_gpu_context_attribute(context_handle,
46d3352c9fSGeert Uytterhoeven 					 L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP,
47d3352c9fSGeert Uytterhoeven 					 head, ddr_offset, 0, 0);
48d3352c9fSGeert Uytterhoeven }
49d3352c9fSGeert Uytterhoeven 
lv1_gpu_fb_setup(u64 context_handle,u64 xdr_lpar,u64 xdr_size,u64 ioif_offset)50d3352c9fSGeert Uytterhoeven static inline int lv1_gpu_fb_setup(u64 context_handle, u64 xdr_lpar,
51d3352c9fSGeert Uytterhoeven 				   u64 xdr_size, u64 ioif_offset)
52d3352c9fSGeert Uytterhoeven {
53d3352c9fSGeert Uytterhoeven 	return lv1_gpu_context_attribute(context_handle,
54d3352c9fSGeert Uytterhoeven 					 L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP,
55d3352c9fSGeert Uytterhoeven 					 xdr_lpar, xdr_size, ioif_offset, 0);
56d3352c9fSGeert Uytterhoeven }
57d3352c9fSGeert Uytterhoeven 
lv1_gpu_fb_blit(u64 context_handle,u64 ddr_offset,u64 ioif_offset,u64 sync_width,u64 pitch)58d3352c9fSGeert Uytterhoeven static inline int lv1_gpu_fb_blit(u64 context_handle, u64 ddr_offset,
59d3352c9fSGeert Uytterhoeven 				  u64 ioif_offset, u64 sync_width, u64 pitch)
60d3352c9fSGeert Uytterhoeven {
61d3352c9fSGeert Uytterhoeven 	return lv1_gpu_context_attribute(context_handle,
62d3352c9fSGeert Uytterhoeven 					 L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
63d3352c9fSGeert Uytterhoeven 					 ddr_offset, ioif_offset, sync_width,
64d3352c9fSGeert Uytterhoeven 					 pitch);
65d3352c9fSGeert Uytterhoeven }
66d3352c9fSGeert Uytterhoeven 
lv1_gpu_fb_close(u64 context_handle)67c204ff65SGeert Uytterhoeven static inline int lv1_gpu_fb_close(u64 context_handle)
68c204ff65SGeert Uytterhoeven {
69c204ff65SGeert Uytterhoeven 	return lv1_gpu_context_attribute(context_handle,
70c204ff65SGeert Uytterhoeven 					 L1GPU_CONTEXT_ATTRIBUTE_FB_CLOSE, 0,
71c204ff65SGeert Uytterhoeven 					 0, 0, 0);
72c204ff65SGeert Uytterhoeven }
73c204ff65SGeert Uytterhoeven 
74d3352c9fSGeert Uytterhoeven #endif /* _ASM_POWERPC_PS3GPU_H */
75