Revert "Revert "modesetting: Indirect the glamor API through LoaderSymbol""
Now that we've fixed LoaderSymbolFromModule this should work properly.
This reverts commit 5c7c6d5cff
.
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
parent
ab61c16ef0
commit
cb1b1e1847
|
@ -123,6 +123,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable,
|
||||||
unsigned int attachment, unsigned int format)
|
unsigned int attachment, unsigned int format)
|
||||||
{
|
{
|
||||||
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
||||||
|
modesettingPtr ms = modesettingPTR(scrn);
|
||||||
DRI2Buffer2Ptr buffer;
|
DRI2Buffer2Ptr buffer;
|
||||||
PixmapPtr pixmap;
|
PixmapPtr pixmap;
|
||||||
CARD32 size;
|
CARD32 size;
|
||||||
|
@ -200,7 +201,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable,
|
||||||
*/
|
*/
|
||||||
buffer->flags = 0;
|
buffer->flags = 0;
|
||||||
|
|
||||||
buffer->name = glamor_name_from_pixmap(pixmap, &pitch, &size);
|
buffer->name = ms->glamor.name_from_pixmap(pixmap, &pitch, &size);
|
||||||
buffer->pitch = pitch;
|
buffer->pitch = pitch;
|
||||||
if (buffer->name == -1) {
|
if (buffer->name == -1) {
|
||||||
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
||||||
|
@ -510,11 +511,12 @@ update_front(DrawablePtr draw, DRI2BufferPtr front)
|
||||||
ScreenPtr screen = draw->pScreen;
|
ScreenPtr screen = draw->pScreen;
|
||||||
PixmapPtr pixmap = get_drawable_pixmap(draw);
|
PixmapPtr pixmap = get_drawable_pixmap(draw);
|
||||||
ms_dri2_buffer_private_ptr priv = front->driverPrivate;
|
ms_dri2_buffer_private_ptr priv = front->driverPrivate;
|
||||||
|
modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen));
|
||||||
CARD32 size;
|
CARD32 size;
|
||||||
CARD16 pitch;
|
CARD16 pitch;
|
||||||
int name;
|
int name;
|
||||||
|
|
||||||
name = glamor_name_from_pixmap(pixmap, &pitch, &size);
|
name = ms->glamor.name_from_pixmap(pixmap, &pitch, &size);
|
||||||
if (name < 0)
|
if (name < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -618,7 +620,7 @@ ms_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front,
|
||||||
*front_pix = *back_pix;
|
*front_pix = *back_pix;
|
||||||
*back_pix = tmp_pix;
|
*back_pix = tmp_pix;
|
||||||
|
|
||||||
glamor_egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap);
|
ms->glamor.egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap);
|
||||||
|
|
||||||
/* Post damage on the front buffer so that listeners, such
|
/* Post damage on the front buffer so that listeners, such
|
||||||
* as DisplayLink know take a copy and shove it over the USB.
|
* as DisplayLink know take a copy and shove it over the USB.
|
||||||
|
@ -1036,7 +1038,7 @@ ms_dri2_screen_init(ScreenPtr screen)
|
||||||
modesettingPtr ms = modesettingPTR(scrn);
|
modesettingPtr ms = modesettingPTR(scrn);
|
||||||
DRI2InfoRec info;
|
DRI2InfoRec info;
|
||||||
|
|
||||||
if (!glamor_supports_pixmap_import_export(screen)) {
|
if (!ms->glamor.supports_pixmap_import_export(screen)) {
|
||||||
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
|
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
|
||||||
"DRI2: glamor lacks support for pixmap import/export\n");
|
"DRI2: glamor lacks support for pixmap import/export\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -615,7 +615,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty, int *timeout)
|
||||||
* the shared pixmap, but not all).
|
* the shared pixmap, but not all).
|
||||||
*/
|
*/
|
||||||
if (ms->drmmode.glamor)
|
if (ms->drmmode.glamor)
|
||||||
glamor_finish(screen);
|
ms->glamor.finish(screen);
|
||||||
#endif
|
#endif
|
||||||
/* Ensure the slave processes the damage immediately */
|
/* Ensure the slave processes the damage immediately */
|
||||||
if (timeout)
|
if (timeout)
|
||||||
|
@ -743,6 +743,26 @@ 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
|
static void
|
||||||
try_enable_glamor(ScrnInfoPtr pScrn)
|
try_enable_glamor(ScrnInfoPtr pScrn)
|
||||||
{
|
{
|
||||||
|
@ -751,6 +771,7 @@ try_enable_glamor(ScrnInfoPtr pScrn)
|
||||||
OPTION_ACCEL_METHOD);
|
OPTION_ACCEL_METHOD);
|
||||||
Bool do_glamor = (!accel_method_str ||
|
Bool do_glamor = (!accel_method_str ||
|
||||||
strcmp(accel_method_str, "glamor") == 0);
|
strcmp(accel_method_str, "glamor") == 0);
|
||||||
|
void *mod;
|
||||||
|
|
||||||
ms->drmmode.glamor = FALSE;
|
ms->drmmode.glamor = FALSE;
|
||||||
|
|
||||||
|
@ -765,8 +786,10 @@ try_enable_glamor(ScrnInfoPtr pScrn)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME)) {
|
mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME);
|
||||||
if (glamor_egl_init(pScrn, ms->fd)) {
|
if (mod) {
|
||||||
|
bind_glamor_api(mod, ms);
|
||||||
|
if (ms->glamor.egl_init(pScrn, ms->fd)) {
|
||||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n");
|
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n");
|
||||||
ms->drmmode.glamor = TRUE;
|
ms->drmmode.glamor = TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1421,11 +1444,12 @@ static Bool
|
||||||
msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle)
|
msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle)
|
||||||
{
|
{
|
||||||
#ifdef GLAMOR_HAS_GBM
|
#ifdef GLAMOR_HAS_GBM
|
||||||
|
modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen));
|
||||||
int ret;
|
int ret;
|
||||||
CARD16 stride;
|
CARD16 stride;
|
||||||
CARD32 size;
|
CARD32 size;
|
||||||
ret = glamor_shareable_fd_from_pixmap(ppix->drawable.pScreen, ppix,
|
ret = ms->glamor.shareable_fd_from_pixmap(ppix->drawable.pScreen, ppix,
|
||||||
&stride, &size);
|
&stride, &size);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -1450,11 +1474,12 @@ msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle)
|
||||||
return drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, 0, 0);
|
return drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, 0, 0);
|
||||||
|
|
||||||
if (ms->drmmode.reverse_prime_offload_mode) {
|
if (ms->drmmode.reverse_prime_offload_mode) {
|
||||||
ret = glamor_back_pixmap_from_fd(ppix, ihandle,
|
ret = ms->glamor.back_pixmap_from_fd(ppix, ihandle,
|
||||||
ppix->drawable.width,
|
ppix->drawable.width,
|
||||||
ppix->drawable.height,
|
ppix->drawable.height,
|
||||||
ppix->devKind, ppix->drawable.depth,
|
ppix->devKind,
|
||||||
ppix->drawable.bitsPerPixel);
|
ppix->drawable.depth,
|
||||||
|
ppix->drawable.bitsPerPixel);
|
||||||
} else {
|
} else {
|
||||||
int size = ppix->devKind * ppix->drawable.height;
|
int size = ppix->devKind * ppix->drawable.height;
|
||||||
ret = drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, ppix->devKind, size);
|
ret = drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, ppix->devKind, size);
|
||||||
|
@ -1571,7 +1596,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
||||||
|
|
||||||
#ifdef GLAMOR_HAS_GBM
|
#ifdef GLAMOR_HAS_GBM
|
||||||
if (ms->drmmode.glamor)
|
if (ms->drmmode.glamor)
|
||||||
ms->drmmode.gbm = glamor_egl_get_gbm_device(pScreen);
|
ms->drmmode.gbm = ms->glamor.egl_get_gbm_device(pScreen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* HW dependent - FIXME */
|
/* HW dependent - FIXME */
|
||||||
|
@ -1715,7 +1740,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
||||||
if (ms->drmmode.glamor) {
|
if (ms->drmmode.glamor) {
|
||||||
XF86VideoAdaptorPtr glamor_adaptor;
|
XF86VideoAdaptorPtr glamor_adaptor;
|
||||||
|
|
||||||
glamor_adaptor = glamor_xv_init(pScreen, 16);
|
glamor_adaptor = ms->glamor.xv_init(pScreen, 16);
|
||||||
if (glamor_adaptor != NULL)
|
if (glamor_adaptor != NULL)
|
||||||
xf86XVScreenInit(pScreen, &glamor_adaptor, 1);
|
xf86XVScreenInit(pScreen, &glamor_adaptor, 1);
|
||||||
else
|
else
|
||||||
|
|
|
@ -132,6 +132,30 @@ typedef struct _modesettingRec {
|
||||||
void (*UpdatePacked)(ScreenPtr, shadowBufPtr);
|
void (*UpdatePacked)(ScreenPtr, shadowBufPtr);
|
||||||
} shadow;
|
} 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;
|
} modesettingRec, *modesettingPtr;
|
||||||
|
|
||||||
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
|
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
|
||||||
|
|
|
@ -1378,6 +1378,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id)
|
||||||
PixmapPtr pixmap = drmmode->fbcon_pixmap;
|
PixmapPtr pixmap = drmmode->fbcon_pixmap;
|
||||||
drmModeFBPtr fbcon;
|
drmModeFBPtr fbcon;
|
||||||
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
|
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
|
||||||
|
modesettingPtr ms = modesettingPTR(pScrn);
|
||||||
Bool ret;
|
Bool ret;
|
||||||
|
|
||||||
if (pixmap)
|
if (pixmap)
|
||||||
|
@ -1398,7 +1399,8 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id)
|
||||||
if (!pixmap)
|
if (!pixmap)
|
||||||
goto out_free_fb;
|
goto out_free_fb;
|
||||||
|
|
||||||
ret = glamor_egl_create_textured_pixmap(pixmap, fbcon->handle, fbcon->pitch);
|
ret = ms->glamor.egl_create_textured_pixmap(pixmap, fbcon->handle,
|
||||||
|
fbcon->pitch);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
FreePixmap(pixmap);
|
FreePixmap(pixmap);
|
||||||
pixmap = NULL;
|
pixmap = NULL;
|
||||||
|
@ -1417,6 +1419,7 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
|
||||||
#ifdef GLAMOR_HAS_GBM
|
#ifdef GLAMOR_HAS_GBM
|
||||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
|
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||||
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
|
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
|
||||||
|
modesettingPtr ms = modesettingPTR(pScrn);
|
||||||
PixmapPtr src, dst;
|
PixmapPtr src, dst;
|
||||||
int fbcon_id = 0;
|
int fbcon_id = 0;
|
||||||
GCPtr gc;
|
GCPtr gc;
|
||||||
|
@ -1454,7 +1457,7 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
|
||||||
|
|
||||||
FreeScratchGC(gc);
|
FreeScratchGC(gc);
|
||||||
|
|
||||||
glamor_finish(pScreen);
|
ms->glamor.finish(pScreen);
|
||||||
|
|
||||||
pScreen->canDoBGNoneRoot = TRUE;
|
pScreen->canDoBGNoneRoot = TRUE;
|
||||||
|
|
||||||
|
@ -3090,12 +3093,13 @@ drmmode_set_pixmap_bo(drmmode_ptr drmmode, PixmapPtr pixmap, drmmode_bo *bo)
|
||||||
{
|
{
|
||||||
#ifdef GLAMOR_HAS_GBM
|
#ifdef GLAMOR_HAS_GBM
|
||||||
ScrnInfoPtr scrn = drmmode->scrn;
|
ScrnInfoPtr scrn = drmmode->scrn;
|
||||||
|
modesettingPtr ms = modesettingPTR(scrn);
|
||||||
|
|
||||||
if (!drmmode->glamor)
|
if (!drmmode->glamor)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (!glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo->gbm,
|
if (!ms->glamor.egl_create_textured_pixmap_from_gbm_bo(pixmap, bo->gbm,
|
||||||
bo->used_modifiers)) {
|
bo->used_modifiers)) {
|
||||||
xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create pixmap\n");
|
xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create pixmap\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -3410,13 +3414,14 @@ drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
|
||||||
{
|
{
|
||||||
#ifdef GLAMOR_HAS_GBM
|
#ifdef GLAMOR_HAS_GBM
|
||||||
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
|
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
|
||||||
|
modesettingPtr ms = modesettingPTR(pScrn);
|
||||||
|
|
||||||
if (drmmode->glamor) {
|
if (drmmode->glamor) {
|
||||||
if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
|
if (!ms->glamor.init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#ifdef GBM_BO_WITH_MODIFIERS
|
#ifdef GBM_BO_WITH_MODIFIERS
|
||||||
glamor_set_drawable_modifiers_func(pScreen, get_drawable_modifiers);
|
ms->glamor.set_drawable_modifiers_func(pScreen, get_drawable_modifiers);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -244,9 +244,9 @@ ms_do_pageflip(ScreenPtr screen,
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
int i;
|
int i;
|
||||||
struct ms_flipdata *flipdata;
|
struct ms_flipdata *flipdata;
|
||||||
glamor_block_handler(screen);
|
ms->glamor.block_handler(screen);
|
||||||
|
|
||||||
new_front_bo.gbm = glamor_gbm_bo_from_pixmap(screen, new_front);
|
new_front_bo.gbm = ms->glamor.gbm_bo_from_pixmap(screen, new_front);
|
||||||
new_front_bo.dumb = NULL;
|
new_front_bo.dumb = NULL;
|
||||||
|
|
||||||
if (!new_front_bo.gbm) {
|
if (!new_front_bo.gbm) {
|
||||||
|
|
|
@ -166,7 +166,7 @@ ms_present_flush(WindowPtr window)
|
||||||
modesettingPtr ms = modesettingPTR(scrn);
|
modesettingPtr ms = modesettingPTR(scrn);
|
||||||
|
|
||||||
if (ms->drmmode.glamor)
|
if (ms->drmmode.glamor)
|
||||||
glamor_block_handler(screen);
|
ms->glamor.block_handler(screen);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ ms_present_check_unflip(RRCrtcPtr crtc,
|
||||||
|
|
||||||
#ifdef GBM_BO_WITH_MODIFIERS
|
#ifdef GBM_BO_WITH_MODIFIERS
|
||||||
/* Check if buffer format/modifier is supported by all active CRTCs */
|
/* Check if buffer format/modifier is supported by all active CRTCs */
|
||||||
gbm = glamor_gbm_bo_from_pixmap(screen, pixmap);
|
gbm = ms->glamor.gbm_bo_from_pixmap(screen, pixmap);
|
||||||
if (gbm) {
|
if (gbm) {
|
||||||
uint32_t format;
|
uint32_t format;
|
||||||
uint64_t modifier;
|
uint64_t modifier;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user