Commit 697f8581 authored by Keith Packard's avatar Keith Packard Committed by Emma Anholt
Browse files

glamor: Eliminate GLAMOR_USE_SCREEN and GLAMOR_USE_PICTURE_SCREEN



Remove these defines as we start to remove support for non-standard
glamor layering as used by the intel driver.

v2: Rebase on the blockhandler change and the Xephyr init failure
    change (by anholt), fix stray NO_DRI3 addition to xwayland.
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
Signed-off-by: Emma Anholt's avatarEric Anholt <eric@anholt.net>
Reviewed-by: Emma Anholt's avatarEric Anholt <eric@anholt.net>
parent 28ff815c
......@@ -309,10 +309,8 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_screen_private *glamor_priv;
int gl_version;
int max_viewport_size[2];
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
#endif
if (flags & ~GLAMOR_VALID_FLAGS) {
ErrorF("glamor_init: Invalid flags %x\n", flags);
return FALSE;
......@@ -447,51 +445,45 @@ glamor_init(ScreenPtr screen, unsigned int flags)
if (!glamor_font_init(screen))
goto fail;
if (flags & GLAMOR_USE_SCREEN) {
glamor_priv->saved_procs.block_handler = screen->BlockHandler;
screen->BlockHandler = _glamor_block_handler;
glamor_priv->saved_procs.block_handler = screen->BlockHandler;
screen->BlockHandler = _glamor_block_handler;
glamor_priv->saved_procs.create_gc = screen->CreateGC;
screen->CreateGC = glamor_create_gc;
glamor_priv->saved_procs.create_gc = screen->CreateGC;
screen->CreateGC = glamor_create_gc;
glamor_priv->saved_procs.create_pixmap = screen->CreatePixmap;
screen->CreatePixmap = glamor_create_pixmap;
glamor_priv->saved_procs.create_pixmap = screen->CreatePixmap;
screen->CreatePixmap = glamor_create_pixmap;
glamor_priv->saved_procs.destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_destroy_pixmap;
glamor_priv->saved_procs.destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_destroy_pixmap;
glamor_priv->saved_procs.get_spans = screen->GetSpans;
screen->GetSpans = glamor_get_spans;
glamor_priv->saved_procs.get_spans = screen->GetSpans;
screen->GetSpans = glamor_get_spans;
glamor_priv->saved_procs.get_image = screen->GetImage;
screen->GetImage = glamor_get_image;
glamor_priv->saved_procs.get_image = screen->GetImage;
screen->GetImage = glamor_get_image;
glamor_priv->saved_procs.change_window_attributes =
screen->ChangeWindowAttributes;
screen->ChangeWindowAttributes = glamor_change_window_attributes;
glamor_priv->saved_procs.change_window_attributes =
screen->ChangeWindowAttributes;
screen->ChangeWindowAttributes = glamor_change_window_attributes;
glamor_priv->saved_procs.copy_window = screen->CopyWindow;
screen->CopyWindow = glamor_copy_window;
glamor_priv->saved_procs.copy_window = screen->CopyWindow;
screen->CopyWindow = glamor_copy_window;
glamor_priv->saved_procs.bitmap_to_region = screen->BitmapToRegion;
screen->BitmapToRegion = glamor_bitmap_to_region;
glamor_priv->saved_procs.bitmap_to_region = screen->BitmapToRegion;
screen->BitmapToRegion = glamor_bitmap_to_region;
}
#ifdef RENDER
if (flags & GLAMOR_USE_PICTURE_SCREEN) {
glamor_priv->saved_procs.composite = ps->Composite;
ps->Composite = glamor_composite;
glamor_priv->saved_procs.composite = ps->Composite;
ps->Composite = glamor_composite;
glamor_priv->saved_procs.trapezoids = ps->Trapezoids;
ps->Trapezoids = glamor_trapezoids;
glamor_priv->saved_procs.trapezoids = ps->Trapezoids;
ps->Trapezoids = glamor_trapezoids;
glamor_priv->saved_procs.triangles = ps->Triangles;
ps->Triangles = glamor_triangles;
glamor_priv->saved_procs.triangles = ps->Triangles;
ps->Triangles = glamor_triangles;
glamor_priv->saved_procs.addtraps = ps->AddTraps;
ps->AddTraps = glamor_add_traps;
}
glamor_priv->saved_procs.addtraps = ps->AddTraps;
ps->AddTraps = glamor_add_traps;
glamor_priv->saved_procs.composite_rects = ps->CompositeRects;
ps->CompositeRects = glamor_composite_rectangles;
......@@ -508,13 +500,14 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_priv->saved_procs.destroy_picture = ps->DestroyPicture;
ps->DestroyPicture = glamor_destroy_picture;
glamor_init_composite_shaders(screen);
#endif
glamor_priv->saved_procs.set_window_pixmap = screen->SetWindowPixmap;
screen->SetWindowPixmap = glamor_set_window_pixmap;
glamor_init_vbo(screen);
glamor_init_pixmap_fbo(screen);
glamor_init_finish_access_shaders(screen);
#ifdef GLAMOR_GRADIENT_SHADER
glamor_init_gradient_shader(screen);
#endif
......@@ -537,9 +530,7 @@ glamor_release_screen_priv(ScreenPtr screen)
glamor_screen_private *glamor_priv;
glamor_priv = glamor_get_screen_private(screen);
#ifdef RENDER
glamor_fini_composite_shaders(screen);
#endif
glamor_fini_vbo(screen);
glamor_fini_pixmap_fbo(screen);
glamor_fini_finish_access_shaders(screen);
......@@ -578,43 +569,34 @@ glamor_close_screen(ScreenPtr screen)
{
glamor_screen_private *glamor_priv;
PixmapPtr screen_pixmap;
int flags;
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
#endif
glamor_priv = glamor_get_screen_private(screen);
flags = glamor_priv->flags;
glamor_sync_close(screen);
glamor_glyphs_fini(screen);
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
screen->CreateScreenResources =
glamor_priv->saved_procs.create_screen_resources;
if (flags & GLAMOR_USE_SCREEN) {
screen->CreateGC = glamor_priv->saved_procs.create_gc;
screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap;
screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap;
screen->GetSpans = glamor_priv->saved_procs.get_spans;
screen->ChangeWindowAttributes =
glamor_priv->saved_procs.change_window_attributes;
screen->CopyWindow = glamor_priv->saved_procs.copy_window;
screen->BitmapToRegion = glamor_priv->saved_procs.bitmap_to_region;
screen->BlockHandler = glamor_priv->saved_procs.block_handler;
}
#ifdef RENDER
if (ps && (flags & GLAMOR_USE_PICTURE_SCREEN)) {
ps->Composite = glamor_priv->saved_procs.composite;
ps->Trapezoids = glamor_priv->saved_procs.trapezoids;
ps->Triangles = glamor_priv->saved_procs.triangles;
ps->CreatePicture = glamor_priv->saved_procs.create_picture;
}
screen->CreateGC = glamor_priv->saved_procs.create_gc;
screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap;
screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap;
screen->GetSpans = glamor_priv->saved_procs.get_spans;
screen->ChangeWindowAttributes =
glamor_priv->saved_procs.change_window_attributes;
screen->CopyWindow = glamor_priv->saved_procs.copy_window;
screen->BitmapToRegion = glamor_priv->saved_procs.bitmap_to_region;
screen->BlockHandler = glamor_priv->saved_procs.block_handler;
ps->Composite = glamor_priv->saved_procs.composite;
ps->Trapezoids = glamor_priv->saved_procs.trapezoids;
ps->Triangles = glamor_priv->saved_procs.triangles;
ps->CreatePicture = glamor_priv->saved_procs.create_picture;
ps->CompositeRects = glamor_priv->saved_procs.composite_rects;
ps->Glyphs = glamor_priv->saved_procs.glyphs;
ps->UnrealizeGlyph = glamor_priv->saved_procs.unrealize_glyph;
screen->SetWindowPixmap = glamor_priv->saved_procs.set_window_pixmap;
#endif
screen_pixmap = screen->GetScreenPixmap(screen);
glamor_set_pixmap_private(screen_pixmap, NULL);
......
......@@ -62,15 +62,9 @@ typedef enum glamor_pixmap_type {
} glamor_pixmap_type_t;
#define GLAMOR_EGL_EXTERNAL_BUFFER 3
#define GLAMOR_INVERTED_Y_AXIS 1 /* compat stub */
#define GLAMOR_USE_SCREEN (1 << 1)
#define GLAMOR_USE_PICTURE_SCREEN (1 << 2)
#define GLAMOR_USE_EGL_SCREEN (1 << 3)
#define GLAMOR_NO_DRI3 (1 << 4)
#define GLAMOR_VALID_FLAGS (GLAMOR_INVERTED_Y_AXIS \
| GLAMOR_USE_SCREEN \
| GLAMOR_USE_PICTURE_SCREEN \
| GLAMOR_USE_EGL_SCREEN \
#define GLAMOR_USE_EGL_SCREEN (1 << 0)
#define GLAMOR_NO_DRI3 (1 << 1)
#define GLAMOR_VALID_FLAGS (GLAMOR_USE_EGL_SCREEN \
| GLAMOR_NO_DRI3)
/* @glamor_init: Initialize glamor internal data structure.
......@@ -78,23 +72,13 @@ typedef enum glamor_pixmap_type {
* @screen: Current screen pointer.
* @flags: Please refer the flags description above.
*
* @GLAMOR_USE_SCREEN:
* If running in an pre-existing X environment, and the
* gl context is GLX, then you should set this bit and
* let the glamor to handle all the screen related
* functions such as GC ops and CreatePixmap/DestroyPixmap.
*
* @GLAMOR_USE_PICTURE_SCREEN:
* If don't use any other underlying DDX driver to handle
* the picture related rendering functions, please set this
* bit on. Otherwise, clear this bit. And then it is the DDX
* driver's responsibility to determine how/when to jump to
* glamor's picture compositing path.
*
* @GLAMOR_USE_EGL_SCREEN:
* If you are using EGL layer, then please set this bit
* on, otherwise, clear it.
*
* @GLAMOR_NO_DRI3
* Disable the built-in DRI3 support
*
* This function initializes necessary internal data structure
* for glamor. And before calling into this function, the OpenGL
* environment should be ready. Should be called before any real
......
......@@ -1407,9 +1407,7 @@ ephyr_glamor_init(ScreenPtr screen)
ephyr_glamor_set_window_size(scrpriv->glamor,
scrpriv->win_width, scrpriv->win_height);
if (!glamor_init(screen,
GLAMOR_USE_SCREEN |
GLAMOR_USE_PICTURE_SCREEN)) {
if (!glamor_init(screen, 0)) {
FatalError("Failed to initialize glamor\n");
return FALSE;
}
......
......@@ -1049,10 +1049,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
#ifdef GLAMOR
if (ms->drmmode.glamor) {
if (!glamor_init(pScreen,
GLAMOR_USE_EGL_SCREEN |
GLAMOR_USE_SCREEN |
GLAMOR_USE_PICTURE_SCREEN)) {
if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to initialize glamor at ScreenInit() time.\n");
return FALSE;
......
......@@ -549,11 +549,7 @@ xwl_glamor_init(struct xwl_screen *xwl_screen)
return FALSE;
}
if (!glamor_init(xwl_screen->screen,
GLAMOR_INVERTED_Y_AXIS |
GLAMOR_USE_EGL_SCREEN |
GLAMOR_USE_SCREEN |
GLAMOR_USE_PICTURE_SCREEN)) {
if (!glamor_init(xwl_screen->screen, GLAMOR_USE_EGL_SCREEN)) {
ErrorF("Failed to initialize glamor\n");
return FALSE;
}
......
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