1119098Sanholt/**
2145132Sanholt * \file drm_sarea.h
3119098Sanholt * \brief SAREA definitions
4112015Sanholt *
5130331Sanholt * \author Michel D���zer <michel@daenzer.net>
6119098Sanholt */
7119098Sanholt
8139749Simp/*-
9112015Sanholt * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
10112015Sanholt * All Rights Reserved.
11112015Sanholt *
12112015Sanholt * Permission is hereby granted, free of charge, to any person obtaining a
13112015Sanholt * copy of this software and associated documentation files (the "Software"),
14112015Sanholt * to deal in the Software without restriction, including without limitation
15112015Sanholt * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16112015Sanholt * and/or sell copies of the Software, and to permit persons to whom the
17112015Sanholt * Software is furnished to do so, subject to the following conditions:
18112015Sanholt *
19112015Sanholt * The above copyright notice and this permission notice (including the next
20112015Sanholt * paragraph) shall be included in all copies or substantial portions of the
21112015Sanholt * Software.
22112015Sanholt *
23112015Sanholt * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24112015Sanholt * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25112015Sanholt * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
26112015Sanholt * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27112015Sanholt * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28112015Sanholt * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29112015Sanholt * OTHER DEALINGS IN THE SOFTWARE.
30112015Sanholt */
31112015Sanholt
32152909Sanholt#include <sys/cdefs.h>
33152909Sanholt__FBSDID("$FreeBSD$");
34152909Sanholt
35112015Sanholt#ifndef _DRM_SAREA_H_
36112015Sanholt#define _DRM_SAREA_H_
37112015Sanholt
38130331Sanholt#include "dev/drm/drm.h"
39130331Sanholt
40130331Sanholt/* SAREA area needs to be at least a page */
41130331Sanholt#if defined(__alpha__)
42130331Sanholt#define SAREA_MAX                       0x2000
43130331Sanholt#elif defined(__ia64__)
44145132Sanholt#define SAREA_MAX                       0x10000	/* 64kB */
45130331Sanholt#else
46130331Sanholt/* Intel 830M driver needs at least 8k SAREA */
47182080Srnoland#define SAREA_MAX                       0x2000UL
48130331Sanholt#endif
49130331Sanholt
50119098Sanholt/** Maximum number of drawables in the SAREA */
51182080Srnoland#define SAREA_MAX_DRAWABLES		256
52112015Sanholt
53130331Sanholt#define SAREA_DRAWABLE_CLAIMED_ENTRY    0x80000000
54130331Sanholt
55119098Sanholt/** SAREA drawable */
56182080Srnolandstruct drm_sarea_drawable {
57145132Sanholt	unsigned int stamp;
58145132Sanholt	unsigned int flags;
59182080Srnoland};
60112015Sanholt
61119098Sanholt/** SAREA frame */
62182080Srnolandstruct drm_sarea_frame {
63145132Sanholt	unsigned int x;
64145132Sanholt	unsigned int y;
65145132Sanholt	unsigned int width;
66145132Sanholt	unsigned int height;
67145132Sanholt	unsigned int fullscreen;
68182080Srnoland};
69112015Sanholt
70119098Sanholt/** SAREA */
71182080Srnolandstruct drm_sarea {
72119098Sanholt    /** first thing is always the DRM locking structure */
73182080Srnoland	struct drm_hw_lock lock;
74119098Sanholt    /** \todo Use readers/writer lock for drm_sarea::drawable_lock */
75182080Srnoland	struct drm_hw_lock drawable_lock;
76182080Srnoland	struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES];	/**< drawables */
77182080Srnoland	struct drm_sarea_frame frame;	/**< frame */
78145132Sanholt	drm_context_t dummy_context;
79182080Srnoland};
80112015Sanholt
81182080Srnoland#ifndef __KERNEL__
82182080Srnolandtypedef struct drm_sarea_drawable drm_sarea_drawable_t;
83182080Srnolandtypedef struct drm_sarea_frame drm_sarea_frame_t;
84182080Srnolandtypedef struct drm_sarea drm_sarea_t;
85182080Srnoland#endif
86182080Srnoland
87145132Sanholt#endif				/* _DRM_SAREA_H_ */
88