summaryrefslogtreecommitdiff
path: root/hw/xfree86
diff options
context:
space:
mode:
authorMichel Dänzer <mdaenzer@redhat.com>2019-11-15 11:32:38 +0100
committerMichel Dänzer <michel@daenzer.net>2019-11-15 11:32:38 +0100
commit5c7c6d5cffa98e4749185af9211d7642b57673d8 (patch)
tree26ddadf8cfd206b88b1eae520cb3d8e44ef9fd50 /hw/xfree86
parentdd63f717fe8636315343f421f4f2ee299258f079 (diff)
Revert "modesetting: Indirect the glamor API through LoaderSymbol"
This reverts commit dd63f717fe8636315343f421f4f2ee299258f079. Caused a crash at least on some systems. Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/934
Diffstat (limited to 'hw/xfree86')
-rw-r--r--hw/xfree86/drivers/modesetting/dri2.c10
-rw-r--r--hw/xfree86/drivers/modesetting/driver.c49
-rw-r--r--hw/xfree86/drivers/modesetting/driver.h24
-rw-r--r--hw/xfree86/drivers/modesetting/drmmode_display.c17
-rw-r--r--hw/xfree86/drivers/modesetting/pageflip.c4
-rw-r--r--hw/xfree86/drivers/modesetting/present.c4
6 files changed, 26 insertions, 82 deletions
diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c
index ccb9d04c9..e4d7cdd67 100644
--- a/hw/xfree86/drivers/modesetting/dri2.c
+++ b/hw/xfree86/drivers/modesetting/dri2.c
@@ -123,7 +123,6 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable,
unsigned int attachment, unsigned int format)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
- modesettingPtr ms = modesettingPTR(scrn);
DRI2Buffer2Ptr buffer;
PixmapPtr pixmap;
CARD32 size;
@@ -201,7 +200,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable,
*/
buffer->flags = 0;
- buffer->name = ms->glamor.name_from_pixmap(pixmap, &pitch, &size);
+ buffer->name = glamor_name_from_pixmap(pixmap, &pitch, &size);
buffer->pitch = pitch;
if (buffer->name == -1) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
@@ -511,12 +510,11 @@ update_front(DrawablePtr draw, DRI2BufferPtr front)
ScreenPtr screen = draw->pScreen;
PixmapPtr pixmap = get_drawable_pixmap(draw);
ms_dri2_buffer_private_ptr priv = front->driverPrivate;
- modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen));
CARD32 size;
CARD16 pitch;
int name;
- name = ms->glamor.name_from_pixmap(pixmap, &pitch, &size);
+ name = glamor_name_from_pixmap(pixmap, &pitch, &size);
if (name < 0)
return FALSE;
@@ -620,7 +618,7 @@ ms_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front,
*front_pix = *back_pix;
*back_pix = tmp_pix;
- ms->glamor.egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap);
+ glamor_egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap);
/* Post damage on the front buffer so that listeners, such
* as DisplayLink know take a copy and shove it over the USB.
@@ -1038,7 +1036,7 @@ ms_dri2_screen_init(ScreenPtr screen)
modesettingPtr ms = modesettingPTR(scrn);
DRI2InfoRec info;
- if (!ms->glamor.supports_pixmap_import_export(screen)) {
+ if (!glamor_supports_pixmap_import_export(screen)) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"DRI2: glamor lacks support for pixmap import/export\n");
}
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 386e33460..e35d5e08e 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -615,7 +615,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty, int *timeout)
* the shared pixmap, but not all).
*/
if (ms->drmmode.glamor)
- ms->glamor.finish(screen);
+ glamor_finish(screen);
#endif
/* Ensure the slave processes the damage immediately */
if (timeout)
@@ -744,26 +744,6 @@ FreeRec(ScrnInfoPtr pScrn)
}
static void
-bind_glamor_api(void *mod, modesettingPtr ms)
-{
- ms->glamor.back_pixmap_from_fd = LoaderSymbolFromModule(mod, "glamor_back_pixmap_from_fd");
- ms->glamor.block_handler = LoaderSymbolFromModule(mod, "glamor_block_handler");
- ms->glamor.egl_create_textured_pixmap = LoaderSymbolFromModule(mod, "glamor_egl_create_textured_pixmap");
- ms->glamor.egl_create_textured_pixmap_from_gbm_bo = LoaderSymbolFromModule(mod, "glamor_egl_create_textured_pixmap_from_gbm_bo");
- ms->glamor.egl_exchange_buffers = LoaderSymbolFromModule(mod, "glamor_egl_exchange_buffers");
- ms->glamor.egl_get_gbm_device = LoaderSymbolFromModule(mod, "glamor_egl_get_gbm_device");
- ms->glamor.egl_init = LoaderSymbolFromModule(mod, "glamor_egl_init");
- ms->glamor.finish = LoaderSymbolFromModule(mod, "glamor_finish");
- ms->glamor.gbm_bo_from_pixmap = LoaderSymbolFromModule(mod, "glamor_gbm_bo_from_pixmap");
- ms->glamor.init = LoaderSymbolFromModule(mod, "glamor_init");
- ms->glamor.name_from_pixmap = LoaderSymbolFromModule(mod, "glamor_name_from_pixmap");
- ms->glamor.set_drawable_modifiers_func = LoaderSymbolFromModule(mod, "glamor_set_drawable_modifiers_func");
- ms->glamor.shareable_fd_from_pixmap = LoaderSymbolFromModule(mod, "glamor_shareable_fd_from_pixmap");
- ms->glamor.supports_pixmap_import_export = LoaderSymbolFromModule(mod, "glamor_supports_pixmap_import_export");
- ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init");
-}
-
-static void
try_enable_glamor(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
@@ -771,7 +751,6 @@ try_enable_glamor(ScrnInfoPtr pScrn)
OPTION_ACCEL_METHOD);
Bool do_glamor = (!accel_method_str ||
strcmp(accel_method_str, "glamor") == 0);
- void *mod;
ms->drmmode.glamor = FALSE;
@@ -786,10 +765,8 @@ try_enable_glamor(ScrnInfoPtr pScrn)
return;
}
- mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME);
- if (mod) {
- bind_glamor_api(mod, ms);
- if (ms->glamor.egl_init(pScrn, ms->fd)) {
+ if (xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME)) {
+ if (glamor_egl_init(pScrn, ms->fd)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n");
ms->drmmode.glamor = TRUE;
} else {
@@ -1444,12 +1421,11 @@ static Bool
msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle)
{
#ifdef GLAMOR_HAS_GBM
- modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen));
int ret;
CARD16 stride;
CARD32 size;
- ret = ms->glamor.shareable_fd_from_pixmap(ppix->drawable.pScreen, ppix,
- &stride, &size);
+ ret = glamor_shareable_fd_from_pixmap(ppix->drawable.pScreen, ppix,
+ &stride, &size);
if (ret == -1)
return FALSE;
@@ -1474,12 +1450,11 @@ msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle)
return drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, 0, 0);
if (ms->drmmode.reverse_prime_offload_mode) {
- ret = ms->glamor.back_pixmap_from_fd(ppix, ihandle,
- ppix->drawable.width,
- ppix->drawable.height,
- ppix->devKind,
- ppix->drawable.depth,
- ppix->drawable.bitsPerPixel);
+ ret = glamor_back_pixmap_from_fd(ppix, ihandle,
+ ppix->drawable.width,
+ ppix->drawable.height,
+ ppix->devKind, ppix->drawable.depth,
+ ppix->drawable.bitsPerPixel);
} else {
int size = ppix->devKind * ppix->drawable.height;
ret = drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, ppix->devKind, size);
@@ -1596,7 +1571,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
#ifdef GLAMOR_HAS_GBM
if (ms->drmmode.glamor)
- ms->drmmode.gbm = ms->glamor.egl_get_gbm_device(pScreen);
+ ms->drmmode.gbm = glamor_egl_get_gbm_device(pScreen);
#endif
/* HW dependent - FIXME */
@@ -1740,7 +1715,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
if (ms->drmmode.glamor) {
XF86VideoAdaptorPtr glamor_adaptor;
- glamor_adaptor = ms->glamor.xv_init(pScreen, 16);
+ glamor_adaptor = glamor_xv_init(pScreen, 16);
if (glamor_adaptor != NULL)
xf86XVScreenInit(pScreen, &glamor_adaptor, 1);
else
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
index 8a4ac9c42..72ed90120 100644
--- a/hw/xfree86/drivers/modesetting/driver.h
+++ b/hw/xfree86/drivers/modesetting/driver.h
@@ -132,30 +132,6 @@ typedef struct _modesettingRec {
void (*UpdatePacked)(ScreenPtr, shadowBufPtr);
} shadow;
- /* glamor API */
- struct {
- Bool (*back_pixmap_from_fd)(PixmapPtr, int, CARD16, CARD16, CARD16,
- CARD8, CARD8);
- void (*block_handler)(ScreenPtr);
- Bool (*egl_create_textured_pixmap)(PixmapPtr, int, int);
- Bool (*egl_create_textured_pixmap_from_gbm_bo)(PixmapPtr,
- struct gbm_bo *,
- Bool);
- void (*egl_exchange_buffers)(PixmapPtr, PixmapPtr);
- struct gbm_device *(*egl_get_gbm_device)(ScreenPtr);
- Bool (*egl_init)(ScrnInfoPtr, int);
- void (*finish)(ScreenPtr);
- struct gbm_bo *(*gbm_bo_from_pixmap)(ScreenPtr, PixmapPtr);
- Bool (*init)(ScreenPtr, unsigned int);
- int (*name_from_pixmap)(PixmapPtr, CARD16 *, CARD32 *);
- void (*set_drawable_modifiers_func)(ScreenPtr,
- GetDrawableModifiersFuncPtr);
- int (*shareable_fd_from_pixmap)(ScreenPtr, PixmapPtr, CARD16 *,
- CARD32 *);
- Bool (*supports_pixmap_import_export)(ScreenPtr);
- XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int);
- } glamor;
-
} modesettingRec, *modesettingPtr;
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 144f7ce5c..ec729a4dc 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1378,7 +1378,6 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id)
PixmapPtr pixmap = drmmode->fbcon_pixmap;
drmModeFBPtr fbcon;
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
- modesettingPtr ms = modesettingPTR(pScrn);
Bool ret;
if (pixmap)
@@ -1399,8 +1398,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id)
if (!pixmap)
goto out_free_fb;
- ret = ms->glamor.egl_create_textured_pixmap(pixmap, fbcon->handle,
- fbcon->pitch);
+ ret = glamor_egl_create_textured_pixmap(pixmap, fbcon->handle, fbcon->pitch);
if (!ret) {
FreePixmap(pixmap);
pixmap = NULL;
@@ -1419,7 +1417,6 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
#ifdef GLAMOR_HAS_GBM
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
- modesettingPtr ms = modesettingPTR(pScrn);
PixmapPtr src, dst;
int fbcon_id = 0;
GCPtr gc;
@@ -1457,7 +1454,7 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
FreeScratchGC(gc);
- ms->glamor.finish(pScreen);
+ glamor_finish(pScreen);
pScreen->canDoBGNoneRoot = TRUE;
@@ -3093,13 +3090,12 @@ drmmode_set_pixmap_bo(drmmode_ptr drmmode, PixmapPtr pixmap, drmmode_bo *bo)
{
#ifdef GLAMOR_HAS_GBM
ScrnInfoPtr scrn = drmmode->scrn;
- modesettingPtr ms = modesettingPTR(scrn);
if (!drmmode->glamor)
return TRUE;
- if (!ms->glamor.egl_create_textured_pixmap_from_gbm_bo(pixmap, bo->gbm,
- bo->used_modifiers)) {
+ if (!glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo->gbm,
+ bo->used_modifiers)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create pixmap\n");
return FALSE;
}
@@ -3414,14 +3410,13 @@ drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
{
#ifdef GLAMOR_HAS_GBM
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
- modesettingPtr ms = modesettingPTR(pScrn);
if (drmmode->glamor) {
- if (!ms->glamor.init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
+ if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
return FALSE;
}
#ifdef GBM_BO_WITH_MODIFIERS
- ms->glamor.set_drawable_modifiers_func(pScreen, get_drawable_modifiers);
+ glamor_set_drawable_modifiers_func(pScreen, get_drawable_modifiers);
#endif
}
#endif
diff --git a/hw/xfree86/drivers/modesetting/pageflip.c b/hw/xfree86/drivers/modesetting/pageflip.c
index 2113f2228..cb11bd4f9 100644
--- a/hw/xfree86/drivers/modesetting/pageflip.c
+++ b/hw/xfree86/drivers/modesetting/pageflip.c
@@ -244,9 +244,9 @@ ms_do_pageflip(ScreenPtr screen,
uint32_t flags;
int i;
struct ms_flipdata *flipdata;
- ms->glamor.block_handler(screen);
+ glamor_block_handler(screen);
- new_front_bo.gbm = ms->glamor.gbm_bo_from_pixmap(screen, new_front);
+ new_front_bo.gbm = glamor_gbm_bo_from_pixmap(screen, new_front);
new_front_bo.dumb = NULL;
if (!new_front_bo.gbm) {
diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c
index fea2d663e..2796b4889 100644
--- a/hw/xfree86/drivers/modesetting/present.c
+++ b/hw/xfree86/drivers/modesetting/present.c
@@ -166,7 +166,7 @@ ms_present_flush(WindowPtr window)
modesettingPtr ms = modesettingPTR(scrn);
if (ms->drmmode.glamor)
- ms->glamor.block_handler(screen);
+ glamor_block_handler(screen);
#endif
}
@@ -259,7 +259,7 @@ ms_present_check_unflip(RRCrtcPtr crtc,
#ifdef GBM_BO_WITH_MODIFIERS
/* Check if buffer format/modifier is supported by all active CRTCs */
- gbm = ms->glamor.gbm_bo_from_pixmap(screen, pixmap);
+ gbm = glamor_gbm_bo_from_pixmap(screen, pixmap);
if (gbm) {
uint32_t format;
uint64_t modifier;