dri2.h revision 03b705cf
103b705cfSriastradh/* 203b705cfSriastradh * Copyright © 2007,2008 Red Hat, Inc. 303b705cfSriastradh * 403b705cfSriastradh * Permission is hereby granted, free of charge, to any person obtaining a 503b705cfSriastradh * copy of this software and associated documentation files (the "Soft- 603b705cfSriastradh * ware"), to deal in the Software without restriction, including without 703b705cfSriastradh * limitation the rights to use, copy, modify, merge, publish, distribute, 803b705cfSriastradh * and/or sell copies of the Software, and to permit persons to whom the 903b705cfSriastradh * Software is furnished to do so, provided that the above copyright 1003b705cfSriastradh * notice(s) and this permission notice appear in all copies of the Soft- 1103b705cfSriastradh * ware and that both the above copyright notice(s) and this permission 1203b705cfSriastradh * notice appear in supporting documentation. 1303b705cfSriastradh * 1403b705cfSriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1503b705cfSriastradh * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 1603b705cfSriastradh * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY 1703b705cfSriastradh * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN 1803b705cfSriastradh * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- 1903b705cfSriastradh * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 2003b705cfSriastradh * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 2103b705cfSriastradh * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- 2203b705cfSriastradh * MANCE OF THIS SOFTWARE. 2303b705cfSriastradh * 2403b705cfSriastradh * Except as contained in this notice, the name of a copyright holder shall 2503b705cfSriastradh * not be used in advertising or otherwise to promote the sale, use or 2603b705cfSriastradh * other dealings in this Software without prior written authorization of 2703b705cfSriastradh * the copyright holder. 2803b705cfSriastradh * 2903b705cfSriastradh * Authors: 3003b705cfSriastradh * Kristian Høgsberg (krh@redhat.com) 3103b705cfSriastradh */ 3203b705cfSriastradh 3303b705cfSriastradh#ifndef _DRI2_H_ 3403b705cfSriastradh#define _DRI2_H_ 3503b705cfSriastradh 3603b705cfSriastradh#include <stdint.h> 3703b705cfSriastradh 3803b705cfSriastradh#include <X11/extensions/Xfixes.h> 3903b705cfSriastradh#include <X11/extensions/dri2tokens.h> 4003b705cfSriastradh 4103b705cfSriastradhtypedef struct 4203b705cfSriastradh{ 4303b705cfSriastradh unsigned int attachment; 4403b705cfSriastradh unsigned int name; 4503b705cfSriastradh unsigned int pitch; 4603b705cfSriastradh unsigned int cpp; 4703b705cfSriastradh unsigned int flags; 4803b705cfSriastradh} DRI2Buffer; 4903b705cfSriastradh 5003b705cfSriastradhextern Bool 5103b705cfSriastradhDRI2QueryExtension(Display * display, int *eventBase, int *errorBase); 5203b705cfSriastradh 5303b705cfSriastradhextern Bool 5403b705cfSriastradhDRI2QueryVersion(Display * display, int *major, int *minor); 5503b705cfSriastradh 5603b705cfSriastradhextern Bool 5703b705cfSriastradhDRI2Connect(Display * display, XID window, 5803b705cfSriastradh char **driverName, char **deviceName); 5903b705cfSriastradh 6003b705cfSriastradhextern Bool 6103b705cfSriastradhDRI2Authenticate(Display * display, XID window, unsigned int magic); 6203b705cfSriastradh 6303b705cfSriastradhextern void 6403b705cfSriastradhDRI2CreateDrawable(Display * display, XID drawable); 6503b705cfSriastradh 6603b705cfSriastradhextern void 6703b705cfSriastradhDRI2DestroyDrawable(Display * display, XID handle); 6803b705cfSriastradh 6903b705cfSriastradhextern DRI2Buffer* 7003b705cfSriastradhDRI2GetBuffers(Display * dpy, XID drawable, 7103b705cfSriastradh int *width, int *height, 7203b705cfSriastradh unsigned int *attachments, int count, 7303b705cfSriastradh int *outCount); 7403b705cfSriastradh 7503b705cfSriastradh/** 7603b705cfSriastradh * \note 7703b705cfSriastradh * This function is only supported with DRI2 version 1.1 or later. 7803b705cfSriastradh */ 7903b705cfSriastradhextern DRI2Buffer* 8003b705cfSriastradhDRI2GetBuffersWithFormat(Display * dpy, XID drawable, 8103b705cfSriastradh int *width, int *height, 8203b705cfSriastradh unsigned int *attachments, 8303b705cfSriastradh int count, int *outCount); 8403b705cfSriastradh 8503b705cfSriastradhextern void 8603b705cfSriastradhDRI2CopyRegion(Display * dpy, XID drawable, 8703b705cfSriastradh XserverRegion region, 8803b705cfSriastradh uint32_t dest, uint32_t src); 8903b705cfSriastradh 9003b705cfSriastradhextern uint64_t 9103b705cfSriastradhDRI2SwapBuffers(Display *dpy, XID drawable, 9203b705cfSriastradh uint64_t target_msc, uint64_t divisor, uint64_t remainder); 9303b705cfSriastradh 9403b705cfSriastradhextern Bool 9503b705cfSriastradhDRI2GetMSC(Display *dpy, XID drawable, uint64_t *ust, uint64_t *msc, uint64_t *sbc); 9603b705cfSriastradh 9703b705cfSriastradhextern Bool 9803b705cfSriastradhDRI2WaitMSC(Display *dpy, XID drawable, uint64_t target_msc, uint64_t divisor, 9903b705cfSriastradh uint64_t remainder, uint64_t *ust, uint64_t *msc, uint64_t *sbc); 10003b705cfSriastradh 10103b705cfSriastradhextern Bool 10203b705cfSriastradhDRI2WaitSBC(Display *dpy, XID drawable, uint64_t target_sbc, uint64_t *ust, 10303b705cfSriastradh uint64_t *msc, uint64_t *sbc); 10403b705cfSriastradh 10503b705cfSriastradhextern void 10603b705cfSriastradhDRI2SwapInterval(Display *dpy, XID drawable, int interval); 10703b705cfSriastradh 10803b705cfSriastradh#endif 109