nouveau_winsys.h revision 848b8605
1#ifndef NOUVEAU_WINSYS_H 2#define NOUVEAU_WINSYS_H 3 4#include <stdint.h> 5#include <inttypes.h> 6 7#include "pipe/p_defines.h" 8 9#include <nouveau.h> 10 11#ifndef NV04_PFIFO_MAX_PACKET_LEN 12#define NV04_PFIFO_MAX_PACKET_LEN 2047 13#endif 14 15#define NOUVEAU_MIN_BUFFER_MAP_ALIGN 64 16#define NOUVEAU_MIN_BUFFER_MAP_ALIGN_MASK (NOUVEAU_MIN_BUFFER_MAP_ALIGN - 1) 17 18static INLINE uint32_t 19PUSH_AVAIL(struct nouveau_pushbuf *push) 20{ 21 return push->end - push->cur; 22} 23 24static INLINE boolean 25PUSH_SPACE(struct nouveau_pushbuf *push, uint32_t size) 26{ 27 if (PUSH_AVAIL(push) < size) 28 return nouveau_pushbuf_space(push, size, 0, 0) == 0; 29 return TRUE; 30} 31 32static INLINE void 33PUSH_DATA(struct nouveau_pushbuf *push, uint32_t data) 34{ 35 *push->cur++ = data; 36} 37 38static INLINE void 39PUSH_DATAp(struct nouveau_pushbuf *push, const void *data, uint32_t size) 40{ 41 memcpy(push->cur, data, size * 4); 42 push->cur += size; 43} 44 45static INLINE void 46PUSH_DATAf(struct nouveau_pushbuf *push, float f) 47{ 48 union { float f; uint32_t i; } u; 49 u.f = f; 50 PUSH_DATA(push, u.i); 51} 52 53static INLINE void 54PUSH_KICK(struct nouveau_pushbuf *push) 55{ 56 nouveau_pushbuf_kick(push, push->channel); 57} 58 59 60#define NOUVEAU_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) 61#define NOUVEAU_RESOURCE_FLAG_DRV_PRIV (PIPE_RESOURCE_FLAG_DRV_PRIV << 1) 62 63static INLINE uint32_t 64nouveau_screen_transfer_flags(unsigned pipe) 65{ 66 uint32_t flags = 0; 67 68 if (!(pipe & PIPE_TRANSFER_UNSYNCHRONIZED)) { 69 if (pipe & PIPE_TRANSFER_READ) 70 flags |= NOUVEAU_BO_RD; 71 if (pipe & PIPE_TRANSFER_WRITE) 72 flags |= NOUVEAU_BO_WR; 73 if (pipe & PIPE_TRANSFER_DONTBLOCK) 74 flags |= NOUVEAU_BO_NOBLOCK; 75 } 76 77 return flags; 78} 79 80extern struct pipe_screen * 81nv30_screen_create(struct nouveau_device *); 82 83extern struct pipe_screen * 84nv50_screen_create(struct nouveau_device *); 85 86extern struct pipe_screen * 87nvc0_screen_create(struct nouveau_device *); 88 89#endif 90