1/* 2 * Copyright © 2007,2008 Red Hat, Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Soft- 6 * ware"), to deal in the Software without restriction, including without 7 * limitation the rights to use, copy, modify, merge, publish, distribute, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, provided that the above copyright 10 * notice(s) and this permission notice appear in all copies of the Soft- 11 * ware and that both the above copyright notice(s) and this permission 12 * notice appear in supporting documentation. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY 17 * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN 18 * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- 19 * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- 22 * MANCE OF THIS SOFTWARE. 23 * 24 * Except as contained in this notice, the name of a copyright holder shall 25 * not be used in advertising or otherwise to promote the sale, use or 26 * other dealings in this Software without prior written authorization of 27 * the copyright holder. 28 * 29 * Authors: 30 * Kristian Høgsberg (krh@redhat.com) 31 */ 32 33#ifndef _DRI2_H_ 34#define _DRI2_H_ 35 36#include <X11/extensions/Xfixes.h> 37#include <X11/extensions/dri2tokens.h> 38 39typedef struct 40{ 41 unsigned int attachment; 42 unsigned int name; 43 unsigned int pitch; 44 unsigned int cpp; 45 unsigned int flags; 46} DRI2Buffer; 47 48extern Bool 49DRI2QueryExtension(Display * display, int *eventBase, int *errorBase); 50 51extern Bool 52DRI2QueryVersion(Display * display, int *major, int *minor); 53 54extern Bool 55DRI2Connect(Display * display, XID window, 56 char **driverName, char **deviceName); 57 58extern Bool 59DRI2Authenticate(Display * display, XID window, drm_magic_t magic); 60 61extern void 62DRI2CreateDrawable(Display * display, XID drawable); 63 64extern void 65DRI2DestroyDrawable(Display * display, XID handle); 66 67extern DRI2Buffer* 68DRI2GetBuffers(Display * dpy, XID drawable, 69 int *width, int *height, 70 unsigned int *attachments, int count, 71 int *outCount); 72 73/** 74 * \note 75 * This function is only supported with DRI2 version 1.1 or later. 76 */ 77extern DRI2Buffer* 78DRI2GetBuffersWithFormat(Display * dpy, XID drawable, 79 int *width, int *height, 80 unsigned int *attachments, 81 int count, int *outCount); 82 83extern void 84DRI2CopyRegion(Display * dpy, XID drawable, 85 XserverRegion region, 86 CARD32 dest, CARD32 src); 87 88extern void 89DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor, 90 CARD64 remainder, CARD64 *count); 91 92extern Bool 93DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc, CARD64 *sbc); 94 95extern Bool 96DRI2WaitMSC(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor, 97 CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc); 98 99extern Bool 100DRI2WaitSBC(Display *dpy, XID drawable, CARD64 target_sbc, CARD64 *ust, 101 CARD64 *msc, CARD64 *sbc); 102 103extern void 104DRI2SwapInterval(Display *dpy, XID drawable, int interval); 105 106#endif 107