radeon_dri2.h revision de2362d3
1/* 2 * Copyright 2008 Jerome Glisse 3 * 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining 7 * a copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation on the rights to use, copy, modify, merge, 10 * publish, distribute, sublicense, and/or sell copies of the Software, 11 * and to permit persons to whom the Software is furnished to do so, 12 * subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial 16 * portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR 22 * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 * DEALINGS IN THE SOFTWARE. 26 */ 27#ifndef RADEON_DRI2_H 28#define RADEON_DRI2_H 29 30#include <xorg-server.h> 31 32struct radeon_dri2 { 33 drmVersionPtr pKernelDRMVersion; 34 int drm_fd; 35 Bool available; 36 Bool enabled; 37 char *device_name; 38}; 39 40#ifdef DRI2 41 42#include "dri2.h" 43Bool radeon_dri2_screen_init(ScreenPtr pScreen); 44void radeon_dri2_close_screen(ScreenPtr pScreen); 45 46int drmmode_get_crtc_id(xf86CrtcPtr crtc); 47void radeon_dri2_frame_event_handler(unsigned int frame, unsigned int tv_sec, 48 unsigned int tv_usec, void *event_data); 49void radeon_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec, 50 unsigned int tv_usec, void *event_data); 51 52#else 53 54static inline Bool radeon_dri2_screen_init(ScreenPtr pScreen) { return FALSE; } 55static inline void radeon_dri2_close_screen(ScreenPtr pScreen) {} 56 57static inline void 58radeon_dri2_dummy_event_handler(unsigned int frame, unsigned int tv_sec, 59 unsigned int tv_usec, void *event_data, 60 const char *name) 61{ 62 static Bool warned; 63 64 if (!warned) { 65 ErrorF("%s called but DRI2 disabled at build time\n", name); 66 warned = TRUE; 67 } 68 69 free(event_data); 70} 71 72static inline void 73radeon_dri2_frame_event_handler(unsigned int frame, unsigned int tv_sec, 74 unsigned int tv_usec, void *event_data) 75{ 76 radeon_dri2_dummy_event_handler(frame, tv_sec, tv_usec, event_data, 77 __func__); 78} 79 80static inline void 81radeon_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec, 82 unsigned int tv_usec, void *event_data) 83{ 84 radeon_dri2_dummy_event_handler(frame, tv_sec, tv_usec, event_data, 85 __func__); 86} 87 88#endif 89 90#endif /* RADEON_DRI2_H */ 91