ephyr: Expose a single function for detecting extensions.
v2: Fix trying to include xcb-dri in the non-dri-build case (Noted by Julien) Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
parent
3aacb22d64
commit
18d836f6dd
|
@ -26,6 +26,7 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <kdrive-config.h>
|
#include <kdrive-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ephyr.h"
|
#include "ephyr.h"
|
||||||
|
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
#include "ephyrlog.h"
|
#include "ephyrlog.h"
|
||||||
|
|
||||||
#ifdef XF86DRI
|
#ifdef XF86DRI
|
||||||
|
#include <xcb/xf86dri.h>
|
||||||
#include "ephyrdri.h"
|
#include "ephyrdri.h"
|
||||||
#include "ephyrdriext.h"
|
#include "ephyrdriext.h"
|
||||||
#include "ephyrglxext.h"
|
#include "ephyrglxext.h"
|
||||||
|
@ -58,6 +60,16 @@ typedef struct _EphyrInputPrivate {
|
||||||
Bool EphyrWantGrayScale = 0;
|
Bool EphyrWantGrayScale = 0;
|
||||||
Bool EphyrWantResize = 0;
|
Bool EphyrWantResize = 0;
|
||||||
|
|
||||||
|
Bool
|
||||||
|
host_has_extension(xcb_extension_t *extension)
|
||||||
|
{
|
||||||
|
const xcb_query_extension_reply_t *rep;
|
||||||
|
|
||||||
|
rep = xcb_get_extension_data(hostx_get_xcbconn(), extension);
|
||||||
|
|
||||||
|
return rep && rep->present;
|
||||||
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
ephyrInitialize(KdCardInfo * card, EphyrPriv * priv)
|
ephyrInitialize(KdCardInfo * card, EphyrPriv * priv)
|
||||||
{
|
{
|
||||||
|
@ -657,7 +669,7 @@ ephyrInitScreen(ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
#endif /*XV*/
|
#endif /*XV*/
|
||||||
#ifdef XF86DRI
|
#ifdef XF86DRI
|
||||||
if (!ephyrNoDRI && !hostx_has_dri()) {
|
if (!ephyrNoDRI && !host_has_extension(&xcb_xf86dri_id)) {
|
||||||
EPHYR_LOG("host x does not support DRI. Disabling DRI forwarding\n");
|
EPHYR_LOG("host x does not support DRI. Disabling DRI forwarding\n");
|
||||||
ephyrNoDRI = TRUE;
|
ephyrNoDRI = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,9 @@
|
||||||
#define _XF86DRI_SERVER_
|
#define _XF86DRI_SERVER_
|
||||||
#include <X11/dri/xf86dri.h>
|
#include <X11/dri/xf86dri.h>
|
||||||
#include <X11/dri/xf86driproto.h>
|
#include <X11/dri/xf86driproto.h>
|
||||||
|
#include <xcb/xcb.h>
|
||||||
|
#include <xcb/shape.h>
|
||||||
|
#include <xcb/xf86dri.h>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "privates.h"
|
#include "privates.h"
|
||||||
#include "dixstruct.h"
|
#include "dixstruct.h"
|
||||||
|
@ -1319,12 +1322,12 @@ ephyrDRIExtensionInit(ScreenPtr a_screen)
|
||||||
EphyrDRIScreenPrivPtr screen_priv = NULL;
|
EphyrDRIScreenPrivPtr screen_priv = NULL;
|
||||||
|
|
||||||
EPHYR_LOG("enter\n");
|
EPHYR_LOG("enter\n");
|
||||||
if (!hostx_has_dri()) {
|
if (!host_has_extension(&xcb_xf86dri_id)) {
|
||||||
EPHYR_LOG("host does not have DRI extension\n");
|
EPHYR_LOG("host does not have DRI extension\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
EPHYR_LOG("host X does have DRI extension\n");
|
EPHYR_LOG("host X does have DRI extension\n");
|
||||||
if (!hostx_has_xshape()) {
|
if (!host_has_extension(&xcb_shape_id)) {
|
||||||
EPHYR_LOG("host does not have XShape extension\n");
|
EPHYR_LOG("host does not have XShape extension\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <kdrive-config.h>
|
#include <kdrive-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <xcb/glx.h>
|
||||||
#include "extnsionst.h"
|
#include "extnsionst.h"
|
||||||
#include "ephyrglxext.h"
|
#include "ephyrglxext.h"
|
||||||
#include "ephyrhostglx.h"
|
#include "ephyrhostglx.h"
|
||||||
|
@ -83,7 +84,7 @@ ephyrHijackGLXExtension(void)
|
||||||
{
|
{
|
||||||
const void *(*dispatch_functions)[2];
|
const void *(*dispatch_functions)[2];
|
||||||
|
|
||||||
if (!hostx_has_glx()) {
|
if (!host_has_extension(&xcb_glx_id)) {
|
||||||
EPHYR_LOG("host X does not have GLX\n");
|
EPHYR_LOG("host X does not have GLX\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1390,15 +1390,6 @@ out:
|
||||||
return is_ok;
|
return is_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
hostx_has_xshape(void)
|
|
||||||
{
|
|
||||||
const xcb_query_extension_reply_t *rep;
|
|
||||||
|
|
||||||
rep = xcb_get_extension_data(HostX.conn, &xcb_shape_id);
|
|
||||||
return rep && rep->present;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef XF86DRI
|
#ifdef XF86DRI
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int is_valid;
|
int is_valid;
|
||||||
|
@ -1471,24 +1462,4 @@ hostx_get_resource_id_peer(int a_local_resource_id, int *a_remote_resource_id)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
hostx_has_dri(void)
|
|
||||||
{
|
|
||||||
const xcb_query_extension_reply_t *dri;
|
|
||||||
|
|
||||||
dri = xcb_get_extension_data(HostX.conn, &xcb_xf86dri_id);
|
|
||||||
|
|
||||||
return dri && dri->present;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
hostx_has_glx(void)
|
|
||||||
{
|
|
||||||
const xcb_query_extension_reply_t *glx;
|
|
||||||
|
|
||||||
glx = xcb_get_extension_data(HostX.conn, &xcb_glx_id);
|
|
||||||
|
|
||||||
return glx && glx->present;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* XF86DRI */
|
#endif /* XF86DRI */
|
||||||
|
|
|
@ -233,7 +233,8 @@ int hostx_set_window_bounding_rectangles(int a_window,
|
||||||
|
|
||||||
int hostx_set_window_clipping_rectangles(int a_window,
|
int hostx_set_window_clipping_rectangles(int a_window,
|
||||||
EphyrRect * a_rects, int a_num_rects);
|
EphyrRect * a_rects, int a_num_rects);
|
||||||
int hostx_has_xshape(void);
|
|
||||||
|
int host_has_extension(xcb_extension_t *extension);
|
||||||
|
|
||||||
#ifdef XF86DRI
|
#ifdef XF86DRI
|
||||||
int hostx_lookup_peer_window(void *a_local_window,
|
int hostx_lookup_peer_window(void *a_local_window,
|
||||||
|
|
Loading…
Reference in New Issue