Xephyr: use glamor glx provider
Xephyr now gained an ability to use glamor glx provider. Unfortunately, without DRI3, we end up with same llvmpipe as before Signed-off-by: Konstantin Pugin <ria.freelander@gmail.com>
This commit is contained in:
parent
a449bb4c5d
commit
8252b110f3
|
@ -1,60 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 2013 Intel Corporation
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice (including the next
|
|
||||||
* paragraph) shall be included in all copies or substantial portions of the
|
|
||||||
* Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
||||||
* IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @file glamor_egl_stubs.c
|
|
||||||
*
|
|
||||||
* Stubbed out glamor_egl.c functions for servers other than Xorg.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dix-config.h"
|
|
||||||
|
|
||||||
#include "glamor.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
glamor_egl_fd_name_from_pixmap(ScreenPtr screen,
|
|
||||||
PixmapPtr pixmap,
|
|
||||||
CARD16 *stride, CARD32 *size)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
glamor_egl_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds,
|
|
||||||
uint32_t *offsets, uint32_t *strides,
|
|
||||||
uint64_t *modifier)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
glamor_egl_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap,
|
|
||||||
CARD16 *stride, CARD32 *size)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
|
@ -51,12 +51,6 @@ glamor = static_library('glamor',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
glamor_egl_stubs = static_library('glamor_egl_stubs',
|
|
||||||
'glamor_egl_stubs.c',
|
|
||||||
include_directories: inc,
|
|
||||||
dependencies: common_dep,
|
|
||||||
)
|
|
||||||
|
|
||||||
if build_xorg
|
if build_xorg
|
||||||
install_data('glamor.h', install_dir: xorgsdkdir)
|
install_data('glamor.h', install_dir: xorgsdkdir)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -25,14 +25,18 @@
|
||||||
*
|
*
|
||||||
* Glamor support and EGL setup.
|
* Glamor support and EGL setup.
|
||||||
*/
|
*/
|
||||||
|
#define MESA_EGL_NO_X11_HEADERS
|
||||||
|
#define EGL_NO_X11
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xcb_aux.h>
|
#include <xcb/xcb_aux.h>
|
||||||
#include <pixman.h>
|
#include <pixman.h>
|
||||||
|
#include "glamor_context.h"
|
||||||
#include "glamor_egl.h"
|
#include "glamor_egl.h"
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
#include "ephyr.h"
|
||||||
#include "ephyr_glamor.h"
|
#include "ephyr_glamor.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
|
@ -69,6 +73,64 @@ struct ephyr_glamor {
|
||||||
GLuint vao, vbo;
|
GLuint vao, vbo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
glamor_egl_make_current(struct glamor_context *glamor_ctx)
|
||||||
|
{
|
||||||
|
/* There's only a single global dispatch table in Mesa. EGL, GLX,
|
||||||
|
* and AIGLX's direct dispatch table manipulation don't talk to
|
||||||
|
* each other. We need to set the context to NULL first to avoid
|
||||||
|
* EGL's no-op context change fast path when switching back to
|
||||||
|
* EGL.
|
||||||
|
*/
|
||||||
|
eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE,
|
||||||
|
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
|
||||||
|
if (!eglMakeCurrent(glamor_ctx->display,
|
||||||
|
glamor_ctx->surface, glamor_ctx->surface,
|
||||||
|
glamor_ctx->ctx)) {
|
||||||
|
FatalError("Failed to make EGL context current\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
|
||||||
|
{
|
||||||
|
KdScreenPriv(screen);
|
||||||
|
KdScreenInfo *kd_screen = pScreenPriv->screen;
|
||||||
|
EphyrScrPriv *scrpriv = kd_screen->driver;
|
||||||
|
struct ephyr_glamor *ephyr_glamor = scrpriv->glamor;
|
||||||
|
|
||||||
|
glamor_enable_dri3(screen);
|
||||||
|
glamor_ctx->display = ephyr_glamor->dpy;
|
||||||
|
glamor_ctx->ctx = ephyr_glamor->ctx;
|
||||||
|
glamor_ctx->surface = ephyr_glamor->egl_win;
|
||||||
|
glamor_ctx->make_current = glamor_egl_make_current;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
glamor_egl_fd_name_from_pixmap(ScreenPtr screen,
|
||||||
|
PixmapPtr pixmap,
|
||||||
|
CARD16 *stride, CARD32 *size)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
glamor_egl_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds,
|
||||||
|
uint32_t *offsets, uint32_t *strides,
|
||||||
|
uint64_t *modifier)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
glamor_egl_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap,
|
||||||
|
CARD16 *stride, CARD32 *size)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static GLuint
|
static GLuint
|
||||||
ephyr_glamor_build_glsl_prog(GLuint vs, GLuint fs)
|
ephyr_glamor_build_glsl_prog(GLuint vs, GLuint fs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
#define X_INCLUDE_STRING_H
|
||||||
|
#include <X11/Xos_r.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xproto.h>
|
#include <xcb/xproto.h>
|
||||||
|
@ -55,8 +57,11 @@
|
||||||
#include <xcb/randr.h>
|
#include <xcb/randr.h>
|
||||||
#include <xcb/xkb.h>
|
#include <xcb/xkb.h>
|
||||||
#ifdef GLAMOR
|
#ifdef GLAMOR
|
||||||
|
#include <xcb/glx.h>
|
||||||
|
#include <epoxy/common.h>
|
||||||
#include <epoxy/gl.h>
|
#include <epoxy/gl.h>
|
||||||
#include "glamor.h"
|
#include "glamor.h"
|
||||||
|
#include "glamor_glx_provider.h"
|
||||||
#include "ephyr_glamor.h"
|
#include "ephyr_glamor.h"
|
||||||
#endif
|
#endif
|
||||||
#include "ephyrlog.h"
|
#include "ephyrlog.h"
|
||||||
|
@ -83,6 +88,7 @@ struct EphyrHostXVars {
|
||||||
|
|
||||||
long damage_debug_msec;
|
long damage_debug_msec;
|
||||||
Bool size_set_from_configure;
|
Bool size_set_from_configure;
|
||||||
|
char *glvnd_vendor;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* memset ( missing> ) instead of below */
|
/* memset ( missing> ) instead of below */
|
||||||
|
@ -1551,12 +1557,50 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GLAMOR
|
#ifdef GLAMOR
|
||||||
|
|
||||||
|
#ifndef GLX_EXTENSIONS
|
||||||
|
#define GLX_EXTENSIONS 3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef GLX_VENDOR_NAMES_EXT
|
||||||
|
#define GLX_VENDOR_NAMES_EXT 0x20F6
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exchange a protocol request for glXQueryServerString.
|
||||||
|
*/
|
||||||
|
static char *
|
||||||
|
__glXQueryServerString(CARD32 name)
|
||||||
|
{
|
||||||
|
xcb_glx_query_server_string_cookie_t cookie;
|
||||||
|
xcb_glx_query_server_string_reply_t *reply;
|
||||||
|
uint32_t len;
|
||||||
|
char *str;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
cookie = xcb_glx_query_server_string(HostX.conn, HostX.screen, name);
|
||||||
|
reply = xcb_glx_query_server_string_reply(HostX.conn, cookie, NULL);
|
||||||
|
str = xcb_glx_query_server_string_string(reply);
|
||||||
|
|
||||||
|
/* The spec doesn't mention this, but the Xorg server replies with
|
||||||
|
* a string already terminated with '\0'. */
|
||||||
|
len = xcb_glx_query_server_string_string_length(reply);
|
||||||
|
buf = xnfalloc(len);
|
||||||
|
memcpy(buf, str, len);
|
||||||
|
free(reply);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
ephyr_glamor_init(ScreenPtr screen)
|
ephyr_glamor_init(ScreenPtr screen)
|
||||||
{
|
{
|
||||||
KdScreenPriv(screen);
|
KdScreenPriv(screen);
|
||||||
KdScreenInfo *kd_screen = pScreenPriv->screen;
|
KdScreenInfo *kd_screen = pScreenPriv->screen;
|
||||||
EphyrScrPriv *scrpriv = kd_screen->driver;
|
EphyrScrPriv *scrpriv = kd_screen->driver;
|
||||||
|
char *hostx_glx_exts = NULL;
|
||||||
|
char *glvnd_vendors = NULL;
|
||||||
|
_Xstrtokparams saveptr;
|
||||||
|
|
||||||
scrpriv->glamor = ephyr_glamor_screen_init(scrpriv->win, scrpriv->vid);
|
scrpriv->glamor = ephyr_glamor_screen_init(scrpriv->win, scrpriv->vid);
|
||||||
ephyr_glamor_set_window_size(scrpriv->glamor,
|
ephyr_glamor_set_window_size(scrpriv->glamor,
|
||||||
|
@ -1566,6 +1610,18 @@ ephyr_glamor_init(ScreenPtr screen)
|
||||||
FatalError("Failed to initialize glamor\n");
|
FatalError("Failed to initialize glamor\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
hostx_glx_exts = __glXQueryServerString(GLX_EXTENSIONS);
|
||||||
|
if (epoxy_extension_in_string(hostx_glx_exts,"GLX_EXT_libglvnd"))
|
||||||
|
glvnd_vendors = __glXQueryServerString(GLX_VENDOR_NAMES_EXT);
|
||||||
|
|
||||||
|
if (glvnd_vendors) {
|
||||||
|
HostX.glvnd_vendor = _XStrtok(glvnd_vendors, " ", saveptr);
|
||||||
|
glamor_set_glvnd_vendor(screen, HostX.glvnd_vendor);
|
||||||
|
free(glvnd_vendors);
|
||||||
|
}
|
||||||
|
free(hostx_glx_exts);
|
||||||
|
|
||||||
|
GlxPushProvider(&glamor_provider);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,8 @@ if build_glamor
|
||||||
srcs += 'ephyr_glamor_xv.c'
|
srcs += 'ephyr_glamor_xv.c'
|
||||||
endif
|
endif
|
||||||
xephyr_glamor += glamor
|
xephyr_glamor += glamor
|
||||||
xephyr_glamor += glamor_egl_stubs
|
|
||||||
xephyr_dep += epoxy_dep
|
xephyr_dep += epoxy_dep
|
||||||
|
xephyr_dep += dependency('xcb-glx')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if build_xv
|
if build_xv
|
||||||
|
|
Loading…
Reference in New Issue