Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions xf86-video-dummy/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ LT_INIT
AH_TOP([#include "xorg-server.h"])

# Define a configure option for an alternate module directory
AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: yes)]), [DGA=$enableval], [DGA=yes])
AC_ARG_WITH(xorg-module-dir, [ --with-xorg-module-dir=DIR ],
[ moduledir="$withval" ],
[ moduledir="$libdir/xorg/modules" ])
Expand All @@ -56,13 +55,6 @@ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
XORG_DRIVER_CHECK_EXT(XV, videoproto)

if test "x$DGA" = xyes; then
XORG_DRIVER_CHECK_EXT(XFreeXDGA, xf86dgaproto)
AC_DEFINE(USE_DGA, 1, [Support DGA extension])
fi
AC_SUBST([DGA])
AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])

# Obtain compiler/linker options for the driver dependencies
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901] xproto fontsproto $REQUIRED_MODULES)

Expand Down
5 changes: 0 additions & 5 deletions xf86-video-dummy/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,3 @@ dummyqbs_drv_la_SOURCES = \
dummy_driver.c \
dummy.h \
../../gui-agent/list.c

if DGA
dummyqbs_drv_la_SOURCES += \
dummy_dga.c
endif
7 changes: 0 additions & 7 deletions xf86-video-dummy/src/dummy.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ extern Bool DUMMYCursorInit(ScreenPtr pScrn);
extern void DUMMYShowCursor(ScrnInfoPtr pScrn);
extern void DUMMYHideCursor(ScrnInfoPtr pScrn);

/* in dummy_dga.c */
Bool DUMMYDGAInit(ScreenPtr pScreen);

/* in dummy_video.c */
extern void DUMMYInitVideo(ScreenPtr pScreen);

Expand All @@ -53,10 +50,6 @@ struct gbm_bo;

typedef struct dummyRec
{
DGAModePtr DGAModes;
int numDGAModes;
Bool DGAactive;
int DGAViewportStatus;
/* options */
OptionInfoPtr Options;
Bool swCursor;
Expand Down
175 changes: 0 additions & 175 deletions xf86-video-dummy/src/dummy_dga.c

This file was deleted.

82 changes: 62 additions & 20 deletions xf86-video-dummy/src/dummy_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
#include <X11/Xproto.h>
#include "scrnintstr.h"
#include "servermd.h"
#ifdef USE_DGA
#define _XF86DGA_SERVER_
#include <X11/extensions/xf86dgaproto.h>
#endif

/* glamor support */
#define GLAMOR_FOR_XORG
Expand Down Expand Up @@ -87,6 +83,16 @@ static Bool dummyDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op,
/* static void DUMMYDisplayPowerManagementSet(ScrnInfoPtr pScrn, */
/* int PowerManagementMode, int flags); */

/*
* Make FBBase grant-table backed if glamor is initialized. Currently it's
* believed to be unneeded, but if you get the
* "can't dump window without grant table allocation" message for a root
* window, set DUMMY_GLAMOR_GNT_BACKED_FBBASE to 1 and report an issue.
* See discussion at:
* https://github.com/QubesOS/qubes-gui-agent-linux/pull/233
*/
#define DUMMY_GLAMOR_GNT_BACKED_FBBASE 0

#define DUMMY_VERSION 4000
#define DUMMY_NAME "DUMMYQBS"
#define DUMMY_DRIVER_NAME "dummyqbs"
Expand Down Expand Up @@ -410,13 +416,41 @@ Bool DUMMYAdjustScreenPixmap(ScrnInfoPtr pScrn, int width, int height)
"Failed to get the screen pixmap.\n");
return FALSE;
}
if (cbLine > UINT32_MAX || cbLine * height > pScrn->videoRam * 1024)
{
if (cbLine > UINT32_MAX) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Unable to set up a virtual screen size of %dx%d with %d Kb of video memory available. Please increase the video memory size.\n",
width, height, pScrn->videoRam);
"Unable to set up a virtual screen size of %dx%d, cbLine "
"overflow\n",
width, height);
return FALSE;
}
if (cbLine * height > pScrn->videoRam * 1024) {
if (!dPtr->FBBasePriv) {
/* If there is no backing grant entries, it's easy enough to extend
*/
pointer *newFBBase;
size_t new_size = (cbLine * height + 1023) & ~1023;

newFBBase = realloc(dPtr->FBBase, new_size);
if (!newFBBase) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Unable to set up a virtual screen size of %dx%d, "
"cannot allocate memory (%zu bytes)\n",
width, height, new_size);
return FALSE;
}
memset((char*)newFBBase + pScrn->videoRam * 1024,
0,
new_size - pScrn->videoRam * 1024);
dPtr->FBBase = newFBBase;
pScrn->videoRam = new_size / 1024;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Unable to set up a virtual screen size of %dx%d with %d Kb of video memory available. Please increase the video memory size.\n",
width, height, pScrn->videoRam);
return FALSE;
}
}

pScreen->ModifyPixmapHeader(pPixmap, width, height,
pScrn->depth, xf86GetBppFromDepth(pScrn, pScrn->depth), cbLine,
dPtr->FBBase);
Expand Down Expand Up @@ -915,9 +949,10 @@ qubes_create_screen_resources(ScreenPtr pScreen) {
if (ret) {
PixmapPtr pixmap = pScreen->GetScreenPixmap(pScreen);
if (dPtr->glamor)
glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, dPtr->front_bo, FALSE);
xf86_qubes_pixmap_set_private(pixmap,
dPtr->FBBasePriv);
glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, dPtr->front_bo, FALSE);
if (dPtr->FBBasePriv)
xf86_qubes_pixmap_set_private(pixmap,
dPtr->FBBasePriv);
}

return ret;
Expand Down Expand Up @@ -1015,10 +1050,17 @@ DUMMYScreenInit(SCREEN_INIT_ARGS_DECL)
return FALSE;
}

dPtr->FBBasePriv = qubes_alloc_pixmap_private(pScrn->videoRam * 1024);
if (dPtr->FBBasePriv == NULL)
return FALSE;
dPtr->FBBase = (void *) dPtr->FBBasePriv->data;
if (DUMMY_GLAMOR_GNT_BACKED_FBBASE && dPtr->glamor) {
dPtr->FBBasePriv = qubes_alloc_pixmap_private(pScrn->videoRam * 1024);
if (dPtr->FBBasePriv == NULL)
return FALSE;
dPtr->FBBase = (void *) dPtr->FBBasePriv->data;
} else {
dPtr->FBBase = calloc(1, pScrn->videoRam * 1024);
if (dPtr->FBBase == NULL)
return FALSE;
}


/*
* next we save the current state and setup the first mode
Expand Down Expand Up @@ -1119,10 +1161,6 @@ DUMMYScreenInit(SCREEN_INIT_ARGS_DECL)
dPtr->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = qubes_create_screen_resources;

#ifdef USE_DGA
DUMMYDGAInit(pScreen);
#endif

/* initialize XRANDR */
xf86CrtcConfigInit(pScrn, &DUMMYCrtcConfigFuncs);
/* FIXME */
Expand Down Expand Up @@ -1290,8 +1328,12 @@ DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECL)
if (dPtr->FBBasePriv) {
xf86_qubes_free_pixmap_private(dPtr->FBBasePriv);
dPtr->FBBasePriv = NULL;
dPtr->FBBase = NULL;
} else {
if (dPtr->FBBase) {
free(dPtr->FBBase);
}
}
dPtr->FBBase = NULL;
}

if (dPtr->CursorInfo)
Expand Down