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: releng/11.0/sys/dev/drm/drm_sarea.h 268351 2014-07-07 00:27:09Z marcel $");
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#else
44130331Sanholt/* Intel 830M driver needs at least 8k SAREA */
45182080Srnoland#define SAREA_MAX                       0x2000UL
46130331Sanholt#endif
47130331Sanholt
48119098Sanholt/** Maximum number of drawables in the SAREA */
49182080Srnoland#define SAREA_MAX_DRAWABLES		256
50112015Sanholt
51130331Sanholt#define SAREA_DRAWABLE_CLAIMED_ENTRY    0x80000000
52130331Sanholt
53119098Sanholt/** SAREA drawable */
54182080Srnolandstruct drm_sarea_drawable {
55145132Sanholt	unsigned int stamp;
56145132Sanholt	unsigned int flags;
57182080Srnoland};
58112015Sanholt
59119098Sanholt/** SAREA frame */
60182080Srnolandstruct drm_sarea_frame {
61145132Sanholt	unsigned int x;
62145132Sanholt	unsigned int y;
63145132Sanholt	unsigned int width;
64145132Sanholt	unsigned int height;
65145132Sanholt	unsigned int fullscreen;
66182080Srnoland};
67112015Sanholt
68119098Sanholt/** SAREA */
69182080Srnolandstruct drm_sarea {
70119098Sanholt    /** first thing is always the DRM locking structure */
71182080Srnoland	struct drm_hw_lock lock;
72119098Sanholt    /** \todo Use readers/writer lock for drm_sarea::drawable_lock */
73182080Srnoland	struct drm_hw_lock drawable_lock;
74182080Srnoland	struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES];	/**< drawables */
75182080Srnoland	struct drm_sarea_frame frame;	/**< frame */
76145132Sanholt	drm_context_t dummy_context;
77182080Srnoland};
78112015Sanholt
79182080Srnoland#ifndef __KERNEL__
80182080Srnolandtypedef struct drm_sarea_drawable drm_sarea_drawable_t;
81182080Srnolandtypedef struct drm_sarea_frame drm_sarea_frame_t;
82182080Srnolandtypedef struct drm_sarea drm_sarea_t;
83182080Srnoland#endif
84182080Srnoland
85145132Sanholt#endif				/* _DRM_SAREA_H_ */
86