Commit 535f1465 authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer

Revert xorg/xserver!235

Caused assertion failures / crashes with Xorg.

Closes: xorg/xserver#916
parent 5315f988
......@@ -927,11 +927,7 @@ glamor_close_screen(ScreenPtr screen)
ps->Glyphs = glamor_priv->saved_procs.glyphs;
screen_pixmap = screen->GetScreenPixmap(screen);
/* For DDX like Xwayland and Xorg, the pixmap is not destroyed so
* we should do so here.
*/
if (screen_pixmap)
glamor_pixmap_destroy_fbo(screen_pixmap);
glamor_pixmap_destroy_fbo(screen_pixmap);
glamor_release_screen_priv(screen);
......
......@@ -68,10 +68,8 @@ typedef Bool (*GetDrawableModifiersFuncPtr) (DrawablePtr draw,
#define GLAMOR_EGL_EXTERNAL_BUFFER 3
#define GLAMOR_USE_EGL_SCREEN (1 << 0)
#define GLAMOR_NO_DRI3 (1 << 1)
#define GLAMOR_NO_MODIFIERS (1 << 2)
#define GLAMOR_VALID_FLAGS (GLAMOR_USE_EGL_SCREEN \
| GLAMOR_NO_DRI3 \
| GLAMOR_NO_MODIFIERS)
| GLAMOR_NO_DRI3)
/* until we need geometry shaders GL3.1 should suffice. */
#define GLAMOR_GL_CORE_VER_MAJOR 3
......@@ -334,18 +332,20 @@ extern _X_EXPORT Bool glamor_get_drawable_modifiers(DrawablePtr draw,
extern _X_EXPORT void glamor_set_drawable_modifiers_func(ScreenPtr screen,
GetDrawableModifiersFuncPtr func);
#ifdef GLAMOR_FOR_XORG
#define GLAMOR_EGL_MODULE_NAME "glamoregl"
/* @glamor_egl_init: Initialize EGL environment.
*
* @screen: Current screen pointer.
* @scrn: Current screen info pointer.
* @fd: Current drm fd.
*
* This function creates and intialize EGL contexts.
* Should be called from DDX's preInit function.
* Return TRUE if success, otherwise return FALSE.
* */
extern _X_EXPORT Bool glamor_egl_init(ScreenPtr screen, int fd);
extern _X_EXPORT Bool glamor_egl_init(ScrnInfoPtr scrn, int fd);
extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen);
......@@ -396,6 +396,8 @@ extern _X_EXPORT Bool
struct gbm_bo *bo,
Bool used_modifiers);
#endif
extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen,
struct glamor_context *glamor_ctx);
......
This diff is collapsed.
......@@ -68,14 +68,6 @@ from The Open Group.
#include "glx_extinit.h"
#include "randrstr.h"
#ifdef GLAMOR_HAS_GBM
#include <glamor.h>
#include <gbm.h>
#include <unistd.h>
#include <fcntl.h>
#endif
#define VFB_DEFAULT_WIDTH 1280
#define VFB_DEFAULT_HEIGHT 1024
#define VFB_DEFAULT_DEPTH 24
......@@ -109,12 +101,6 @@ typedef struct {
#ifdef HAS_SHM
int shmid;
#endif
#ifdef GLAMOR_HAS_GBM
int fd;
CreateScreenResourcesProcPtr createScreenResources;
struct gbm_device *gbm;
struct gbm_bo *front_bo;
#endif
} vfbScreenInfo, *vfbScreenInfoPtr;
static int vfbNumScreens;
......@@ -740,110 +726,10 @@ vfbCloseScreen(ScreenPtr pScreen)
if (pScreen->devPrivate)
(*pScreen->DestroyPixmap) (pScreen->devPrivate);
pScreen->devPrivate = NULL;
#ifdef GLAMOR_HAS_GBM
if (pvfb->fd >= 0) {
if (pvfb->front_bo) {
gbm_bo_destroy(pvfb->front_bo);
pvfb->front_bo = NULL;
}
close(pvfb->fd);
pvfb->fd = -1;
}
#endif
/*
* XXX: There is an existing vfbScreens leak. Should we free() it directly
* or otherwise - input welcome.
*/
return pScreen->CloseScreen(pScreen);
}
#ifdef GLAMOR_HAS_GBM
static Bool
vfbCreateScreenResources(ScreenPtr pScreen)
{
vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
PixmapPtr pixmap;
Bool ret;
pScreen->CreateScreenResources = pvfb->createScreenResources;
ret = pScreen->CreateScreenResources(pScreen);
pScreen->CreateScreenResources = vfbCreateScreenResources;
if (!ret)
return FALSE;
pixmap = pScreen->GetScreenPixmap(pScreen);
/* TODO: add support for modifiers at some point */
if (!glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, pvfb->front_bo,
FALSE)) {
LogMessage(X_ERROR, "glamor_egl_create_textured_pixmap() failed\n");
/* TODO: plug the leak, aka undo the CreateScreenResources() call above. */
return FALSE;
}
return TRUE;
}
static void
vfbDRIInit(ScreenPtr pScreen)
{
vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
/* TODO: don't hardcode the node name */
const char *node_name = "/dev/dri/renderD128";
const char *error_msg;
pvfb->fd = open(node_name, O_RDWR | O_CLOEXEC);
if (pvfb->fd < 0) {
error_msg = "Failed to open device node";
goto out;
}
if (!glamor_egl_init(pScreen, pvfb->fd)) {
error_msg = "Failed to initialize glamor";
goto close_fd;
}
pvfb->gbm = glamor_egl_get_gbm_device(pScreen);
if (!pvfb->gbm) {
error_msg = "Failed to get gbm device";
goto egl_fini;
}
pvfb->front_bo = gbm_bo_create(pvfb->gbm,
pScreen->width, pScreen->height,
GBM_FORMAT_ARGB8888,
GBM_BO_USE_RENDERING);
if (!pvfb->front_bo) {
error_msg = "Failed to create front buffer";
goto egl_fini;
}
if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
error_msg = "Failed to initialize glamor at ScreenInit() time";
goto destroy_bo;
}
pvfb->createScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = vfbCreateScreenResources;
return;
destroy_bo:
gbm_bo_destroy(pvfb->front_bo);
egl_fini:
/* TODO: There's no glamor_egl_fini just yet */
close_fd:
close(pvfb->fd);
out:
LogMessage(X_ERROR, "%s. Disabling GLAMOR/DRI3.\n", error_msg);
return;
}
#else
static void
vfbDRIInit(ScreenPtr pScreen)
{
}
#endif
static Bool
vfbRROutputValidateMode(ScreenPtr pScreen,
RROutputPtr output,
......@@ -1036,14 +922,12 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
dpix, dpiy, pvfb->paddedWidth, pvfb->bitsPerPixel);
if (ret && Render)
fbPictureInit(pScreen, 0, 0);
if (!ret)
return FALSE;
if (Render) {
fbPictureInit(pScreen, 0, 0);
vfbDRIInit(pScreen);
}
if (!vfbRandRInit(pScreen))
return FALSE;
......
......@@ -4,10 +4,6 @@ bin_PROGRAMS = Xvfb
AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
$(XVFBMODULES_CFLAGS) \
-I$(top_srcdir)/glamor/ \
-I$(top_srcdir)/dri3/ \
$(LIBDRM_CFLAGS) \
$(GBM_CFLAGS) \
$(DIX_CFLAGS)
SRCS = InitInput.c \
......@@ -17,7 +13,6 @@ SRCS = InitInput.c \
Xvfb_SOURCES = $(SRCS)
XVFB_LIBS = \
$(glamor_lib) \
@XVFB_LIBS@ \
$(MAIN_LIB) \
$(XSERVER_LIBS) \
......@@ -27,13 +22,5 @@ Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS)
Xvfb_DEPENDENCIES = $(XVFB_LIBS)
Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
if GLAMOR_EGL
Xvfb_SOURCES += $(top_srcdir)/glamor/glamor_egl.c
glamor_lib = $(top_builddir)/glamor/libglamor.la
Xvfb_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) $(LIBDRM_LIBS) -lEGL -lGL
Xvfb_DEPENDENCIES = $(glamor_lib) $(XVFB_LIBS)
endif
relink:
$(AM_V_at)rm -f Xvfb$(EXEEXT) && $(MAKE) Xvfb$(EXEEXT)
......@@ -4,27 +4,12 @@ srcs = [
'../../mi/miinitext.c',
]
vfb_dep = []
vfb_glamor = []
if build_glamor
srcs += '../../glamor/glamor_egl.c'
vfb_dep += [
libdrm_dep,
gbm_dep,
]
vfb_glamor += glamor
endif
xvfb_server = executable(
'Xvfb',
srcs,
include_directories: inc,
dependencies: [
common_dep,
vfb_dep,
],
dependencies: common_dep,
link_with: [
vfb_glamor,
libxserver_main,
libxserver_fb,
libxserver,
......
......@@ -768,7 +768,7 @@ try_enable_glamor(ScrnInfoPtr pScrn)
}
if (xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME)) {
if (glamor_egl_init(xf86ScrnToScreen(pScrn), ms->fd)) {
if (glamor_egl_init(pScrn, ms->fd)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n");
ms->drmmode.glamor = TRUE;
} else {
......
......@@ -36,7 +36,6 @@
#include "dumb_bo.h"
#include "inputstr.h"
#include "xf86str.h"
#include "xf86Priv.h"
#include "X11/Xatom.h"
#include "micmap.h"
#include "xf86cmap.h"
......@@ -3413,12 +3412,7 @@ drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
if (drmmode->glamor) {
unsigned int flags = GLAMOR_USE_EGL_SCREEN;
if (xf86Info.debug != NULL && !strstr(xf86Info.debug, "dmabuf_capable"))
flags |= GLAMOR_NO_MODIFIERS;
if (!glamor_init(pScreen, flags)) {
if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
return FALSE;
}
#ifdef GBM_BO_WITH_MODIFIERS
......
......@@ -324,8 +324,8 @@ endif
gbm_dep = dependency('', required: false)
epoxy_dep = dependency('', required: false)
if build_glamor
gbm_dep = dependency('gbm', version: gbm_req, required: true)
epoxy_dep = dependency('epoxy', required: true)
gbm_dep = dependency('gbm', version: gbm_req, required: false)
epoxy_dep = dependency('epoxy', required: false)
endif
eglstream_option = get_option('xwayland_eglstream')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment