1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright © 2008 Jérôme Glisse 3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright © 2011 Marek Olšák <maraeo@gmail.com> 4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * All Rights Reserved. 5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining 7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * a copy of this software and associated documentation files (the 8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * "Software"), to deal in the Software without restriction, including 9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * without limitation the rights to use, copy, modify, merge, publish, 10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * distribute, sub license, and/or sell copies of the Software, and to 11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * permit persons to whom the Software is furnished to do so, subject to 12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the following conditions: 13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS 18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * USE OR OTHER DEALINGS IN THE SOFTWARE. 22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the 24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * next paragraph) shall be included in all copies or substantial portions 25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * of the Software. 26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* 28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Authors: 29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Jérôme Glisse <glisse@freedesktop.org> 30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Marek Olšák <maraeo@gmail.com> 31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef RADEON_DRM_BO_H 33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define RADEON_DRM_BO_H 34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "radeon_drm_winsys.h" 36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipebuffer/pb_bufmgr.h" 37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "os/os_thread.h" 38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct radeon_bomgr; 40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct radeon_bo_desc { 42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pb_desc base; 43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned initial_domains; 45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct radeon_bo { 48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pb_buffer base; 49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct radeon_bomgr *mgr; 51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct radeon_drm_winsys *rws; 52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void *ptr; 54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org pipe_mutex map_mutex; 55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t handle; 57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t name; 58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint64_t va; 59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint64_t va_size; 60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* how many command streams is this bo referenced in? */ 62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int num_cs_references; 63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /* how many command streams, which are being emitted in a separate 65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * thread, is this bo referenced in? */ 66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int num_active_ioctls; 67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org boolean flinked; 69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t flink; 70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct pb_manager *radeon_bomgr_create(struct radeon_drm_winsys *rws); 73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid radeon_bomgr_init_functions(struct radeon_drm_winsys *ws); 74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE 76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid radeon_bo_reference(struct radeon_bo **dst, struct radeon_bo *src) 77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org pb_reference((struct pb_buffer**)dst, (struct pb_buffer*)src); 79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif 82