blob: 413a5642d49f55a711bf998beb222740b2e021d2 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/**
Dave Airlieb5e89ed2005-09-25 14:28:13 +10002 * \file drm_sarea.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * \brief SAREA definitions
4 *
Jan Engelhardt96de0e22007-10-19 23:21:04 +02005 * \author Michel Dänzer <michel@daenzer.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 */
7
8/*
9 * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
10 * All Rights Reserved.
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice (including the next
20 * paragraph) shall be included in all copies or substantial portions of the
21 * Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29 * OTHER DEALINGS IN THE SOFTWARE.
30 */
31
32#ifndef _DRM_SAREA_H_
33#define _DRM_SAREA_H_
34
David Howellsa1ce3922012-10-02 18:01:25 +010035#include <drm/drm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
37/* SAREA area needs to be at least a page */
38#if defined(__alpha__)
Dave Airlie7c1c2872008-11-28 14:22:24 +100039#define SAREA_MAX 0x2000U
Huacai Chenfc7b8122012-08-11 09:32:18 +000040#elif defined(__mips__)
41#define SAREA_MAX 0x4000U
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#elif defined(__ia64__)
Dave Airlie7c1c2872008-11-28 14:22:24 +100043#define SAREA_MAX 0x10000U /* 64kB */
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#else
45/* Intel 830M driver needs at least 8k SAREA */
Dave Airlie7c1c2872008-11-28 14:22:24 +100046#define SAREA_MAX 0x2000U
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#endif
48
49/** Maximum number of drawables in the SAREA */
Dave Airliebc5f4522007-11-05 12:50:58 +100050#define SAREA_MAX_DRAWABLES 256
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
52#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000
53
54/** SAREA drawable */
Dave Airliebd63cb52007-07-12 10:35:02 +100055struct drm_sarea_drawable {
Dave Airlieb5e89ed2005-09-25 14:28:13 +100056 unsigned int stamp;
57 unsigned int flags;
Dave Airliebd63cb52007-07-12 10:35:02 +100058};
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
60/** SAREA frame */
Dave Airliebd63cb52007-07-12 10:35:02 +100061struct drm_sarea_frame {
Dave Airlieb5e89ed2005-09-25 14:28:13 +100062 unsigned int x;
63 unsigned int y;
64 unsigned int width;
65 unsigned int height;
66 unsigned int fullscreen;
Dave Airliebd63cb52007-07-12 10:35:02 +100067};
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
69/** SAREA */
Dave Airliebd63cb52007-07-12 10:35:02 +100070struct drm_sarea {
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 /** first thing is always the DRM locking structure */
Dave Airliec60ce622007-07-11 15:27:12 +100072 struct drm_hw_lock lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 /** \todo Use readers/writer lock for drm_sarea::drawable_lock */
Dave Airliec60ce622007-07-11 15:27:12 +100074 struct drm_hw_lock drawable_lock;
Dave Airliebd63cb52007-07-12 10:35:02 +100075 struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES]; /**< drawables */
76 struct drm_sarea_frame frame; /**< frame */
Dave Airlieb5e89ed2005-09-25 14:28:13 +100077 drm_context_t dummy_context;
Dave Airliebd63cb52007-07-12 10:35:02 +100078};
79
80#ifndef __KERNEL__
81typedef struct drm_sarea_drawable drm_sarea_drawable_t;
82typedef struct drm_sarea_frame drm_sarea_frame_t;
83typedef struct drm_sarea drm_sarea_t;
84#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
Dave Airlieb5e89ed2005-09-25 14:28:13 +100086#endif /* _DRM_SAREA_H_ */