190b17f1bSmrg/* 290b17f1bSmrg * Copyright 2011 James Simmons, All Rights Reserved. 390b17f1bSmrg * 490b17f1bSmrg * Permission is hereby granted, free of charge, to any person obtaining a 590b17f1bSmrg * copy of this software and associated documentation files (the "Software"), 690b17f1bSmrg * to deal in the Software without restriction, including without limitation 790b17f1bSmrg * the rights to use, copy, modify, merge, publish, distribute, sub license, 890b17f1bSmrg * and/or sell copies of the Software, and to permit persons to whom the 990b17f1bSmrg * Software is furnished to do so, subject to the following conditions: 1090b17f1bSmrg * 1190b17f1bSmrg * The above copyright notice and this permission notice (including the 1290b17f1bSmrg * next paragraph) shall be included in all copies or substantial portions 1390b17f1bSmrg * of the Software. 1490b17f1bSmrg * 1590b17f1bSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1690b17f1bSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1790b17f1bSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 1890b17f1bSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1990b17f1bSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 2090b17f1bSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 2190b17f1bSmrg * DEALINGS IN THE SOFTWARE. 2290b17f1bSmrg */ 2390b17f1bSmrg#ifndef _VIA_MEMMGR_H_ 2490b17f1bSmrg#define _VIA_MEMMGR_H_ 2590b17f1bSmrg 2690b17f1bSmrg#include <sys/mman.h> 2790b17f1bSmrg#include "xf86.h" 2890b17f1bSmrg 2990b17f1bSmrg#define TTM_PL_FLAG_SYSTEM 1 3090b17f1bSmrg#define TTM_PL_FLAG_TT 2 3190b17f1bSmrg#define TTM_PL_FLAG_VRAM 4 3290b17f1bSmrg 3390b17f1bSmrgstruct buffer_object { 3490b17f1bSmrg off_t map_offset; 3590b17f1bSmrg unsigned long handle; 3690b17f1bSmrg unsigned long offset; /* Offset into fb */ 3790b17f1bSmrg unsigned long pitch; 3890b17f1bSmrg unsigned long size; 3990b17f1bSmrg void *ptr; 4090b17f1bSmrg int domain; 4190b17f1bSmrg}; 4290b17f1bSmrg 4390b17f1bSmrg/* In via_memory.c */ 4490b17f1bSmrgBool drm_bo_manager_init(ScrnInfoPtr pScrn); 4590b17f1bSmrg 4690b17f1bSmrgstruct buffer_object * 4790b17f1bSmrgdrm_bo_alloc_surface(ScrnInfoPtr pScrn, unsigned int width, unsigned int height, 4890b17f1bSmrg int format, unsigned int alignment, int domain); 4990b17f1bSmrgstruct buffer_object * 5090b17f1bSmrgdrm_bo_alloc(ScrnInfoPtr pScrn, unsigned int size, unsigned int alignment, 5190b17f1bSmrg int domain); 5290b17f1bSmrgvoid *drm_bo_map(ScrnInfoPtr pScrn, struct buffer_object *obj); 5390b17f1bSmrgvoid drm_bo_unmap(ScrnInfoPtr pScrn, struct buffer_object *obj); 5490b17f1bSmrgvoid drm_bo_free(ScrnInfoPtr pScrn, struct buffer_object *); 5590b17f1bSmrg 5690b17f1bSmrg#endif 57