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