7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync/*
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * Copyright 2007 Nouveau Project
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync *
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * Permission is hereby granted, free of charge, to any person obtaining a
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * copy of this software and associated documentation files (the "Software"),
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * to deal in the Software without restriction, including without limitation
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * and/or sell copies of the Software, and to permit persons to whom the
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * Software is furnished to do so, subject to the following conditions:
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync *
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * The above copyright notice and this permission notice shall be included in
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * all copies or substantial portions of the Software.
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync *
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync * SOFTWARE.
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync */
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#ifndef __NOUVEAU_BO_H__
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define __NOUVEAU_BO_H__
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync/* Relocation/Buffer type flags */
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_VRAM (1 << 0)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_GART (1 << 1)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_RD (1 << 2)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_WR (1 << 3)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_RDWR (NOUVEAU_BO_RD | NOUVEAU_BO_WR)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_MAP (1 << 4)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_PIN (1 << 5)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_LOW (1 << 6)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_HIGH (1 << 7)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_OR (1 << 8)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_LOCAL (1 << 9)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_TILED (1 << 10)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_ZTILE (1 << 11)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_INVAL (1 << 12)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_NOSYNC (1 << 13)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_NOWAIT (1 << 14)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_IFLUSH (1 << 15)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#define NOUVEAU_BO_DUMMY (1 << 31)
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncstruct nouveau_bo {
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync struct nouveau_device *device;
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync uint32_t handle;
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync uint64_t size;
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync void *map;
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync uint32_t tile_mode;
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync uint32_t tile_flags;
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync /* Available when buffer is pinned *only* */
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync uint32_t flags;
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync uint64_t offset;
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync};
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_new(struct nouveau_device *, uint32_t flags, int align, int size,
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync struct nouveau_bo **);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_new_tile(struct nouveau_device *, uint32_t flags, int align,
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync int size, uint32_t tile_mode, uint32_t tile_flags,
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync struct nouveau_bo **);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_user(struct nouveau_device *, void *ptr, int size,
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync struct nouveau_bo **);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_wrap(struct nouveau_device *, uint32_t handle, struct nouveau_bo **);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_handle_get(struct nouveau_bo *, uint32_t *);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_handle_ref(struct nouveau_device *, uint32_t handle,
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync struct nouveau_bo **);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_ref(struct nouveau_bo *, struct nouveau_bo **);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_map_range(struct nouveau_bo *, uint32_t delta, uint32_t size,
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync uint32_t flags);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncvoid
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_map_flush(struct nouveau_bo *, uint32_t delta, uint32_t size);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_map(struct nouveau_bo *, uint32_t flags);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncvoid
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_unmap(struct nouveau_bo *);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_pin(struct nouveau_bo *, uint32_t flags);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncvoid
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_unpin(struct nouveau_bo *);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncint
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsyncnouveau_bo_busy(struct nouveau_bo *, uint32_t access);
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync
7a0d67332f33bc21290d63bc7c8150b0cf0a4b21vboxsync#endif