ps3gpu.h 1.9 KB

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