Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1.  
  2. #ifndef __NV50_WINSYS_H__
  3. #define __NV50_WINSYS_H__
  4.  
  5. #include <stdint.h>
  6. #include <unistd.h>
  7.  
  8. #include "pipe/p_defines.h"
  9.  
  10. #include "nouveau/nouveau_winsys.h"
  11. #include "nouveau/nouveau_buffer.h"
  12.  
  13.  
  14. #ifndef NV04_PFIFO_MAX_PACKET_LEN
  15. #define NV04_PFIFO_MAX_PACKET_LEN 2047
  16. #endif
  17.  
  18.  
  19. static INLINE void
  20. nv50_add_bufctx_resident_bo(struct nouveau_bufctx *bufctx, int bin,
  21.                             unsigned flags, struct nouveau_bo *bo)
  22. {
  23.    nouveau_bufctx_refn(bufctx, bin, bo, flags)->priv = NULL;
  24. }
  25.  
  26. static INLINE void
  27. nv50_add_bufctx_resident(struct nouveau_bufctx *bufctx, int bin,
  28.                          struct nv04_resource *res, unsigned flags)
  29. {
  30.    struct nouveau_bufref *ref =
  31.       nouveau_bufctx_refn(bufctx, bin, res->bo, flags | res->domain);
  32.    ref->priv = res;
  33.    ref->priv_data = flags;
  34. }
  35.  
  36. #define BCTX_REFN_bo(ctx, bin, fl, bo) \
  37.    nv50_add_bufctx_resident_bo(ctx, NV50_BIND_##bin, fl, bo);
  38.  
  39. #define BCTX_REFN(bctx, bin, res, acc) \
  40.    nv50_add_bufctx_resident(bctx, NV50_BIND_##bin, res, NOUVEAU_BO_##acc)
  41.  
  42. static INLINE void
  43. PUSH_REFN(struct nouveau_pushbuf *push, struct nouveau_bo *bo, uint32_t flags)
  44. {
  45.    struct nouveau_pushbuf_refn ref = { bo, flags };
  46.    nouveau_pushbuf_refn(push, &ref, 1);
  47. }
  48.  
  49.  
  50. #define SUBC_3D(m) 3, (m)
  51. #define NV50_3D(n) SUBC_3D(NV50_3D_##n)
  52. #define NVA0_3D(n) SUBC_3D(NVA0_3D_##n)
  53.  
  54. #define SUBC_2D(m) 4, (m)
  55. #define NV50_2D(n) SUBC_2D(NV50_2D_##n)
  56.  
  57. #define SUBC_M2MF(m) 5, (m)
  58. #define NV50_M2MF(n) SUBC_M2MF(NV50_M2MF_##n)
  59.  
  60. #define SUBC_COMPUTE(m) 6, (m)
  61. #define NV50_COMPUTE(n) SUBC_COMPUTE(NV50_COMPUTE_##n)
  62.  
  63. /* These are expected to be on their own pushbufs */
  64. #define SUBC_BSP(m) 2, (m)
  65. #define SUBC_VP(m) 2, (m)
  66.  
  67.  
  68. static INLINE uint32_t
  69. NV50_FIFO_PKHDR(int subc, int mthd, unsigned size)
  70. {
  71.    return 0x00000000 | (size << 18) | (subc << 13) | mthd;
  72. }
  73.  
  74. static INLINE uint32_t
  75. NV50_FIFO_PKHDR_NI(int subc, int mthd, unsigned size)
  76. {
  77.    return 0x40000000 | (size << 18) | (subc << 13) | mthd;
  78. }
  79.  
  80. static INLINE uint32_t
  81. NV50_FIFO_PKHDR_L(int subc, int mthd)
  82. {
  83.    return 0x00030000 | (subc << 13) | mthd;
  84. }
  85.  
  86.  
  87. static INLINE uint32_t
  88. nouveau_bo_memtype(const struct nouveau_bo *bo)
  89. {
  90.    return bo->config.nv50.memtype;
  91. }
  92.  
  93.  
  94. static INLINE void
  95. PUSH_DATAh(struct nouveau_pushbuf *push, uint64_t data)
  96. {
  97.    *push->cur++ = (uint32_t)(data >> 32);
  98. }
  99.  
  100. static INLINE void
  101. BEGIN_NV04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
  102. {
  103. #ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING
  104.    PUSH_SPACE(push, size + 1);
  105. #endif
  106.    PUSH_DATA (push, NV50_FIFO_PKHDR(subc, mthd, size));
  107. }
  108.  
  109. static INLINE void
  110. BEGIN_NI04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
  111. {
  112. #ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING
  113.    PUSH_SPACE(push, size + 1);
  114. #endif
  115.    PUSH_DATA (push, NV50_FIFO_PKHDR_NI(subc, mthd, size));
  116. }
  117.  
  118. /* long, non-incremental, nv50-only */
  119. static INLINE void
  120. BEGIN_NL50(struct nouveau_pushbuf *push, int subc, int mthd, uint32_t size)
  121. {
  122. #ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING
  123.    PUSH_SPACE(push, 2);
  124. #endif
  125.    PUSH_DATA (push, NV50_FIFO_PKHDR_L(subc, mthd));
  126.    PUSH_DATA (push, size);
  127. }
  128.  
  129. #endif /* __NV50_WINSYS_H__ */
  130.