Path: blob/21.2-virgl/src/gallium/drivers/nouveau/nouveau_winsys.h
4570 views
#ifndef NOUVEAU_WINSYS_H1#define NOUVEAU_WINSYS_H23#include <stdint.h>4#include <inttypes.h>56#include "pipe/p_defines.h"78#include "drm-uapi/drm.h"9#include <nouveau.h>1011#ifndef NV04_PFIFO_MAX_PACKET_LEN12#define NV04_PFIFO_MAX_PACKET_LEN 204713#endif1415#define NOUVEAU_MIN_BUFFER_MAP_ALIGN 6416#define NOUVEAU_MIN_BUFFER_MAP_ALIGN_MASK (NOUVEAU_MIN_BUFFER_MAP_ALIGN - 1)1718static inline uint32_t19PUSH_AVAIL(struct nouveau_pushbuf *push)20{21return push->end - push->cur;22}2324static inline bool25PUSH_SPACE(struct nouveau_pushbuf *push, uint32_t size)26{27/* Provide a buffer so that fences always have room to be emitted */28size += 8;29if (PUSH_AVAIL(push) < size)30return nouveau_pushbuf_space(push, size, 0, 0) == 0;31return true;32}3334static inline void35PUSH_DATA(struct nouveau_pushbuf *push, uint32_t data)36{37*push->cur++ = data;38}3940static inline void41PUSH_DATAp(struct nouveau_pushbuf *push, const void *data, uint32_t size)42{43memcpy(push->cur, data, size * 4);44push->cur += size;45}4647static inline void48PUSH_DATAb(struct nouveau_pushbuf *push, const void *data, uint32_t size)49{50memcpy(push->cur, data, size);51push->cur += DIV_ROUND_UP(size, 4);52}5354static inline void55PUSH_DATAf(struct nouveau_pushbuf *push, float f)56{57union { float f; uint32_t i; } u;58u.f = f;59PUSH_DATA(push, u.i);60}6162static inline void63PUSH_KICK(struct nouveau_pushbuf *push)64{65nouveau_pushbuf_kick(push, push->channel);66}676869#define NOUVEAU_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)70#define NOUVEAU_RESOURCE_FLAG_DRV_PRIV (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)7172static inline uint32_t73nouveau_screen_transfer_flags(unsigned pipe)74{75uint32_t flags = 0;7677if (!(pipe & PIPE_MAP_UNSYNCHRONIZED)) {78if (pipe & PIPE_MAP_READ)79flags |= NOUVEAU_BO_RD;80if (pipe & PIPE_MAP_WRITE)81flags |= NOUVEAU_BO_WR;82if (pipe & PIPE_MAP_DONTBLOCK)83flags |= NOUVEAU_BO_NOBLOCK;84}8586return flags;87}8889extern struct nouveau_screen *90nv30_screen_create(struct nouveau_device *);9192extern struct nouveau_screen *93nv50_screen_create(struct nouveau_device *);9495extern struct nouveau_screen *96nvc0_screen_create(struct nouveau_device *);9798#endif99100101