1 1.1 riastrad /* $NetBSD: drm_sarea.h,v 1.2 2021/12/18 23:45:46 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /** 4 1.1 riastrad * \file drm_sarea.h 5 1.1 riastrad * \brief SAREA definitions 6 1.1 riastrad * 7 1.1 riastrad * \author Michel Dnzer <michel (at) daenzer.net> 8 1.1 riastrad */ 9 1.1 riastrad 10 1.1 riastrad /* 11 1.1 riastrad * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. 12 1.1 riastrad * All Rights Reserved. 13 1.1 riastrad * 14 1.1 riastrad * Permission is hereby granted, free of charge, to any person obtaining a 15 1.1 riastrad * copy of this software and associated documentation files (the "Software"), 16 1.1 riastrad * to deal in the Software without restriction, including without limitation 17 1.1 riastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense, 18 1.1 riastrad * and/or sell copies of the Software, and to permit persons to whom the 19 1.1 riastrad * Software is furnished to do so, subject to the following conditions: 20 1.1 riastrad * 21 1.1 riastrad * The above copyright notice and this permission notice (including the next 22 1.1 riastrad * paragraph) shall be included in all copies or substantial portions of the 23 1.1 riastrad * Software. 24 1.1 riastrad * 25 1.1 riastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 1.1 riastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 1.1 riastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 28 1.1 riastrad * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 29 1.1 riastrad * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 30 1.1 riastrad * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 31 1.1 riastrad * OTHER DEALINGS IN THE SOFTWARE. 32 1.1 riastrad */ 33 1.1 riastrad 34 1.1 riastrad #ifndef _DRM_SAREA_H_ 35 1.1 riastrad #define _DRM_SAREA_H_ 36 1.1 riastrad 37 1.1 riastrad #include "drm.h" 38 1.1 riastrad 39 1.1 riastrad #if defined(__cplusplus) 40 1.1 riastrad extern "C" { 41 1.1 riastrad #endif 42 1.1 riastrad 43 1.1 riastrad /* SAREA area needs to be at least a page */ 44 1.1 riastrad #if defined(__alpha__) 45 1.1 riastrad #define SAREA_MAX 0x2000U 46 1.1 riastrad #elif defined(__mips__) 47 1.1 riastrad #define SAREA_MAX 0x4000U 48 1.1 riastrad #elif defined(__ia64__) 49 1.1 riastrad #define SAREA_MAX 0x10000U /* 64kB */ 50 1.1 riastrad #else 51 1.1 riastrad /* Intel 830M driver needs at least 8k SAREA */ 52 1.1 riastrad #define SAREA_MAX 0x2000U 53 1.1 riastrad #endif 54 1.1 riastrad 55 1.1 riastrad /** Maximum number of drawables in the SAREA */ 56 1.1 riastrad #define SAREA_MAX_DRAWABLES 256 57 1.1 riastrad 58 1.1 riastrad #define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 59 1.1 riastrad 60 1.1 riastrad /** SAREA drawable */ 61 1.1 riastrad struct drm_sarea_drawable { 62 1.1 riastrad unsigned int stamp; 63 1.1 riastrad unsigned int flags; 64 1.1 riastrad }; 65 1.1 riastrad 66 1.1 riastrad /** SAREA frame */ 67 1.1 riastrad struct drm_sarea_frame { 68 1.1 riastrad unsigned int x; 69 1.1 riastrad unsigned int y; 70 1.1 riastrad unsigned int width; 71 1.1 riastrad unsigned int height; 72 1.1 riastrad unsigned int fullscreen; 73 1.1 riastrad }; 74 1.1 riastrad 75 1.1 riastrad /** SAREA */ 76 1.1 riastrad struct drm_sarea { 77 1.1 riastrad /** first thing is always the DRM locking structure */ 78 1.1 riastrad struct drm_hw_lock lock; 79 1.1 riastrad /** \todo Use readers/writer lock for drm_sarea::drawable_lock */ 80 1.1 riastrad struct drm_hw_lock drawable_lock; 81 1.1 riastrad struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES]; /**< drawables */ 82 1.1 riastrad struct drm_sarea_frame frame; /**< frame */ 83 1.1 riastrad drm_context_t dummy_context; 84 1.1 riastrad }; 85 1.1 riastrad 86 1.1 riastrad #ifndef __KERNEL__ 87 1.1 riastrad typedef struct drm_sarea_drawable drm_sarea_drawable_t; 88 1.1 riastrad typedef struct drm_sarea_frame drm_sarea_frame_t; 89 1.1 riastrad typedef struct drm_sarea drm_sarea_t; 90 1.1 riastrad #endif 91 1.1 riastrad 92 1.1 riastrad #if defined(__cplusplus) 93 1.1 riastrad } 94 1.1 riastrad #endif 95 1.1 riastrad 96 1.1 riastrad #endif /* _DRM_SAREA_H_ */ 97