dri3_priv.h revision 1b5d61b8
1/* 2 * Copyright © 2013 Keith Packard 3 * 4 * Permission to use, copy, modify, distribute, and sell this software and its 5 * documentation for any purpose is hereby granted without fee, provided that 6 * the above copyright notice appear in all copies and that both that copyright 7 * notice and this permission notice appear in supporting documentation, and 8 * that the name of the copyright holders not be used in advertising or 9 * publicity pertaining to distribution of the software without specific, 10 * written prior permission. The copyright holders make no representations 11 * about the suitability of this software for any purpose. It is provided "as 12 * is" without express or implied warranty. 13 * 14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 20 * OF THIS SOFTWARE. 21 */ 22 23#ifndef _DRI3PRIV_H_ 24#define _DRI3PRIV_H_ 25 26#include <X11/X.h> 27#include "scrnintstr.h" 28#include "misc.h" 29#include "list.h" 30#include "windowstr.h" 31#include "dixstruct.h" 32#include <randrstr.h> 33#include "dri3.h" 34 35extern DevPrivateKeyRec dri3_screen_private_key; 36 37typedef struct dri3_dmabuf_format { 38 uint32_t format; 39 uint32_t num_modifiers; 40 uint64_t *modifiers; 41} dri3_dmabuf_format_rec, *dri3_dmabuf_format_ptr; 42 43typedef struct dri3_screen_priv { 44 CloseScreenProcPtr CloseScreen; 45 ConfigNotifyProcPtr ConfigNotify; 46 DestroyWindowProcPtr DestroyWindow; 47 48 Bool formats_cached; 49 CARD32 num_formats; 50 dri3_dmabuf_format_ptr formats; 51 52 const dri3_screen_info_rec *info; 53} dri3_screen_priv_rec, *dri3_screen_priv_ptr; 54 55#define wrap(priv,real,mem,func) {\ 56 priv->mem = real->mem; \ 57 real->mem = func; \ 58} 59 60#define unwrap(priv,real,mem) {\ 61 real->mem = priv->mem; \ 62} 63 64static inline dri3_screen_priv_ptr 65dri3_screen_priv(ScreenPtr screen) 66{ 67 return (dri3_screen_priv_ptr)dixLookupPrivate(&(screen)->devPrivates, &dri3_screen_private_key); 68} 69 70int 71proc_dri3_dispatch(ClientPtr client); 72 73int 74sproc_dri3_dispatch(ClientPtr client); 75 76/* DDX interface */ 77 78int 79dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd); 80 81int 82dri3_pixmap_from_fds(PixmapPtr *ppixmap, ScreenPtr screen, 83 CARD8 num_fds, const int *fds, 84 CARD16 width, CARD16 height, 85 const CARD32 *strides, const CARD32 *offsets, 86 CARD8 depth, CARD8 bpp, CARD64 modifier); 87 88int 89dri3_fd_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size); 90 91int 92dri3_fds_from_pixmap(PixmapPtr pixmap, int *fds, 93 uint32_t *strides, uint32_t *offsets, 94 uint64_t *modifier); 95 96int 97dri3_get_supported_modifiers(ScreenPtr screen, DrawablePtr drawable, 98 CARD8 depth, CARD8 bpp, 99 CARD32 *num_drawable_modifiers, 100 CARD64 **drawable_modifiers, 101 CARD32 *num_screen_modifiers, 102 CARD64 **screen_modifiers); 103 104#endif /* _DRI3PRIV_H_ */ 105