135c4bbdfSmrg/* 235c4bbdfSmrg * Copyright © 2013 Keith Packard 335c4bbdfSmrg * 435c4bbdfSmrg * Permission to use, copy, modify, distribute, and sell this software and its 535c4bbdfSmrg * documentation for any purpose is hereby granted without fee, provided that 635c4bbdfSmrg * the above copyright notice appear in all copies and that both that copyright 735c4bbdfSmrg * notice and this permission notice appear in supporting documentation, and 835c4bbdfSmrg * that the name of the copyright holders not be used in advertising or 935c4bbdfSmrg * publicity pertaining to distribution of the software without specific, 1035c4bbdfSmrg * written prior permission. The copyright holders make no representations 1135c4bbdfSmrg * about the suitability of this software for any purpose. It is provided "as 1235c4bbdfSmrg * is" without express or implied warranty. 1335c4bbdfSmrg * 1435c4bbdfSmrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 1535c4bbdfSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 1635c4bbdfSmrg * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 1735c4bbdfSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 1835c4bbdfSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 1935c4bbdfSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 2035c4bbdfSmrg * OF THIS SOFTWARE. 2135c4bbdfSmrg */ 2235c4bbdfSmrg 2335c4bbdfSmrg#ifndef _DRI3_H_ 2435c4bbdfSmrg#define _DRI3_H_ 2535c4bbdfSmrg 2635c4bbdfSmrg#ifdef DRI3 2735c4bbdfSmrg 2835c4bbdfSmrg#include <X11/extensions/dri3proto.h> 2935c4bbdfSmrg#include <randrstr.h> 3035c4bbdfSmrg 311b5d61b8Smrg#define DRI3_SCREEN_INFO_VERSION 2 3235c4bbdfSmrg 3335c4bbdfSmrgtypedef int (*dri3_open_proc)(ScreenPtr screen, 3435c4bbdfSmrg RRProviderPtr provider, 3535c4bbdfSmrg int *fd); 3635c4bbdfSmrg 3735c4bbdfSmrgtypedef int (*dri3_open_client_proc)(ClientPtr client, 3835c4bbdfSmrg ScreenPtr screen, 3935c4bbdfSmrg RRProviderPtr provider, 4035c4bbdfSmrg int *fd); 4135c4bbdfSmrg 4235c4bbdfSmrgtypedef PixmapPtr (*dri3_pixmap_from_fd_proc) (ScreenPtr screen, 4335c4bbdfSmrg int fd, 4435c4bbdfSmrg CARD16 width, 4535c4bbdfSmrg CARD16 height, 4635c4bbdfSmrg CARD16 stride, 4735c4bbdfSmrg CARD8 depth, 4835c4bbdfSmrg CARD8 bpp); 4935c4bbdfSmrg 501b5d61b8Smrgtypedef PixmapPtr (*dri3_pixmap_from_fds_proc) (ScreenPtr screen, 511b5d61b8Smrg CARD8 num_fds, 521b5d61b8Smrg const int *fds, 531b5d61b8Smrg CARD16 width, 541b5d61b8Smrg CARD16 height, 551b5d61b8Smrg const CARD32 *strides, 561b5d61b8Smrg const CARD32 *offsets, 571b5d61b8Smrg CARD8 depth, 581b5d61b8Smrg CARD8 bpp, 591b5d61b8Smrg CARD64 modifier); 601b5d61b8Smrg 6135c4bbdfSmrgtypedef int (*dri3_fd_from_pixmap_proc) (ScreenPtr screen, 6235c4bbdfSmrg PixmapPtr pixmap, 6335c4bbdfSmrg CARD16 *stride, 6435c4bbdfSmrg CARD32 *size); 6535c4bbdfSmrg 661b5d61b8Smrgtypedef int (*dri3_fds_from_pixmap_proc) (ScreenPtr screen, 671b5d61b8Smrg PixmapPtr pixmap, 681b5d61b8Smrg int *fds, 691b5d61b8Smrg uint32_t *strides, 701b5d61b8Smrg uint32_t *offsets, 711b5d61b8Smrg uint64_t *modifier); 721b5d61b8Smrg 731b5d61b8Smrgtypedef int (*dri3_get_formats_proc) (ScreenPtr screen, 741b5d61b8Smrg CARD32 *num_formats, 751b5d61b8Smrg CARD32 **formats); 761b5d61b8Smrg 771b5d61b8Smrgtypedef int (*dri3_get_modifiers_proc) (ScreenPtr screen, 781b5d61b8Smrg uint32_t format, 791b5d61b8Smrg uint32_t *num_modifiers, 801b5d61b8Smrg uint64_t **modifiers); 811b5d61b8Smrg 821b5d61b8Smrgtypedef int (*dri3_get_drawable_modifiers_proc) (DrawablePtr draw, 831b5d61b8Smrg uint32_t format, 841b5d61b8Smrg uint32_t *num_modifiers, 851b5d61b8Smrg uint64_t **modifiers); 861b5d61b8Smrg 8735c4bbdfSmrgtypedef struct dri3_screen_info { 8835c4bbdfSmrg uint32_t version; 8935c4bbdfSmrg 9035c4bbdfSmrg dri3_open_proc open; 9135c4bbdfSmrg dri3_pixmap_from_fd_proc pixmap_from_fd; 9235c4bbdfSmrg dri3_fd_from_pixmap_proc fd_from_pixmap; 9335c4bbdfSmrg 9435c4bbdfSmrg /* Version 1 */ 9535c4bbdfSmrg dri3_open_client_proc open_client; 9635c4bbdfSmrg 971b5d61b8Smrg /* Version 2 */ 981b5d61b8Smrg dri3_pixmap_from_fds_proc pixmap_from_fds; 991b5d61b8Smrg dri3_fds_from_pixmap_proc fds_from_pixmap; 1001b5d61b8Smrg dri3_get_formats_proc get_formats; 1011b5d61b8Smrg dri3_get_modifiers_proc get_modifiers; 1021b5d61b8Smrg dri3_get_drawable_modifiers_proc get_drawable_modifiers; 1031b5d61b8Smrg 10435c4bbdfSmrg} dri3_screen_info_rec, *dri3_screen_info_ptr; 10535c4bbdfSmrg 10635c4bbdfSmrgextern _X_EXPORT Bool 1071b5d61b8Smrgdri3_screen_init(ScreenPtr screen, const dri3_screen_info_rec *info); 10835c4bbdfSmrg 10935c4bbdfSmrgextern _X_EXPORT int 11035c4bbdfSmrgdri3_send_open_reply(ClientPtr client, int fd); 11135c4bbdfSmrg 1121b5d61b8Smrgextern _X_EXPORT uint32_t 1131b5d61b8Smrgdrm_format_for_depth(uint32_t depth, uint32_t bpp); 1141b5d61b8Smrg 11535c4bbdfSmrg#endif 11635c4bbdfSmrg 11735c4bbdfSmrg#endif /* _DRI3_H_ */ 118