122944501Smrg/**
222944501Smrg * \file drm_sarea.h
322944501Smrg * \brief SAREA definitions
422944501Smrg *
522944501Smrg * \author Michel Dänzer <michel@daenzer.net>
622944501Smrg */
722944501Smrg
822944501Smrg/*
922944501Smrg * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
1022944501Smrg * All Rights Reserved.
1122944501Smrg *
1222944501Smrg * Permission is hereby granted, free of charge, to any person obtaining a
1322944501Smrg * copy of this software and associated documentation files (the "Software"),
1422944501Smrg * to deal in the Software without restriction, including without limitation
1522944501Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1622944501Smrg * and/or sell copies of the Software, and to permit persons to whom the
1722944501Smrg * Software is furnished to do so, subject to the following conditions:
1822944501Smrg *
1922944501Smrg * The above copyright notice and this permission notice (including the next
2022944501Smrg * paragraph) shall be included in all copies or substantial portions of the
2122944501Smrg * Software.
2222944501Smrg *
2322944501Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2422944501Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2522944501Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2622944501Smrg * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
2722944501Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2822944501Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2922944501Smrg * OTHER DEALINGS IN THE SOFTWARE.
3022944501Smrg */
3122944501Smrg
3222944501Smrg#ifndef _DRM_SAREA_H_
3322944501Smrg#define _DRM_SAREA_H_
3422944501Smrg
3522944501Smrg#include "drm.h"
3622944501Smrg
37d8807b2fSmrg#if defined(__cplusplus)
38d8807b2fSmrgextern "C" {
39d8807b2fSmrg#endif
40d8807b2fSmrg
4122944501Smrg/* SAREA area needs to be at least a page */
4222944501Smrg#if defined(__alpha__)
4322944501Smrg#define SAREA_MAX                       0x2000U
443f012e29Smrg#elif defined(__mips__)
453f012e29Smrg#define SAREA_MAX                       0x4000U
4622944501Smrg#elif defined(__ia64__)
4722944501Smrg#define SAREA_MAX                       0x10000U	/* 64kB */
4822944501Smrg#else
4922944501Smrg/* Intel 830M driver needs at least 8k SAREA */
5022944501Smrg#define SAREA_MAX                       0x2000U
5122944501Smrg#endif
5222944501Smrg
5322944501Smrg/** Maximum number of drawables in the SAREA */
5422944501Smrg#define SAREA_MAX_DRAWABLES		256
5522944501Smrg
5622944501Smrg#define SAREA_DRAWABLE_CLAIMED_ENTRY    0x80000000
5722944501Smrg
5822944501Smrg/** SAREA drawable */
5922944501Smrgstruct drm_sarea_drawable {
6022944501Smrg	unsigned int stamp;
6122944501Smrg	unsigned int flags;
6222944501Smrg};
6322944501Smrg
6422944501Smrg/** SAREA frame */
6522944501Smrgstruct drm_sarea_frame {
6622944501Smrg	unsigned int x;
6722944501Smrg	unsigned int y;
6822944501Smrg	unsigned int width;
6922944501Smrg	unsigned int height;
7022944501Smrg	unsigned int fullscreen;
7122944501Smrg};
7222944501Smrg
7322944501Smrg/** SAREA */
7422944501Smrgstruct drm_sarea {
7522944501Smrg    /** first thing is always the DRM locking structure */
7622944501Smrg	struct drm_hw_lock lock;
7722944501Smrg    /** \todo Use readers/writer lock for drm_sarea::drawable_lock */
7822944501Smrg	struct drm_hw_lock drawable_lock;
7922944501Smrg	struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES];	/**< drawables */
8022944501Smrg	struct drm_sarea_frame frame;	/**< frame */
8122944501Smrg	drm_context_t dummy_context;
8222944501Smrg};
8322944501Smrg
8422944501Smrgtypedef struct drm_sarea_drawable drm_sarea_drawable_t;
8522944501Smrgtypedef struct drm_sarea_frame drm_sarea_frame_t;
8622944501Smrgtypedef struct drm_sarea drm_sarea_t;
8722944501Smrg
88d8807b2fSmrg#if defined(__cplusplus)
89d8807b2fSmrg}
90d8807b2fSmrg#endif
91d8807b2fSmrg
9222944501Smrg#endif				/* _DRM_SAREA_H_ */
93