2 * Copyright © 2013 Keith Packard
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.
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
23 #ifdef HAVE_XORG_CONFIG_H
24 #include <xorg-config.h>
27 #include "dri3_priv.h"
30 DevPrivateKeyRec dri3_screen_private_key
;
31 DevPrivateKeyRec dri3_window_private_key
;
34 dri3_close_screen(ScreenPtr screen
)
36 dri3_screen_priv_ptr screen_priv
= dri3_screen_priv(screen
);
38 unwrap(screen_priv
, screen
, CloseScreen
);
41 return (*screen
->CloseScreen
) (screen
);
45 dri3_screen_init(ScreenPtr screen
, dri3_screen_info_ptr info
)
47 if (!dixRegisterPrivateKey(&dri3_screen_private_key
, PRIVATE_SCREEN
, 0))
50 if (!dri3_screen_priv(screen
)) {
51 dri3_screen_priv_ptr screen_priv
= calloc(1, sizeof (dri3_screen_priv_rec
));
55 wrap(screen_priv
, screen
, CloseScreen
, dri3_close_screen
);
57 screen_priv
->info
= info
;
59 dixSetPrivate(&screen
->devPrivates
, &dri3_screen_private_key
, screen_priv
);
66 dri3_extension_init(void)
68 ExtensionEntry
*extension
;
72 if (!noPanoramiXExtension
)
76 extension
= AddExtension(DRI3_NAME
, DRI3NumberEvents
, DRI3NumberErrors
,
77 proc_dri3_dispatch
, sproc_dri3_dispatch
,
78 NULL
, StandardMinorOpcode
);
82 dri3_request
= extension
->base
;
84 for (i
= 0; i
< screenInfo
.numScreens
; i
++) {
85 if (!dri3_screen_init(screenInfo
.screens
[i
], NULL
))
91 FatalError("Cannot initialize DRI3 extension");