18c2ecf20Sopenharmony_ci/**
28c2ecf20Sopenharmony_ci * \file drm_sarea.h
38c2ecf20Sopenharmony_ci * \brief SAREA definitions
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * \author Michel Dänzer <michel@daenzer.net>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/*
98c2ecf20Sopenharmony_ci * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
108c2ecf20Sopenharmony_ci * All Rights Reserved.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
138c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
148c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
158c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
168c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
178c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next
208c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
218c2ecf20Sopenharmony_ci * Software.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
248c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
258c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
268c2ecf20Sopenharmony_ci * TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
278c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
288c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
298c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
308c2ecf20Sopenharmony_ci */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#ifndef _DRM_SAREA_H_
338c2ecf20Sopenharmony_ci#define _DRM_SAREA_H_
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#include "drm.h"
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#if defined(__cplusplus)
388c2ecf20Sopenharmony_ciextern "C" {
398c2ecf20Sopenharmony_ci#endif
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* SAREA area needs to be at least a page */
428c2ecf20Sopenharmony_ci#if defined(__alpha__)
438c2ecf20Sopenharmony_ci#define SAREA_MAX                       0x2000U
448c2ecf20Sopenharmony_ci#elif defined(__mips__)
458c2ecf20Sopenharmony_ci#define SAREA_MAX                       0x4000U
468c2ecf20Sopenharmony_ci#elif defined(__ia64__)
478c2ecf20Sopenharmony_ci#define SAREA_MAX                       0x10000U	/* 64kB */
488c2ecf20Sopenharmony_ci#else
498c2ecf20Sopenharmony_ci/* Intel 830M driver needs at least 8k SAREA */
508c2ecf20Sopenharmony_ci#define SAREA_MAX                       0x2000U
518c2ecf20Sopenharmony_ci#endif
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/** Maximum number of drawables in the SAREA */
548c2ecf20Sopenharmony_ci#define SAREA_MAX_DRAWABLES		256
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define SAREA_DRAWABLE_CLAIMED_ENTRY    0x80000000
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/** SAREA drawable */
598c2ecf20Sopenharmony_cistruct drm_sarea_drawable {
608c2ecf20Sopenharmony_ci	unsigned int stamp;
618c2ecf20Sopenharmony_ci	unsigned int flags;
628c2ecf20Sopenharmony_ci};
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci/** SAREA frame */
658c2ecf20Sopenharmony_cistruct drm_sarea_frame {
668c2ecf20Sopenharmony_ci	unsigned int x;
678c2ecf20Sopenharmony_ci	unsigned int y;
688c2ecf20Sopenharmony_ci	unsigned int width;
698c2ecf20Sopenharmony_ci	unsigned int height;
708c2ecf20Sopenharmony_ci	unsigned int fullscreen;
718c2ecf20Sopenharmony_ci};
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/** SAREA */
748c2ecf20Sopenharmony_cistruct drm_sarea {
758c2ecf20Sopenharmony_ci    /** first thing is always the DRM locking structure */
768c2ecf20Sopenharmony_ci	struct drm_hw_lock lock;
778c2ecf20Sopenharmony_ci    /** \todo Use readers/writer lock for drm_sarea::drawable_lock */
788c2ecf20Sopenharmony_ci	struct drm_hw_lock drawable_lock;
798c2ecf20Sopenharmony_ci	struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES];	/**< drawables */
808c2ecf20Sopenharmony_ci	struct drm_sarea_frame frame;	/**< frame */
818c2ecf20Sopenharmony_ci	drm_context_t dummy_context;
828c2ecf20Sopenharmony_ci};
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#ifndef __KERNEL__
858c2ecf20Sopenharmony_citypedef struct drm_sarea_drawable drm_sarea_drawable_t;
868c2ecf20Sopenharmony_citypedef struct drm_sarea_frame drm_sarea_frame_t;
878c2ecf20Sopenharmony_citypedef struct drm_sarea drm_sarea_t;
888c2ecf20Sopenharmony_ci#endif
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#if defined(__cplusplus)
918c2ecf20Sopenharmony_ci}
928c2ecf20Sopenharmony_ci#endif
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#endif				/* _DRM_SAREA_H_ */
95