aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/configure.ac2
-rw-r--r--xorg-server/glamor/glamor.c224
-rw-r--r--xorg-server/glamor/glamor.h173
-rw-r--r--xorg-server/glamor/glamor_addtraps.c29
-rw-r--r--xorg-server/glamor/glamor_compositerects.c4
-rw-r--r--xorg-server/glamor/glamor_copy.c75
-rw-r--r--xorg-server/glamor/glamor_core.c30
-rw-r--r--xorg-server/glamor/glamor_dash.c15
-rw-r--r--xorg-server/glamor/glamor_egl.c24
-rw-r--r--xorg-server/glamor/glamor_fbo.c162
-rw-r--r--xorg-server/glamor/glamor_font.c1
-rw-r--r--xorg-server/glamor/glamor_glyphblt.c54
-rw-r--r--xorg-server/glamor/glamor_glyphs.c14
-rw-r--r--xorg-server/glamor/glamor_gradient.c12
-rw-r--r--xorg-server/glamor/glamor_image.c27
-rw-r--r--xorg-server/glamor/glamor_largepixmap.c185
-rw-r--r--xorg-server/glamor/glamor_lines.c23
-rw-r--r--xorg-server/glamor/glamor_picture.c20
-rw-r--r--xorg-server/glamor/glamor_pixmap.c144
-rw-r--r--xorg-server/glamor/glamor_points.c24
-rw-r--r--xorg-server/glamor/glamor_prepare.c40
-rw-r--r--xorg-server/glamor/glamor_priv.h243
-rw-r--r--xorg-server/glamor/glamor_program.c19
-rw-r--r--xorg-server/glamor/glamor_program.h2
-rw-r--r--xorg-server/glamor/glamor_rects.c28
-rw-r--r--xorg-server/glamor/glamor_render.c309
-rw-r--r--xorg-server/glamor/glamor_segs.c20
-rw-r--r--xorg-server/glamor/glamor_spans.c61
-rw-r--r--xorg-server/glamor/glamor_sync.c2
-rw-r--r--xorg-server/glamor/glamor_text.c47
-rw-r--r--xorg-server/glamor/glamor_transfer.c57
-rw-r--r--xorg-server/glamor/glamor_transform.c16
-rw-r--r--xorg-server/glamor/glamor_trapezoid.c16
-rw-r--r--xorg-server/glamor/glamor_triangles.c42
-rw-r--r--xorg-server/glamor/glamor_utils.h215
-rw-r--r--xorg-server/glamor/glamor_window.c12
-rw-r--r--xorg-server/glamor/glamor_xv.c15
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c2
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.c9
-rw-r--r--xorg-server/hw/xfree86/common/xf86Events.c7
-rw-r--r--xorg-server/hw/xfree86/common/xf86platformBus.c20
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/driver.c5
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c53
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.h26
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/systemd-logind.c17
-rw-r--r--xorg-server/hw/xquartz/quartz.c1
-rw-r--r--xorg-server/hw/xquartz/xpr/xprScreen.c2
-rw-r--r--xorg-server/hw/xwayland/Makefile.am1
-rw-r--r--xorg-server/hw/xwayland/xwayland-glamor.c6
-rw-r--r--xorg-server/hw/xwin/InitOutput.c61
-rw-r--r--xorg-server/hw/xwin/Makefile.am2
-rw-r--r--xorg-server/hw/xwin/XWin.exe.manifest16
-rw-r--r--xorg-server/hw/xwin/glx/gen_gl_wrappers.py96
-rw-r--r--xorg-server/hw/xwin/man/XWin.man11
-rw-r--r--xorg-server/hw/xwin/win.h35
-rw-r--r--xorg-server/hw/xwin/winengine.c26
-rw-r--r--xorg-server/hw/xwin/winglobals.c2
-rw-r--r--xorg-server/hw/xwin/winos.c72
-rw-r--r--xorg-server/hw/xwin/winprocarg.c20
-rw-r--r--xorg-server/hw/xwin/winscrinit.c23
-rw-r--r--xorg-server/hw/xwin/winshaddd.c1221
-rw-r--r--xorg-server/hw/xwin/winwndproc.c6
-rw-r--r--xorg-server/include/Makefile.am1
-rw-r--r--xorg-server/include/extinit.h5
-rw-r--r--xorg-server/include/nonsdk_extinit.h35
-rw-r--r--xorg-server/include/protocol-versions.h2
-rw-r--r--xorg-server/mi/mifillarc.c5
-rw-r--r--xorg-server/mi/miinitext.c3
-rw-r--r--xorg-server/os/log.c28
-rw-r--r--xorg-server/os/xdmcp.c17
-rw-r--r--xorg-server/pseudoramiX/pseudoramiX.c6
-rw-r--r--xorg-server/pseudoramiX/pseudoramiX.h2
-rw-r--r--xorg-server/randr/Makefile.am1
-rw-r--r--xorg-server/randr/randr.c4
-rw-r--r--xorg-server/randr/randrstr.h44
-rw-r--r--xorg-server/randr/rrdispatch.c3
-rw-r--r--xorg-server/randr/rrmonitor.c748
-rw-r--r--xorg-server/randr/rrsdispatch.c38
-rw-r--r--xorg-server/randr/rrxinerama.c123
-rw-r--r--xorg-server/xkeyboard-config/rules/base.xml.in6
-rw-r--r--xorg-server/xkeyboard-config/symbols/de1
-rw-r--r--xorg-server/xkeyboard-config/symbols/latam61
-rw-r--r--xorg-server/xkeyboard-config/symbols/typo107
83 files changed, 2276 insertions, 3090 deletions
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 280c3692a..606298bdc 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -782,7 +782,7 @@ LIBXSHMFENCE="xshmfence >= 1.1"
dnl Required modules
XPROTO="xproto >= 7.0.26"
-RANDRPROTO="randrproto >= 1.4.0"
+RANDRPROTO="randrproto >= 1.5.0"
RENDERPROTO="renderproto >= 0.11"
XEXTPROTO="xextproto >= 7.2.99.901"
INPUTPROTO="inputproto >= 2.3"
diff --git a/xorg-server/glamor/glamor.c b/xorg-server/glamor/glamor.c
index 017266a85..6f4f30927 100644
--- a/xorg-server/glamor/glamor.c
+++ b/xorg-server/glamor/glamor.c
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include "glamor_priv.h"
+#include "mipict.h"
DevPrivateKeyRec glamor_screen_private_key;
DevPrivateKeyRec glamor_pixmap_private_key;
@@ -59,26 +60,34 @@ glamor_get_drawable_pixmap(DrawablePtr drawable)
return (PixmapPtr) drawable;
}
+static void
+glamor_init_pixmap_private_small(PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv)
+{
+ pixmap_priv->box.x1 = 0;
+ pixmap_priv->box.x2 = pixmap->drawable.width;
+ pixmap_priv->box.y1 = 0;
+ pixmap_priv->box.y2 = pixmap->drawable.height;
+ pixmap_priv->block_w = pixmap->drawable.width;
+ pixmap_priv->block_h = pixmap->drawable.height;
+ pixmap_priv->block_hcnt = 1;
+ pixmap_priv->block_wcnt = 1;
+ pixmap_priv->box_array = &pixmap_priv->box;
+ pixmap_priv->fbo_array = &pixmap_priv->fbo;
+}
+
_X_EXPORT void
glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
{
glamor_pixmap_private *pixmap_priv;
- glamor_screen_private *glamor_priv =
- glamor_get_screen_private(pixmap->drawable.pScreen);
pixmap_priv = dixLookupPrivate(&pixmap->devPrivates,
&glamor_pixmap_private_key);
if (pixmap_priv == NULL) {
pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
glamor_set_pixmap_private(pixmap, pixmap_priv);
- pixmap_priv->base.pixmap = pixmap;
- pixmap_priv->base.glamor_priv = glamor_priv;
}
pixmap_priv->type = type;
- pixmap_priv->base.box.x1 = 0;
- pixmap_priv->base.box.x2 = pixmap->drawable.width;
- pixmap_priv->base.box.y1 = 0;
- pixmap_priv->base.box.y2 = pixmap->drawable.height;
+ glamor_init_pixmap_private_small(pixmap, pixmap_priv);
}
_X_EXPORT void
@@ -93,9 +102,9 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex)
glamor_priv = glamor_get_screen_private(screen);
pixmap_priv = glamor_get_pixmap_private(pixmap);
- if (pixmap_priv->base.fbo) {
+ if (pixmap_priv->fbo) {
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
- glamor_destroy_fbo(fbo);
+ glamor_destroy_fbo(glamor_priv, fbo);
}
format = gl_iformat_for_pixmap(pixmap);
@@ -119,10 +128,10 @@ glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap)
glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen);
pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
- glamor_priv->screen_fbo = pixmap_priv->base.fbo->fb;
+ glamor_priv->screen_fbo = pixmap_priv->fbo->fb;
- pixmap_priv->base.fbo->width = screen_pixmap->drawable.width;
- pixmap_priv->base.fbo->height = screen_pixmap->drawable.height;
+ pixmap_priv->fbo->width = screen_pixmap->drawable.width;
+ pixmap_priv->fbo->height = screen_pixmap->drawable.height;
}
uint32_t
@@ -133,7 +142,7 @@ glamor_get_pixmap_texture(PixmapPtr pixmap)
if (pixmap_priv->type != GLAMOR_TEXTURE_ONLY)
return 0;
- return pixmap_priv->base.fbo->tex;
+ return pixmap_priv->fbo->tex;
}
PixmapPtr
@@ -141,7 +150,6 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
unsigned int usage)
{
PixmapPtr pixmap;
- glamor_pixmap_type_t type = GLAMOR_TEXTURE_ONLY;
glamor_pixmap_private *pixmap_priv;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glamor_pixmap_fbo *fbo = NULL;
@@ -169,38 +177,26 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
}
glamor_set_pixmap_private(pixmap, pixmap_priv);
- if (usage == GLAMOR_CREATE_PIXMAP_MAP)
- type = GLAMOR_MEMORY_MAP;
-
- pixmap_priv->base.pixmap = pixmap;
- pixmap_priv->base.glamor_priv = glamor_priv;
-
format = gl_iformat_for_pixmap(pixmap);
pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL);
+ pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
+
if (usage == GLAMOR_CREATE_PIXMAP_NO_TEXTURE) {
- pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
- pixmap_priv->base.box.x1 = 0;
- pixmap_priv->base.box.y1 = 0;
- pixmap_priv->base.box.x2 = w;
- pixmap_priv->base.box.y2 = h;
+ glamor_init_pixmap_private_small(pixmap, pixmap_priv);
return pixmap;
}
- else if (type == GLAMOR_MEMORY_MAP || usage == GLAMOR_CREATE_NO_LARGE ||
+ else if (usage == GLAMOR_CREATE_NO_LARGE ||
glamor_check_fbo_size(glamor_priv, w, h))
{
- pixmap_priv->type = type;
- pixmap_priv->base.box.x1 = 0;
- pixmap_priv->base.box.y1 = 0;
- pixmap_priv->base.box.x2 = w;
- pixmap_priv->base.box.y2 = h;
+ glamor_init_pixmap_private_small(pixmap, pixmap_priv);
fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
} else {
int tile_size = glamor_priv->max_fbo_size;
- DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n", pixmap, w, h, tile_size);
- pixmap_priv->type = GLAMOR_TEXTURE_LARGE;
+ DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n",
+ pixmap, w, h, tile_size);
fbo = glamor_create_fbo_array(glamor_priv, w, h, format, usage,
tile_size, tile_size, pixmap_priv);
}
@@ -305,6 +301,35 @@ glamor_create_screen_resources(ScreenPtr screen)
return ret;
}
+static Bool
+glamor_check_instruction_count(int gl_version)
+{
+ GLint max_native_alu_instructions;
+
+ /* Avoid using glamor if the reported instructions limit is too low,
+ * as this would cause glamor to fallback on sw due to large shaders
+ * which ends up being unbearably slow.
+ */
+ if (gl_version < 30) {
+ if (!epoxy_has_gl_extension("GL_ARB_fragment_program")) {
+ ErrorF("GL_ARB_fragment_program required\n");
+ return FALSE;
+ }
+
+ glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB,
+ GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB,
+ &max_native_alu_instructions);
+ if (max_native_alu_instructions < GLAMOR_MIN_ALU_INSTRUCTIONS) {
+ LogMessage(X_WARNING,
+ "glamor requires at least %d instructions (%d reported)\n",
+ GLAMOR_MIN_ALU_INSTRUCTIONS, max_native_alu_instructions);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
/** Set up glamor for an already-configured GL context. */
Bool
glamor_init(ScreenPtr screen, unsigned int flags)
@@ -312,10 +337,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;
@@ -384,6 +407,9 @@ glamor_init(ScreenPtr screen, unsigned int flags)
ErrorF("Require OpenGL version 2.1 or later.\n");
goto fail;
}
+
+ if (!glamor_check_instruction_count(gl_version))
+ goto fail;
} else {
if (gl_version < 20) {
ErrorF("Require Open GLES2.0 or later.\n");
@@ -411,6 +437,14 @@ glamor_init(ScreenPtr screen, unsigned int flags)
epoxy_has_gl_extension("GL_ARB_buffer_storage");
glamor_priv->has_nv_texture_barrier =
epoxy_has_gl_extension("GL_NV_texture_barrier");
+ glamor_priv->has_unpack_subimage =
+ glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP ||
+ epoxy_gl_version() >= 30 ||
+ epoxy_has_gl_extension("GL_EXT_unpack_subimage");
+ glamor_priv->has_pack_subimage =
+ glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP ||
+ epoxy_gl_version() >= 30 ||
+ epoxy_has_gl_extension("GL_NV_pack_subimage");
glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size);
@@ -442,54 +476,48 @@ 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;
+ ps->CompositeRects = miCompositeRects;
glamor_priv->saved_procs.glyphs = ps->Glyphs;
ps->Glyphs = glamor_glyphs;
@@ -503,13 +531,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
@@ -532,9 +561,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);
@@ -560,8 +587,8 @@ glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv)
else {
if (old_priv == NULL)
return;
-
- glamor_pixmap_destroy_fbo(old_priv);
+ glamor_pixmap_destroy_fbo(glamor_get_screen_private(pixmap->drawable.pScreen),
+ old_priv);
free(old_priv);
}
@@ -573,43 +600,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);
@@ -658,7 +676,7 @@ glamor_fd_from_pixmap(ScreenPtr screen,
return -1;
return glamor_egl_dri3_fd_name_from_tex(screen,
pixmap,
- pixmap_priv->base.fbo->tex,
+ pixmap_priv->fbo->tex,
FALSE, stride, size);
default:
break;
@@ -683,7 +701,7 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
return -1;
return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
pixmap,
- pixmap_priv->base.fbo->tex,
+ pixmap_priv->fbo->tex,
TRUE, stride, size);
default:
break;
diff --git a/xorg-server/glamor/glamor.h b/xorg-server/glamor/glamor.h
index 206158c02..d07182d9e 100644
--- a/xorg-server/glamor/glamor.h
+++ b/xorg-server/glamor/glamor.h
@@ -53,25 +53,15 @@ struct glamor_context;
*/
typedef enum glamor_pixmap_type {
GLAMOR_MEMORY,
- GLAMOR_MEMORY_MAP,
GLAMOR_TEXTURE_DRM,
- GLAMOR_SEPARATE_TEXTURE,
GLAMOR_DRM_ONLY,
GLAMOR_TEXTURE_ONLY,
- GLAMOR_TEXTURE_LARGE,
- GLAMOR_TEXTURE_PACK
} 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.
@@ -79,23 +69,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
@@ -142,7 +122,6 @@ extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap);
#define GLAMOR_CREATE_PIXMAP_CPU 0x100
#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101
#define GLAMOR_CREATE_FBO_NO_FBO 0x103
-#define GLAMOR_CREATE_PIXMAP_MAP 0x104
#define GLAMOR_CREATE_NO_LARGE 0x105
#define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106
@@ -326,146 +305,6 @@ extern _X_EXPORT void glamor_destroy_gc(GCPtr gc);
extern Bool _X_EXPORT glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
extern void _X_EXPORT glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region);
-/* Glamor rendering/drawing functions with XXX_nf.
- * nf means no fallback within glamor internal if possible. If glamor
- * fail to accelerate the operation, glamor will return a false, and the
- * caller need to implement fallback method. Return a true means the
- * rendering request get done successfully. */
-extern _X_EXPORT Bool glamor_fill_spans_nf(DrawablePtr drawable,
- GCPtr gc,
- int n, DDXPointPtr points,
- int *widths, int sorted);
-
-extern _X_EXPORT Bool glamor_poly_fill_rect_nf(DrawablePtr drawable,
- GCPtr gc,
- int nrect, xRectangle *prect);
-
-extern _X_EXPORT Bool glamor_put_image_nf(DrawablePtr drawable,
- GCPtr gc, int depth, int x, int y,
- int w, int h, int left_pad,
- int image_format, char *bits);
-
-extern _X_EXPORT Bool glamor_copy_n_to_n_nf(DrawablePtr src,
- DrawablePtr dst,
- GCPtr gc,
- BoxPtr box,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown, Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT Bool glamor_copy_nf(DrawablePtr src,
- DrawablePtr dst,
- GCPtr gc,
- BoxPtr box,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown, Pixel bitplane,
- void *closure);
-
-extern _X_EXPORT Bool glamor_composite_nf(CARD8 op,
- PicturePtr source,
- PicturePtr mask,
- PicturePtr dest,
- INT16 x_source,
- INT16 y_source,
- INT16 x_mask,
- INT16 y_mask,
- INT16 x_dest, INT16 y_dest,
- CARD16 width, CARD16 height);
-
-extern _X_EXPORT Bool glamor_trapezoids_nf(CARD8 op,
- PicturePtr src, PicturePtr dst,
- PictFormatPtr mask_format,
- INT16 x_src, INT16 y_src,
- int ntrap, xTrapezoid *traps);
-
-extern _X_EXPORT Bool glamor_glyphs_nf(CARD8 op,
- PicturePtr src,
- PicturePtr dst,
- PictFormatPtr mask_format,
- INT16 x_src,
- INT16 y_src, int nlist,
- GlyphListPtr list, GlyphPtr *glyphs);
-
-extern _X_EXPORT Bool glamor_triangles_nf(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int ntris, xTriangle *tris);
-
-extern _X_EXPORT void glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph);
-
-extern _X_EXPORT Bool glamor_set_spans_nf(DrawablePtr drawable, GCPtr gc,
- char *src, DDXPointPtr points,
- int *widths, int n, int sorted);
-
-extern _X_EXPORT Bool glamor_get_spans_nf(DrawablePtr drawable, int wmax,
- DDXPointPtr points, int *widths,
- int count, char *dst);
-
-extern _X_EXPORT Bool glamor_composite_rects_nf(CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect, xRectangle *rects);
-
-extern _X_EXPORT Bool glamor_get_image_nf(DrawablePtr pDrawable, int x, int y,
- int w, int h, unsigned int format,
- unsigned long planeMask, char *d);
-
-extern _X_EXPORT Bool glamor_add_traps_nf(PicturePtr pPicture,
- INT16 x_off,
- INT16 y_off, int ntrap,
- xTrap *traps);
-
-extern _X_EXPORT Bool glamor_copy_plane_nf(DrawablePtr pSrc, DrawablePtr pDst,
- GCPtr pGC, int srcx, int srcy, int w,
- int h, int dstx, int dsty,
- unsigned long bitPlane,
- RegionPtr *pRegion);
-
-extern _X_EXPORT Bool glamor_image_glyph_blt_nf(DrawablePtr pDrawable,
- GCPtr pGC, int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- void *pglyphBase);
-
-extern _X_EXPORT Bool glamor_poly_glyph_blt_nf(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- void *pglyphBase);
-
-extern _X_EXPORT Bool glamor_push_pixels_nf(GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable, int w, int h,
- int x, int y);
-
-extern _X_EXPORT Bool glamor_poly_point_nf(DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr ppt);
-
-extern _X_EXPORT Bool glamor_poly_segment_nf(DrawablePtr pDrawable, GCPtr pGC,
- int nseg, xSegment *pSeg);
-
-extern _X_EXPORT Bool glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc,
- int mode, int n, DDXPointPtr points);
-
-extern _X_EXPORT Bool glamor_poly_text8_nf(DrawablePtr drawable, GCPtr gc,
- int x, int y, int count, char *chars, int *final_pos);
-
-extern _X_EXPORT Bool glamor_poly_text16_nf(DrawablePtr drawable, GCPtr gc,
- int x, int y, int count, unsigned short *chars, int *final_pos);
-
-extern _X_EXPORT Bool glamor_image_text8_nf(DrawablePtr drawable, GCPtr gc,
- int x, int y, int count, char *chars);
-
-extern _X_EXPORT Bool glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc,
- int x, int y, int count, unsigned short *chars);
-
#define HAS_GLAMOR_TEXT 1
#ifdef GLAMOR_FOR_XORG
diff --git a/xorg-server/glamor/glamor_addtraps.c b/xorg-server/glamor/glamor_addtraps.c
index fdc0f4232..7ad9f3000 100644
--- a/xorg-server/glamor/glamor_addtraps.c
+++ b/xorg-server/glamor/glamor_addtraps.c
@@ -28,34 +28,13 @@
#include "glamor_priv.h"
-static Bool
-_glamor_add_traps(PicturePtr pPicture,
- INT16 x_off,
- INT16 y_off, int ntrap, xTrap *traps, Bool fallback)
+void
+glamor_add_traps(PicturePtr pPicture,
+ INT16 x_off,
+ INT16 y_off, int ntrap, xTrap *traps)
{
- if (!fallback
- && (!pPicture->pDrawable
- || glamor_ddx_fallback_check_pixmap(pPicture->pDrawable)))
- return FALSE;
-
if (glamor_prepare_access_picture(pPicture, GLAMOR_ACCESS_RW)) {
fbAddTraps(pPicture, x_off, y_off, ntrap, traps);
}
glamor_finish_access_picture(pPicture);
-
- return TRUE;
-}
-
-void
-glamor_add_traps(PicturePtr pPicture,
- INT16 x_off, INT16 y_off, int ntrap, xTrap *traps)
-{
- _glamor_add_traps(pPicture, x_off, y_off, ntrap, traps, TRUE);
-}
-
-Bool
-glamor_add_traps_nf(PicturePtr pPicture,
- INT16 x_off, INT16 y_off, int ntrap, xTrap *traps)
-{
- return _glamor_add_traps(pPicture, x_off, y_off, ntrap, traps, FALSE);
}
diff --git a/xorg-server/glamor/glamor_compositerects.c b/xorg-server/glamor/glamor_compositerects.c
index 3b6b2ed07..e188d8a3f 100644
--- a/xorg-server/glamor/glamor_compositerects.c
+++ b/xorg-server/glamor/glamor_compositerects.c
@@ -246,7 +246,7 @@ glamor_composite_rectangles(CARD8 op,
goto done;
}
else {
- if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) {
+ if (_X_LIKELY(glamor_pixmap_priv_is_small(priv))) {
int error;
source = CreateSolidPicture(0, color, &error);
@@ -254,7 +254,7 @@ glamor_composite_rectangles(CARD8 op,
goto done;
if (glamor_composite_clipped_region(op, source,
NULL, dst,
- NULL, NULL, priv,
+ NULL, NULL, pixmap,
&region, 0, 0, 0, 0, 0, 0))
goto done;
}
diff --git a/xorg-server/glamor/glamor_copy.c b/xorg-server/glamor/glamor_copy.c
index 3320935f0..75fe8a700 100644
--- a/xorg-server/glamor/glamor_copy.c
+++ b/xorg-server/glamor/glamor_copy.c
@@ -42,7 +42,7 @@ use_copyarea(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
glBindTexture(GL_TEXTURE_2D, src->tex);
glUniform2f(prog->fill_offset_uniform, args->dx, args->dy);
- glUniform2f(prog->fill_size_uniform, src->width, src->height);
+ glUniform2f(prog->fill_size_inv_uniform, 1.0f/src->width, 1.0f/src->height);
return TRUE;
}
@@ -51,7 +51,7 @@ static const glamor_facet glamor_facet_copyarea = {
"copy_area",
.vs_vars = "attribute vec2 primitive;\n",
.vs_exec = (GLAMOR_POS(gl_Position, primitive.xy)
- " fill_pos = (fill_offset + primitive.xy) / fill_size;\n"),
+ " fill_pos = (fill_offset + primitive.xy) * fill_size_inv;\n"),
.fs_exec = " gl_FragColor = texture2D(sampler, fill_pos);\n",
.locations = glamor_program_location_fill,
.use = use_copyarea,
@@ -71,7 +71,7 @@ use_copyplane(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
glBindTexture(GL_TEXTURE_2D, src->tex);
glUniform2f(prog->fill_offset_uniform, args->dx, args->dy);
- glUniform2f(prog->fill_size_uniform, src->width, src->height);
+ glUniform2f(prog->fill_size_inv_uniform, 1.0f/src->width, 1.0f/src->height);
glamor_set_color(dst, gc->fgPixel, prog->fg_uniform);
glamor_set_color(dst, gc->bgPixel, prog->bg_uniform);
@@ -134,7 +134,7 @@ static const glamor_facet glamor_facet_copyplane = {
.version = 130,
.vs_vars = "attribute vec2 primitive;\n",
.vs_exec = (GLAMOR_POS(gl_Position, (primitive.xy))
- " fill_pos = (fill_offset + primitive.xy) / fill_size;\n"),
+ " fill_pos = (fill_offset + primitive.xy) * fill_size_inv;\n"),
.fs_exec = (" uvec4 bits = uvec4(round(texture2D(sampler, fill_pos) * bitmul));\n"
" if ((bits & bitplane) != uvec4(0,0,0,0))\n"
" gl_FragColor = fg;\n"
@@ -315,7 +315,6 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
struct copy_args args;
glamor_program *prog;
const glamor_facet *copy_facet;
- Bool set_scissor;
int n;
glamor_make_current(glamor_priv);
@@ -367,9 +366,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
glamor_get_drawable_deltas(src, src_pixmap, &src_off_x, &src_off_y);
- set_scissor = src_priv->type == GLAMOR_TEXTURE_LARGE;
- if (set_scissor)
- glEnable(GL_SCISSOR_TEST);
+ glEnable(GL_SCISSOR_TEST);
glamor_pixmap_loop(src_priv, src_box_x, src_box_y) {
BoxPtr src_box = glamor_pixmap_box_at(src_priv, src_box_x, src_box_y);
@@ -385,30 +382,20 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
glamor_set_destination_drawable(dst, dst_box_x, dst_box_y, FALSE, FALSE,
prog->matrix_uniform, &dst_off_x, &dst_off_y);
- if (set_scissor)
- glScissor(dst_off_x - args.dx,
- dst_off_y - args.dy,
- src_box->x2 - src_box->x1,
- src_box->y2 - src_box->y1);
-
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
- glDrawArrays(GL_QUADS, 0, nbox * 4);
- else {
- int i;
- for (i = 0; i < nbox; i++)
- glDrawArrays(GL_TRIANGLE_FAN, i*4, 4);
- }
+ glScissor(dst_off_x - args.dx,
+ dst_off_y - args.dy,
+ src_box->x2 - src_box->x1,
+ src_box->y2 - src_box->y1);
+
+ glamor_glDrawArrays_GL_QUADS(glamor_priv, nbox);
}
}
- if (set_scissor)
- glDisable(GL_SCISSOR_TEST);
+ glDisable(GL_SCISSOR_TEST);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glDisable(GL_COLOR_LOGIC_OP);
return TRUE;
bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
return FALSE;
}
@@ -452,7 +439,6 @@ glamor_copy_fbo_fbo_temp(DrawablePtr src,
if (!glamor_set_alu(screen, gc ? gc->alu : GXcopy))
goto bail_ctx;
- glDisable(GL_COLOR_LOGIC_OP);
/* Find the size of the area to copy
*/
@@ -521,7 +507,6 @@ bail:
return FALSE;
bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
return FALSE;
}
@@ -709,39 +694,3 @@ glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_regio
RegionUninit(&dst_region);
}
-
-Bool
-glamor_copy_n_to_n_nf(DrawablePtr src,
- DrawablePtr dst,
- GCPtr gc,
- BoxPtr box,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown, Pixel bitplane,
- void *closure)
-{
- if (glamor_copy_gl(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure))
- return TRUE;
- if (glamor_ddx_fallback_check_pixmap(src) && glamor_ddx_fallback_check_pixmap(dst))
- return FALSE;
- glamor_copy_bail(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure);
- return TRUE;
-}
-
-Bool
-glamor_copy_plane_nf(DrawablePtr src, DrawablePtr dst, GCPtr gc,
- int srcx, int srcy, int w, int h, int dstx, int dsty,
- unsigned long bitplane, RegionPtr *region)
-{
- if (glamor_ddx_fallback_check_pixmap(src) &&
- glamor_ddx_fallback_check_pixmap(dst) &&
- glamor_ddx_fallback_check_gc(gc))
- return FALSE;
-
- *region = glamor_copy_plane(src, dst, gc,
- srcx, srcy, w, h, dstx, dsty,
- bitplane);
- return TRUE;
-}
diff --git a/xorg-server/glamor/glamor_core.c b/xorg-server/glamor/glamor_core.c
index 737b2744b..55174541f 100644
--- a/xorg-server/glamor/glamor_core.c
+++ b/xorg-server/glamor/glamor_core.c
@@ -43,9 +43,9 @@ glamor_get_drawable_location(const DrawablePtr drawable)
glamor_screen_private *glamor_priv =
glamor_get_screen_private(drawable->pScreen);
if (pixmap_priv == NULL ||
- pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED)
+ pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED)
return 'm';
- if (pixmap_priv->base.fbo->fb == glamor_priv->screen_fbo)
+ if (pixmap_priv->fbo->fb == glamor_priv->screen_fbo)
return 's';
else
return 'f';
@@ -173,46 +173,48 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
const char *fs_source =
"void main()\n"
"{\n"
+ " vec4 color = texture2D(sampler, source_texture);\n"
" if (revert == REVERT_NONE) \n"
" { \n"
" if ((swap_rb != SWAP_NONE_DOWNLOADING) && (swap_rb != SWAP_NONE_UPLOADING)) \n"
- " gl_FragColor = texture2D(sampler, source_texture).bgra;\n"
+ " gl_FragColor = color.bgra;\n"
" else \n"
- " gl_FragColor = texture2D(sampler, source_texture).rgba;\n"
+ " gl_FragColor = color.rgba;\n"
" } \n"
" else \n"
" { \n"
" if (swap_rb == SWAP_DOWNLOADING) \n"
- " gl_FragColor = texture2D(sampler, source_texture).argb;\n"
+ " gl_FragColor = color.argb;\n"
" else if (swap_rb == SWAP_NONE_DOWNLOADING)\n"
- " gl_FragColor = texture2D(sampler, source_texture).abgr;\n"
+ " gl_FragColor = color.abgr;\n"
" else if (swap_rb == SWAP_UPLOADING)\n"
- " gl_FragColor = texture2D(sampler, source_texture).gbar;\n"
+ " gl_FragColor = color.gbar;\n"
" else if (swap_rb == SWAP_NONE_UPLOADING)\n"
- " gl_FragColor = texture2D(sampler, source_texture).abgr;\n"
+ " gl_FragColor = color.abgr;\n"
" } \n"
"}\n";
const char *set_alpha_source =
"void main()\n"
"{\n"
+ " vec4 color = texture2D(sampler, source_texture);\n"
" if (revert == REVERT_NONE) \n"
" { \n"
" if ((swap_rb != SWAP_NONE_DOWNLOADING) && (swap_rb != SWAP_NONE_UPLOADING)) \n"
- " gl_FragColor = vec4(texture2D(sampler, source_texture).bgr, 1);\n"
+ " gl_FragColor = vec4(color.bgr, 1);\n"
" else \n"
- " gl_FragColor = vec4(texture2D(sampler, source_texture).rgb, 1);\n"
+ " gl_FragColor = vec4(color.rgb, 1);\n"
" } \n"
" else \n"
" { \n"
" if (swap_rb == SWAP_DOWNLOADING) \n"
- " gl_FragColor = vec4(1, texture2D(sampler, source_texture).rgb);\n"
+ " gl_FragColor = vec4(1, color.rgb);\n"
" else if (swap_rb == SWAP_NONE_DOWNLOADING)\n"
- " gl_FragColor = vec4(1, texture2D(sampler, source_texture).bgr);\n"
+ " gl_FragColor = vec4(1, color.bgr);\n"
" else if (swap_rb == SWAP_UPLOADING)\n"
- " gl_FragColor = vec4(texture2D(sampler, source_texture).gba, 1);\n"
+ " gl_FragColor = vec4(color.gba, 1);\n"
" else if (swap_rb == SWAP_NONE_UPLOADING)\n"
- " gl_FragColor = vec4(texture2D(sampler, source_texture).abg, 1);\n"
+ " gl_FragColor = vec4(color.abg, 1);\n"
" } \n"
"}\n";
GLint fs_prog, vs_prog, avs_prog, set_alpha_prog;
diff --git a/xorg-server/glamor/glamor_dash.c b/xorg-server/glamor/glamor_dash.c
index e8f60fa10..4281ff0a8 100644
--- a/xorg-server/glamor/glamor_dash.c
+++ b/xorg-server/glamor/glamor_dash.c
@@ -159,11 +159,11 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
&glamor_priv->on_off_dash_line_progs,
&glamor_facet_on_off_dash_lines);
if (!prog)
- goto bail_ctx;
+ goto bail;
break;
case LineDoubleDash:
if (gc->fillStyle != FillSolid)
- goto bail_ctx;
+ goto bail;
prog = &glamor_priv->double_dash_line_prog;
@@ -171,32 +171,30 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
if (!glamor_build_program(screen, prog,
&glamor_facet_double_dash_lines,
NULL))
- goto bail_ctx;
+ goto bail;
}
if (!glamor_use_program(pixmap, gc, prog, NULL))
- goto bail_ctx;
+ goto bail;
glamor_set_color(pixmap, gc->fgPixel, prog->fg_uniform);
glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform);
break;
default:
- goto bail_ctx;
+ goto bail;
}
/* Set the dash pattern as texture 1 */
glActiveTexture(GL_TEXTURE1);
- glBindTexture(GL_TEXTURE_2D, dash_priv->base.fbo->tex);
+ glBindTexture(GL_TEXTURE_2D, dash_priv->fbo->tex);
glUniform1i(prog->dash_uniform, 1);
glUniform1f(prog->dash_length_uniform, dash_pixmap->drawable.width);
return prog;
-bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
bail:
return NULL;
}
@@ -230,7 +228,6 @@ glamor_dash_loop(DrawablePtr drawable, GCPtr gc, glamor_program *prog,
}
glDisable(GL_SCISSOR_TEST);
- glDisable(GL_COLOR_LOGIC_OP);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
}
diff --git a/xorg-server/glamor/glamor_egl.c b/xorg-server/glamor/glamor_egl.c
index 113450c8d..6033780f8 100644
--- a/xorg-server/glamor/glamor_egl.c
+++ b/xorg-server/glamor/glamor_egl.c
@@ -239,7 +239,6 @@ glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
"Failed to create textured screen.");
return FALSE;
}
-
glamor_set_screen_pixmap(screen_pixmap, NULL);
return TRUE;
}
@@ -272,7 +271,7 @@ glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image)
glamor_get_pixmap_private(pixmap);
EGLImageKHR old;
- old = pixmap_priv->base.image;
+ old = pixmap_priv->image;
if (old) {
ScreenPtr screen = pixmap->drawable.pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
@@ -280,7 +279,7 @@ glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image)
eglDestroyImageKHR(glamor_egl->display, old);
}
- pixmap_priv->base.image = image;
+ pixmap_priv->image = image;
}
Bool
@@ -420,7 +419,7 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
glamor_make_current(glamor_priv);
- image = pixmap_priv->base.image;
+ image = pixmap_priv->image;
if (!image) {
image = eglCreateImageKHR(glamor_egl->display,
glamor_egl->context,
@@ -536,7 +535,7 @@ glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
struct glamor_pixmap_private *pixmap_priv =
glamor_get_pixmap_private(pixmap);
- if (pixmap_priv && pixmap_priv->base.image) {
+ if (pixmap_priv && pixmap_priv->image) {
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
struct glamor_egl_screen_private *glamor_egl =
glamor_egl_get_screen_private(scrn);
@@ -545,8 +544,8 @@ glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
* a texture. we must call glFlush to make sure the
* operation on that texture has been done.*/
glamor_block_handler(pixmap->drawable.pScreen);
- eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image);
- pixmap_priv->base.image = NULL;
+ eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
+ pixmap_priv->image = NULL;
}
}
@@ -561,13 +560,12 @@ glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back)
glamor_pixmap_exchange_fbos(front, back);
- temp = back_priv->base.image;
- back_priv->base.image = front_priv->base.image;
- front_priv->base.image = temp;
+ temp = back_priv->image;
+ back_priv->image = front_priv->image;
+ front_priv->image = temp;
glamor_set_pixmap_type(front, GLAMOR_TEXTURE_DRM);
glamor_set_pixmap_type(back, GLAMOR_TEXTURE_DRM);
-
}
void
@@ -589,8 +587,8 @@ glamor_egl_close_screen(ScreenPtr screen)
screen_pixmap = screen->GetScreenPixmap(screen);
pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
- eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image);
- pixmap_priv->base.image = NULL;
+ eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
+ pixmap_priv->image = NULL;
screen->CloseScreen = glamor_egl->saved_close_screen;
diff --git a/xorg-server/glamor/glamor_fbo.c b/xorg-server/glamor/glamor_fbo.c
index 8d73e4765..ea0e80102 100644
--- a/xorg-server/glamor/glamor_fbo.c
+++ b/xorg-server/glamor/glamor_fbo.c
@@ -72,7 +72,7 @@ cache_hbucket(int size)
static glamor_pixmap_fbo *
glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
- int w, int h, GLenum format, int flag)
+ int w, int h, GLenum format)
{
struct xorg_list *cache;
glamor_pixmap_fbo *fbo_entry, *ret_fbo = NULL;
@@ -87,33 +87,18 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
cache = &glamor_priv->fbo_cache[n_format]
[cache_wbucket(w)]
[cache_hbucket(h)];
- if (!(flag & GLAMOR_CACHE_EXACT_SIZE)) {
- xorg_list_for_each_entry(fbo_entry, cache, list) {
- if (fbo_entry->width >= w && fbo_entry->height >= h) {
-
- DEBUGF("Request w %d h %d format %x \n", w, h, format);
- DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n",
- fbo_entry, fbo_entry->width, fbo_entry->height,
- fbo_entry->fb, fbo_entry->tex);
- xorg_list_del(&fbo_entry->list);
- ret_fbo = fbo_entry;
- break;
- }
- }
- }
- else {
- xorg_list_for_each_entry(fbo_entry, cache, list) {
- if (fbo_entry->width == w && fbo_entry->height == h) {
-
- DEBUGF("Request w %d h %d format %x \n", w, h, format);
- DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n",
- fbo_entry, fbo_entry->width, fbo_entry->height,
- fbo_entry->fb, fbo_entry->tex, fbo_entry->format);
- assert(format == fbo_entry->format);
- xorg_list_del(&fbo_entry->list);
- ret_fbo = fbo_entry;
- break;
- }
+
+ xorg_list_for_each_entry(fbo_entry, cache, list) {
+ if (fbo_entry->width == w && fbo_entry->height == h) {
+
+ DEBUGF("Request w %d h %d format %x \n", w, h, format);
+ DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n",
+ fbo_entry, fbo_entry->width, fbo_entry->height,
+ fbo_entry->fb, fbo_entry->tex, fbo_entry->format);
+ assert(format == fbo_entry->format);
+ xorg_list_del(&fbo_entry->list);
+ ret_fbo = fbo_entry;
+ break;
}
}
@@ -127,9 +112,10 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
}
static void
-glamor_purge_fbo(glamor_pixmap_fbo *fbo)
+glamor_purge_fbo(glamor_screen_private *glamor_priv,
+ glamor_pixmap_fbo *fbo)
{
- glamor_make_current(fbo->glamor_priv);
+ glamor_make_current(glamor_priv);
if (fbo->fb)
glDeleteFramebuffers(1, &fbo->fb);
@@ -142,7 +128,8 @@ glamor_purge_fbo(glamor_pixmap_fbo *fbo)
}
static void
-glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo)
+glamor_pixmap_fbo_cache_put(glamor_screen_private *glamor_priv,
+ glamor_pixmap_fbo *fbo)
{
struct xorg_list *cache;
int n_format;
@@ -154,32 +141,33 @@ glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo)
n_format = cache_format(fbo->format);
if (fbo->fb == 0 || fbo->external || n_format == -1
- || fbo->glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) {
- fbo->glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX;
- glamor_fbo_expire(fbo->glamor_priv);
- glamor_purge_fbo(fbo);
+ || glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) {
+ glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX;
+ glamor_fbo_expire(glamor_priv);
+ glamor_purge_fbo(glamor_priv, fbo);
return;
}
- cache = &fbo->glamor_priv->fbo_cache[n_format]
+ cache = &glamor_priv->fbo_cache[n_format]
[cache_wbucket(fbo->width)]
[cache_hbucket(fbo->height)];
DEBUGF
("Put cache entry %p to cache %p w %d h %d format %x fbo %d tex %d \n",
fbo, cache, fbo->width, fbo->height, fbo->format, fbo->fb, fbo->tex);
- fbo->glamor_priv->fbo_cache_watermark += fbo->width * fbo->height;
+ glamor_priv->fbo_cache_watermark += fbo->width * fbo->height;
xorg_list_add(&fbo->list, cache);
- fbo->expire = fbo->glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX;
+ fbo->expire = glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX;
#endif
}
static int
-glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
+glamor_pixmap_ensure_fb(glamor_screen_private *glamor_priv,
+ glamor_pixmap_fbo *fbo)
{
int status, err = 0;
- glamor_make_current(fbo->glamor_priv);
+ glamor_make_current(glamor_priv);
if (fbo->fb == 0)
glGenFramebuffers(1, &fbo->fb);
@@ -239,22 +227,14 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
fbo->height = h;
fbo->external = FALSE;
fbo->format = format;
- fbo->glamor_priv = glamor_priv;
-
- if (flag == GLAMOR_CREATE_PIXMAP_MAP) {
- glamor_make_current(glamor_priv);
- glGenBuffers(1, &fbo->pbo);
- goto done;
- }
if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
- if (glamor_pixmap_ensure_fb(fbo) != 0) {
- glamor_purge_fbo(fbo);
+ if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) {
+ glamor_purge_fbo(glamor_priv, fbo);
fbo = NULL;
}
}
- done:
return fbo;
}
@@ -280,7 +260,7 @@ glamor_fbo_expire(glamor_screen_private *glamor_priv)
xorg_list_del(&fbo_entry->list);
DEBUGF("cache %p fbo %p expired %d current %d \n", cache,
fbo_entry, fbo_entry->expire, glamor_priv->tick);
- glamor_purge_fbo(fbo_entry);
+ glamor_purge_fbo(glamor_priv, fbo_entry);
}
}
@@ -317,16 +297,17 @@ glamor_fini_pixmap_fbo(ScreenPtr screen)
xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache,
list) {
xorg_list_del(&fbo_entry->list);
- glamor_purge_fbo(fbo_entry);
+ glamor_purge_fbo(glamor_priv, fbo_entry);
}
}
}
void
-glamor_destroy_fbo(glamor_pixmap_fbo *fbo)
+glamor_destroy_fbo(glamor_screen_private *glamor_priv,
+ glamor_pixmap_fbo *fbo)
{
xorg_list_del(&fbo->list);
- glamor_pixmap_fbo_cache_put(fbo);
+ glamor_pixmap_fbo_cache_put(glamor_priv, fbo);
}
@@ -348,7 +329,6 @@ _glamor_create_tex(glamor_screen_private *glamor_priv,
glamor_make_current(glamor_priv);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
@@ -363,26 +343,15 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
{
glamor_pixmap_fbo *fbo;
GLint tex = 0;
- int cache_flag;
if (flag == GLAMOR_CREATE_FBO_NO_FBO)
goto new_fbo;
- if (flag == GLAMOR_CREATE_PIXMAP_MAP)
- goto no_tex;
-
- /* Tiling from textures requires exact pixmap sizes. As we don't
- * know which pixmaps will be used as tiles, just allocate
- * everything at the requested size
- */
- cache_flag = GLAMOR_CACHE_EXACT_SIZE;
-
- fbo = glamor_pixmap_fbo_cache_get(glamor_priv, w, h, format, cache_flag);
+ fbo = glamor_pixmap_fbo_cache_get(glamor_priv, w, h, format);
if (fbo)
return fbo;
new_fbo:
tex = _glamor_create_tex(glamor_priv, w, h, format);
- no_tex:
fbo = glamor_create_fbo_from_tex(glamor_priv, w, h, format, tex, flag);
return fbo;
@@ -399,9 +368,9 @@ _glamor_create_fbo_array(glamor_screen_private *glamor_priv,
glamor_pixmap_fbo **fbo_array;
BoxPtr box_array;
int i, j;
- glamor_pixmap_private_large_t *priv;
+ glamor_pixmap_private *priv;
- priv = &pixmap_priv->large;
+ priv = pixmap_priv;
block_wcnt = (w + block_w - 1) / block_w;
block_hcnt = (h + block_h - 1) / block_h;
@@ -438,7 +407,7 @@ _glamor_create_fbo_array(glamor_screen_private *glamor_priv,
format,
GLAMOR_CREATE_PIXMAP_FIXUP);
else
- fbo_array[i * block_wcnt + j] = priv->base.fbo;
+ fbo_array[i * block_wcnt + j] = priv->fbo;
if (fbo_array[i * block_wcnt + j] == NULL)
goto cleanup;
}
@@ -454,7 +423,7 @@ _glamor_create_fbo_array(glamor_screen_private *glamor_priv,
cleanup:
for (i = 0; i < block_wcnt * block_hcnt; i++)
if ((fbo_array)[i])
- glamor_destroy_fbo((fbo_array)[i]);
+ glamor_destroy_fbo(glamor_priv, (fbo_array)[i]);
free(box_array);
free(fbo_array);
return NULL;
@@ -468,8 +437,8 @@ glamor_create_fbo_array(glamor_screen_private *glamor_priv,
int block_w, int block_h,
glamor_pixmap_private *pixmap_priv)
{
- pixmap_priv->large.block_w = block_w;
- pixmap_priv->large.block_h = block_h;
+ pixmap_priv->block_w = block_w;
+ pixmap_priv->block_h = block_h;
return _glamor_create_fbo_array(glamor_priv, w, h, format, flag,
block_w, block_h, pixmap_priv, 0);
}
@@ -482,11 +451,11 @@ glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv)
if (pixmap_priv == NULL)
return NULL;
- fbo = pixmap_priv->base.fbo;
+ fbo = pixmap_priv->fbo;
if (fbo == NULL)
return NULL;
- pixmap_priv->base.fbo = NULL;
+ pixmap_priv->fbo = NULL;
return fbo;
}
@@ -498,47 +467,44 @@ glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo)
pixmap_priv = glamor_get_pixmap_private(pixmap);
- if (pixmap_priv->base.fbo)
+ if (pixmap_priv->fbo)
return;
- pixmap_priv->base.fbo = fbo;
+ pixmap_priv->fbo = fbo;
switch (pixmap_priv->type) {
- case GLAMOR_TEXTURE_LARGE:
case GLAMOR_TEXTURE_ONLY:
case GLAMOR_TEXTURE_DRM:
- pixmap_priv->base.gl_fbo = GLAMOR_FBO_NORMAL;
+ pixmap_priv->gl_fbo = GLAMOR_FBO_NORMAL;
if (fbo->tex != 0)
- pixmap_priv->base.gl_tex = 1;
+ pixmap_priv->gl_tex = 1;
else {
/* XXX For the Xephyr only, may be broken now. */
- pixmap_priv->base.gl_tex = 0;
+ pixmap_priv->gl_tex = 0;
}
- case GLAMOR_MEMORY_MAP:
pixmap->devPrivate.ptr = NULL;
- break;
default:
break;
}
}
void
-glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv)
+glamor_pixmap_destroy_fbo(glamor_screen_private *glamor_priv,
+ glamor_pixmap_private *priv)
{
glamor_pixmap_fbo *fbo;
- if (priv->type == GLAMOR_TEXTURE_LARGE) {
+ if (glamor_pixmap_priv_is_large(priv)) {
int i;
- glamor_pixmap_private_large_t *large = &priv->large;
- for (i = 0; i < large->block_wcnt * large->block_hcnt; i++)
- glamor_destroy_fbo(large->fbo_array[i]);
- free(large->fbo_array);
+ for (i = 0; i < priv->block_wcnt * priv->block_hcnt; i++)
+ glamor_destroy_fbo(glamor_priv, priv->fbo_array[i]);
+ free(priv->fbo_array);
}
else {
fbo = glamor_pixmap_detach_fbo(priv);
if (fbo)
- glamor_destroy_fbo(fbo);
+ glamor_destroy_fbo(glamor_priv, fbo);
}
}
@@ -551,7 +517,7 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
pixmap_priv = glamor_get_pixmap_private(pixmap);
- if (pixmap_priv->base.fbo == NULL) {
+ if (pixmap_priv->fbo == NULL) {
fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width,
pixmap->drawable.height, format, flag);
@@ -562,13 +528,13 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
}
else {
/* We do have a fbo, but it may lack of fb or tex. */
- if (!pixmap_priv->base.fbo->tex)
- pixmap_priv->base.fbo->tex =
+ if (!pixmap_priv->fbo->tex)
+ pixmap_priv->fbo->tex =
_glamor_create_tex(glamor_priv, pixmap->drawable.width,
pixmap->drawable.height, format);
- if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->base.fbo->fb == 0)
- if (glamor_pixmap_ensure_fb(pixmap_priv->base.fbo) != 0)
+ if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->fbo->fb == 0)
+ if (glamor_pixmap_ensure_fb(glamor_priv, pixmap_priv->fbo) != 0)
return FALSE;
}
@@ -583,7 +549,7 @@ glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back)
front_priv = glamor_get_pixmap_private(front);
back_priv = glamor_get_pixmap_private(back);
- temp_fbo = front_priv->base.fbo;
- front_priv->base.fbo = back_priv->base.fbo;
- back_priv->base.fbo = temp_fbo;
+ temp_fbo = front_priv->fbo;
+ front_priv->fbo = back_priv->fbo;
+ back_priv->fbo = temp_fbo;
}
diff --git a/xorg-server/glamor/glamor_font.c b/xorg-server/glamor/glamor_font.c
index 0ca91fa2e..cc0fecf7a 100644
--- a/xorg-server/glamor/glamor_font.c
+++ b/xorg-server/glamor/glamor_font.c
@@ -97,7 +97,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
diff --git a/xorg-server/glamor/glamor_glyphblt.c b/xorg-server/glamor/glamor_glyphblt.c
index 73b1df51e..1791f6dca 100644
--- a/xorg-server/glamor/glamor_glyphblt.c
+++ b/xorg-server/glamor/glamor_glyphblt.c
@@ -60,7 +60,7 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
&glamor_priv->poly_glyph_blt_progs,
&glamor_facet_poly_glyph_blt);
if (!prog)
- goto bail_ctx;
+ goto bail;
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
@@ -138,12 +138,9 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
}
}
- glDisable(GL_COLOR_LOGIC_OP);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
return TRUE;
-bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
bail:
return FALSE;
}
@@ -160,32 +157,6 @@ glamor_poly_glyph_blt(DrawablePtr drawable, GCPtr gc,
ppci, pglyph_base);
}
-Bool
-glamor_poly_glyph_blt_nf(DrawablePtr drawable, GCPtr gc,
- int start_x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, void *pglyph_base)
-{
- if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci,
- pglyph_base))
- return TRUE;
- if (glamor_ddx_fallback_check_pixmap(drawable) &&
- glamor_ddx_fallback_check_gc(gc)) {
- return FALSE;
- }
- miPolyGlyphBlt(drawable, gc, start_x, y, nglyph,
- ppci, pglyph_base);
- return TRUE;
-}
-
-Bool
-glamor_image_glyph_blt_nf(DrawablePtr drawable, GCPtr gc,
- int start_x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, void *pglyph_base)
-{
- miImageGlyphBlt(drawable, gc, start_x, y, nglyph, ppci, pglyph_base);
- return TRUE;
-}
-
static Bool
glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
DrawablePtr drawable, int w, int h, int x, int y)
@@ -217,7 +188,7 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
&glamor_priv->poly_glyph_blt_progs,
&glamor_facet_poly_glyph_blt);
if (!prog)
- goto bail_ctx;
+ goto bail;
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
@@ -256,12 +227,9 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
glDrawArrays(GL_POINTS, 0, num_points);
}
- glDisable(GL_COLOR_LOGIC_OP);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
return TRUE;
-bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
bail:
return FALSE;
}
@@ -275,21 +243,3 @@ glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
miPushPixels(pGC, pBitmap, pDrawable, w, h, x, y);
}
-
-Bool
-glamor_push_pixels_nf(GCPtr gc, PixmapPtr bitmap,
- DrawablePtr drawable, int w, int h, int x, int y)
-{
- if (glamor_push_pixels_gl(gc, bitmap, drawable, w, h, x, y))
- return TRUE;
-
- if (glamor_ddx_fallback_check_pixmap(drawable) &&
- glamor_ddx_fallback_check_pixmap(&bitmap->drawable) &&
- glamor_ddx_fallback_check_gc(gc))
- {
- return FALSE;
- }
-
- miPushPixels(gc, bitmap, drawable, w, h, x, y);
- return TRUE;
-}
diff --git a/xorg-server/glamor/glamor_glyphs.c b/xorg-server/glamor/glamor_glyphs.c
index 1f1362487..2cf0c7d16 100644
--- a/xorg-server/glamor/glamor_glyphs.c
+++ b/xorg-server/glamor/glamor_glyphs.c
@@ -1166,11 +1166,9 @@ static void
glamor_glyphs_flush_mask(struct glyphs_flush_mask_arg *arg)
{
if (arg->buffer->count > 0) {
-#ifdef RENDER
glamor_composite_glyph_rects(PictOpAdd, arg->buffer->source,
NULL, arg->mask,
arg->buffer->count, arg->buffer->rects);
-#endif
}
arg->buffer->count = 0;
arg->buffer->source = NULL;
@@ -1769,15 +1767,3 @@ glamor_glyphs(CARD8 op,
_glamor_glyphs(op, src, dst, mask_format, x_src,
y_src, nlist, list, glyphs, TRUE);
}
-
-Bool
-glamor_glyphs_nf(CARD8 op,
- PicturePtr src,
- PicturePtr dst,
- PictFormatPtr mask_format,
- INT16 x_src,
- INT16 y_src, int nlist, GlyphListPtr list, GlyphPtr *glyphs)
-{
- return _glamor_glyphs(op, src, dst, mask_format, x_src,
- y_src, nlist, list, glyphs, FALSE);
-}
diff --git a/xorg-server/glamor/glamor_gradient.c b/xorg-server/glamor/glamor_gradient.c
index 4ded89dcd..8ea645efc 100644
--- a/xorg-server/glamor/glamor_gradient.c
+++ b/xorg-server/glamor/glamor_gradient.c
@@ -32,8 +32,6 @@
#include "glamor_priv.h"
-#ifdef RENDER
-
#define LINEAR_SMALL_STOPS (6 + 2)
#define LINEAR_LARGE_STOPS (16 + 2)
@@ -684,9 +682,9 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
return 0;
}
- glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+ glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
- pixmap_priv_get_dest_scale(pixmap_priv, xscale, yscale);
+ pixmap_priv_get_dest_scale(pixmap, pixmap_priv, xscale, yscale);
DEBUGF("xscale = %f, yscale = %f,"
" x_source = %d, y_source = %d, width = %d, height = %d\n",
@@ -995,6 +993,8 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
vertices, tex_vertices, 0))
goto GRADIENT_FAIL;
+ glamor_set_alu(screen, GXcopy);
+
/* Set all the stops and colors to shader. */
if (stops_count > RADIAL_SMALL_STOPS) {
stop_colors = malloc(4 * stops_count * sizeof(float));
@@ -1311,6 +1311,8 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
vertices, tex_vertices, 1))
goto GRADIENT_FAIL;
+ glamor_set_alu(screen, GXcopy);
+
/* Normalize the PTs. */
glamor_set_normalize_pt(xscale, yscale,
pixman_fixed_to_double(src_picture->pSourcePict->
@@ -1473,5 +1475,3 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
}
#endif /* End of GLAMOR_GRADIENT_SHADER */
-
-#endif /* End of RENDER */
diff --git a/xorg-server/glamor/glamor_image.c b/xorg-server/glamor/glamor_image.c
index b38b41212..5633da647 100644
--- a/xorg-server/glamor/glamor_image.c
+++ b/xorg-server/glamor/glamor_image.c
@@ -102,19 +102,6 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
}
-Bool
-glamor_put_image_nf(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *bits)
-{
- if (glamor_put_image_gl(drawable, gc, depth, x, y, w, h, leftPad, format, bits))
- return TRUE;
- if (glamor_ddx_fallback_check_pixmap(drawable) &&
- glamor_ddx_fallback_check_gc(gc))
- return FALSE;
- glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
- return TRUE;
-}
-
static Bool
glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h,
unsigned int format, unsigned long plane_mask, char *d)
@@ -163,17 +150,3 @@ glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
return;
glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d);
}
-
-Bool
-glamor_get_image_nf(DrawablePtr drawable, int x, int y, int w, int h,
- unsigned int format, unsigned long plane_mask, char *d)
-{
- if (glamor_get_image_gl(drawable, x, y, w, h, format, plane_mask, d))
- return TRUE;
-
- if (glamor_ddx_fallback_check_pixmap(drawable))
- return FALSE;
-
- glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d);
- return TRUE;
-}
diff --git a/xorg-server/glamor/glamor_largepixmap.c b/xorg-server/glamor/glamor_largepixmap.c
index 9b2458453..391f376e9 100644
--- a/xorg-server/glamor/glamor_largepixmap.c
+++ b/xorg-server/glamor/glamor_largepixmap.c
@@ -2,10 +2,10 @@
#include "glamor_priv.h"
-static inline glamor_pixmap_private_large_t *
+static inline glamor_pixmap_private *
__glamor_large(glamor_pixmap_private *pixmap_priv) {
- assert(pixmap_priv->type == GLAMOR_TEXTURE_LARGE);
- return &pixmap_priv->large;
+ assert(glamor_pixmap_priv_is_large(pixmap_priv));
+ return pixmap_priv;
}
/**
@@ -150,12 +150,13 @@ __glamor_compute_clipped_regions(int block_w,
*/
glamor_pixmap_clipped_regions *
-glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
+glamor_compute_clipped_regions_ext(PixmapPtr pixmap,
RegionPtr region,
int *n_region,
int inner_block_w, int inner_block_h,
int reverse, int upsidedown)
{
+ glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_pixmap_clipped_regions *clipped_regions, *inner_regions,
*result_regions;
int i, j, x, y, k, inner_n_regions;
@@ -166,7 +167,7 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
DEBUGF("ext called \n");
- if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
+ if (glamor_pixmap_priv_is_small(pixmap_priv)) {
clipped_regions = calloc(1, sizeof(*clipped_regions));
if (clipped_regions == NULL) {
*n_region = 0;
@@ -176,24 +177,22 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
clipped_regions[0].block_idx = 0;
RegionCopy(clipped_regions[0].region, region);
*n_region = 1;
- block_w = pixmap_priv->base.pixmap->drawable.width;
- block_h = pixmap_priv->base.pixmap->drawable.height;
+ block_w = pixmap->drawable.width;
+ block_h = pixmap->drawable.height;
box_array = &small_box;
small_box.x1 = small_box.y1 = 0;
small_box.x2 = block_w;
small_box.y2 = block_h;
}
else {
- glamor_pixmap_private_large_t *priv = __glamor_large(pixmap_priv);
+ glamor_pixmap_private *priv = __glamor_large(pixmap_priv);
clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
priv->block_h,
priv->block_wcnt,
0, 0,
- priv->base.pixmap->
- drawable.width,
- priv->base.pixmap->
- drawable.height,
+ pixmap->drawable.width,
+ pixmap->drawable.height,
region, n_region,
reverse, upsidedown);
@@ -336,7 +335,8 @@ _glamor_largepixmap_reflect_fixup(short *xy1, short *xy2, int wh)
*
*/
static glamor_pixmap_clipped_regions *
-_glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
+_glamor_compute_clipped_regions(PixmapPtr pixmap,
+ glamor_pixmap_private *pixmap_priv,
RegionPtr region, int *n_region,
int repeat_type, int is_transform,
int reverse, int upsidedown)
@@ -352,10 +352,10 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
int right_shift = 0;
int down_shift = 0;
int x_center_shift = 0, y_center_shift = 0;
- glamor_pixmap_private_large_t *priv;
+ glamor_pixmap_private *priv;
DEBUGRegionPrint(region);
- if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
+ if (glamor_pixmap_priv_is_small(pixmap_priv)) {
clipped_regions = calloc(1, sizeof(*clipped_regions));
clipped_regions[0].region = RegionCreate(NULL, 1);
clipped_regions[0].block_idx = 0;
@@ -366,8 +366,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
priv = __glamor_large(pixmap_priv);
- pixmap_width = priv->base.pixmap->drawable.width;
- pixmap_height = priv->base.pixmap->drawable.height;
+ pixmap_width = pixmap->drawable.width;
+ pixmap_height = pixmap->drawable.height;
if (repeat_type == 0 || repeat_type == RepeatPad) {
RegionPtr saved_region = NULL;
@@ -385,10 +385,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
priv->block_h,
priv->block_wcnt,
0, 0,
- priv->base.pixmap->
- drawable.width,
- priv->base.pixmap->
- drawable.height,
+ pixmap->drawable.width,
+ pixmap->drawable.height,
region, n_region,
reverse, upsidedown);
if (saved_region)
@@ -670,11 +668,13 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
}
glamor_pixmap_clipped_regions *
-glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region,
+glamor_compute_clipped_regions(PixmapPtr pixmap,
+ RegionPtr region,
int *n_region, int repeat_type,
int reverse, int upsidedown)
{
- return _glamor_compute_clipped_regions(priv, region, n_region, repeat_type,
+ glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
+ return _glamor_compute_clipped_regions(pixmap, priv, region, n_region, repeat_type,
0, reverse, upsidedown);
}
@@ -682,12 +682,13 @@ glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region,
* by default. Or just use region32 for repeat cases?
**/
glamor_pixmap_clipped_regions *
-glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
+glamor_compute_transform_clipped_regions(PixmapPtr pixmap,
struct pixman_transform *transform,
RegionPtr region, int *n_region,
int dx, int dy, int repeat_type,
int reverse, int upsidedown)
{
+ glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
BoxPtr temp_extent;
struct pixman_box32 temp_box;
struct pixman_box16 short_box;
@@ -714,8 +715,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
temp_box.x1 = 0;
if (temp_box.y1 < 0)
temp_box.y1 = 0;
- temp_box.x2 = MIN(temp_box.x2, priv->base.pixmap->drawable.width);
- temp_box.y2 = MIN(temp_box.y2, priv->base.pixmap->drawable.height);
+ temp_box.x2 = MIN(temp_box.x2, pixmap->drawable.width);
+ temp_box.y2 = MIN(temp_box.y2, pixmap->drawable.height);
}
/* Now copy back the box32 to a box16 box. */
short_box.x1 = temp_box.x1;
@@ -725,7 +726,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
RegionInitBoxes(temp_region, &short_box, 1);
DEBUGF("copy to temp source region \n");
DEBUGRegionPrint(temp_region);
- ret = _glamor_compute_clipped_regions(priv,
+ ret = _glamor_compute_clipped_regions(pixmap,
+ priv,
temp_region,
n_region,
repeat_type, 1, reverse, upsidedown);
@@ -747,7 +749,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
* if the clipped result cross the region boundary.
*/
static void
-glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
+glamor_merge_clipped_regions(PixmapPtr pixmap,
+ glamor_pixmap_private *pixmap_priv,
int repeat_type,
glamor_pixmap_clipped_regions *clipped_regions,
int *n_regions, int *need_clean_fbo)
@@ -760,11 +763,11 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
int overlap;
int i;
int pixmap_width, pixmap_height;
- glamor_pixmap_private_large_t *priv;
+ glamor_pixmap_private *priv;
priv = __glamor_large(pixmap_priv);
- pixmap_width = priv->base.pixmap->drawable.width;
- pixmap_height = priv->base.pixmap->drawable.height;
+ pixmap_width = pixmap->drawable.width;
+ pixmap_height =pixmap->drawable.height;
temp_region = RegionCreate(NULL, 4);
for (i = 0; i < *n_regions; i++) {
@@ -784,10 +787,10 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
DEBUGF("%d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2,
temp_box.y2);
temp_pixmap =
- glamor_create_pixmap(priv->base.pixmap->drawable.pScreen,
+ glamor_create_pixmap(pixmap->drawable.pScreen,
temp_box.x2 - temp_box.x1,
temp_box.y2 - temp_box.y1,
- priv->base.pixmap->drawable.depth,
+ pixmap->drawable.depth,
GLAMOR_CREATE_PIXMAP_FIXUP);
if (temp_pixmap == NULL) {
assert(0);
@@ -795,7 +798,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
}
temp_priv = glamor_get_pixmap_private(temp_pixmap);
- assert(temp_priv->type != GLAMOR_TEXTURE_LARGE);
+ assert(glamor_pixmap_priv_is_small(temp_priv));
priv->box = temp_box;
if (temp_extent->x1 >= 0 && temp_extent->x2 <= pixmap_width
@@ -808,7 +811,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
copy_box.y2 = temp_extent->y2 - temp_extent->y1;
dx = temp_extent->x1;
dy = temp_extent->y1;
- glamor_copy(&priv->base.pixmap->drawable,
+ glamor_copy(&pixmap->drawable,
&temp_pixmap->drawable,
NULL, &copy_box, 1, dx, dy, 0, 0, 0, NULL);
// glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width,
@@ -840,7 +843,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
copy_box.x1, copy_box.y1, copy_box.x2,
copy_box.y2, dx, dy);
- glamor_copy(&priv->base.pixmap->drawable,
+ glamor_copy(&pixmap->drawable,
&temp_pixmap->drawable,
NULL, &copy_box, 1, dx, dy, 0, 0, 0, NULL);
@@ -855,7 +858,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
RegionDestroy(clipped_regions[i].region);
RegionDestroy(temp_region);
priv->box = temp_box;
- priv->base.fbo = glamor_pixmap_detach_fbo(temp_priv);
+ priv->fbo = glamor_pixmap_detach_fbo(temp_priv);
DEBUGF("priv box x1 %d y1 %d x2 %d y2 %d \n",
priv->box.x1, priv->box.y1, priv->box.x2, priv->box.y2);
glamor_destroy_pixmap(temp_pixmap);
@@ -920,10 +923,10 @@ glamor_get_transform_block_size(struct pixman_transform *transform,
return TRUE;
}
-#define VECTOR_FROM_POINT(p, x, y) \
+#define VECTOR_FROM_POINT(p, x, y) do {\
p.v[0] = x; \
p.v[1] = y; \
- p.v[2] = 1.0;
+ p.v[2] = 1.0; } while (0)
void
glamor_get_transform_extent_from_box(struct pixman_box32 *box,
struct pixman_transform *transform)
@@ -933,12 +936,12 @@ glamor_get_transform_extent_from_box(struct pixman_box32 *box,
struct pixman_f_transform ftransform;
- VECTOR_FROM_POINT(p0, box->x1, box->y1)
- VECTOR_FROM_POINT(p1, box->x2, box->y1)
- VECTOR_FROM_POINT(p2, box->x2, box->y2)
- VECTOR_FROM_POINT(p3, box->x1, box->y2)
+ VECTOR_FROM_POINT(p0, box->x1, box->y1);
+ VECTOR_FROM_POINT(p1, box->x2, box->y1);
+ VECTOR_FROM_POINT(p2, box->x2, box->y2);
+ VECTOR_FROM_POINT(p3, box->x1, box->y2);
- pixman_f_transform_from_pixman_transform(&ftransform, transform);
+ pixman_f_transform_from_pixman_transform(&ftransform, transform);
pixman_f_transform_point(&ftransform, &p0);
pixman_f_transform_point(&ftransform, &p1);
pixman_f_transform_point(&ftransform, &p2);
@@ -966,7 +969,8 @@ glamor_get_transform_extent_from_box(struct pixman_box32 *box,
}
static void
-_glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
+_glamor_process_transformed_clipped_region(PixmapPtr pixmap,
+ glamor_pixmap_private *priv,
int repeat_type,
glamor_pixmap_clipped_regions *
clipped_regions, int *n_regions,
@@ -976,7 +980,7 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
if (*n_regions != 1) {
/* Merge all source regions into one region. */
- glamor_merge_clipped_regions(priv, repeat_type,
+ glamor_merge_clipped_regions(pixmap, priv, repeat_type,
clipped_regions, n_regions,
need_clean_fbo);
}
@@ -990,22 +994,22 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
int rem;
temp_box = RegionExtents(clipped_regions[0].region);
- modulus(temp_box->x1, priv->base.pixmap->drawable.width, rem);
- shift_x = (temp_box->x1 - rem) / priv->base.pixmap->drawable.width;
- modulus(temp_box->y1, priv->base.pixmap->drawable.height, rem);
- shift_y = (temp_box->y1 - rem) / priv->base.pixmap->drawable.height;
+ modulus(temp_box->x1, pixmap->drawable.width, rem);
+ shift_x = (temp_box->x1 - rem) / pixmap->drawable.width;
+ modulus(temp_box->y1, pixmap->drawable.height, rem);
+ shift_y = (temp_box->y1 - rem) / pixmap->drawable.height;
if (shift_x != 0) {
__glamor_large(priv)->box.x1 +=
- shift_x * priv->base.pixmap->drawable.width;
+ shift_x * pixmap->drawable.width;
__glamor_large(priv)->box.x2 +=
- shift_x * priv->base.pixmap->drawable.width;
+ shift_x * pixmap->drawable.width;
}
if (shift_y != 0) {
__glamor_large(priv)->box.y1 +=
- shift_y * priv->base.pixmap->drawable.height;
+ shift_y * pixmap->drawable.height;
__glamor_large(priv)->box.y2 +=
- shift_y * priv->base.pixmap->drawable.height;
+ shift_y * pixmap->drawable.height;
}
}
}
@@ -1016,9 +1020,9 @@ glamor_composite_largepixmap_region(CARD8 op,
PicturePtr source,
PicturePtr mask,
PicturePtr dest,
- glamor_pixmap_private *source_pixmap_priv,
- glamor_pixmap_private *mask_pixmap_priv,
- glamor_pixmap_private *dest_pixmap_priv,
+ PixmapPtr source_pixmap,
+ PixmapPtr mask_pixmap,
+ PixmapPtr dest_pixmap,
RegionPtr region, Bool force_clip,
INT16 x_source,
INT16 y_source,
@@ -1027,6 +1031,11 @@ glamor_composite_largepixmap_region(CARD8 op,
INT16 x_dest, INT16 y_dest,
CARD16 width, CARD16 height)
{
+ ScreenPtr screen = dest_pixmap->drawable.pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ glamor_pixmap_private *source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
+ glamor_pixmap_private *mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
+ glamor_pixmap_private *dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
glamor_pixmap_clipped_regions *clipped_dest_regions;
glamor_pixmap_clipped_regions *clipped_source_regions;
glamor_pixmap_clipped_regions *clipped_mask_regions;
@@ -1056,12 +1065,12 @@ glamor_composite_largepixmap_region(CARD8 op,
else
mask_repeat_type = RepeatNone;
- if (dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+ if (glamor_pixmap_priv_is_large(dest_pixmap_priv)) {
dest_block_width = __glamor_large(dest_pixmap_priv)->block_w;
dest_block_height = __glamor_large(dest_pixmap_priv)->block_h;
} else {
- dest_block_width = dest_pixmap_priv->base.pixmap->drawable.width;
- dest_block_height = dest_pixmap_priv->base.pixmap->drawable.height;
+ dest_block_width = dest_pixmap->drawable.width;
+ dest_block_height = dest_pixmap->drawable.height;
}
fixed_block_width = dest_block_width;
fixed_block_height = dest_block_height;
@@ -1087,7 +1096,7 @@ glamor_composite_largepixmap_region(CARD8 op,
*/
if (source_pixmap_priv
&& source->transform
- && source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+ && glamor_pixmap_priv_is_large(source_pixmap_priv)) {
int source_transformed_block_width, source_transformed_block_height;
if (!glamor_get_transform_block_size(source->transform,
@@ -1109,7 +1118,7 @@ glamor_composite_largepixmap_region(CARD8 op,
}
if (mask_pixmap_priv
- && mask->transform && mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+ && mask->transform && glamor_pixmap_priv_is_large(mask_pixmap_priv)) {
int mask_transformed_block_width, mask_transformed_block_height;
if (!glamor_get_transform_block_size(mask->transform,
@@ -1134,12 +1143,12 @@ glamor_composite_largepixmap_region(CARD8 op,
if (force_clip || fixed_block_width < dest_block_width
|| fixed_block_height < dest_block_height)
clipped_dest_regions =
- glamor_compute_clipped_regions_ext(dest_pixmap_priv, region,
+ glamor_compute_clipped_regions_ext(dest_pixmap, region,
&n_dest_regions,
fixed_block_width,
fixed_block_height, 0, 0);
else
- clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap_priv,
+ clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap,
region,
&n_dest_regions,
0, 0, 0);
@@ -1147,7 +1156,7 @@ glamor_composite_largepixmap_region(CARD8 op,
if (source_pixmap_priv
&& (source_pixmap_priv == dest_pixmap_priv ||
source_pixmap_priv == mask_pixmap_priv)
- && source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+ && glamor_pixmap_priv_is_large(source_pixmap_priv)) {
/* XXX self-copy... */
need_free_source_pixmap_priv = source_pixmap_priv;
source_pixmap_priv = malloc(sizeof(*source_pixmap_priv));
@@ -1163,12 +1172,12 @@ glamor_composite_largepixmap_region(CARD8 op,
glamor_set_pixmap_fbo_current(dest_pixmap_priv,
clipped_dest_regions[i].block_idx);
if (source_pixmap_priv &&
- source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+ glamor_pixmap_priv_is_large(source_pixmap_priv)) {
if (!source->transform && source_repeat_type != RepeatPad) {
RegionTranslate(clipped_dest_regions[i].region,
x_source - x_dest, y_source - y_dest);
clipped_source_regions =
- glamor_compute_clipped_regions(source_pixmap_priv,
+ glamor_compute_clipped_regions(source_pixmap,
clipped_dest_regions[i].
region, &n_source_regions,
source_repeat_type, 0, 0);
@@ -1176,7 +1185,7 @@ glamor_composite_largepixmap_region(CARD8 op,
}
else {
clipped_source_regions =
- glamor_compute_transform_clipped_regions(source_pixmap_priv,
+ glamor_compute_transform_clipped_regions(source_pixmap,
source->transform,
clipped_dest_regions
[i].region,
@@ -1193,7 +1202,7 @@ glamor_composite_largepixmap_region(CARD8 op,
}
else
_glamor_process_transformed_clipped_region
- (source_pixmap_priv, source_repeat_type,
+ (source_pixmap, source_pixmap_priv, source_repeat_type,
clipped_source_regions, &n_source_regions,
&need_clean_source_fbo);
}
@@ -1204,7 +1213,7 @@ glamor_composite_largepixmap_region(CARD8 op,
clipped_source_regions[j].block_idx);
if (mask_pixmap_priv &&
- mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+ glamor_pixmap_priv_is_large(mask_pixmap_priv)) {
if (is_normal_mask_fbo && is_normal_source_fbo) {
/* both mask and source are normal fbo box without transform or repeatpad.
* The region is clipped against source and then we clip it against mask here.*/
@@ -1214,7 +1223,7 @@ glamor_composite_largepixmap_region(CARD8 op,
RegionTranslate(clipped_source_regions[j].region,
-x_source + x_mask, -y_source + y_mask);
clipped_mask_regions =
- glamor_compute_clipped_regions(mask_pixmap_priv,
+ glamor_compute_clipped_regions(mask_pixmap,
clipped_source_regions
[j].region,
&n_mask_regions,
@@ -1230,7 +1239,7 @@ glamor_composite_largepixmap_region(CARD8 op,
RegionTranslate(clipped_dest_regions[i].region,
-x_dest + x_mask, -y_dest + y_mask);
clipped_mask_regions =
- glamor_compute_clipped_regions(mask_pixmap_priv,
+ glamor_compute_clipped_regions(mask_pixmap,
clipped_dest_regions
[i].region,
&n_mask_regions,
@@ -1244,14 +1253,14 @@ glamor_composite_largepixmap_region(CARD8 op,
if (!is_normal_source_fbo)
clipped_mask_regions =
glamor_compute_transform_clipped_regions
- (mask_pixmap_priv, mask->transform,
+ (mask_pixmap, mask->transform,
clipped_dest_regions[i].region,
&n_mask_regions, x_mask - x_dest,
y_mask - y_dest, mask_repeat_type, 0, 0);
else
clipped_mask_regions =
glamor_compute_transform_clipped_regions
- (mask_pixmap_priv, mask->transform,
+ (mask_pixmap, mask->transform,
clipped_source_regions[j].region,
&n_mask_regions, x_mask - x_source,
y_mask - y_source, mask_repeat_type, 0, 0);
@@ -1263,7 +1272,7 @@ glamor_composite_largepixmap_region(CARD8 op,
}
else
_glamor_process_transformed_clipped_region
- (mask_pixmap_priv, mask_repeat_type,
+ (mask_pixmap, mask_pixmap_priv, mask_repeat_type,
clipped_mask_regions, &n_mask_regions,
&need_clean_mask_fbo);
}
@@ -1273,9 +1282,9 @@ glamor_composite_largepixmap_region(CARD8 op,
if (!glamor_composite_clipped_region(op, \
null_source ? NULL : source, \
null_mask ? NULL : mask, dest, \
- null_source ? NULL : source_pixmap_priv, \
- null_mask ? NULL : mask_pixmap_priv, \
- dest_pixmap_priv, region, \
+ null_source ? NULL : source_pixmap, \
+ null_mask ? NULL : mask_pixmap, \
+ dest_pixmap, region, \
x_source, y_source, x_mask, y_mask, \
x_dest, y_dest)) { \
assert(0); \
@@ -1326,8 +1335,8 @@ glamor_composite_largepixmap_region(CARD8 op,
null_mask = 0;
if (need_clean_mask_fbo) {
assert(is_normal_mask_fbo == 0);
- glamor_destroy_fbo(mask_pixmap_priv->base.fbo);
- mask_pixmap_priv->base.fbo = NULL;
+ glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->fbo);
+ mask_pixmap_priv->fbo = NULL;
need_clean_mask_fbo = 0;
}
}
@@ -1355,19 +1364,19 @@ glamor_composite_largepixmap_region(CARD8 op,
null_source = 0;
if (need_clean_source_fbo) {
assert(is_normal_source_fbo == 0);
- glamor_destroy_fbo(source_pixmap_priv->base.fbo);
- source_pixmap_priv->base.fbo = NULL;
+ glamor_destroy_fbo(glamor_priv, source_pixmap_priv->fbo);
+ source_pixmap_priv->fbo = NULL;
need_clean_source_fbo = 0;
}
}
else {
if (mask_pixmap_priv &&
- mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+ glamor_pixmap_priv_is_large(mask_pixmap_priv)) {
if (!mask->transform && mask_repeat_type != RepeatPad) {
RegionTranslate(clipped_dest_regions[i].region,
x_mask - x_dest, y_mask - y_dest);
clipped_mask_regions =
- glamor_compute_clipped_regions(mask_pixmap_priv,
+ glamor_compute_clipped_regions(mask_pixmap,
clipped_dest_regions[i].
region, &n_mask_regions,
mask_repeat_type, 0, 0);
@@ -1376,7 +1385,7 @@ glamor_composite_largepixmap_region(CARD8 op,
else {
clipped_mask_regions =
glamor_compute_transform_clipped_regions
- (mask_pixmap_priv, mask->transform,
+ (mask_pixmap, mask->transform,
clipped_dest_regions[i].region, &n_mask_regions,
x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0,
0);
@@ -1388,7 +1397,7 @@ glamor_composite_largepixmap_region(CARD8 op,
}
else
_glamor_process_transformed_clipped_region
- (mask_pixmap_priv, mask_repeat_type,
+ (mask_pixmap, mask_pixmap_priv, mask_repeat_type,
clipped_mask_regions, &n_mask_regions,
&need_clean_mask_fbo);
}
@@ -1417,8 +1426,8 @@ glamor_composite_largepixmap_region(CARD8 op,
if (null_mask)
null_mask = 0;
if (need_clean_mask_fbo) {
- glamor_destroy_fbo(mask_pixmap_priv->base.fbo);
- mask_pixmap_priv->base.fbo = NULL;
+ glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->fbo);
+ mask_pixmap_priv->fbo = NULL;
need_clean_mask_fbo = 0;
}
}
diff --git a/xorg-server/glamor/glamor_lines.c b/xorg-server/glamor/glamor_lines.c
index e9a619505..2dd9c07db 100644
--- a/xorg-server/glamor/glamor_lines.c
+++ b/xorg-server/glamor/glamor_lines.c
@@ -65,7 +65,7 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
&glamor_facet_poly_lines);
if (!prog)
- goto bail_ctx;
+ goto bail;
/* Set up the vertex buffers for the points */
@@ -117,12 +117,9 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
}
glDisable(GL_SCISSOR_TEST);
- glDisable(GL_COLOR_LOGIC_OP);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
return TRUE;
-bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
bail:
return FALSE;
}
@@ -167,21 +164,3 @@ glamor_poly_lines(DrawablePtr drawable, GCPtr gc,
return;
glamor_poly_lines_bail(drawable, gc, mode, n, points);
}
-
-Bool
-glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc,
- int mode, int n, DDXPointPtr points)
-{
- if (glamor_poly_lines_gl(drawable, gc, mode, n, points))
- return TRUE;
-
- if (glamor_ddx_fallback_check_pixmap(drawable) &&
- glamor_ddx_fallback_check_gc(gc))
- {
- return FALSE;
- }
-
- glamor_poly_lines_bail(drawable, gc, mode, n, points);
- return TRUE;
-}
-
diff --git a/xorg-server/glamor/glamor_picture.c b/xorg-server/glamor/glamor_picture.c
index bc658f801..53b032c89 100644
--- a/xorg-server/glamor/glamor_picture.c
+++ b/xorg-server/glamor/glamor_picture.c
@@ -69,19 +69,9 @@ glamor_create_picture(PicturePtr picture)
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
pixmap_priv = glamor_get_pixmap_private(pixmap);
}
- else {
- if (GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
- /* If the picture format is not compatible with glamor fbo format,
- * we have to mark this pixmap as a separated texture, and don't
- * fallback to DDX layer. */
- if (pixmap_priv->type == GLAMOR_TEXTURE_DRM
- && !glamor_pict_format_is_compatible(picture))
- glamor_set_pixmap_type(pixmap, GLAMOR_SEPARATE_TEXTURE);
- }
- }
- pixmap_priv->base.is_picture = 1;
- pixmap_priv->base.picture = picture;
+ pixmap_priv->is_picture = 1;
+ pixmap_priv->picture = picture;
return miCreatePicture(picture);
}
@@ -99,8 +89,8 @@ glamor_destroy_picture(PicturePtr picture)
pixmap_priv = glamor_get_pixmap_private(pixmap);
if (pixmap_priv) {
- pixmap_priv->base.is_picture = 0;
- pixmap_priv->base.picture = NULL;
+ pixmap_priv->is_picture = 0;
+ pixmap_priv->picture = NULL;
}
miDestroyPicture(picture);
}
@@ -109,5 +99,5 @@ void
glamor_picture_format_fixup(PicturePtr picture,
glamor_pixmap_private *pixmap_priv)
{
- pixmap_priv->base.picture = picture;
+ pixmap_priv->picture = picture;
}
diff --git a/xorg-server/glamor/glamor_pixmap.c b/xorg-server/glamor/glamor_pixmap.c
index 947113ee9..89b4c366b 100644
--- a/xorg-server/glamor/glamor_pixmap.c
+++ b/xorg-server/glamor/glamor_pixmap.c
@@ -63,31 +63,36 @@ glamor_pixmap_fini(ScreenPtr screen)
}
void
-glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *fbo, int x0, int y0,
+glamor_set_destination_pixmap_fbo(glamor_screen_private *glamor_priv,
+ glamor_pixmap_fbo *fbo, int x0, int y0,
int width, int height)
{
- glamor_make_current(fbo->glamor_priv);
+ glamor_make_current(glamor_priv);
glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
glViewport(x0, y0, width, height);
}
void
-glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private *pixmap_priv)
+glamor_set_destination_pixmap_priv_nc(glamor_screen_private *glamor_priv,
+ PixmapPtr pixmap,
+ glamor_pixmap_private *pixmap_priv)
{
int w, h;
- PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap_priv, w, h);
- glamor_set_destination_pixmap_fbo(pixmap_priv->base.fbo, 0, 0, w, h);
+ PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, pixmap_priv, w, h);
+ glamor_set_destination_pixmap_fbo(glamor_priv, pixmap_priv->fbo, 0, 0, w, h);
}
int
-glamor_set_destination_pixmap_priv(glamor_pixmap_private *pixmap_priv)
+glamor_set_destination_pixmap_priv(glamor_screen_private *glamor_priv,
+ PixmapPtr pixmap,
+ glamor_pixmap_private *pixmap_priv)
{
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
return -1;
- glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+ glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
return 0;
}
@@ -96,8 +101,10 @@ glamor_set_destination_pixmap(PixmapPtr pixmap)
{
int err;
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+ ScreenPtr screen = pixmap->drawable.pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- err = glamor_set_destination_pixmap_priv(pixmap_priv);
+ err = glamor_set_destination_pixmap_priv(glamor_priv, pixmap, pixmap_priv);
return err;
}
@@ -471,7 +478,7 @@ glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap,
pixmap_priv = glamor_get_pixmap_private(pixmap);
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
- pict_format = pixmap_priv->base.picture->format;
+ pict_format = pixmap_priv->picture->format;
else
pict_format = format_for_depth(pixmap->drawable.depth);
@@ -717,7 +724,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
}
glBindTexture(GL_TEXTURE_2D, *tex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
@@ -742,6 +748,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
int swap_rb, int x, int y, int w, int h,
int stride, void *bits, int pbo)
{
+ ScreenPtr screen = pixmap->drawable.pScreen;
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_screen_private *glamor_priv =
glamor_get_screen_private(pixmap->drawable.pScreen);
@@ -793,25 +800,25 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
if (no_alpha == 0
&& revert == REVERT_NONE && swap_rb == SWAP_NONE_UPLOADING
#ifdef WALKAROUND_LARGE_TEXTURE_MAP
- && pixmap_priv->type != GLAMOR_TEXTURE_LARGE
+ && glamor_pixmap_priv_is_small(pixmap_priv)
#endif
) {
int fbo_x_off, fbo_y_off;
- assert(pixmap_priv->base.fbo->tex);
+ assert(pixmap_priv->fbo->tex);
pixmap_priv_get_fbo_off(pixmap_priv, &fbo_x_off, &fbo_y_off);
assert(x + fbo_x_off >= 0 && y + fbo_y_off >= 0);
- assert(x + fbo_x_off + w <= pixmap_priv->base.fbo->width);
- assert(y + fbo_y_off + h <= pixmap_priv->base.fbo->height);
- __glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->base.fbo->tex,
+ assert(x + fbo_x_off + w <= pixmap_priv->fbo->width);
+ assert(y + fbo_y_off + h <= pixmap_priv->fbo->height);
+ __glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->fbo->tex,
format, type,
x + fbo_x_off, y + fbo_y_off, w, h,
bits, pbo);
} else {
ptexcoords = texcoords_inv;
- pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale);
+ pixmap_priv_get_dest_scale(pixmap, pixmap_priv, &dst_xscale, &dst_yscale);
glamor_set_normalize_vcoords(pixmap_priv, dst_xscale,
dst_yscale,
x, y,
@@ -826,7 +833,8 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
GL_FALSE, 2 * sizeof(float), ptexcoords);
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+ glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
+ glamor_set_alu(screen, GXcopy);
__glamor_upload_pixmap_to_texture(pixmap, &tex,
format, type, 0, 0, w, h, bits, pbo);
glActiveTexture(GL_TEXTURE0);
@@ -868,17 +876,17 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
- if (pixmap_priv->base.gl_fbo != GLAMOR_FBO_UNATTACHED)
+ if (pixmap_priv->gl_fbo != GLAMOR_FBO_UNATTACHED)
return 0;
- if (pixmap_priv->base.fbo
- && (pixmap_priv->base.fbo->width < pixmap->drawable.width
- || pixmap_priv->base.fbo->height < pixmap->drawable.height)) {
+ if (pixmap_priv->fbo
+ && (pixmap_priv->fbo->width < pixmap->drawable.width
+ || pixmap_priv->fbo->height < pixmap->drawable.height)) {
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
- glamor_destroy_fbo(fbo);
+ glamor_destroy_fbo(glamor_priv, fbo);
}
- if (pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb)
+ if (pixmap_priv->fbo && pixmap_priv->fbo->fb)
return 0;
if (!(no_alpha || (revert == REVERT_NORMAL)
@@ -889,8 +897,8 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
}
if ((flag == GLAMOR_CREATE_FBO_NO_FBO
- && pixmap_priv->base.fbo && pixmap_priv->base.fbo->tex)
- || (flag == 0 && pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb))
+ && pixmap_priv->fbo && pixmap_priv->fbo->tex)
+ || (flag == 0 && pixmap_priv->fbo && pixmap_priv->fbo->fb))
return 0;
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
@@ -928,6 +936,8 @@ Bool
glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
int h, int stride, void *bits, int pbo)
{
+ ScreenPtr screen = pixmap->drawable.pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
GLenum format, type;
int no_alpha, revert, swap_rb;
glamor_pixmap_private *pixmap_priv;
@@ -945,10 +955,10 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
return FALSE;
pixmap_priv = glamor_get_pixmap_private(pixmap);
- force_clip = pixmap_priv->base.glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
- && !glamor_check_fbo_size(pixmap_priv->base.glamor_priv, w, h);
+ force_clip = glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
+ && !glamor_check_fbo_size(glamor_priv, w, h);
- if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE || force_clip) {
+ if (glamor_pixmap_priv_is_large(pixmap_priv) || force_clip) {
RegionRec region;
BoxRec box;
int n_region;
@@ -966,14 +976,14 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
RegionInitBoxes(&region, &box, 1);
if (!force_clip)
clipped_regions =
- glamor_compute_clipped_regions(pixmap_priv, &region, &n_region,
+ glamor_compute_clipped_regions(pixmap, &region, &n_region,
0, 0, 0);
else
clipped_regions =
- glamor_compute_clipped_regions_ext(pixmap_priv, &region,
+ glamor_compute_clipped_regions_ext(pixmap, &region,
&n_region,
- pixmap_priv->large.block_w,
- pixmap_priv->large.block_h,
+ pixmap_priv->block_w,
+ pixmap_priv->block_h,
0,
0);
DEBUGF("prepare upload %dx%d to a large pixmap %p\n", w, h, pixmap);
@@ -1044,10 +1054,10 @@ glamor_upload_pixmap_to_texture(PixmapPtr pixmap)
pixmap_priv = glamor_get_pixmap_private(pixmap);
- if ((pixmap_priv->base.fbo)
- && (pixmap_priv->base.fbo->pbo_valid)) {
+ if ((pixmap_priv->fbo)
+ && (pixmap_priv->fbo->pbo_valid)) {
data = NULL;
- pbo = pixmap_priv->base.fbo->pbo;
+ pbo = pixmap_priv->fbo->pbo;
}
else {
data = pixmap->devPrivate.ptr;
@@ -1118,11 +1128,12 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, source_priv->base.fbo->tex);
+ glBindTexture(GL_TEXTURE_2D, source_priv->fbo->tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glamor_set_destination_pixmap_fbo(temp_fbo, 0, 0, w, h);
+ glamor_set_destination_pixmap_fbo(glamor_priv, temp_fbo, 0, 0, w, h);
+ glamor_set_alu(screen, GXcopy);
glUseProgram(glamor_priv->finish_access_prog[no_alpha]);
glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert);
glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb);
@@ -1133,62 +1144,3 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
return temp_fbo;
}
-
-/* fixup a fbo to the exact size as the pixmap. */
-/* XXX LARGE pixmap? */
-Bool
-glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv)
-{
- glamor_pixmap_fbo *old_fbo;
- glamor_pixmap_fbo *new_fbo = NULL;
- PixmapPtr scratch = NULL;
- glamor_pixmap_private *scratch_priv;
- DrawablePtr drawable;
- GCPtr gc = NULL;
- int ret = FALSE;
-
- drawable = &pixmap_priv->base.pixmap->drawable;
-
- if (!GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv))
- return TRUE;
-
- old_fbo = pixmap_priv->base.fbo;
-
- if (!old_fbo)
- return FALSE;
-
- gc = GetScratchGC(drawable->depth, screen);
- if (!gc)
- goto fail;
-
- scratch = glamor_create_pixmap(screen, drawable->width, drawable->height,
- drawable->depth, GLAMOR_CREATE_PIXMAP_FIXUP);
-
- scratch_priv = glamor_get_pixmap_private(scratch);
-
- if (!scratch_priv->base.fbo)
- goto fail;
-
- ValidateGC(&scratch->drawable, gc);
- glamor_copy_area(drawable,
- &scratch->drawable,
- gc, 0, 0, drawable->width, drawable->height, 0, 0);
- old_fbo = glamor_pixmap_detach_fbo(pixmap_priv);
- new_fbo = glamor_pixmap_detach_fbo(scratch_priv);
- glamor_pixmap_attach_fbo(pixmap_priv->base.pixmap, new_fbo);
- glamor_pixmap_attach_fbo(scratch, old_fbo);
-
- DEBUGF("old %dx%d type %d\n",
- drawable->width, drawable->height, pixmap_priv->type);
- DEBUGF("copy tex %d %dx%d to tex %d %dx%d \n",
- old_fbo->tex, old_fbo->width, old_fbo->height, new_fbo->tex,
- new_fbo->width, new_fbo->height);
- ret = TRUE;
- fail:
- if (gc)
- FreeScratchGC(gc);
- if (scratch)
- glamor_destroy_pixmap(scratch);
-
- return ret;
-}
diff --git a/xorg-server/glamor/glamor_points.c b/xorg-server/glamor/glamor_points.c
index 84383d254..df7e5a23f 100644
--- a/xorg-server/glamor/glamor_points.c
+++ b/xorg-server/glamor/glamor_points.c
@@ -55,17 +55,17 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
glamor_make_current(glamor_priv);
if (prog->failed)
- goto bail_ctx;
+ goto bail;
if (!prog->prog) {
if (!glamor_build_program(screen, prog,
&glamor_facet_point,
&glamor_fill_solid))
- goto bail_ctx;
+ goto bail;
}
if (!glamor_use_program(pixmap, gc, prog, NULL))
- goto bail_ctx;
+ goto bail;
vbo_ppt = glamor_get_vbo_space(screen, npt * (2 * sizeof (INT16)), &vbo_offset);
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
@@ -102,13 +102,10 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
}
glDisable(GL_SCISSOR_TEST);
- glDisable(GL_COLOR_LOGIC_OP);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
return TRUE;
-bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
bail:
return FALSE;
}
@@ -121,18 +118,3 @@ glamor_poly_point(DrawablePtr drawable, GCPtr gc, int mode, int npt,
return;
miPolyPoint(drawable, gc, mode, npt, ppt);
}
-
-Bool
-glamor_poly_point_nf(DrawablePtr drawable, GCPtr gc, int mode, int npt,
- DDXPointPtr ppt)
-{
- if (glamor_poly_point_gl(drawable, gc, mode, npt, ppt))
- return TRUE;
-
- if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
- return FALSE;
-
- miPolyPoint(drawable, gc, mode, npt, ppt);
- return TRUE;
-}
-
diff --git a/xorg-server/glamor/glamor_prepare.c b/xorg-server/glamor/glamor_prepare.c
index fb85d9082..83ba7f16f 100644
--- a/xorg-server/glamor/glamor_prepare.c
+++ b/xorg-server/glamor/glamor_prepare.c
@@ -54,7 +54,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
* we'll assume that it's directly mapped
* by a lower level driver
*/
- if (!priv->base.prepared)
+ if (!priv->prepared)
return TRUE;
/* In X, multiple Drawables can be stored in the same Pixmap (such as
@@ -65,28 +65,28 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
* As a result, when doing a series of mappings for a fallback, we may
* need to add more boxes to the set of data we've downloaded, as we go.
*/
- RegionSubtract(&region, &region, &priv->base.prepare_region);
+ RegionSubtract(&region, &region, &priv->prepare_region);
if (!RegionNotEmpty(&region))
return TRUE;
if (access == GLAMOR_ACCESS_RW)
FatalError("attempt to remap buffer as writable");
- if (priv->base.pbo) {
- glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->base.pbo);
+ if (priv->pbo) {
+ glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->pbo);
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
pixmap->devPrivate.ptr = NULL;
}
} else {
- RegionInit(&priv->base.prepare_region, box, 1);
+ RegionInit(&priv->prepare_region, box, 1);
if (glamor_priv->has_rw_pbo) {
- if (priv->base.pbo == 0)
- glGenBuffers(1, &priv->base.pbo);
+ if (priv->pbo == 0)
+ glGenBuffers(1, &priv->pbo);
gl_usage = GL_STREAM_READ;
- glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->base.pbo);
+ glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->pbo);
glBufferData(GL_PIXEL_PACK_BUFFER,
pixmap->devKind * pixmap->drawable.height, NULL,
gl_usage);
@@ -96,7 +96,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
if (!pixmap->devPrivate.ptr)
return FALSE;
}
- priv->base.map_access = access;
+ priv->map_access = access;
}
glamor_download_boxes(pixmap, RegionRects(&region), RegionNumRects(&region),
@@ -105,7 +105,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
RegionUninit(&region);
if (glamor_priv->has_rw_pbo) {
- if (priv->base.map_access == GLAMOR_ACCESS_RW)
+ if (priv->map_access == GLAMOR_ACCESS_RW)
gl_access = GL_READ_WRITE;
else
gl_access = GL_READ_ONLY;
@@ -114,7 +114,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
}
- priv->base.prepared = TRUE;
+ priv->prepared = TRUE;
return TRUE;
}
@@ -133,34 +133,34 @@ glamor_fini_pixmap(PixmapPtr pixmap)
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv))
return;
- if (!priv->base.prepared)
+ if (!priv->prepared)
return;
if (glamor_priv->has_rw_pbo) {
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, priv->base.pbo);
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, priv->pbo);
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
pixmap->devPrivate.ptr = NULL;
}
- if (priv->base.map_access == GLAMOR_ACCESS_RW) {
+ if (priv->map_access == GLAMOR_ACCESS_RW) {
glamor_upload_boxes(pixmap,
- RegionRects(&priv->base.prepare_region),
- RegionNumRects(&priv->base.prepare_region),
+ RegionRects(&priv->prepare_region),
+ RegionNumRects(&priv->prepare_region),
0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
}
- RegionUninit(&priv->base.prepare_region);
+ RegionUninit(&priv->prepare_region);
if (glamor_priv->has_rw_pbo) {
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
- glDeleteBuffers(1, &priv->base.pbo);
- priv->base.pbo = 0;
+ glDeleteBuffers(1, &priv->pbo);
+ priv->pbo = 0;
} else {
free(pixmap->devPrivate.ptr);
pixmap->devPrivate.ptr = NULL;
}
- priv->base.prepared = FALSE;
+ priv->prepared = FALSE;
}
Bool
diff --git a/xorg-server/glamor/glamor_priv.h b/xorg-server/glamor/glamor_priv.h
index ed6e2d192..898a9348a 100644
--- a/xorg-server/glamor/glamor_priv.h
+++ b/xorg-server/glamor/glamor_priv.h
@@ -48,9 +48,7 @@
"precision mediump float;\n" \
"#endif\n"
-#ifdef RENDER
#include "glyphstr.h"
-#endif
#include "glamor_debug.h"
#include "glamor_context.h"
@@ -74,7 +72,7 @@ typedef struct glamor_composite_shader {
union {
float source_solid_color[4];
struct {
- struct glamor_pixmap_private *source_priv;
+ PixmapPtr source_pixmap;
PicturePtr source;
};
};
@@ -82,7 +80,7 @@ typedef struct glamor_composite_shader {
union {
float mask_solid_color[4];
struct {
- struct glamor_pixmap_private *mask_priv;
+ PixmapPtr mask_pixmap;
PicturePtr mask;
};
};
@@ -236,6 +234,8 @@ typedef struct glamor_screen_private {
int has_buffer_storage;
int has_khr_debug;
int has_nv_texture_barrier;
+ int has_pack_subimage;
+ int has_unpack_subimage;
int max_fbo_size;
int has_rw_pbo;
@@ -369,7 +369,6 @@ typedef struct glamor_pixmap_fbo {
Bool external;
GLenum format;
GLenum type;
- glamor_screen_private *glamor_priv;
} glamor_pixmap_fbo;
/*
@@ -378,6 +377,14 @@ typedef struct glamor_pixmap_fbo {
* @is_picture: The drawable is attached to a picture.
* @pict_format: the corresponding picture's format.
* @pixmap: The corresponding pixmap's pointer.
+ * @box: current fbo's coords in the whole pixmap.
+ * @block_w: block width of this large pixmap.
+ * @block_h: block height of this large pixmap.
+ * @block_wcnt: block count in one block row.
+ * @block_hcnt: block count in one block column.
+ * @nbox: total block count.
+ * @box_array: contains each block's corresponding box.
+ * @fbo_array: contains each block's fbo pointer.
*
* For GLAMOR_TEXTURE_LARGE, nbox should larger than 1.
* And the box and fbo will both have nbox elements.
@@ -427,9 +434,6 @@ typedef struct glamor_pixmap_fbo {
* to the box and fbo elements. Thus the inner routines
* can handle it as normal, only the coords calculation need
* to aware of it's large pixmap.
- *
- * Currently, we haven't implemented the atlas pixmap.
- *
**/
typedef struct glamor_pixmap_clipped_regions {
@@ -437,7 +441,7 @@ typedef struct glamor_pixmap_clipped_regions {
RegionPtr region;
} glamor_pixmap_clipped_regions;
-typedef struct glamor_pixmap_private_base {
+typedef struct glamor_pixmap_private {
glamor_pixmap_type_t type;
enum glamor_fbo_state gl_fbo;
/**
@@ -449,10 +453,8 @@ typedef struct glamor_pixmap_private_base {
unsigned char is_picture:1;
unsigned char gl_tex:1;
glamor_pixmap_fbo *fbo;
- PixmapPtr pixmap;
BoxRec box;
int drm_stride;
- glamor_screen_private *glamor_priv;
PicturePtr picture;
GLuint pbo;
RegionRec prepare_region;
@@ -460,104 +462,125 @@ typedef struct glamor_pixmap_private_base {
#if GLAMOR_HAS_GBM
EGLImageKHR image;
#endif
-} glamor_pixmap_private_base_t;
-
-/*
- * @base.fbo: current fbo.
- * @box: current fbo's coords in the whole pixmap.
- * @block_w: block width of this large pixmap.
- * @block_h: block height of this large pixmap.
- * @block_wcnt: block count in one block row.
- * @block_hcnt: block count in one block column.
- * @nbox: total block count.
- * @box_array: contains each block's corresponding box.
- * @fbo_array: contains each block's fbo pointer.
- *
- **/
-typedef struct glamor_pixmap_private_large {
- union {
- glamor_pixmap_type_t type;
- glamor_pixmap_private_base_t base;
- };
- BoxRec box;
int block_w;
int block_h;
int block_wcnt;
int block_hcnt;
- int nbox;
BoxPtr box_array;
glamor_pixmap_fbo **fbo_array;
-} glamor_pixmap_private_large_t;
+} glamor_pixmap_private;
+
+extern DevPrivateKeyRec glamor_pixmap_private_key;
+
+static inline glamor_pixmap_private *
+glamor_get_pixmap_private(PixmapPtr pixmap)
+{
+ glamor_pixmap_private *priv;
+
+ if (pixmap == NULL)
+ return NULL;
+
+ priv = dixLookupPrivate(&pixmap->devPrivates, &glamor_pixmap_private_key);
+ if (!priv) {
+ glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
+ priv = dixLookupPrivate(&pixmap->devPrivates,
+ &glamor_pixmap_private_key);
+ }
+ return priv;
+}
+
+void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv);
/*
- * @box: the relative coords in the corresponding fbo.
+ * Returns TRUE if pixmap has no image object
*/
-typedef struct glamor_pixmap_private_atlas {
- union {
- glamor_pixmap_type_t type;
- glamor_pixmap_private_base_t base;
- };
- BoxRec box;
-} glamor_pixmap_private_atlas_t;
+static inline Bool
+glamor_pixmap_drm_only(PixmapPtr pixmap)
+{
+ glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
-typedef struct glamor_pixmap_private {
- union {
- glamor_pixmap_type_t type;
- glamor_pixmap_private_base_t base;
- glamor_pixmap_private_large_t large;
- glamor_pixmap_private_atlas_t atlas;
- };
-} glamor_pixmap_private;
+ return priv && priv->type == GLAMOR_DRM_ONLY;
+}
+
+/*
+ * Returns TRUE if pixmap is plain memory (not a GL object at all)
+ */
+static inline Bool
+glamor_pixmap_is_memory(PixmapPtr pixmap)
+{
+ glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
+
+ return !priv || priv->type == GLAMOR_MEMORY;
+}
+
+/*
+ * Returns TRUE if pixmap requires multiple textures to hold it
+ */
+static inline Bool
+glamor_pixmap_priv_is_large(glamor_pixmap_private *priv)
+{
+ return priv && (priv->block_wcnt > 1 || priv->block_hcnt > 1);
+}
+
+static inline Bool
+glamor_pixmap_priv_is_small(glamor_pixmap_private *priv)
+{
+ return priv && priv->block_wcnt <= 1 && priv->block_hcnt <= 1;
+}
+
+static inline Bool
+glamor_pixmap_is_large(PixmapPtr pixmap)
+{
+ glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
+
+ return priv && glamor_pixmap_priv_is_large(priv);
+}
+/*
+ * Returns TRUE if pixmap has an FBO
+ */
+static inline Bool
+glamor_pixmap_has_fbo(PixmapPtr pixmap)
+{
+ glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
+
+ return priv && priv->gl_fbo == GLAMOR_FBO_NORMAL;
+}
static inline void
glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx)
{
- if (priv->type == GLAMOR_TEXTURE_LARGE) {
- priv->large.base.fbo = priv->large.fbo_array[idx];
- priv->large.box = priv->large.box_array[idx];
+ if (glamor_pixmap_priv_is_large(priv)) {
+ priv->fbo = priv->fbo_array[idx];
+ priv->box = priv->box_array[idx];
}
}
static inline glamor_pixmap_fbo *
glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y)
{
- if (priv->type == GLAMOR_TEXTURE_LARGE) {
- assert(x < priv->large.block_wcnt);
- assert(y < priv->large.block_hcnt);
- return priv->large.fbo_array[y * priv->large.block_wcnt + x];
- }
- assert (x == 0);
- assert (y == 0);
- return priv->base.fbo;
+ assert(x < priv->block_wcnt);
+ assert(y < priv->block_hcnt);
+ return priv->fbo_array[y * priv->block_wcnt + x];
}
static inline BoxPtr
glamor_pixmap_box_at(glamor_pixmap_private *priv, int x, int y)
{
- if (priv->type == GLAMOR_TEXTURE_LARGE) {
- assert(x < priv->large.block_wcnt);
- assert(y < priv->large.block_hcnt);
- return &priv->large.box_array[y * priv->large.block_wcnt + x];
- }
- assert (x == 0);
- assert (y == 0);
- return &priv->base.box;
+ assert(x < priv->block_wcnt);
+ assert(y < priv->block_hcnt);
+ return &priv->box_array[y * priv->block_wcnt + x];
}
static inline int
glamor_pixmap_wcnt(glamor_pixmap_private *priv)
{
- if (priv->type == GLAMOR_TEXTURE_LARGE)
- return priv->large.block_wcnt;
- return 1;
+ return priv->block_wcnt;
}
static inline int
glamor_pixmap_hcnt(glamor_pixmap_private *priv)
{
- if (priv->type == GLAMOR_TEXTURE_LARGE)
- return priv->large.block_hcnt;
- return 1;
+ return priv->block_hcnt;
}
#define glamor_pixmap_loop(priv, x, y) \
@@ -590,7 +613,6 @@ typedef struct {
extern DevPrivateKeyRec glamor_gc_private_key;
extern DevPrivateKeyRec glamor_screen_private_key;
-extern DevPrivateKeyRec glamor_pixmap_private_key;
static inline glamor_screen_private *
glamor_get_screen_private(ScreenPtr screen)
@@ -605,22 +627,6 @@ glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv)
dixSetPrivate(&screen->devPrivates, &glamor_screen_private_key, priv);
}
-static inline glamor_pixmap_private *
-glamor_get_pixmap_private(PixmapPtr pixmap)
-{
- glamor_pixmap_private *priv;
-
- priv = dixLookupPrivate(&pixmap->devPrivates, &glamor_pixmap_private_key);
- if (!priv) {
- glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
- priv = dixLookupPrivate(&pixmap->devPrivates,
- &glamor_pixmap_private_key);
- }
- return priv;
-}
-
-void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv);
-
static inline glamor_gc_private *
glamor_get_gc_private(GCPtr gc)
{
@@ -652,9 +658,10 @@ glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private *
int flag);
glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w,
int h, GLenum format, int flag);
-void glamor_destroy_fbo(glamor_pixmap_fbo *fbo);
-void glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv);
-
+void glamor_destroy_fbo(glamor_screen_private *glamor_priv,
+ glamor_pixmap_fbo *fbo);
+void glamor_pixmap_destroy_fbo(glamor_screen_private *glamor_priv,
+ glamor_pixmap_private *priv);
void glamor_init_pixmap_fbo(ScreenPtr screen);
void glamor_fini_pixmap_fbo(ScreenPtr screen);
Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap);
@@ -679,13 +686,13 @@ void glamor_get_color_4f_from_pixel(PixmapPtr pixmap,
unsigned long fg_pixel, GLfloat *color);
int glamor_set_destination_pixmap(PixmapPtr pixmap);
-int glamor_set_destination_pixmap_priv(glamor_pixmap_private *pixmap_priv);
-void glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *, int, int, int, int);
+int glamor_set_destination_pixmap_priv(glamor_screen_private *glamor_priv, PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv);
+void glamor_set_destination_pixmap_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *, int, int, int, int);
/* nc means no check. caller must ensure this pixmap has valid fbo.
* usually use the GLAMOR_PIXMAP_PRIV_HAS_FBO firstly.
* */
-void glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private *pixmap_priv);
+void glamor_set_destination_pixmap_priv_nc(glamor_screen_private *glamor_priv, PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv);
glamor_pixmap_fbo *glamor_es2_pixmap_read_prepare(PixmapPtr source, int x,
int y, int w, int h,
@@ -702,6 +709,7 @@ glamor_track_stipple(GCPtr gc);
/* glamor_glyphs.c */
Bool glamor_realize_glyph_caches(ScreenPtr screen);
+void glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph);
void glamor_glyphs_fini(ScreenPtr screen);
void glamor_glyphs(CARD8 op,
PicturePtr pSrc,
@@ -715,9 +723,9 @@ Bool glamor_composite_clipped_region(CARD8 op,
PicturePtr source,
PicturePtr mask,
PicturePtr dest,
- glamor_pixmap_private *soruce_pixmap_priv,
- glamor_pixmap_private *mask_pixmap_priv,
- glamor_pixmap_private *dest_pixmap_priv,
+ PixmapPtr source_pixmap,
+ PixmapPtr mask_pixmap,
+ PixmapPtr dest_pixmap,
RegionPtr region,
int x_source,
int y_source,
@@ -748,23 +756,6 @@ PicturePtr glamor_convert_gradient_picture(ScreenPtr screen,
int x_source,
int y_source, int width, int height);
-Bool glamor_composite_choose_shader(CARD8 op,
- PicturePtr source,
- PicturePtr mask,
- PicturePtr dest,
- glamor_pixmap_private *source_pixmap_priv,
- glamor_pixmap_private *mask_pixmap_priv,
- glamor_pixmap_private *dest_pixmap_priv,
- struct shader_key *s_key,
- glamor_composite_shader ** shader,
- struct blendinfo *op_info,
- PictFormatShort *psaved_source_format);
-
-void glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
- struct shader_key *key,
- glamor_composite_shader *shader,
- struct blendinfo *op_info);
-
void *glamor_setup_composite_vbo(ScreenPtr screen, int n_verts);
/* glamor_trapezoid.c */
@@ -831,19 +822,19 @@ Bool glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
int pbo);
glamor_pixmap_clipped_regions *
-glamor_compute_clipped_regions(glamor_pixmap_private *priv,
+glamor_compute_clipped_regions(PixmapPtr pixmap,
RegionPtr region, int *clipped_nbox,
int repeat_type, int reverse,
int upsidedown);
glamor_pixmap_clipped_regions *
-glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
+glamor_compute_clipped_regions_ext(PixmapPtr pixmap,
RegionPtr region, int *n_region,
int inner_block_w, int inner_block_h,
int reverse, int upsidedown);
glamor_pixmap_clipped_regions *
-glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
+glamor_compute_transform_clipped_regions(PixmapPtr pixmap,
struct pixman_transform *transform,
RegionPtr region,
int *n_region, int dx, int dy,
@@ -854,9 +845,9 @@ Bool glamor_composite_largepixmap_region(CARD8 op,
PicturePtr source,
PicturePtr mask,
PicturePtr dest,
- glamor_pixmap_private *source_pixmap_priv,
- glamor_pixmap_private *mask_pixmap_priv,
- glamor_pixmap_private *dest_pixmap_priv,
+ PixmapPtr source_pixmap,
+ PixmapPtr mask_pixmap,
+ PixmapPtr dest_pixmap,
RegionPtr region, Bool force_clip,
INT16 x_source,
INT16 y_source,
@@ -894,10 +885,6 @@ void glamor_set_window_pixmap(WindowPtr pWindow, PixmapPtr pPixmap);
void glamor_destroy_picture(PicturePtr picture);
-/* fixup a fbo to the exact size as the pixmap. */
-Bool glamor_fixup_pixmap_priv(ScreenPtr screen,
- glamor_pixmap_private *pixmap_priv);
-
void glamor_picture_format_fixup(PicturePtr picture,
glamor_pixmap_private *pixmap_priv);
@@ -1095,4 +1082,6 @@ void glamor_xv_render(glamor_port_private *port_priv);
#include "glamor_font.h"
+#define GLAMOR_MIN_ALU_INSTRUCTIONS 128 /* Minimum required number of native ALU instructions */
+
#endif /* GLAMOR_PRIV_H */
diff --git a/xorg-server/glamor/glamor_program.c b/xorg-server/glamor/glamor_program.c
index 1d0328f2b..8aab53f4f 100644
--- a/xorg-server/glamor/glamor_program.c
+++ b/xorg-server/glamor/glamor_program.c
@@ -40,12 +40,12 @@ const glamor_facet glamor_fill_solid = {
static Bool
use_tile(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
{
- return glamor_set_tiled(pixmap, gc, prog->fill_offset_uniform, prog->fill_size_uniform);
+ return glamor_set_tiled(pixmap, gc, prog->fill_offset_uniform, prog->fill_size_inv_uniform);
}
static const glamor_facet glamor_fill_tile = {
.name = "tile",
- .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) / fill_size;\n",
+ .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n",
.fs_exec = " gl_FragColor = texture2D(sampler, fill_pos);\n",
.locations = glamor_program_location_fill,
.use = use_tile,
@@ -56,12 +56,12 @@ use_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
{
return glamor_set_stippled(pixmap, gc, prog->fg_uniform,
prog->fill_offset_uniform,
- prog->fill_size_uniform);
+ prog->fill_size_inv_uniform);
}
static const glamor_facet glamor_fill_stipple = {
.name = "stipple",
- .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) / fill_size;\n",
+ .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n",
.fs_exec = (" float a = texture2D(sampler, fill_pos).w;\n"
" if (a == 0.0)\n"
" discard;\n"
@@ -81,7 +81,7 @@ use_opaque_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
static const glamor_facet glamor_fill_opaque_stipple = {
.name = "opaque_stipple",
- .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) / fill_size;\n",
+ .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n",
.fs_exec = (" float a = texture2D(sampler, fill_pos).w;\n"
" if (a == 0.0)\n"
" gl_FragColor = bg;\n"
@@ -116,10 +116,10 @@ static glamor_location_var location_vars[] = {
{
.location = glamor_program_location_fill,
.vs_vars = ("uniform vec2 fill_offset;\n"
- "uniform vec2 fill_size;\n"
+ "uniform vec2 fill_size_inv;\n"
"varying vec2 fill_pos;\n"),
.fs_vars = ("uniform sampler2D sampler;\n"
- "uniform vec2 fill_size;\n"
+ "uniform vec2 fill_size_inv;\n"
"varying vec2 fill_pos;\n")
},
{
@@ -336,16 +336,13 @@ glamor_build_program(ScreenPtr screen,
prog->fg_uniform = glamor_get_uniform(prog, glamor_program_location_fg, "fg");
prog->bg_uniform = glamor_get_uniform(prog, glamor_program_location_bg, "bg");
prog->fill_offset_uniform = glamor_get_uniform(prog, glamor_program_location_fill, "fill_offset");
- prog->fill_size_uniform = glamor_get_uniform(prog, glamor_program_location_fill, "fill_size");
+ prog->fill_size_inv_uniform = glamor_get_uniform(prog, glamor_program_location_fill, "fill_size_inv");
prog->font_uniform = glamor_get_uniform(prog, glamor_program_location_font, "font");
prog->bitplane_uniform = glamor_get_uniform(prog, glamor_program_location_bitplane, "bitplane");
prog->bitmul_uniform = glamor_get_uniform(prog, glamor_program_location_bitplane, "bitmul");
prog->dash_uniform = glamor_get_uniform(prog, glamor_program_location_dash, "dash");
prog->dash_length_uniform = glamor_get_uniform(prog, glamor_program_location_dash, "dash_length");
- if (glGetError() != GL_NO_ERROR)
- goto fail;
-
free(version_string);
free(fs_vars);
free(vs_vars);
diff --git a/xorg-server/glamor/glamor_program.h b/xorg-server/glamor/glamor_program.h
index 56ba03aa8..fa3877c5d 100644
--- a/xorg-server/glamor/glamor_program.h
+++ b/xorg-server/glamor/glamor_program.h
@@ -60,7 +60,7 @@ struct _glamor_program {
GLint matrix_uniform;
GLint fg_uniform;
GLint bg_uniform;
- GLint fill_size_uniform;
+ GLint fill_size_inv_uniform;
GLint fill_offset_uniform;
GLint font_uniform;
GLint bitplane_uniform;
diff --git a/xorg-server/glamor/glamor_rects.c b/xorg-server/glamor/glamor_rects.c
index 3a5c3f3f9..c378e4a30 100644
--- a/xorg-server/glamor/glamor_rects.c
+++ b/xorg-server/glamor/glamor_rects.c
@@ -65,7 +65,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
&glamor_facet_polyfillrect_130);
if (!prog)
- goto bail_ctx;
+ goto bail;
/* Set up the vertex buffers for the points */
@@ -87,7 +87,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
&glamor_facet_polyfillrect_120);
if (!prog)
- goto bail_ctx;
+ goto bail;
/* Set up the vertex buffers for the points */
@@ -126,27 +126,17 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
if (glamor_priv->glsl_version >= 130)
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nrect);
else {
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
- glDrawArrays(GL_QUADS, 0, nrect * 4);
- } else {
- int i;
- for (i = 0; i < nrect; i++) {
- glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
- }
- }
+ glamor_glDrawArrays_GL_QUADS(glamor_priv, nrect);
}
}
}
glDisable(GL_SCISSOR_TEST);
- glDisable(GL_COLOR_LOGIC_OP);
if (glamor_priv->glsl_version >= 130)
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
return TRUE;
-bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
bail:
return FALSE;
}
@@ -173,15 +163,3 @@ glamor_poly_fill_rect(DrawablePtr drawable,
return;
glamor_poly_fill_rect_bail(drawable, gc, nrect, prect);
}
-
-Bool
-glamor_poly_fill_rect_nf(DrawablePtr drawable,
- GCPtr gc, int nrect, xRectangle *prect)
-{
- if (glamor_poly_fill_rect_gl(drawable, gc, nrect, prect))
- return TRUE;
- if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
- return FALSE;
- glamor_poly_fill_rect_bail(drawable, gc, nrect, prect);
- return TRUE;
-}
diff --git a/xorg-server/glamor/glamor_render.c b/xorg-server/glamor/glamor_render.c
index 2386f2e2e..27c09fd48 100644
--- a/xorg-server/glamor/glamor_render.c
+++ b/xorg-server/glamor/glamor_render.c
@@ -34,7 +34,6 @@
#include "glamor_priv.h"
-#ifdef RENDER
#include "mipict.h"
#include "fbpict.h"
#if 0
@@ -483,15 +482,16 @@ glamor_set_composite_op(ScreenPtr screen,
static void
glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
PicturePtr picture,
- glamor_pixmap_private *pixmap_priv,
+ PixmapPtr pixmap,
GLuint wh_location, GLuint repeat_location)
{
+ glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
float wh[4];
int repeat_type;
glamor_make_current(glamor_priv);
glActiveTexture(GL_TEXTURE0 + unit);
- glBindTexture(GL_TEXTURE_2D, pixmap_priv->base.fbo->tex);
+ glBindTexture(GL_TEXTURE_2D, pixmap_priv->fbo->tex);
repeat_type = picture->repeatType;
switch (picture->repeatType) {
case RepeatNone:
@@ -542,13 +542,12 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
if (repeat_type != RepeatNone)
repeat_type += RepeatFix;
else if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
- || pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
- if (picture->transform
- || (GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv)))
+ || glamor_pixmap_priv_is_large(pixmap_priv)) {
+ if (picture->transform)
repeat_type += RepeatFix;
}
if (repeat_type >= RepeatFix) {
- glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap_priv);
+ glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap, pixmap_priv);
if ((wh[0] != 1.0 || wh[1] != 1.0)
|| (glamor_priv->gl_flavor == GLAMOR_GL_ES2
&& repeat_type == RepeatFix))
@@ -788,7 +787,8 @@ combine_pict_format(PictFormatShort * des, const PictFormatShort src,
}
static void
-glamor_set_normalize_tcoords_generic(glamor_pixmap_private *priv,
+glamor_set_normalize_tcoords_generic(PixmapPtr pixmap,
+ glamor_pixmap_private *priv,
int repeat_type,
float *matrix,
float xscale, float yscale,
@@ -806,24 +806,27 @@ glamor_set_normalize_tcoords_generic(glamor_pixmap_private *priv,
x2, y2,
texcoords, stride);
else if (!matrix && repeat_type != RepeatNone)
- glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type,
+ glamor_set_repeat_normalize_tcoords_ext(pixmap, priv, repeat_type,
xscale, yscale,
x1, y1,
x2, y2,
texcoords, stride);
else if (matrix && repeat_type != RepeatNone)
- glamor_set_repeat_transformed_normalize_tcoords_ext(priv, repeat_type,
+ glamor_set_repeat_transformed_normalize_tcoords_ext(pixmap, priv, repeat_type,
matrix, xscale,
yscale, x1, y1, x2,
y2,
texcoords, stride);
}
-Bool
+static Bool
glamor_composite_choose_shader(CARD8 op,
PicturePtr source,
PicturePtr mask,
PicturePtr dest,
+ PixmapPtr source_pixmap,
+ PixmapPtr mask_pixmap,
+ PixmapPtr dest_pixmap,
glamor_pixmap_private *source_pixmap_priv,
glamor_pixmap_private *mask_pixmap_priv,
glamor_pixmap_private *dest_pixmap_priv,
@@ -833,9 +836,6 @@ glamor_composite_choose_shader(CARD8 op,
PictFormatShort *psaved_source_format)
{
ScreenPtr screen = dest->pDrawable->pScreen;
- PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap;
- PixmapPtr source_pixmap = NULL;
- PixmapPtr mask_pixmap = NULL;
enum glamor_pixmap_status source_status = GLAMOR_NONE;
enum glamor_pixmap_status mask_status = GLAMOR_NONE;
PictFormatShort saved_source_format = 0;
@@ -928,13 +928,12 @@ glamor_composite_choose_shader(CARD8 op,
if (key.source == SHADER_SOURCE_TEXTURE ||
key.source == SHADER_SOURCE_TEXTURE_ALPHA) {
- source_pixmap = source_pixmap_priv->base.pixmap;
if (source_pixmap == dest_pixmap) {
/* XXX source and the dest share the same texture.
* Does it need special handle? */
glamor_fallback("source == dest\n");
}
- if (source_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
+ if (source_pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED) {
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
source_status = GLAMOR_UPLOAD_PENDING;
#else
@@ -946,12 +945,11 @@ glamor_composite_choose_shader(CARD8 op,
if (key.mask == SHADER_MASK_TEXTURE ||
key.mask == SHADER_MASK_TEXTURE_ALPHA) {
- mask_pixmap = mask_pixmap_priv->base.pixmap;
if (mask_pixmap == dest_pixmap) {
glamor_fallback("mask == dest\n");
goto fail;
}
- if (mask_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
+ if (mask_pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED) {
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
mask_status = GLAMOR_UPLOAD_PENDING;
#else
@@ -1041,23 +1039,6 @@ glamor_composite_choose_shader(CARD8 op,
goto fail;
}
- /*Before enter the rendering stage, we need to fixup
- * transformed source and mask, if the transform is not int translate. */
- if (key.source != SHADER_SOURCE_SOLID
- && source->transform
- && !pixman_transform_is_int_translate(source->transform)
- && source_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
- if (!glamor_fixup_pixmap_priv(screen, source_pixmap_priv))
- goto fail;
- }
- if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID
- && mask->transform
- && !pixman_transform_is_int_translate(mask->transform)
- && mask_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
- if (!glamor_fixup_pixmap_priv(screen, mask_pixmap_priv))
- goto fail;
- }
-
if (!glamor_set_composite_op(screen, op, op_info, dest, mask))
goto fail;
@@ -1071,7 +1052,7 @@ glamor_composite_choose_shader(CARD8 op,
memcpy(&(*shader)->source_solid_color[0],
source_solid_color, 4 * sizeof(float));
else {
- (*shader)->source_priv = source_pixmap_priv;
+ (*shader)->source_pixmap = source_pixmap;
(*shader)->source = source;
}
@@ -1079,7 +1060,7 @@ glamor_composite_choose_shader(CARD8 op,
memcpy(&(*shader)->mask_solid_color[0],
mask_solid_color, 4 * sizeof(float));
else {
- (*shader)->mask_priv = mask_pixmap_priv;
+ (*shader)->mask_pixmap = mask_pixmap;
(*shader)->mask = mask;
}
@@ -1095,16 +1076,13 @@ glamor_composite_choose_shader(CARD8 op,
return ret;
}
-void
-glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
+static void
+glamor_composite_set_shader_blend(glamor_screen_private *glamor_priv,
+ glamor_pixmap_private *dest_priv,
struct shader_key *key,
glamor_composite_shader *shader,
struct blendinfo *op_info)
{
- glamor_screen_private *glamor_priv;
-
- glamor_priv = dest_priv->base.glamor_priv;
-
glamor_make_current(glamor_priv);
glUseProgram(shader->prog);
@@ -1115,7 +1093,7 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
else {
glamor_set_composite_texture(glamor_priv, 0,
shader->source,
- shader->source_priv, shader->source_wh,
+ shader->source_pixmap, shader->source_wh,
shader->source_repeat_mode);
}
@@ -1127,7 +1105,7 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
else {
glamor_set_composite_texture(glamor_priv, 1,
shader->mask,
- shader->mask_priv, shader->mask_wh,
+ shader->mask_pixmap, shader->mask_wh,
shader->mask_repeat_mode);
}
}
@@ -1146,6 +1124,9 @@ glamor_composite_with_shader(CARD8 op,
PicturePtr source,
PicturePtr mask,
PicturePtr dest,
+ PixmapPtr source_pixmap,
+ PixmapPtr mask_pixmap,
+ PixmapPtr dest_pixmap,
glamor_pixmap_private *source_pixmap_priv,
glamor_pixmap_private *mask_pixmap_priv,
glamor_pixmap_private *dest_pixmap_priv,
@@ -1153,10 +1134,7 @@ glamor_composite_with_shader(CARD8 op,
Bool two_pass_ca)
{
ScreenPtr screen = dest->pDrawable->pScreen;
- glamor_screen_private *glamor_priv = dest_pixmap_priv->base.glamor_priv;
- PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap;
- PixmapPtr source_pixmap = NULL;
- PixmapPtr mask_pixmap = NULL;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
GLfloat dst_xscale, dst_yscale;
GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1;
struct shader_key key, key_ca;
@@ -1172,6 +1150,7 @@ glamor_composite_with_shader(CARD8 op,
struct blendinfo op_info, op_info_ca;
if (!glamor_composite_choose_shader(op, source, mask, dest,
+ source_pixmap, mask_pixmap, dest_pixmap,
source_pixmap_priv, mask_pixmap_priv,
dest_pixmap_priv,
&key, &shader, &op_info,
@@ -1181,6 +1160,7 @@ glamor_composite_with_shader(CARD8 op,
}
if (two_pass_ca) {
if (!glamor_composite_choose_shader(PictOpAdd, source, mask, dest,
+ source_pixmap, mask_pixmap, dest_pixmap,
source_pixmap_priv,
mask_pixmap_priv, dest_pixmap_priv,
&key_ca, &shader_ca, &op_info_ca,
@@ -1190,8 +1170,9 @@ glamor_composite_with_shader(CARD8 op,
}
}
- glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
- glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info);
+ glamor_set_destination_pixmap_priv_nc(glamor_priv, dest_pixmap, dest_pixmap_priv);
+ glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv, &key, shader, &op_info);
+ glamor_set_alu(screen, GXcopy);
glamor_make_current(glamor_priv);
@@ -1203,10 +1184,9 @@ glamor_composite_with_shader(CARD8 op,
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
glamor_get_drawable_deltas(dest->pDrawable, dest_pixmap,
&dest_x_off, &dest_y_off);
- pixmap_priv_get_dest_scale(dest_pixmap_priv, &dst_xscale, &dst_yscale);
+ pixmap_priv_get_dest_scale(dest_pixmap, dest_pixmap_priv, &dst_xscale, &dst_yscale);
if (glamor_priv->has_source_coords) {
- source_pixmap = source_pixmap_priv->base.pixmap;
glamor_get_drawable_deltas(source->pDrawable,
source_pixmap, &source_x_off, &source_y_off);
pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale);
@@ -1217,7 +1197,6 @@ glamor_composite_with_shader(CARD8 op,
}
if (glamor_priv->has_mask_coords) {
- mask_pixmap = mask_pixmap_priv->base.pixmap;
glamor_get_drawable_deltas(mask->pDrawable, mask_pixmap,
&mask_x_off, &mask_y_off);
pixmap_priv_get_scale(mask_pixmap_priv, &mask_xscale, &mask_yscale);
@@ -1269,7 +1248,8 @@ glamor_composite_with_shader(CARD8 op,
vb_stride);
vertices += 2;
if (key.source != SHADER_SOURCE_SOLID) {
- glamor_set_normalize_tcoords_generic(source_pixmap_priv,
+ glamor_set_normalize_tcoords_generic(source_pixmap,
+ source_pixmap_priv,
source->repeatType,
psrc_matrix, src_xscale,
src_yscale, x_source,
@@ -1280,7 +1260,8 @@ glamor_composite_with_shader(CARD8 op,
}
if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID) {
- glamor_set_normalize_tcoords_generic(mask_pixmap_priv,
+ glamor_set_normalize_tcoords_generic(mask_pixmap,
+ mask_pixmap_priv,
mask->repeatType,
pmask_matrix, mask_xscale,
mask_yscale, x_mask,
@@ -1299,11 +1280,11 @@ glamor_composite_with_shader(CARD8 op,
glamor_flush_composite_rects(screen);
nrect -= rect_processed;
if (two_pass_ca) {
- glamor_composite_set_shader_blend(dest_pixmap_priv,
+ glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv,
&key_ca, shader_ca, &op_info_ca);
glamor_flush_composite_rects(screen);
if (nrect)
- glamor_composite_set_shader_blend(dest_pixmap_priv,
+ glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv,
&key, shader, &op_info);
}
}
@@ -1390,17 +1371,21 @@ glamor_composite_clipped_region(CARD8 op,
PicturePtr source,
PicturePtr mask,
PicturePtr dest,
- glamor_pixmap_private *source_pixmap_priv,
- glamor_pixmap_private *mask_pixmap_priv,
- glamor_pixmap_private *dest_pixmap_priv,
+ PixmapPtr source_pixmap,
+ PixmapPtr mask_pixmap,
+ PixmapPtr dest_pixmap,
RegionPtr region,
int x_source,
int y_source,
int x_mask, int y_mask, int x_dest, int y_dest)
{
+ glamor_pixmap_private *source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
+ glamor_pixmap_private *mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
+ glamor_pixmap_private *dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
ScreenPtr screen = dest->pDrawable->pScreen;
- PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
PicturePtr temp_src = source, temp_mask = mask;
+ PixmapPtr temp_src_pixmap = source_pixmap;
+ PixmapPtr temp_mask_pixmap = mask_pixmap;
glamor_pixmap_private *temp_src_priv = source_pixmap_priv;
glamor_pixmap_private *temp_mask_priv = mask_pixmap_priv;
int x_temp_src, y_temp_src, x_temp_mask, y_temp_mask;
@@ -1430,12 +1415,6 @@ glamor_composite_clipped_region(CARD8 op,
DEBUGF("clipped (%d %d) (%d %d) (%d %d) width %d height %d \n",
x_source, y_source, x_mask, y_mask, x_dest, y_dest, width, height);
- if (source_pixmap_priv)
- source_pixmap = source_pixmap_priv->base.pixmap;
-
- if (mask_pixmap_priv)
- mask_pixmap = mask_pixmap_priv->base.pixmap;
-
/* XXX is it possible source mask have non-zero drawable.x/y? */
if (source
&& ((!source->pDrawable
@@ -1453,8 +1432,8 @@ glamor_composite_clipped_region(CARD8 op,
temp_src = source;
goto out;
}
- temp_src_priv =
- glamor_get_pixmap_private((PixmapPtr) (temp_src->pDrawable));
+ temp_src_pixmap = (PixmapPtr) (temp_src->pDrawable);
+ temp_src_priv = glamor_get_pixmap_private(temp_src_pixmap);
x_temp_src = -extent->x1 + x_dest + dest->pDrawable->x;
y_temp_src = -extent->y1 + y_dest + dest->pDrawable->y;
}
@@ -1477,8 +1456,8 @@ glamor_composite_clipped_region(CARD8 op,
temp_mask = mask;
goto out;
}
- temp_mask_priv =
- glamor_get_pixmap_private((PixmapPtr) (temp_mask->pDrawable));
+ temp_mask_pixmap = (PixmapPtr) (temp_mask->pDrawable);
+ temp_mask_priv = glamor_get_pixmap_private(temp_mask_pixmap);
x_temp_mask = -extent->x1 + x_dest + dest->pDrawable->x;
y_temp_mask = -extent->y1 + y_dest + dest->pDrawable->y;
}
@@ -1540,6 +1519,7 @@ glamor_composite_clipped_region(CARD8 op,
DEBUGF("dest %d %d \n", prect[i].x_dst, prect[i].y_dst);
}
ok = glamor_composite_with_shader(op, temp_src, temp_mask, dest,
+ temp_src_pixmap, temp_mask_pixmap, dest_pixmap,
temp_src_priv, temp_mask_priv,
dest_pixmap_priv,
box_cnt, prect, two_pass_ca);
@@ -1560,43 +1540,35 @@ glamor_composite_clipped_region(CARD8 op,
return ok;
}
-static Bool
-_glamor_composite(CARD8 op,
- PicturePtr source,
- PicturePtr mask,
- PicturePtr dest,
- INT16 x_source,
- INT16 y_source,
- INT16 x_mask,
- INT16 y_mask,
- INT16 x_dest, INT16 y_dest,
- CARD16 width, CARD16 height, Bool fallback)
+void
+glamor_composite(CARD8 op,
+ PicturePtr source,
+ PicturePtr mask,
+ PicturePtr dest,
+ INT16 x_source,
+ INT16 y_source,
+ INT16 x_mask,
+ INT16 y_mask,
+ INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height)
{
ScreenPtr screen = dest->pDrawable->pScreen;
- glamor_pixmap_private *dest_pixmap_priv;
- glamor_pixmap_private *source_pixmap_priv = NULL, *mask_pixmap_priv = NULL;
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable);
PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- Bool ret = TRUE;
RegionRec region;
BoxPtr extent;
int nbox, ok = FALSE;
int force_clip = 0;
- dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
-
if (source->pDrawable) {
source_pixmap = glamor_get_drawable_pixmap(source->pDrawable);
- source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
- if (source_pixmap_priv && source_pixmap_priv->type == GLAMOR_DRM_ONLY)
+ if (glamor_pixmap_drm_only(source_pixmap))
goto fail;
}
if (mask && mask->pDrawable) {
mask_pixmap = glamor_get_drawable_pixmap(mask->pDrawable);
- mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
- if (mask_pixmap_priv && mask_pixmap_priv->type == GLAMOR_DRM_ONLY)
+ if (glamor_pixmap_drm_only(mask_pixmap))
goto fail;
}
@@ -1605,9 +1577,8 @@ _glamor_composite(CARD8 op,
source_pixmap, x_source, y_source, x_mask, y_mask, x_dest, y_dest,
width, height);
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
+ if (!glamor_pixmap_has_fbo(dest_pixmap))
goto fail;
- }
if (op >= ARRAY_SIZE(composite_op_info))
goto fail;
@@ -1639,18 +1610,16 @@ _glamor_composite(CARD8 op,
(mask_pixmap ? mask->pDrawable->y : 0),
x_dest + dest->pDrawable->x,
y_dest + dest->pDrawable->y, width, height)) {
- ret = TRUE;
- goto done;
+ return;
}
nbox = REGION_NUM_RECTS(&region);
DEBUGF("first clipped when compositing.\n");
DEBUGRegionPrint(&region);
extent = RegionExtents(&region);
- if (nbox == 0) {
- ret = TRUE;
- goto done;
- }
+ if (nbox == 0)
+ return;
+
/* If destination is not a large pixmap, but the region is larger
* than texture size limitation, and source or mask is memory pixmap,
* then there may be need to load a large memory pixmap to a
@@ -1659,28 +1628,28 @@ _glamor_composite(CARD8 op,
* pixmap. */
if (!glamor_check_fbo_size(glamor_priv,
extent->x2 - extent->x1, extent->y2 - extent->y1)
- && (dest_pixmap_priv->type != GLAMOR_TEXTURE_LARGE)
- && ((source_pixmap_priv
- && (source_pixmap_priv->type == GLAMOR_MEMORY ||
+ && glamor_pixmap_is_large(dest_pixmap)
+ && ((source_pixmap
+ && (glamor_pixmap_is_memory(source_pixmap) ||
source->repeatType == RepeatPad))
- || (mask_pixmap_priv &&
- (mask_pixmap_priv->type == GLAMOR_MEMORY ||
+ || (mask_pixmap &&
+ (glamor_pixmap_is_memory(mask_pixmap) ||
mask->repeatType == RepeatPad))
- || (!source_pixmap_priv &&
+ || (!source_pixmap &&
(source->pSourcePict->type != SourcePictTypeSolidFill))
- || (!mask_pixmap_priv && mask &&
+ || (!mask_pixmap && mask &&
mask->pSourcePict->type != SourcePictTypeSolidFill)))
force_clip = 1;
- if (force_clip || dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE
- || (source_pixmap_priv
- && source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE)
- || (mask_pixmap_priv && mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE))
+ if (force_clip || glamor_pixmap_is_large(dest_pixmap)
+ || (source_pixmap
+ && glamor_pixmap_is_large(source_pixmap))
+ || (mask_pixmap && glamor_pixmap_is_large(mask_pixmap)))
ok = glamor_composite_largepixmap_region(op,
source, mask, dest,
- source_pixmap_priv,
- mask_pixmap_priv,
- dest_pixmap_priv,
+ source_pixmap,
+ mask_pixmap,
+ dest_pixmap,
&region, force_clip,
x_source, y_source,
x_mask, y_mask,
@@ -1688,9 +1657,9 @@ _glamor_composite(CARD8 op,
else
ok = glamor_composite_clipped_region(op, source,
mask, dest,
- source_pixmap_priv,
- mask_pixmap_priv,
- dest_pixmap_priv,
+ source_pixmap,
+ mask_pixmap,
+ dest_pixmap,
&region,
x_source, y_source,
x_mask, y_mask, x_dest, y_dest);
@@ -1698,17 +1667,9 @@ _glamor_composite(CARD8 op,
REGION_UNINIT(dest->pDrawable->pScreen, &region);
if (ok)
- goto done;
- fail:
+ return;
- if (!fallback && glamor_ddx_fallback_check_pixmap(&dest_pixmap->drawable)
- && (!source_pixmap
- || glamor_ddx_fallback_check_pixmap(&source_pixmap->drawable))
- && (!mask_pixmap
- || glamor_ddx_fallback_check_pixmap(&mask_pixmap->drawable))) {
- ret = FALSE;
- goto done;
- }
+ fail:
glamor_fallback
("from picts %p:%p %dx%d / %p:%p %d x %d (%c,%c) to pict %p:%p %dx%d (%c)\n",
@@ -1739,40 +1700,6 @@ _glamor_composite(CARD8 op,
glamor_finish_access_picture(mask);
glamor_finish_access_picture(source);
glamor_finish_access_picture(dest);
-
- done:
- return ret;
-}
-
-void
-glamor_composite(CARD8 op,
- PicturePtr source,
- PicturePtr mask,
- PicturePtr dest,
- INT16 x_source,
- INT16 y_source,
- INT16 x_mask,
- INT16 y_mask,
- INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height)
-{
- _glamor_composite(op, source, mask, dest, x_source, y_source,
- x_mask, y_mask, x_dest, y_dest, width, height, TRUE);
-}
-
-Bool
-glamor_composite_nf(CARD8 op,
- PicturePtr source,
- PicturePtr mask,
- PicturePtr dest,
- INT16 x_source,
- INT16 y_source,
- INT16 x_mask,
- INT16 y_mask,
- INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height)
-{
- return _glamor_composite(op, source, mask, dest, x_source, y_source,
- x_mask, y_mask, x_dest, y_dest, width, height,
- FALSE);
}
static void
@@ -1823,21 +1750,27 @@ glamor_composite_glyph_rects(CARD8 op,
if (!(glamor_is_large_picture(src)
|| (mask && glamor_is_large_picture(mask))
|| glamor_is_large_picture(dst))) {
+ PixmapPtr src_pixmap = NULL;
+ PixmapPtr mask_pixmap = NULL;
+ PixmapPtr dst_pixmap = NULL;
+ PixmapPtr temp_src_pixmap = NULL;
glamor_pixmap_private *src_pixmap_priv = NULL;
glamor_pixmap_private *mask_pixmap_priv = NULL;
glamor_pixmap_private *dst_pixmap_priv;
glamor_pixmap_private *temp_src_priv = NULL;
BoxRec src_extent;
- dst_pixmap_priv = glamor_get_pixmap_private
- (glamor_get_drawable_pixmap(dst->pDrawable));
+ dst_pixmap = glamor_get_drawable_pixmap(dst->pDrawable);
+ dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
- if (mask && mask->pDrawable)
- mask_pixmap_priv = glamor_get_pixmap_private
- (glamor_get_drawable_pixmap(mask->pDrawable));
- if (src->pDrawable)
- src_pixmap_priv = glamor_get_pixmap_private
- (glamor_get_drawable_pixmap(src->pDrawable));
+ if (mask && mask->pDrawable) {
+ mask_pixmap = glamor_get_drawable_pixmap(mask->pDrawable);
+ mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
+ }
+ if (src->pDrawable) {
+ src_pixmap = glamor_get_drawable_pixmap(src->pDrawable);
+ src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
+ }
if (!src->pDrawable
&& (src->pSourcePict->type != SourcePictTypeSolidFill)) {
@@ -1853,13 +1786,14 @@ glamor_composite_glyph_rects(CARD8 op,
if (!temp_src)
goto fallback;
- temp_src_priv = glamor_get_pixmap_private
- ((PixmapPtr) (temp_src->pDrawable));
+ temp_src_pixmap = (PixmapPtr) (temp_src->pDrawable);
+ temp_src_priv = glamor_get_pixmap_private(temp_src_pixmap);
glamor_composite_src_rect_translate(nrect, rects,
-src_extent.x1, -src_extent.y1);
}
else {
temp_src = src;
+ temp_src_pixmap = src_pixmap;
temp_src_priv = src_pixmap_priv;
}
@@ -1867,6 +1801,7 @@ glamor_composite_glyph_rects(CARD8 op,
if (op == PictOpOver) {
if (glamor_composite_with_shader(PictOpOutReverse,
temp_src, mask, dst,
+ temp_src_pixmap, mask_pixmap, dst_pixmap,
temp_src_priv,
mask_pixmap_priv,
dst_pixmap_priv, nrect, rects,
@@ -1876,7 +1811,9 @@ glamor_composite_glyph_rects(CARD8 op,
}
else {
if (glamor_composite_with_shader
- (op, temp_src, mask, dst, temp_src_priv, mask_pixmap_priv,
+ (op, temp_src, mask, dst,
+ temp_src_pixmap, mask_pixmap, dst_pixmap,
+ temp_src_priv, mask_pixmap_priv,
dst_pixmap_priv, nrect, rects, FALSE))
goto done;
}
@@ -1900,31 +1837,3 @@ glamor_composite_glyph_rects(CARD8 op,
if (temp_src && temp_src != src)
FreePicture(temp_src, 0);
}
-
-static Bool
-_glamor_composite_rects(CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect, xRectangle *rects, Bool fallback)
-{
- miCompositeRects(op, pDst, color, nRect, rects);
- return TRUE;
-}
-
-void
-glamor_composite_rects(CARD8 op,
- PicturePtr pDst,
- xRenderColor *color, int nRect, xRectangle *rects)
-{
- _glamor_composite_rects(op, pDst, color, nRect, rects, TRUE);
-}
-
-Bool
-glamor_composite_rects_nf(CARD8 op,
- PicturePtr pDst,
- xRenderColor *color, int nRect, xRectangle *rects)
-{
- return _glamor_composite_rects(op, pDst, color, nRect, rects, FALSE);
-}
-
-#endif /* RENDER */
diff --git a/xorg-server/glamor/glamor_segs.c b/xorg-server/glamor/glamor_segs.c
index ff0daef10..e16732565 100644
--- a/xorg-server/glamor/glamor_segs.c
+++ b/xorg-server/glamor/glamor_segs.c
@@ -109,12 +109,10 @@ glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc,
}
glDisable(GL_SCISSOR_TEST);
- glDisable(GL_COLOR_LOGIC_OP);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
return TRUE;
bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
bail:
return FALSE;
}
@@ -168,21 +166,3 @@ glamor_poly_segment(DrawablePtr drawable, GCPtr gc,
glamor_poly_segment_bail(drawable, gc, nseg, segs);
}
-
-Bool
-glamor_poly_segment_nf(DrawablePtr drawable, GCPtr gc,
- int nseg, xSegment *segs)
-{
- if (glamor_poly_segment_gl(drawable, gc, nseg, segs))
- return TRUE;
-
- if (glamor_ddx_fallback_check_pixmap(drawable) &&
- glamor_ddx_fallback_check_gc(gc))
- {
- return FALSE;
- }
-
- glamor_poly_segment_bail(drawable, gc, nseg, segs);
- return TRUE;
-}
-
diff --git a/xorg-server/glamor/glamor_spans.c b/xorg-server/glamor/glamor_spans.c
index 582d11df3..b358c60bd 100644
--- a/xorg-server/glamor/glamor_spans.c
+++ b/xorg-server/glamor/glamor_spans.c
@@ -68,7 +68,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
&glamor_facet_fillspans_130);
if (!prog)
- goto bail_ctx;
+ goto bail;
/* Set up the vertex buffers for the points */
@@ -93,7 +93,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
&glamor_facet_fillspans_120);
if (!prog)
- goto bail_ctx;
+ goto bail;
/* Set up the vertex buffers for the points */
@@ -134,27 +134,17 @@ glamor_fill_spans_gl(DrawablePtr drawable,
if (glamor_priv->glsl_version >= 130)
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, n);
else {
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
- glDrawArrays(GL_QUADS, 0, 4 * n);
- } else {
- int i;
- for (i = 0; i < n; i++) {
- glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
- }
- }
+ glamor_glDrawArrays_GL_QUADS(glamor_priv, nbox);
}
}
}
glDisable(GL_SCISSOR_TEST);
- glDisable(GL_COLOR_LOGIC_OP);
if (glamor_priv->glsl_version >= 130)
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
return TRUE;
-bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
bail:
return FALSE;
}
@@ -182,21 +172,6 @@ glamor_fill_spans(DrawablePtr drawable,
glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted);
}
-Bool
-glamor_fill_spans_nf(DrawablePtr drawable,
- GCPtr gc,
- int n, DDXPointPtr points, int *widths, int sorted)
-{
- if (glamor_fill_spans_gl(drawable, gc, n, points, widths, sorted))
- return TRUE;
-
- if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
- return FALSE;
-
- glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted);
- return TRUE;
-}
-
static Bool
glamor_get_spans_gl(DrawablePtr drawable, int wmax,
DDXPointPtr points, int *widths, int count, char *dst)
@@ -226,7 +201,7 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax,
BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y);
- glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
glPixelStorei(GL_PACK_ALIGNMENT, 4);
d = dst;
@@ -282,20 +257,6 @@ glamor_get_spans(DrawablePtr drawable, int wmax,
glamor_get_spans_bail(drawable, wmax, points, widths, count, dst);
}
-Bool
-glamor_get_spans_nf(DrawablePtr drawable, int wmax,
- DDXPointPtr points, int *widths, int count, char *dst)
-{
- if (glamor_get_spans_gl(drawable, wmax, points, widths, count, dst))
- return TRUE;
-
- if (glamor_ddx_fallback_check_pixmap(drawable))
- return FALSE;
-
- glamor_get_spans_bail(drawable, wmax, points, widths, count, dst);
- return TRUE;
-}
-
static Bool
glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src,
DDXPointPtr points, int *widths, int numPoints, int sorted)
@@ -415,17 +376,3 @@ glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
return;
glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted);
}
-
-Bool
-glamor_set_spans_nf(DrawablePtr drawable, GCPtr gc, char *src,
- DDXPointPtr points, int *widths, int numPoints, int sorted)
-{
- if (glamor_set_spans_gl(drawable, gc, src, points, widths, numPoints, sorted))
- return TRUE;
-
- if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
- return FALSE;
-
- glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted);
- return TRUE;
-}
diff --git a/xorg-server/glamor/glamor_sync.c b/xorg-server/glamor/glamor_sync.c
index 5e158c33a..fbc47d4b3 100644
--- a/xorg-server/glamor/glamor_sync.c
+++ b/xorg-server/glamor/glamor_sync.c
@@ -94,8 +94,10 @@ glamor_sync_init(ScreenPtr screen)
return FALSE;
}
+#ifdef HAVE_XSHMFENCE
if (!miSyncShmScreenInit(screen))
return FALSE;
+#endif
screen_funcs = miSyncGetScreenFuncs(screen);
glamor->saved_procs.sync_screen_funcs.CreateFence = screen_funcs->CreateFence;
diff --git a/xorg-server/glamor/glamor_text.c b/xorg-server/glamor/glamor_text.c
index 59cd0fdc8..c7c1ab738 100644
--- a/xorg-server/glamor/glamor_text.c
+++ b/xorg-server/glamor/glamor_text.c
@@ -210,7 +210,6 @@ glamor_text(DrawablePtr drawable, GCPtr gc,
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glDisable(GL_COLOR_LOGIC_OP);
return x;
}
@@ -286,34 +285,18 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
if (!prog)
- goto bail_ctx;
+ goto bail;
x = glamor_text(drawable, gc, glamor_font, prog,
x, y, count, chars, charinfo, sixteen);
- glDisable(GL_COLOR_LOGIC_OP);
-
*final_pos = x;
return TRUE;
-bail_ctx:
- glDisable(GL_COLOR_LOGIC_OP);
bail:
return FALSE;
}
-Bool
-glamor_poly_text8_nf(DrawablePtr drawable, GCPtr gc,
- int x, int y, int count, char *chars, int *final_pos)
-{
- if (glamor_poly_text(drawable, gc, x, y, count, chars, FALSE, final_pos))
- return TRUE;
- if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
- return FALSE;
- *final_pos = miPolyText8(drawable, gc, x, y, count, chars);
- return TRUE;
-}
-
int
glamor_poly_text8(DrawablePtr drawable, GCPtr gc,
int x, int y, int count, char *chars)
@@ -325,19 +308,6 @@ glamor_poly_text8(DrawablePtr drawable, GCPtr gc,
return miPolyText8(drawable, gc, x, y, count, chars);
}
-Bool
-glamor_poly_text16_nf(DrawablePtr drawable, GCPtr gc,
- int x, int y, int count, unsigned short *chars, int *final_pos)
-{
- if (glamor_poly_text(drawable, gc, x, y, count, (char *) chars, TRUE, final_pos))
- return TRUE;
-
- if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
- return FALSE;
- *final_pos = miPolyText16(drawable, gc, x, y, count, chars);
- return TRUE;
-}
-
int
glamor_poly_text16(DrawablePtr drawable, GCPtr gc,
int x, int y, int count, unsigned short *chars)
@@ -493,17 +463,9 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
return TRUE;
bail:
- glDisable(GL_COLOR_LOGIC_OP);
return FALSE;
}
-Bool
-glamor_image_text8_nf(DrawablePtr drawable, GCPtr gc,
- int x, int y, int count, char *chars)
-{
- return glamor_image_text(drawable, gc, x, y, count, chars, FALSE);
-}
-
void
glamor_image_text8(DrawablePtr drawable, GCPtr gc,
int x, int y, int count, char *chars)
@@ -512,13 +474,6 @@ glamor_image_text8(DrawablePtr drawable, GCPtr gc,
miImageText8(drawable, gc, x, y, count, chars);
}
-Bool
-glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc,
- int x, int y, int count, unsigned short *chars)
-{
- return glamor_image_text(drawable, gc, x, y, count, (char *) chars, TRUE);
-}
-
void
glamor_image_text16(DrawablePtr drawable, GCPtr gc,
int x, int y, int count, unsigned short *chars)
diff --git a/xorg-server/glamor/glamor_transfer.c b/xorg-server/glamor/glamor_transfer.c
index 891415565..aa5e8616e 100644
--- a/xorg-server/glamor/glamor_transfer.c
+++ b/xorg-server/glamor/glamor_transfer.c
@@ -73,7 +73,9 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
glamor_make_current(glamor_priv);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
+
+ if (glamor_priv->has_unpack_subimage)
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
glamor_pixmap_loop(priv, box_x, box_y) {
BoxPtr box = glamor_pixmap_box_at(priv, box_x, box_y);
@@ -92,25 +94,34 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
int y1 = MAX(boxes->y1 + dy_dst, box->y1);
int y2 = MIN(boxes->y2 + dy_dst, box->y2);
+ size_t ofs = (y1 - dy_dst + dy_src) * byte_stride;
+ ofs += (x1 - dx_dst + dx_src) * bytes_per_pixel;
+
boxes++;
if (x2 <= x1 || y2 <= y1)
continue;
- glPixelStorei(GL_UNPACK_SKIP_ROWS, y1 - dy_dst + dy_src);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1 - dx_dst + dx_src);
-
- glTexSubImage2D(GL_TEXTURE_2D, 0,
- x1 - box->x1, y1 - box->y1,
- x2 - x1, y2 - y1,
- format, type,
- bits);
+ if (glamor_priv->has_unpack_subimage ||
+ x2 - x1 == byte_stride / bytes_per_pixel) {
+ glTexSubImage2D(GL_TEXTURE_2D, 0,
+ x1 - box->x1, y1 - box->y1,
+ x2 - x1, y2 - y1,
+ format, type,
+ bits + ofs);
+ } else {
+ for (; y1 < y2; y1++, ofs += byte_stride)
+ glTexSubImage2D(GL_TEXTURE_2D, 0,
+ x1 - box->x1, y1 - box->y1,
+ x2 - x1, 1,
+ format, type,
+ bits + ofs);
+ }
}
}
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+ if (glamor_priv->has_unpack_subimage)
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}
/*
@@ -166,7 +177,8 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
glamor_make_current(glamor_priv);
glPixelStorei(GL_PACK_ALIGNMENT, 4);
- glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
+ if (glamor_priv->has_pack_subimage)
+ glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
glamor_pixmap_loop(priv, box_x, box_y) {
BoxPtr box = glamor_pixmap_box_at(priv, box_x, box_y);
@@ -174,7 +186,7 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
BoxPtr boxes = in_boxes;
int nbox = in_nbox;
- glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
while (nbox--) {
@@ -183,20 +195,25 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
int x2 = MIN(boxes->x2 + dx_src, box->x2);
int y1 = MAX(boxes->y1 + dy_src, box->y1);
int y2 = MIN(boxes->y2 + dy_src, box->y2);
+ size_t ofs = (y1 - dy_src + dy_dst) * byte_stride;
+ ofs += (x1 - dx_src + dx_dst) * bytes_per_pixel;
boxes++;
if (x2 <= x1 || y2 <= y1)
continue;
- glPixelStorei(GL_PACK_SKIP_PIXELS, x1 - dx_src + dx_dst);
- glPixelStorei(GL_PACK_SKIP_ROWS, y1 - dy_src + dy_dst);
- glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits);
+ if (glamor_priv->has_pack_subimage ||
+ x2 - x1 == byte_stride / bytes_per_pixel) {
+ glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits + ofs);
+ } else {
+ for (; y1 < y2; y1++, ofs += byte_stride)
+ glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, 1, format, type, bits + ofs);
+ }
}
}
- glPixelStorei(GL_PACK_ROW_LENGTH, 0);
- glPixelStorei(GL_PACK_SKIP_ROWS, 0);
- glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
+ if (glamor_priv->has_pack_subimage)
+ glPixelStorei(GL_PACK_ROW_LENGTH, 0);
}
/*
diff --git a/xorg-server/glamor/glamor_transform.c b/xorg-server/glamor/glamor_transform.c
index c1df56018..6d29e9eb6 100644
--- a/xorg-server/glamor/glamor_transform.c
+++ b/xorg-server/glamor/glamor_transform.c
@@ -43,6 +43,8 @@ glamor_set_destination_drawable(DrawablePtr drawable,
int *p_off_x,
int *p_off_y)
{
+ ScreenPtr screen = drawable->pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
int off_x, off_y;
@@ -95,7 +97,7 @@ glamor_set_destination_drawable(DrawablePtr drawable,
scale_x, (off_x + center_adjust) * scale_x - 1.0f,
scale_y, (off_y + center_adjust) * scale_y - 1.0f);
- glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y),
+ glamor_set_destination_pixmap_fbo(glamor_priv, glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y),
0, 0, w, h);
}
@@ -158,7 +160,7 @@ glamor_set_texture(PixmapPtr pixmap,
int off_x,
int off_y,
GLint offset_uniform,
- GLint size_uniform)
+ GLint size_inv_uniform)
{
glamor_pixmap_private *texture_priv;
@@ -167,14 +169,14 @@ glamor_set_texture(PixmapPtr pixmap,
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(texture_priv))
return FALSE;
- if (texture_priv->type == GLAMOR_TEXTURE_LARGE)
+ if (glamor_pixmap_priv_is_large(texture_priv))
return FALSE;
glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, texture_priv->base.fbo->tex);
+ glBindTexture(GL_TEXTURE_2D, texture_priv->fbo->tex);
glUniform2f(offset_uniform, off_x, off_y);
- glUniform2f(size_uniform, texture->drawable.width, texture->drawable.height);
+ glUniform2f(size_inv_uniform, 1.0f/texture->drawable.width, 1.0f/texture->drawable.height);
return TRUE;
}
@@ -182,7 +184,7 @@ Bool
glamor_set_tiled(PixmapPtr pixmap,
GCPtr gc,
GLint offset_uniform,
- GLint size_uniform)
+ GLint size_inv_uniform)
{
if (!glamor_set_alu(pixmap->drawable.pScreen, gc->alu))
return FALSE;
@@ -195,7 +197,7 @@ glamor_set_tiled(PixmapPtr pixmap,
-gc->patOrg.x,
-gc->patOrg.y,
offset_uniform,
- size_uniform);
+ size_inv_uniform);
}
static PixmapPtr
diff --git a/xorg-server/glamor/glamor_trapezoid.c b/xorg-server/glamor/glamor_trapezoid.c
index f8bf6c97f..a448a6b3e 100644
--- a/xorg-server/glamor/glamor_trapezoid.c
+++ b/xorg-server/glamor/glamor_trapezoid.c
@@ -32,7 +32,6 @@
#include "glamor_priv.h"
-#ifdef RENDER
#include "mipict.h"
#include "fbpict.h"
@@ -155,18 +154,3 @@ glamor_trapezoids(CARD8 op,
FreePicture(picture, 0);
}
-
-Bool
-glamor_trapezoids_nf(CARD8 op,
- PicturePtr src, PicturePtr dst,
- PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
- int ntrap, xTrapezoid *traps)
-{
- DEBUGF("x_src = %d, y_src = %d, ntrap = %d\n", x_src, y_src, ntrap);
-
- glamor_trapezoids(op, src, dst, mask_format, x_src,
- y_src, ntrap, traps);
- return TRUE;
-}
-
-#endif /* RENDER */
diff --git a/xorg-server/glamor/glamor_triangles.c b/xorg-server/glamor/glamor_triangles.c
index b89cb2de7..88a46c11f 100644
--- a/xorg-server/glamor/glamor_triangles.c
+++ b/xorg-server/glamor/glamor_triangles.c
@@ -28,29 +28,6 @@
#include "glamor_priv.h"
-static Bool
-_glamor_triangles(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris,
- Bool fallback)
-{
- if (!fallback && glamor_ddx_fallback_check_pixmap(pDst->pDrawable)
- && (!pSrc->pDrawable
- || glamor_ddx_fallback_check_pixmap(pSrc->pDrawable)))
- return FALSE;
-
- if (glamor_prepare_access_picture(pDst, GLAMOR_ACCESS_RW) &&
- glamor_prepare_access_picture(pSrc, GLAMOR_ACCESS_RO)) {
- fbTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris);
- }
- glamor_finish_access_picture(pSrc);
- glamor_finish_access_picture(pDst);
-
- return TRUE;
-}
-
void
glamor_triangles(CARD8 op,
PicturePtr pSrc,
@@ -58,17 +35,10 @@ glamor_triangles(CARD8 op,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris)
{
- _glamor_triangles(op, pSrc, pDst, maskFormat,
- xSrc, ySrc, ntris, tris, TRUE);
-}
-
-Bool
-glamor_triangles_nf(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris)
-{
- return _glamor_triangles(op, pSrc, pDst, maskFormat,
- xSrc, ySrc, ntris, tris, FALSE);
+ if (glamor_prepare_access_picture(pDst, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access_picture(pSrc, GLAMOR_ACCESS_RO)) {
+ fbTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris);
+ }
+ glamor_finish_access_picture(pSrc);
+ glamor_finish_access_picture(pDst);
}
diff --git a/xorg-server/glamor/glamor_utils.h b/xorg-server/glamor/glamor_utils.h
index c15d17ca3..0927ffb06 100644
--- a/xorg-server/glamor/glamor_utils.h
+++ b/xorg-server/glamor/glamor_utils.h
@@ -41,50 +41,46 @@
#define t_from_x_coord_y(_yscale_, _y_) (1.0 - (_y_) * (_yscale_))
#define t_from_x_coord_y_inverted(_yscale_, _y_) ((_y_) * (_yscale_))
-#define pixmap_priv_get_dest_scale(_pixmap_priv_, _pxscale_, _pyscale_) \
+#define pixmap_priv_get_dest_scale(pixmap, _pixmap_priv_, _pxscale_, _pyscale_) \
do { \
int _w_,_h_; \
- PIXMAP_PRIV_GET_ACTUAL_SIZE(_pixmap_priv_, _w_, _h_); \
+ PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, _pixmap_priv_, _w_, _h_); \
*(_pxscale_) = 1.0 / _w_; \
*(_pyscale_) = 1.0 / _h_; \
} while(0)
#define pixmap_priv_get_scale(_pixmap_priv_, _pxscale_, _pyscale_) \
do { \
- *(_pxscale_) = 1.0 / (_pixmap_priv_)->base.fbo->width; \
- *(_pyscale_) = 1.0 / (_pixmap_priv_)->base.fbo->height; \
+ *(_pxscale_) = 1.0 / (_pixmap_priv_)->fbo->width; \
+ *(_pyscale_) = 1.0 / (_pixmap_priv_)->fbo->height; \
} while(0)
-#define GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(priv) \
- (priv->base.fbo->width != priv->base.pixmap->drawable.width \
- || priv->base.fbo->height != priv->base.pixmap->drawable.height) \
-
-#define PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, w, h) \
+#define PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, priv, w, h) \
do { \
- if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
- w = priv->large.box.x2 - priv->large.box.x1; \
- h = priv->large.box.y2 - priv->large.box.y1; \
+ if (_X_UNLIKELY(glamor_pixmap_priv_is_large(priv))) { \
+ w = priv->box.x2 - priv->box.x1; \
+ h = priv->box.y2 - priv->box.y1; \
} else { \
- w = priv->base.pixmap->drawable.width; \
- h = priv->base.pixmap->drawable.height; \
+ w = (pixmap)->drawable.width; \
+ h = (pixmap)->drawable.height; \
} \
} while(0)
-#define glamor_pixmap_fbo_fix_wh_ratio(wh, priv) \
+#define glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap, priv) \
do { \
int actual_w, actual_h; \
- PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, actual_w, actual_h); \
- wh[0] = (float)priv->base.fbo->width / actual_w; \
- wh[1] = (float)priv->base.fbo->height / actual_h; \
- wh[2] = 1.0 / priv->base.fbo->width; \
- wh[3] = 1.0 / priv->base.fbo->height; \
+ PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, priv, actual_w, actual_h); \
+ wh[0] = (float)priv->fbo->width / actual_w; \
+ wh[1] = (float)priv->fbo->height / actual_h; \
+ wh[2] = 1.0 / priv->fbo->width; \
+ wh[3] = 1.0 / priv->fbo->height; \
} while(0)
#define pixmap_priv_get_fbo_off(_priv_, _xoff_, _yoff_) \
do { \
- if (_X_UNLIKELY(_priv_ && (_priv_)->type == GLAMOR_TEXTURE_LARGE)) { \
- *(_xoff_) = - (_priv_)->large.box.x1; \
- *(_yoff_) = - (_priv_)->large.box.y1; \
+ if (_X_UNLIKELY(_priv_ && glamor_pixmap_priv_is_large(_priv_))) { \
+ *(_xoff_) = - (_priv_)->box.x1; \
+ *(_yoff_) = - (_priv_)->box.y1; \
} else { \
*(_xoff_) = 0; \
*(_yoff_) = 0; \
@@ -193,33 +189,33 @@
txy = xy - bxy1; \
} while(0)
-#define _glamor_get_reflect_transform_coords(priv, repeat_type, \
+#define _glamor_get_reflect_transform_coords(pixmap, priv, repeat_type, \
tx1, ty1, \
_x1_, _y1_) \
do { \
int odd_x, odd_y; \
float c, d; \
fodd_repeat_mod(_x1_,priv->box.x2, \
- priv->base.pixmap->drawable.width, \
+ (pixmap)->drawable.width, \
odd_x, c); \
fodd_repeat_mod(_y1_, priv->box.y2, \
- priv->base.pixmap->drawable.height, \
+ (pixmap)->drawable.height, \
odd_y, d); \
DEBUGF("c %f d %f oddx %d oddy %d \n", \
c, d, odd_x, odd_y); \
DEBUGF("x2 %d x1 %d fbo->width %d \n", priv->box.x2, \
- priv->box.x1, priv->base.fbo->width); \
+ priv->box.x1, priv->fbo->width); \
DEBUGF("y2 %d y1 %d fbo->height %d \n", priv->box.y2, \
- priv->box.y1, priv->base.fbo->height); \
+ priv->box.y1, priv->fbo->height); \
_glamor_repeat_reflect_fixup(tx1, _x1_, c, odd_x, \
- priv->base.pixmap->drawable.width, \
+ (pixmap)->drawable.width, \
priv->box.x1, priv->box.x2); \
_glamor_repeat_reflect_fixup(ty1, _y1_, d, odd_y, \
- priv->base.pixmap->drawable.height, \
+ (pixmap)->drawable.height, \
priv->box.y1, priv->box.y2); \
} while(0)
-#define _glamor_get_repeat_coords(priv, repeat_type, tx1, \
+#define _glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, \
ty1, tx2, ty2, \
_x1_, _y1_, _x2_, \
_y2_, c, d, odd_x, odd_y) \
@@ -228,10 +224,10 @@
DEBUGF("x1 y1 %d %d\n", \
_x1_, _y1_ ); \
DEBUGF("width %d box.x1 %d \n", \
- (priv)->base.pixmap->drawable.width, \
+ (pixmap)->drawable.width, \
priv->box.x1); \
if (odd_x) { \
- c = (priv)->base.pixmap->drawable.width \
+ c = (pixmap)->drawable.width \
- c; \
tx1 = c - priv->box.x1; \
tx2 = tx1 - ((_x2_) - (_x1_)); \
@@ -240,7 +236,7 @@
tx2 = tx1 + ((_x2_) - (_x1_)); \
} \
if (odd_y){ \
- d = (priv)->base.pixmap->drawable.height\
+ d = (pixmap)->drawable.height\
- d; \
ty1 = d - priv->box.y1; \
ty2 = ty1 - ((_y2_) - (_y1_)); \
@@ -257,11 +253,11 @@
} while(0)
/* _x1_ ... _y2_ may has fractional. */
-#define glamor_get_repeat_transform_coords(priv, repeat_type, tx1, \
+#define glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, tx1, \
ty1, _x1_, _y1_) \
do { \
DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \
- (priv)->base.pixmap->drawable.width, \
+ (pixmap)->drawable.width, \
priv->box.x1, priv->box.x2, priv->box.y1, \
priv->box.y2); \
DEBUGF("x1 %f y1 %f \n", _x1_, _y1_); \
@@ -269,33 +265,33 @@
tx1 = _x1_ - priv->box.x1; \
ty1 = _y1_ - priv->box.y1; \
} else \
- _glamor_get_reflect_transform_coords(priv, repeat_type, \
+ _glamor_get_reflect_transform_coords(pixmap, priv, repeat_type, \
tx1, ty1, \
_x1_, _y1_); \
DEBUGF("tx1 %f ty1 %f \n", tx1, ty1); \
} while(0)
/* _x1_ ... _y2_ must be integer. */
-#define glamor_get_repeat_coords(priv, repeat_type, tx1, \
+#define glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, \
ty1, tx2, ty2, _x1_, _y1_, _x2_, \
_y2_) \
do { \
int c, d; \
int odd_x = 0, odd_y = 0; \
DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \
- (priv)->base.pixmap->drawable.width, \
+ (pixmap)->drawable.width, \
priv->box.x1, priv->box.x2, \
priv->box.y1, priv->box.y2); \
- modulus((_x1_), (priv)->base.pixmap->drawable.width, c); \
- modulus((_y1_), (priv)->base.pixmap->drawable.height, d); \
+ modulus((_x1_), (pixmap)->drawable.width, c); \
+ modulus((_y1_), (pixmap)->drawable.height, d); \
DEBUGF("c %d d %d \n", c, d); \
if (repeat_type == RepeatReflect) { \
odd_x = abs((_x1_ - c) \
- / (priv->base.pixmap->drawable.width)) & 1; \
+ / ((pixmap)->drawable.width)) & 1; \
odd_y = abs((_y1_ - d) \
- / (priv->base.pixmap->drawable.height)) & 1; \
+ / ((pixmap)->drawable.height)) & 1; \
} \
- _glamor_get_repeat_coords(priv, repeat_type, tx1, ty1, tx2, ty2,\
+ _glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, ty1, tx2, ty2, \
_x1_, _y1_, _x2_, _y2_, c, d, \
odd_x, odd_y); \
} while(0)
@@ -321,7 +317,7 @@
(texcoord)[1]); \
} while(0)
-#define glamor_set_transformed_point(priv, matrix, xscale, \
+#define glamor_set_transformed_point(priv, matrix, xscale, \
yscale, texcoord, \
x, y) \
do { \
@@ -404,7 +400,7 @@
texcoords+4); \
} while (0)
-#define glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \
+#define glamor_set_repeat_transformed_normalize_tcoords_ext(pixmap, priv, \
repeat_type, \
matrix, \
xscale, \
@@ -414,7 +410,7 @@
texcoords, \
stride) \
do { \
- if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) { \
+ if (_X_LIKELY(glamor_pixmap_priv_is_small(priv))) { \
glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale, \
yscale, _x1_, _y1_, \
_x2_, _y2_, \
@@ -429,16 +425,16 @@
glamor_transform_point(matrix, tx4, ty4, _x1_, _y2_); \
DEBUGF("transformed %f %f %f %f %f %f %f %f\n", \
tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4); \
- glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
+ glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
ttx1, tty1, \
tx1, ty1); \
- glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
+ glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
ttx2, tty2, \
tx2, ty2); \
- glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
+ glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
ttx3, tty3, \
tx3, ty3); \
- glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
+ glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
ttx4, tty4, \
tx4, ty4); \
DEBUGF("repeat transformed %f %f %f %f %f %f %f %f\n", ttx1, tty1, \
@@ -454,7 +450,8 @@
} \
} while (0)
-#define glamor_set_repeat_transformed_normalize_tcoords( priv, \
+#define glamor_set_repeat_transformed_normalize_tcoords( pixmap, \
+ priv, \
repeat_type, \
matrix, \
xscale, \
@@ -463,7 +460,8 @@
_x2_, _y2_, \
texcoords) \
do { \
- glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \
+ glamor_set_repeat_transformed_normalize_tcoords_ext( pixmap, \
+ priv, \
repeat_type, \
matrix, \
xscale, \
@@ -495,7 +493,7 @@
x1, y1, x2, y2, \
vertices, stride) \
do { \
- if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
+ if (_X_UNLIKELY(glamor_pixmap_priv_is_large(priv))) { \
float tx1, tx2, ty1, ty2; \
int fbo_x_off, fbo_y_off; \
pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \
@@ -520,20 +518,20 @@
vertices, 2); \
} while(0)
-#define glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type, \
+#define glamor_set_repeat_normalize_tcoords_ext(pixmap, priv, repeat_type, \
xscale, yscale, \
_x1_, _y1_, _x2_, _y2_, \
vertices, stride) \
do { \
- if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
+ if (_X_UNLIKELY(glamor_pixmap_priv_is_large(priv))) { \
float tx1, tx2, ty1, ty2; \
if (repeat_type == RepeatPad) { \
- tx1 = _x1_ - priv->large.box.x1; \
- ty1 = _y1_ - priv->large.box.y1; \
+ tx1 = _x1_ - priv->box.x1; \
+ ty1 = _y1_ - priv->box.y1; \
tx2 = tx1 + ((_x2_) - (_x1_)); \
ty2 = ty1 + ((_y2_) - (_y1_)); \
} else { \
- glamor_get_repeat_coords((&priv->large), repeat_type, \
+ glamor_get_repeat_coords(pixmap, priv, repeat_type, \
tx1, ty1, tx2, ty2, \
_x1_, _y1_, _x2_, _y2_); \
} \
@@ -758,9 +756,9 @@ glamor_translate_boxes(BoxPtr boxes, int nbox, int dx, int dy)
|| _depth_ == 30 \
|| _depth_ == 32)
-#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->base.is_picture == 1)
-#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->base.gl_fbo == GLAMOR_FBO_NORMAL)
-#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv) (pixmap_priv && (pixmap_priv->base.gl_fbo == GLAMOR_FBO_DOWNLOADED))
+#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->is_picture == 1)
+#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL)
+#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv) (pixmap_priv && (pixmap_priv->gl_fbo == GLAMOR_FBO_DOWNLOADED))
/**
* Borrow from uxa.
@@ -795,10 +793,10 @@ static inline GLenum
gl_iformat_for_pixmap(PixmapPtr pixmap)
{
glamor_screen_private *glamor_priv =
- glamor_get_screen_private(pixmap->drawable.pScreen);
+ glamor_get_screen_private((pixmap)->drawable.pScreen);
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP &&
- (pixmap->drawable.depth == 1 || pixmap->drawable.depth == 8)) {
+ ((pixmap)->drawable.depth == 1 || (pixmap)->drawable.depth == 8)) {
return GL_ALPHA;
} else {
return GL_RGBA;
@@ -813,9 +811,9 @@ format_for_pixmap(PixmapPtr pixmap)
pixmap_priv = glamor_get_pixmap_private(pixmap);
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
- pict_format = pixmap_priv->base.picture->format;
+ pict_format = pixmap_priv->picture->format;
else
- pict_format = format_for_depth(pixmap->drawable.depth);
+ pict_format = format_for_depth((pixmap)->drawable.depth);
return pict_format;
}
@@ -939,47 +937,13 @@ glamor_pict_format_is_compatible(PicturePtr picture)
}
}
-/* return TRUE if we can access this pixmap at DDX driver. */
-inline static Bool
-glamor_ddx_fallback_check_pixmap(DrawablePtr drawable)
-{
- PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
- glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
-
- return (!pixmap_priv
- || (pixmap_priv->type == GLAMOR_TEXTURE_DRM
- || pixmap_priv->type == GLAMOR_MEMORY
- || pixmap_priv->type == GLAMOR_DRM_ONLY));
-}
-
-inline static Bool
-glamor_ddx_fallback_check_gc(GCPtr gc)
-{
- PixmapPtr pixmap;
-
- if (!gc)
- return TRUE;
- switch (gc->fillStyle) {
- case FillStippled:
- case FillOpaqueStippled:
- pixmap = gc->stipple;
- break;
- case FillTiled:
- pixmap = gc->tile.pixmap;
- break;
- default:
- pixmap = NULL;
- }
- return (!pixmap || glamor_ddx_fallback_check_pixmap(&pixmap->drawable));
-}
-
inline static Bool
glamor_is_large_pixmap(PixmapPtr pixmap)
{
glamor_pixmap_private *priv;
priv = glamor_get_pixmap_private(pixmap);
- return (priv->type == GLAMOR_TEXTURE_LARGE);
+ return (glamor_pixmap_priv_is_large(priv));
}
inline static Bool
@@ -1005,8 +969,8 @@ static inline void
_glamor_dump_pixmap_bits(PixmapPtr pixmap, int x, int y, int w, int h)
{
int i, j;
- unsigned char *p = pixmap->devPrivate.ptr;
- int stride = pixmap->devKind;
+ unsigned char *p = (pixmap)->devPrivate.ptr;
+ int stride = (pixmap)->devKind;
p = p + y * stride + x;
@@ -1023,8 +987,8 @@ static inline void
_glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int w, int h)
{
int i, j;
- unsigned char *p = pixmap->devPrivate.ptr;
- int stride = pixmap->devKind;
+ unsigned char *p = (pixmap)->devPrivate.ptr;
+ int stride = (pixmap)->devKind;
p = p + y * stride + x;
@@ -1041,8 +1005,8 @@ static inline void
_glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h)
{
int i, j;
- unsigned short *p = pixmap->devPrivate.ptr;
- int stride = pixmap->devKind / 2;
+ unsigned short *p = (pixmap)->devPrivate.ptr;
+ int stride = (pixmap)->devKind / 2;
p = p + y * stride + x;
@@ -1059,8 +1023,8 @@ static inline void
_glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
{
int i, j;
- unsigned int *p = pixmap->devPrivate.ptr;
- int stride = pixmap->devKind / 4;
+ unsigned int *p = (pixmap)->devPrivate.ptr;
+ int stride = (pixmap)->devKind / 4;
p = p + y * stride + x;
@@ -1076,11 +1040,11 @@ _glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
static inline void
glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
{
- w = ((x + w) > pixmap->drawable.width) ? (pixmap->drawable.width - x) : w;
- h = ((y + h) > pixmap->drawable.height) ? (pixmap->drawable.height - y) : h;
+ w = ((x + w) > (pixmap)->drawable.width) ? ((pixmap)->drawable.width - x) : w;
+ h = ((y + h) > (pixmap)->drawable.height) ? ((pixmap)->drawable.height - y) : h;
- glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
- switch (pixmap->drawable.depth) {
+ glamor_prepare_access(&(pixmap)->drawable, GLAMOR_ACCESS_RO);
+ switch ((pixmap)->drawable.depth) {
case 8:
_glamor_dump_pixmap_byte(pixmap, x, y, w, h);
break;
@@ -1097,9 +1061,9 @@ glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
_glamor_dump_pixmap_bits(pixmap, x, y, w, h);
break;
default:
- ErrorF("dump depth %d, not implemented.\n", pixmap->drawable.depth);
+ ErrorF("dump depth %d, not implemented.\n", (pixmap)->drawable.depth);
}
- glamor_finish_access(&pixmap->drawable);
+ glamor_finish_access(&(pixmap)->drawable);
}
static inline void
@@ -1297,7 +1261,7 @@ glamor_compare_pictures(ScreenPtr screen,
GLAMOR_CREATE_PIXMAP_CPU);
pixman_pic = CreatePicture(0,
- &pixmap->drawable,
+ &(pixmap)->drawable,
PictureMatchFormat(screen,
PIXMAN_FORMAT_DEPTH
(format), format), 0, 0,
@@ -1325,7 +1289,7 @@ glamor_compare_pictures(ScreenPtr screen,
GLAMOR_CREATE_PIXMAP_CPU);
pixman_pic = CreatePicture(0,
- &pixmap->drawable,
+ &(pixmap)->drawable,
PictureMatchFormat(screen,
PIXMAN_FORMAT_DEPTH
(format), format), 0, 0,
@@ -1429,4 +1393,21 @@ glamor_make_current(glamor_screen_private *glamor_priv)
}
}
+/**
+ * Helper function for implementing draws with GL_QUADS on GLES2,
+ * where we don't have them.
+ */
+static inline void
+glamor_glDrawArrays_GL_QUADS(glamor_screen_private *glamor_priv, unsigned count)
+{
+ if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+ glDrawArrays(GL_QUADS, 0, count * 4);
+ } else {
+ unsigned i;
+ for (i = 0; i < count; i++)
+ glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
+ }
+}
+
+
#endif
diff --git a/xorg-server/glamor/glamor_window.c b/xorg-server/glamor/glamor_window.c
index 60647bf80..a39e723ef 100644
--- a/xorg-server/glamor/glamor_window.c
+++ b/xorg-server/glamor/glamor_window.c
@@ -79,16 +79,16 @@ glamor_set_window_pixmap(WindowPtr win, PixmapPtr pPixmap)
pixmap_priv = glamor_get_pixmap_private(old);
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) &&
- pixmap_priv->base.picture->pDrawable == (DrawablePtr) win) {
- pic = pixmap_priv->base.picture;
- pixmap_priv->base.is_picture = 0;
- pixmap_priv->base.picture = NULL;
+ pixmap_priv->picture->pDrawable == (DrawablePtr) win) {
+ pic = pixmap_priv->picture;
+ pixmap_priv->is_picture = 0;
+ pixmap_priv->picture = NULL;
}
pixmap_priv = glamor_get_pixmap_private(pPixmap);
if (pixmap_priv) {
- pixmap_priv->base.is_picture = ! !pic;
- pixmap_priv->base.picture = pic;
+ pixmap_priv->is_picture = ! !pic;
+ pixmap_priv->picture = pic;
}
}
diff --git a/xorg-server/glamor/glamor_xv.c b/xorg-server/glamor/glamor_xv.c
index 83e24adb2..364104ddd 100644
--- a/xorg-server/glamor/glamor_xv.c
+++ b/xorg-server/glamor/glamor_xv.c
@@ -241,8 +241,8 @@ glamor_xv_render(glamor_port_private *port_priv)
{
ScreenPtr screen = port_priv->pPixmap->drawable.pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- glamor_pixmap_private *pixmap_priv =
- glamor_get_pixmap_private(port_priv->pPixmap);
+ PixmapPtr pixmap = port_priv->pPixmap;
+ glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_pixmap_private *src_pixmap_priv[3];
float vertices[32], texcoords[8];
BoxPtr box = REGION_RECTS(&port_priv->clip);
@@ -282,10 +282,11 @@ glamor_xv_render(glamor_port_private *port_priv)
off[2] = Loff * yco + Coff * (uco[2] + vco[2]) + bright;
gamma = 1.0;
- pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale);
+ pixmap_priv_get_dest_scale(pixmap, pixmap_priv, &dst_xscale, &dst_yscale);
glamor_get_drawable_deltas(port_priv->pDraw, port_priv->pPixmap, &dst_x_off,
&dst_y_off);
- glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+ glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
+ glamor_set_alu(screen, GXcopy);
for (i = 0; i < 3; i++) {
if (port_priv->src_pix[i]) {
@@ -306,21 +307,21 @@ glamor_xv_render(glamor_port_private *port_priv)
glUniform4f(uloc, vco[0], vco[1], vco[2], 0);
glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->base.fbo->tex);
+ glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->fbo->tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glActiveTexture(GL_TEXTURE1);
- glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->base.fbo->tex);
+ glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->fbo->tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glActiveTexture(GL_TEXTURE2);
- glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->base.fbo->tex);
+ glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->fbo->tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
index 8fe751693..582e3af96 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
@@ -214,6 +214,8 @@ ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glUseProgram(glamor->texture_shader);
glViewport(0, 0, glamor->width, glamor->height);
+ if (!ephyr_glamor_gles2)
+ glDisable(GL_COLOR_LOGIC_OP);
glVertexAttribPointer(glamor->texture_shader_position_loc,
2, GL_FLOAT, FALSE, 0, position);
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c
index f64861b50..c67ff60d3 100644
--- a/xorg-server/hw/kdrive/ephyr/hostx.c
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
@@ -443,7 +443,7 @@ hostx_init(void)
else
#endif
HostX.conn = xcb_connect(NULL, &HostX.screen);
- if (xcb_connection_has_error(HostX.conn)) {
+ if (!HostX.conn || xcb_connection_has_error(HostX.conn)) {
fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n");
exit(1);
}
@@ -1407,9 +1407,10 @@ ephyr_glamor_init(ScreenPtr screen)
ephyr_glamor_set_window_size(scrpriv->glamor,
scrpriv->win_width, scrpriv->win_height);
- glamor_init(screen,
- GLAMOR_USE_SCREEN |
- GLAMOR_USE_PICTURE_SCREEN);
+ if (!glamor_init(screen, 0)) {
+ FatalError("Failed to initialize glamor\n");
+ return FALSE;
+ }
return TRUE;
}
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
index c06aaaee1..97a1f97b2 100644
--- a/xorg-server/hw/xfree86/common/xf86Events.c
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -583,10 +583,11 @@ xf86VTEnter(void)
/* Turn screen saver off when switching back */
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
- /* If we use systemd-logind it will enable input devices for us */
- if (!systemd_logind_controls_session())
- for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
+ for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
+ /* Devices with server managed fds get enabled on logind resume */
+ if (!(pInfo->flags & XI86_SERVER_FD))
xf86EnableInputDeviceForVTSwitch(pInfo);
+ }
for (ih = InputHandlers; ih; ih = ih->next) {
if (ih->is_input)
diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c
index 15988b8b1..c1aaba41a 100644
--- a/xorg-server/hw/xfree86/common/xf86platformBus.c
+++ b/xorg-server/hw/xfree86/common/xf86platformBus.c
@@ -153,8 +153,10 @@ xf86_check_platform_slot(const struct xf86_platform_device *pd)
for (i = 0; i < xf86NumEntities; i++) {
const EntityPtr u = xf86Entities[i];
- if (pd->pdev && u->bus.type == BUS_PCI)
- return !MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci);
+ if (pd->pdev && u->bus.type == BUS_PCI &&
+ MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci)) {
+ return FALSE;
+ }
if ((u->bus.type == BUS_PLATFORM) && (pd == u->bus.id.plat)) {
return FALSE;
}
@@ -426,6 +428,10 @@ xf86platformProbeDev(DriverPtr drvp)
/* find the main device or any device specificed in xorg.conf */
for (i = 0; i < numDevs; i++) {
+ /* skip inactive devices */
+ if (!devList[i]->active)
+ continue;
+
for (j = 0; j < xf86_num_platform_devices; j++) {
if (devList[i]->busID && *devList[i]->busID) {
if (xf86PlatformDeviceCheckBusID(&xf86_platform_devices[j], devList[i]->busID))
@@ -449,10 +455,14 @@ xf86platformProbeDev(DriverPtr drvp)
continue;
}
- /* if autoaddgpu devices is enabled then go find a few more and add them as GPU screens */
- if (xf86Info.autoAddGPU && numDevs) {
+ /* if autoaddgpu devices is enabled then go find any unclaimed platform
+ * devices and add them as GPU screens */
+ if (xf86Info.autoAddGPU) {
for (j = 0; j < xf86_num_platform_devices; j++) {
- probeSingleDevice(&xf86_platform_devices[j], drvp, devList[0], PLATFORM_PROBE_GPU_SCREEN);
+ if (probeSingleDevice(&xf86_platform_devices[j], drvp,
+ devList ? devList[0] : NULL,
+ PLATFORM_PROBE_GPU_SCREEN))
+ foundScreen = TRUE;
}
}
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/driver.c b/xorg-server/hw/xfree86/drivers/modesetting/driver.c
index d52517d1a..e2f3846ca 100644
--- a/xorg-server/hw/xfree86/drivers/modesetting/driver.c
+++ b/xorg-server/hw/xfree86/drivers/modesetting/driver.c
@@ -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;
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index 9d592a7eb..a1947241b 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -3026,6 +3026,27 @@ xf86OutputSetEDIDProperty(xf86OutputPtr output, void *data, int data_len)
}
}
+#define TILE_ATOM_NAME "TILE"
+/* changing this in the future could be tricky as people may hardcode 8 */
+#define TILE_PROP_NUM_ITEMS 8
+static void
+xf86OutputSetTileProperty(xf86OutputPtr output)
+{
+ Atom tile_atom = MakeAtom(TILE_ATOM_NAME, sizeof(TILE_ATOM_NAME) - 1, TRUE);
+
+ /* This may get called before the RandR resources have been created */
+ if (output->randr_output == NULL)
+ return;
+
+ if (output->tile_info.group_id != 0) {
+ RRChangeOutputProperty(output->randr_output, tile_atom, XA_INTEGER, 32,
+ PropModeReplace, TILE_PROP_NUM_ITEMS, (uint32_t *)&output->tile_info, FALSE, TRUE);
+ }
+ else {
+ RRDeleteOutputProperty(output->randr_output, tile_atom);
+ }
+}
+
#endif
/* Pull out a phyiscal size from a detailed timing if available. */
@@ -3071,6 +3092,38 @@ handle_detailed_physical_size(struct detailed_monitor_section
}
}
+Bool
+xf86OutputParseKMSTile(const char *tile_data, int tile_length,
+ struct xf86CrtcTileInfo *tile_info)
+{
+ int ret;
+
+ ret = sscanf(tile_data, "%d:%d:%d:%d:%d:%d:%d:%d",
+ &tile_info->group_id,
+ &tile_info->flags,
+ &tile_info->num_h_tile,
+ &tile_info->num_v_tile,
+ &tile_info->tile_h_loc,
+ &tile_info->tile_v_loc,
+ &tile_info->tile_h_size,
+ &tile_info->tile_v_size);
+ if (ret != 8)
+ return FALSE;
+ return TRUE;
+}
+
+void
+xf86OutputSetTile(xf86OutputPtr output, struct xf86CrtcTileInfo *tile_info)
+{
+ if (tile_info)
+ output->tile_info = *tile_info;
+ else
+ memset(&output->tile_info, 0, sizeof(output->tile_info));
+#ifdef RANDR_12_INTERFACE
+ xf86OutputSetTileProperty(output);
+#endif
+}
+
/**
* Set the EDID information for the specified output
*/
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.h b/xorg-server/hw/xfree86/modes/xf86Crtc.h
index 692bf40b9..3c5bbcfd5 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.h
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.h
@@ -70,6 +70,17 @@ typedef enum _xf86OutputStatus {
XF86OutputStatusUnknown
} xf86OutputStatus;
+struct xf86CrtcTileInfo {
+ uint32_t group_id;
+ uint32_t flags;
+ uint32_t num_h_tile;
+ uint32_t num_v_tile;
+ uint32_t tile_h_loc;
+ uint32_t tile_v_loc;
+ uint32_t tile_h_size;
+ uint32_t tile_v_size;
+};
+
typedef struct _xf86CrtcFuncs {
/**
* Turns the crtc on/off, or sets intermediate power levels if available.
@@ -226,7 +237,7 @@ typedef struct _xf86CrtcFuncs {
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
-#define XF86_CRTC_VERSION 5
+#define XF86_CRTC_VERSION 6
struct _xf86Crtc {
/**
@@ -500,7 +511,7 @@ typedef struct _xf86OutputFuncs {
(*destroy) (xf86OutputPtr output);
} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
-#define XF86_OUTPUT_VERSION 2
+#define XF86_OUTPUT_VERSION 3
struct _xf86Output {
/**
@@ -615,6 +626,8 @@ struct _xf86Output {
BoxRec initialTotalArea;
BoxRec initialTrackingArea;
INT16 initialBorder[4];
+
+ struct xf86CrtcTileInfo tile_info;
};
typedef struct _xf86ProviderFuncs {
@@ -881,6 +894,15 @@ extern _X_EXPORT void
xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon);
/**
+ * Set the TILE information for the specified output
+ */
+extern _X_EXPORT void
+xf86OutputSetTile(xf86OutputPtr output, struct xf86CrtcTileInfo *tile_info);
+
+extern _X_EXPORT Bool
+xf86OutputParseKMSTile(const char *tile_data, int tile_length, struct xf86CrtcTileInfo *tile_info);
+
+/**
* Return the list of modes supported by the EDID information
* stored in 'output'
*/
diff --git a/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c b/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c
index 49758f465..4ad41a374 100644
--- a/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c
@@ -40,8 +40,6 @@
#include "systemd-logind.h"
-#define DBUS_TIMEOUT 500 /* Wait max 0.5 seconds */
-
struct systemd_logind_info {
DBusConnection *conn;
char *session;
@@ -130,7 +128,7 @@ systemd_logind_take_fd(int _major, int _minor, const char *path,
}
reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
- DBUS_TIMEOUT, &error);
+ DBUS_TIMEOUT_USE_DEFAULT, &error);
if (!reply) {
LogMessage(X_ERROR, "systemd-logind: failed to take device %s: %s\n",
path, error.message);
@@ -207,7 +205,7 @@ systemd_logind_release_fd(int _major, int _minor, int fd)
}
reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
- DBUS_TIMEOUT, &error);
+ DBUS_TIMEOUT_USE_DEFAULT, &error);
if (!reply)
LogMessage(X_ERROR, "systemd-logind: failed to release device: %s\n",
error.message);
@@ -289,7 +287,7 @@ systemd_logind_ack_pause(struct systemd_logind_info *info,
}
reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
- DBUS_TIMEOUT, &error);
+ DBUS_TIMEOUT_USE_DEFAULT, &error);
if (!reply)
LogMessage(X_ERROR, "systemd-logind: failed to ack pause: %s\n",
error.message);
@@ -313,6 +311,9 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
dbus_int32_t major, minor;
char *pause_str;
+ if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
dbus_error_init(&error);
if (dbus_message_is_signal(message,
@@ -454,7 +455,7 @@ connect_hook(DBusConnection *connection, void *data)
}
reply = dbus_connection_send_with_reply_and_block(connection, msg,
- DBUS_TIMEOUT, &error);
+ DBUS_TIMEOUT_USE_DEFAULT, &error);
if (!reply) {
LogMessage(X_ERROR, "systemd-logind: failed to get session: %s\n",
error.message);
@@ -489,7 +490,7 @@ connect_hook(DBusConnection *connection, void *data)
}
reply = dbus_connection_send_with_reply_and_block(connection, msg,
- DBUS_TIMEOUT, &error);
+ DBUS_TIMEOUT_USE_DEFAULT, &error);
if (!reply) {
LogMessage(X_ERROR, "systemd-logind: TakeControl failed: %s\n",
error.message);
@@ -561,7 +562,7 @@ systemd_logind_release_control(struct systemd_logind_info *info)
}
reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
- DBUS_TIMEOUT, &error);
+ DBUS_TIMEOUT_USE_DEFAULT, &error);
if (!reply) {
LogMessage(X_ERROR, "systemd-logind: ReleaseControl failed: %s\n",
error.message);
diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c
index d7229cecb..851ce4842 100644
--- a/xorg-server/hw/xquartz/quartz.c
+++ b/xorg-server/hw/xquartz/quartz.c
@@ -43,6 +43,7 @@
#include "darwinEvents.h"
#include "pseudoramiX.h"
#include "extension.h"
+#include "nonsdk_extinit.h"
#include "glx_extinit.h"
#define _APPLEWM_SERVER_
#include "applewmExt.h"
diff --git a/xorg-server/hw/xquartz/xpr/xprScreen.c b/xorg-server/hw/xquartz/xpr/xprScreen.c
index d0a525ff4..30f2218b6 100644
--- a/xorg-server/hw/xquartz/xpr/xprScreen.c
+++ b/xorg-server/hw/xquartz/xpr/xprScreen.c
@@ -54,6 +54,8 @@
#include "damage.h"
#endif
+#include "nonsdk_extinit.h"
+
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
// From NSApplication.h
extern const double NSAppKitVersionNumber;
diff --git a/xorg-server/hw/xwayland/Makefile.am b/xorg-server/hw/xwayland/Makefile.am
index 994554088..ab1bbb6a5 100644
--- a/xorg-server/hw/xwayland/Makefile.am
+++ b/xorg-server/hw/xwayland/Makefile.am
@@ -43,6 +43,7 @@ xwayland-glamor.c : $(nodist_Xwayland_SOURCES)
glamor_lib = $(top_builddir)/glamor/libglamor.la
Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL
+Xwayland_DEPENDENCIES = $(glamor_lib)
endif
EXTRA_DIST = drm.xml
diff --git a/xorg-server/hw/xwayland/xwayland-glamor.c b/xorg-server/hw/xwayland/xwayland-glamor.c
index dd8551840..d06006c70 100644
--- a/xorg-server/hw/xwayland/xwayland-glamor.c
+++ b/xorg-server/hw/xwayland/xwayland-glamor.c
@@ -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;
}
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
index 654c58c14..b6f258313 100644
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -58,6 +58,11 @@ typedef WINAPI HRESULT(*SHGETFOLDERPATHPROC) (HWND hwndOwner,
HANDLE hToken,
DWORD dwFlags, LPTSTR pszPath);
#endif
+
+#include "winmonitors.h"
+#include "nonsdk_extinit.h"
+#include "pseudoramiX/pseudoramiX.h"
+
#include "glx_extinit.h"
#ifdef XWIN_GLX_WINDOWS
#include "glx/glwindows.h"
@@ -733,13 +738,12 @@ winUseMsg(void)
ErrorF("-engine engine_type_id\n"
"\tOverride the server's automatically selected engine type:\n"
"\t\t1 - Shadow GDI\n"
- "\t\t2 - Shadow DirectDraw\n"
"\t\t4 - Shadow DirectDraw4 Non-Locking\n"
);
ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n");
- ErrorF("-hostintitle\n"
+ ErrorF("-[no]hostintitle\n"
"\tIn multiwindow mode, add remote host names to window titles.\n");
ErrorF("-ignoreinput\n" "\tIgnore keyboard and mouse input.\n");
@@ -973,6 +977,59 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
}
}
+ /*
+ Unless full xinerama has been explicitly enabled, register all native screens with pseudoramiX
+ */
+ if (!noPanoramiXExtension)
+ noPseudoramiXExtension = TRUE;
+
+ if ((g_ScreenInfo[0].fMultipleMonitors) && !noPseudoramiXExtension)
+ {
+ int pass;
+
+ PseudoramiXExtensionInit();
+
+ /* Add primary monitor on pass 0, other monitors on pass 1, to ensure
+ the primary monitor is first in XINERAMA list */
+ for (pass = 0; pass < 2; pass++)
+ {
+ int iMonitor;
+
+ for (iMonitor = 1; ; iMonitor++)
+ {
+ struct GetMonitorInfoData data;
+ QueryMonitor(iMonitor, &data);
+ if (data.bMonitorSpecifiedExists)
+ {
+ MONITORINFO mi;
+ mi.cbSize = sizeof(MONITORINFO);
+
+ if (GetMonitorInfo(data.monitorHandle, &mi))
+ {
+ /* pass == 1 XOR primary monitor flags is set */
+ if ((!(pass == 1)) != (!(mi.dwFlags & MONITORINFOF_PRIMARY)))
+ {
+ /*
+ Note the screen origin in a normalized coordinate space where (0,0) is at the top left
+ of the native virtual desktop area
+ */
+ data.monitorOffsetX = data.monitorOffsetX - GetSystemMetrics(SM_XVIRTUALSCREEN);
+ data.monitorOffsetY = data.monitorOffsetY - GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ winDebug ("InitOutput - screen %d added at virtual desktop coordinate (%d,%d) (pseudoramiX) \n",
+ iMonitor-1, data.monitorOffsetX, data.monitorOffsetY);
+
+ PseudoramiXAddScreen(data.monitorOffsetX, data.monitorOffsetY,
+ data.monitorWidth, data.monitorHeight);
+ }
+ }
+ }
+ else
+ break;
+ }
+ }
+ }
+
#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
/* Generate a cookie used by internal clients for authorization */
diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am
index 0ea8ba769..4da3d12a4 100644
--- a/xorg-server/hw/xwin/Makefile.am
+++ b/xorg-server/hw/xwin/Makefile.am
@@ -71,12 +71,12 @@ SRCS = InitInput.c \
winmsgwindow.c \
winmultiwindowclass.c \
winmultiwindowicons.c \
+ winos.c \
winprefs.c \
winprefsyacc.y \
winprefslex.l \
winprocarg.c \
winscrinit.c \
- winshaddd.c \
winshadddnl.c \
winshadgdi.c \
wintaskbar.c \
diff --git a/xorg-server/hw/xwin/XWin.exe.manifest b/xorg-server/hw/xwin/XWin.exe.manifest
index 477334fb3..bd44b1066 100644
--- a/xorg-server/hw/xwin/XWin.exe.manifest
+++ b/xorg-server/hw/xwin/XWin.exe.manifest
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <description>The XWin X Windows server for Cygwin.</description>
+ <description>The XWin X Windows server</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
@@ -18,4 +18,18 @@
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!-- Windows Vista -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <!-- Windows 7 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!-- Windows 10 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ </application>
+ </compatibility>
</assembly>
diff --git a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
index 69ab1efa9..b9e8dda75 100644
--- a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
+++ b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
@@ -123,6 +123,36 @@ else:
errWarn = sys.stderr
diag = open(diagFilename, 'w')
+def ParseCmdRettype(cmd):
+ proto=noneStr(cmd.elem.find('proto'))
+ rettype=noneStr(proto.text)
+ if rettype.lower()!="void ":
+ plist = ([t for t in proto.itertext()])
+ rettype = ''.join(plist[:-1])
+ rettype=rettype.strip()
+ return rettype
+
+def ParseCmdParams(cmd):
+ params = cmd.elem.findall('param')
+ plist=[]
+ for param in params:
+ # construct the formal parameter definition from ptype and name
+ # elements, also using any text found around these in the
+ # param element, in the order it appears in the document
+ paramtype = ''
+ # also extract the formal parameter name from the name element
+ paramname = ''
+ for t in param.iter():
+ if t.tag == 'ptype' or t.tag == 'param':
+ paramtype = paramtype + noneStr(t.text)
+ if t.tag == 'name':
+ paramname = t.text + '_'
+ paramtype = paramtype + ' ' + paramname
+ if t.tail is not None:
+ paramtype = paramtype + t.tail.strip()
+ plist.append((paramtype, paramname))
+ return plist
+
class PreResolveOutputGenerator(OutputGenerator):
def __init__(self,
errFile = sys.stderr,
@@ -179,25 +209,15 @@ class WrapperOutputGenerator(OutputGenerator):
if prefix == 'wgl' and not name in used_wgl_ext_fns:
return
- proto=noneStr(cmd.elem.find('proto'))
- rettype=noneStr(proto.text)
- if rettype.lower()!="void ":
- plist = ([t for t in proto.itertext()])
- rettype = ''.join(plist[:-1])
- rettype=rettype.strip()
+ rettype=ParseCmdRettype(cmd)
+
if staticwrappers: self.outFile.write("static ")
self.outFile.write("%s %sWrapper("%(rettype, name))
- params = cmd.elem.findall('param')
- plist=[]
- for param in params:
- paramlist = ([t for t in param.itertext()])
- paramtype = ''.join(paramlist[:-1])
- paramname = paramlist[-1]
- plist.append((paramtype, paramname))
+ plist=ParseCmdParams(cmd)
Comma=""
if len(plist):
for ptype, pname in plist:
- self.outFile.write("%s%s%s_"%(Comma, ptype, pname))
+ self.outFile.write("%s%s"%(Comma, ptype))
Comma=", "
else:
self.outFile.write("void")
@@ -218,7 +238,7 @@ class WrapperOutputGenerator(OutputGenerator):
Comma=""
for ptype, pname in plist:
- self.outFile.write("%s%s_"%(Comma, pname))
+ self.outFile.write("%s%s"%(Comma, pname))
Comma=", "
# for GL 1.2+ functions, generate stdcall wrappers which use wglGetProcAddress()
@@ -244,7 +264,7 @@ class WrapperOutputGenerator(OutputGenerator):
Comma=""
for ptype, pname in plist:
- self.outFile.write("%s%s_"%(Comma, pname))
+ self.outFile.write("%s%s"%(Comma, pname))
Comma=", "
self.outFile.write(" );\n}\n\n")
@@ -270,24 +290,14 @@ class ThunkOutputGenerator(OutputGenerator):
def genCmd(self, cmd, name):
OutputGenerator.genCmd(self, cmd, name)
- proto=noneStr(cmd.elem.find('proto'))
- rettype=noneStr(proto.text)
- if rettype.lower()!="void ":
- plist = ([t for t in proto.itertext()])
- rettype = ''.join(plist[:-1])
- rettype=rettype.strip()
+ rettype=ParseCmdRettype(cmd)
self.outFile.write("%s %sWrapper("%(rettype, name))
- params = cmd.elem.findall('param')
- plist=[]
- for param in params:
- paramlist = ([t for t in param.itertext()])
- paramtype = ''.join(paramlist[:-1])
- paramname = paramlist[-1]
- plist.append((paramtype, paramname))
+ plist=ParseCmdParams(cmd)
+
Comma=""
if len(plist):
for ptype, pname in plist:
- self.outFile.write("%s%s%s_"%(Comma, ptype, pname))
+ self.outFile.write("%s%s"%(Comma, ptype))
Comma=", "
else:
self.outFile.write("void")
@@ -303,7 +313,7 @@ class ThunkOutputGenerator(OutputGenerator):
Comma=""
for ptype, pname in plist:
- self.outFile.write("%s%s_"%(Comma, pname))
+ self.outFile.write("%s%s"%(Comma, pname))
Comma=", "
# for GL 1.2+ functions, generate wrappers which use wglGetProcAddress()
@@ -317,7 +327,7 @@ class ThunkOutputGenerator(OutputGenerator):
Comma=""
for ptype, pname in plist:
- self.outFile.write("%s%s_"%(Comma, pname))
+ self.outFile.write("%s%s"%(Comma, pname))
Comma=", "
self.outFile.write(" );\n}\n\n")
@@ -372,24 +382,14 @@ class ShimOutputGenerator(OutputGenerator):
return
# for GL functions which are in the ABI, generate a shim which calls the function via GetProcAddress
- proto=noneStr(cmd.elem.find('proto'))
- rettype=noneStr(proto.text)
- if rettype.lower()!="void ":
- plist = ([t for t in proto.itertext()])
- rettype = ''.join(plist[:-1])
- rettype=rettype.strip()
+ rettype=ParseCmdRettype(cmd)
self.outFile.write("%s %s("%(rettype, name))
- params = cmd.elem.findall('param')
- plist=[]
- for param in params:
- paramlist = ([t for t in param.itertext()])
- paramtype = ''.join(paramlist[:-1])
- paramname = paramlist[-1]
- plist.append((paramtype, paramname))
+ plist=ParseCmdParams(cmd)
+
Comma=""
if len(plist):
for ptype, pname in plist:
- self.outFile.write("%s%s%s_"%(Comma, ptype, pname))
+ self.outFile.write("%s%s"%(Comma, ptype))
Comma=", "
else:
self.outFile.write("void")
@@ -401,7 +401,7 @@ class ShimOutputGenerator(OutputGenerator):
if len(plist):
Comma=""
for ptype, pname in plist:
- self.outFile.write("%s %s %s_"%(Comma, ptype, pname))
+ self.outFile.write("%s %s"%(Comma, ptype))
Comma=", "
else:
self.outFile.write("void")
@@ -417,7 +417,7 @@ class ShimOutputGenerator(OutputGenerator):
Comma=""
for ptype, pname in plist:
- self.outFile.write("%s%s_"%(Comma, pname))
+ self.outFile.write("%s%s"%(Comma, pname))
Comma=", "
self.outFile.write(" );\n}\n\n")
diff --git a/xorg-server/hw/xwin/man/XWin.man b/xorg-server/hw/xwin/man/XWin.man
index 15a57db02..d68ee2a41 100644
--- a/xorg-server/hw/xwin/man/XWin.man
+++ b/xorg-server/hw/xwin/man/XWin.man
@@ -76,6 +76,9 @@ preceeding \fB\-screen\fP parameter.
.B \-[no]multimonitors or \-[no]multiplemonitors
Create a screen 0 that covers all monitors [the primary monitor] on a system with
multiple monitors.
+Fake XINERAMA data is created describing the individual monitors,
+(This is similar to the 'merged framebuffer' or 'pseudo-xinerama' mode provided by
+some drivers for the xorg X server).
This option is currently enabled by default in \fB\-multiwindow\fP mode.
.TP 8
.B "\-screen \fIscreen_number\fP [\fIW\fP \fIH\fP [\fIX\fP \fIY\fP] | [[\fIW\fPx\fIH\fP[+\fIX\fP+\fIY\fP]][@\fIM\fP]] ] "
@@ -167,9 +170,10 @@ on its own is equivalent to \fB\-resize=randr\fP
.SH OPTIONS FOR MULTIWINDOW MODE
.TP 8
-.B \-hostintitle
+.B \-[no]hostintitle
Add the host name to the window title for X applications which are running
on remote hosts, when that information is available and it's useful to do so.
+The default is enabled.
.SH OPTIONS CONTROLLING WINDOWS INTEGRATION
.TP 8
@@ -244,9 +248,6 @@ functionality does not provide a benefit at any number of boxes; we
can only determine the usefulness of this feature through testing.
This option probably has limited effect on current \fIWindows\fP versions
as they already perform GDI batching.
-This parameter works in conjunction with engines 1, 2, and 4 (Shadow
-GDI, Shadow DirectDraw, and Shadow DirectDraw Non-Locking,
-respectively).
.TP 8
.B "\-engine \fIengine_type_id\fP"
This option, which is intended for Cygwin/X developers,
@@ -261,8 +262,6 @@ The engine type ids are:
.RS
.IP 1 4
Shadow GDI
-.IP 2 4
-Shadow DirectDraw
.IP 4 4
Shadow DirectDraw Non-Locking
.RE
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index b7d20ca73..5710ea852 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -101,7 +101,6 @@
#define WIN_SERVER_NONE 0x0L /* 0 */
#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
-#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
#define AltMapIndex Mod1MapIndex
@@ -468,35 +467,20 @@ typedef struct _winPrivScreenRec {
int iE3BCachedPress;
Bool fE3BFakeButton2Sent;
- /* Privates used by shadow fb GDI server */
+ /* Privates used by shadow fb GDI engine */
HBITMAP hbmpShadow;
HDC hdcScreen;
HDC hdcShadow;
HWND hwndScreen;
BITMAPINFOHEADER *pbmih;
- /* Privates used by shadow fb and primary fb DirectDraw servers */
+ /* Privates used by shadow fb DirectDraw Nonlocking engine */
LPDIRECTDRAW pdd;
- LPDIRECTDRAWSURFACE2 pddsPrimary;
- LPDIRECTDRAW2 pdd2;
-
- /* Privates used by shadow fb DirectDraw server */
- LPDIRECTDRAWSURFACE2 pddsShadow;
- LPDDSURFACEDESC pddsdShadow;
-
- /* Privates used by primary fb DirectDraw server */
- LPDIRECTDRAWSURFACE2 pddsOffscreen;
- LPDDSURFACEDESC pddsdOffscreen;
- LPDDSURFACEDESC pddsdPrimary;
-
- /* Privates used by shadow fb DirectDraw Nonlocking server */
LPDIRECTDRAW4 pdd4;
LPDIRECTDRAWSURFACE4 pddsShadow4;
LPDIRECTDRAWSURFACE4 pddsPrimary4;
- BOOL fRetryCreateSurface;
-
- /* Privates used by both shadow fb DirectDraw servers */
LPDIRECTDRAWCLIPPER pddcPrimary;
+ BOOL fRetryCreateSurface;
#ifdef XWIN_MULTIWINDOWEXTWM
/* Privates used by multi-window external window manager */
@@ -921,13 +905,6 @@ Bool
winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv);
/*
- * winshaddd.c
- */
-
-Bool
- winSetEngineFunctionsShadowDD(ScreenPtr pScreen);
-
-/*
* winshadddnl.c
*/
@@ -1219,6 +1196,12 @@ Bool
winCreateMsgWindowThread(void);
/*
+ * winos.c
+ */
+void
+winOS(void);
+
+/*
* END DDX and DIX Function Prototypes
*/
diff --git a/xorg-server/hw/xwin/winengine.c b/xorg-server/hw/xwin/winengine.c
index b473b3ac0..b8f8da06b 100644
--- a/xorg-server/hw/xwin/winengine.c
+++ b/xorg-server/hw/xwin/winengine.c
@@ -54,16 +54,9 @@ static HMODULE g_hmodDirectDraw = NULL;
void
winDetectSupportedEngines(void)
{
- OSVERSIONINFO osvi;
-
/* Initialize the engine support flags */
g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI;
- /* Get operating system version information */
- ZeroMemory(&osvi, sizeof(osvi));
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- GetVersionEx(&osvi);
-
/* Do we have DirectDraw? */
if (g_hmodDirectDraw != NULL) {
LPDIRECTDRAW lpdd = NULL;
@@ -85,12 +78,6 @@ winDetectSupportedEngines(void)
"winDetectSupportedEngines - DirectDraw not installed\n");
return;
}
- else {
- /* We have DirectDraw */
- winErrorFVerb(2,
- "winDetectSupportedEngines - DirectDraw installed, allowing ShadowDD\n");
- g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
- }
/* Try to query for DirectDraw4 interface */
ddrval = IDirectDraw_QueryInterface(lpdd,
@@ -187,9 +174,6 @@ winSetEngine(ScreenPtr pScreen)
case WIN_SERVER_SHADOW_GDI:
winSetEngineFunctionsShadowGDI(pScreen);
break;
- case WIN_SERVER_SHADOW_DD:
- winSetEngineFunctionsShadowDD(pScreen);
- break;
case WIN_SERVER_SHADOW_DDNL:
winSetEngineFunctionsShadowDDNL(pScreen);
break;
@@ -209,16 +193,6 @@ winSetEngine(ScreenPtr pScreen)
return TRUE;
}
- /* ShadowDD is next in line */
- if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DD) {
- winErrorFVerb(2, "winSetEngine - Using Shadow DirectDraw\n");
- pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DD;
-
- /* Set engine function pointers */
- winSetEngineFunctionsShadowDD(pScreen);
- return TRUE;
- }
-
/* ShadowGDI is next in line */
if (g_dwEnginesSupported & WIN_SERVER_SHADOW_GDI) {
winErrorFVerb(2, "winSetEngine - Using Shadow GDI DIB\n");
diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c
index ad82b83f6..1382c8972 100644
--- a/xorg-server/hw/xwin/winglobals.c
+++ b/xorg-server/hw/xwin/winglobals.c
@@ -78,7 +78,7 @@ Bool g_fNoHelpMessageBox = FALSE;
Bool g_fSoftwareCursor = FALSE;
Bool g_fSilentDupError = FALSE;
Bool g_fNativeGl = TRUE;
-Bool g_fHostInTitle = FALSE;
+Bool g_fHostInTitle = TRUE;
pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER;
#ifdef XWIN_CLIPBOARD
diff --git a/xorg-server/hw/xwin/winos.c b/xorg-server/hw/xwin/winos.c
new file mode 100644
index 000000000..0d825bb83
--- /dev/null
+++ b/xorg-server/hw/xwin/winos.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010-2014 Colin Harrison All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ *
+ * Author: Colin Harrison
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
+
+static const char*
+IsWow64(void)
+{
+#ifdef __x86_64__
+ return " (64-bit)";
+#else
+ WINBOOL bIsWow64;
+ LPFN_ISWOW64PROCESS fnIsWow64Process =
+ (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandle(TEXT("kernel32")),
+ "IsWow64Process");
+ if (NULL != fnIsWow64Process) {
+ if (fnIsWow64Process(GetCurrentProcess(), &bIsWow64))
+ return bIsWow64 ? " (WoW64)" : " (32-bit)";
+ }
+
+ /* OS doesn't support IsWow64Process() */
+ return "";
+#endif
+}
+
+/*
+ * Report the OS version
+ */
+
+void
+winOS(void)
+{
+ OSVERSIONINFOEX osvi = {0};
+
+ /* Get operating system version information */
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx((LPOSVERSIONINFO)&osvi);
+
+ ErrorF("OS: Windows NT %d.%d build %d%s\n",
+ (int)osvi.dwMajorVersion, (int)osvi.dwMinorVersion,
+ (int)osvi.dwBuildNumber, IsWow64());
+}
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c
index e8cccb4c2..73aa027d8 100644
--- a/xorg-server/hw/xwin/winprocarg.c
+++ b/xorg-server/hw/xwin/winprocarg.c
@@ -31,6 +31,10 @@ from The Open Group.
#include <xwin-config.h>
#endif
+#ifdef HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+
#include <../xfree86/common/xorgVersion.h>
#include "win.h"
#include "winconfig.h"
@@ -1094,6 +1098,11 @@ ddxProcessArgument(int argc, char *argv[], int i)
return 1;
}
+ if (IS_OPTION("-nohostintitle")) {
+ g_fHostInTitle = FALSE;
+ return 1;
+ }
+
return 0;
}
@@ -1181,6 +1190,17 @@ winLogVersionInfo(void)
ErrorF("Vendor: %s\n", XVENDORNAME);
ErrorF("Release: %d.%d.%d.%d\n", XORG_VERSION_MAJOR,
XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP);
+#ifdef HAVE_SYS_UTSNAME_H
+ {
+ struct utsname name;
+
+ if (uname(&name) >= 0) {
+ ErrorF("OS: %s %s %s %s %s\n", name.sysname, name.nodename,
+ name.release, name.version, name.machine);
+ }
+ }
+#endif
+ winOS();
if (strlen(BUILDERSTRING))
ErrorF("%s\n", BUILDERSTRING);
ErrorF("Contact: %s\n", BUILDERADDR);
diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c
index ce0aada31..e68ee1227 100644
--- a/xorg-server/hw/xwin/winscrinit.c
+++ b/xorg-server/hw/xwin/winscrinit.c
@@ -216,15 +216,19 @@ winScreenInit(ScreenPtr pScreen, int argc, char **argv)
else
winErrorFVerb(2, "winScreenInit - Using software cursor\n");
- /*
- Note the screen origin in a normalized coordinate space where (0,0) is at the top left
- of the native virtual desktop area
- */
- pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN);
- pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN);
+ if (!noPanoramiXExtension) {
+ /*
+ Note the screen origin in a normalized coordinate space where (0,0) is at the top left
+ of the native virtual desktop area
+ */
+ pScreen->x =
+ pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN);
+ pScreen->y =
+ pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN);
- ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n",
- pScreen->myNum, pScreen->x, pScreen->y);
+ ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n",
+ pScreen->myNum, pScreen->x, pScreen->y);
+ }
#if CYGDEBUG || YES
winDebug("winScreenInit - returning\n");
@@ -309,8 +313,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
if (pScreenInfo->dwDepth == 8
&& (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
|| (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
- && pScreenInfo->fFullScreen)
- || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
&& pScreenInfo->fFullScreen))) {
winSetColormapFunctions(pScreen);
@@ -384,7 +386,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
/* Initialize the shadow framebuffer layer */
if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
- || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
|| pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
#ifdef XWIN_MULTIWINDOWEXTWM
&& !pScreenInfo->fMWExtWM
diff --git a/xorg-server/hw/xwin/winshaddd.c b/xorg-server/hw/xwin/winshaddd.c
deleted file mode 100644
index 4904eb440..000000000
--- a/xorg-server/hw/xwin/winshaddd.c
+++ /dev/null
@@ -1,1221 +0,0 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Dakshinamurthy Karra
- * Suhaib M Siddiqi
- * Peter Busch
- * Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/*
- * Local prototypes
- */
-
-static Bool
- winAllocateFBShadowDD(ScreenPtr pScreen);
-
-static void
- winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf);
-
-static Bool
- winCloseScreenShadowDD(ScreenPtr pScreen);
-
-static Bool
- winInitVisualsShadowDD(ScreenPtr pScreen);
-
-static Bool
- winAdjustVideoModeShadowDD(ScreenPtr pScreen);
-
-static Bool
- winBltExposedRegionsShadowDD(ScreenPtr pScreen);
-
-static Bool
- winActivateAppShadowDD(ScreenPtr pScreen);
-
-static Bool
- winRedrawScreenShadowDD(ScreenPtr pScreen);
-
-static Bool
- winRealizeInstalledPaletteShadowDD(ScreenPtr pScreen);
-
-static Bool
- winInstallColormapShadowDD(ColormapPtr pColormap);
-
-static Bool
- winStoreColorsShadowDD(ColormapPtr pmap, int ndef, xColorItem * pdefs);
-
-static Bool
- winCreateColormapShadowDD(ColormapPtr pColormap);
-
-static Bool
- winDestroyColormapShadowDD(ColormapPtr pColormap);
-
-static Bool
- winCreatePrimarySurfaceShadowDD(ScreenPtr pScreen);
-
-static Bool
- winReleasePrimarySurfaceShadowDD(ScreenPtr pScreen);
-
-/*
- * Create the primary surface and attach the clipper.
- * Used for both the initial surface creation and during
- * WM_DISPLAYCHANGE messages.
- */
-
-static Bool
-winCreatePrimarySurfaceShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC ddsd;
-
- /* Describe the primary surface */
- ZeroMemory(&ddsd, sizeof(ddsd));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS;
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-
- /* Create the primary surface */
- ddrval = IDirectDraw2_CreateSurface(pScreenPriv->pdd2,
- &ddsd, &pScreenPriv->pddsPrimary, NULL);
- if (FAILED(ddrval)) {
- ErrorF("winCreatePrimarySurfaceShadowDD - Could not create primary "
- "surface: %08x\n", (unsigned int) ddrval);
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug("winCreatePrimarySurfaceShadowDD - Created primary surface\n");
-#endif
-
- /*
- * Attach a clipper to the primary surface that will clip our blits to our
- * display window.
- */
- ddrval = IDirectDrawSurface2_SetClipper(pScreenPriv->pddsPrimary,
- pScreenPriv->pddcPrimary);
- if (FAILED(ddrval)) {
- ErrorF("winCreatePrimarySurfaceShadowDD - Primary attach clipper "
- "failed: %08x\n", (unsigned int) ddrval);
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug("winCreatePrimarySurfaceShadowDD - Attached clipper to "
- "primary surface\n");
-#endif
-
- /* Everything was correct */
- return TRUE;
-}
-
-/*
- * Detach the clipper and release the primary surface.
- * Called from WM_DISPLAYCHANGE.
- */
-
-static Bool
-winReleasePrimarySurfaceShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
-
- ErrorF("winReleasePrimarySurfaceShadowDD - Hello\n");
-
- /* Release the primary surface and clipper, if they exist */
- if (pScreenPriv->pddsPrimary) {
- /*
- * Detach the clipper from the primary surface.
- * NOTE: We do this explicity for clarity. The Clipper is not released.
- */
- IDirectDrawSurface2_SetClipper(pScreenPriv->pddsPrimary, NULL);
-
- ErrorF("winReleasePrimarySurfaceShadowDD - Detached clipper\n");
-
- /* Release the primary surface */
- IDirectDrawSurface2_Release(pScreenPriv->pddsPrimary);
- pScreenPriv->pddsPrimary = NULL;
- }
-
- ErrorF("winReleasePrimarySurfaceShadowDD - Released primary surface\n");
-
- return TRUE;
-}
-
-/*
- * Create a DirectDraw surface for the shadow framebuffer; also create
- * a primary surface object so we can blit to the display.
- *
- * Install a DirectDraw clipper on our primary surface object
- * that clips our blits to the unobscured client area of our display window.
- */
-
-static Bool
-winAllocateFBShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HRESULT ddrval = DD_OK;
- DDSURFACEDESC ddsd;
- DDSURFACEDESC *pddsdShadow = NULL;
-
-#if CYGDEBUG
- winDebug("winAllocateFBShadowDD\n");
-#endif
-
- /* Create a clipper */
- ddrval = (*g_fpDirectDrawCreateClipper) (0,
- &pScreenPriv->pddcPrimary, NULL);
- if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDD - Could not create clipper: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug("winAllocateFBShadowDD - Created a clipper\n");
-#endif
-
- /* Attach the clipper to our display window */
- ddrval = IDirectDrawClipper_SetHWnd(pScreenPriv->pddcPrimary,
- 0, pScreenPriv->hwndScreen);
- if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDD - Clipper not attached to "
- "window: %08x\n", (unsigned int) ddrval);
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug("winAllocateFBShadowDD - Attached clipper to window\n");
-#endif
-
- /* Create a DirectDraw object, store the address at lpdd */
- ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
- if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDD - Could not start DirectDraw: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug("winAllocateFBShadowDD () - Created and initialized DD\n");
-#endif
-
- /* Get a DirectDraw2 interface pointer */
- ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
- &IID_IDirectDraw2,
- (LPVOID *) &pScreenPriv->pdd2);
- if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
-
- /* Are we full screen? */
- if (pScreenInfo->fFullScreen) {
- DDSURFACEDESC ddsdCurrent;
- DWORD dwRefreshRateCurrent = 0;
- HDC hdc = NULL;
-
- /* Set the cooperative level to full screen */
- ddrval = IDirectDraw2_SetCooperativeLevel(pScreenPriv->pdd2,
- pScreenPriv->hwndScreen,
- DDSCL_EXCLUSIVE
- | DDSCL_FULLSCREEN);
- if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDD - Could not set "
- "cooperative level: %08x\n", (unsigned int) ddrval);
- return FALSE;
- }
-
- /*
- * We only need to get the current refresh rate for comparison
- * if a refresh rate has been passed on the command line.
- */
- if (pScreenInfo->dwRefreshRate != 0) {
- ZeroMemory(&ddsdCurrent, sizeof(ddsdCurrent));
- ddsdCurrent.dwSize = sizeof(ddsdCurrent);
-
- /* Get information about current display settings */
- ddrval = IDirectDraw2_GetDisplayMode(pScreenPriv->pdd2,
- &ddsdCurrent);
- if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDD - Could not get current "
- "refresh rate: %08x. Continuing.\n",
- (unsigned int) ddrval);
- dwRefreshRateCurrent = 0;
- }
- else {
- /* Grab the current refresh rate */
- dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate;
- }
- }
-
- /* Clean up the refresh rate */
- if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate) {
- /*
- * Refresh rate is non-specified or equal to current.
- */
- pScreenInfo->dwRefreshRate = 0;
- }
-
- /* Grab a device context for the screen */
- hdc = GetDC(NULL);
- if (hdc == NULL) {
- ErrorF("winAllocateFBShadowDD - GetDC () failed\n");
- return FALSE;
- }
-
- /* Only change the video mode when different than current mode */
- if (!pScreenInfo->fMultipleMonitors
- && (pScreenInfo->dwWidth != GetSystemMetrics(SM_CXSCREEN)
- || pScreenInfo->dwHeight != GetSystemMetrics(SM_CYSCREEN)
- || pScreenInfo->dwBPP != GetDeviceCaps(hdc, BITSPIXEL)
- || pScreenInfo->dwRefreshRate != 0)) {
- ErrorF("winAllocateFBShadowDD - Changing video mode\n");
-
- /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
- ddrval = IDirectDraw2_SetDisplayMode(pScreenPriv->pdd2,
- pScreenInfo->dwWidth,
- pScreenInfo->dwHeight,
- pScreenInfo->dwBPP,
- pScreenInfo->dwRefreshRate, 0);
- if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDD - Could not set "
- "full screen display mode: %08x\n",
- (unsigned int) ddrval);
- ErrorF
- ("winAllocateFBShadowDD - Using default driver refresh rate\n");
- ddrval =
- IDirectDraw2_SetDisplayMode(pScreenPriv->pdd2,
- pScreenInfo->dwWidth,
- pScreenInfo->dwHeight,
- pScreenInfo->dwBPP, 0, 0);
- if (FAILED(ddrval)) {
- ErrorF
- ("winAllocateFBShadowDD - Could not set default refresh rate "
- "full screen display mode: %08x\n",
- (unsigned int) ddrval);
- return FALSE;
- }
- }
- }
- else {
- ErrorF("winAllocateFBShadowDD - Not changing video mode\n");
- }
-
- /* Release our DC */
- ReleaseDC(NULL, hdc);
- hdc = NULL;
- }
- else {
- /* Set the cooperative level for windowed mode */
- ddrval = IDirectDraw2_SetCooperativeLevel(pScreenPriv->pdd2,
- pScreenPriv->hwndScreen,
- DDSCL_NORMAL);
- if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDD - Could not set "
- "cooperative level: %08x\n", (unsigned int) ddrval);
- return FALSE;
- }
- }
-
- /* Create the primary surface */
- if (!winCreatePrimarySurfaceShadowDD(pScreen)) {
- ErrorF("winAllocateFBShadowDD - winCreatePrimarySurfaceShadowDD "
- "failed\n");
- return FALSE;
- }
-
- /* Describe the shadow surface to be created */
- /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
- * as drawing, locking, and unlocking take forever
- * with video memory surfaces. In addition,
- * video memory is a somewhat scarce resource,
- * so you shouldn't be allocating video memory when
- * you have the option of using system memory instead.
- */
- ZeroMemory(&ddsd, sizeof(ddsd));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
- ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
- ddsd.dwHeight = pScreenInfo->dwHeight;
- ddsd.dwWidth = pScreenInfo->dwWidth;
-
- /* Create the shadow surface */
- ddrval = IDirectDraw2_CreateSurface(pScreenPriv->pdd2,
- &ddsd, &pScreenPriv->pddsShadow, NULL);
- if (FAILED(ddrval)) {
- ErrorF("winAllocateFBShadowDD - Could not create shadow "
- "surface: %08x\n", (unsigned int) ddrval);
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug("winAllocateFBShadowDD - Created shadow\n");
-#endif
-
- /* Allocate a DD surface description for our screen privates */
- pddsdShadow = pScreenPriv->pddsdShadow = malloc(sizeof(DDSURFACEDESC));
- if (pddsdShadow == NULL) {
- ErrorF("winAllocateFBShadowDD - Could not allocate surface "
- "description memory\n");
- return FALSE;
- }
- ZeroMemory(pddsdShadow, sizeof(*pddsdShadow));
- pddsdShadow->dwSize = sizeof(*pddsdShadow);
-
-#if CYGDEBUG
- winDebug("winAllocateFBShadowDD - Locking shadow\n");
-#endif
-
- /* Lock the shadow surface */
- ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsShadow,
- NULL, pddsdShadow, DDLOCK_WAIT, NULL);
- if (FAILED(ddrval) || pddsdShadow->lpSurface == NULL) {
- ErrorF("winAllocateFBShadowDD - Could not lock shadow "
- "surface: %08x\n", (unsigned int) ddrval);
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug("winAllocateFBShadowDD - Locked shadow\n");
-#endif
-
- /* We don't know how to deal with anything other than RGB */
- if (!(pddsdShadow->ddpfPixelFormat.dwFlags & DDPF_RGB)) {
- ErrorF("winAllocateFBShadowDD - Color format other than RGB\n");
- return FALSE;
- }
-
- /* Grab the pitch from the surface desc */
- pScreenInfo->dwStride = (pddsdShadow->u1.lPitch * 8)
- / pScreenInfo->dwBPP;
-
- /* Save the pointer to our surface memory */
- pScreenInfo->pfb = pddsdShadow->lpSurface;
-
- /* Grab the color depth and masks from the surface description */
- pScreenPriv->dwRedMask = pddsdShadow->ddpfPixelFormat.u2.dwRBitMask;
- pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask;
- pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask;
-
-#if CYGDEBUG
- winDebug("winAllocateFBShadowDD - Returning\n");
-#endif
-
- return TRUE;
-}
-
-static void
-winFreeFBShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Free the shadow surface, if there is one */
- if (pScreenPriv->pddsShadow) {
- IDirectDrawSurface2_Unlock(pScreenPriv->pddsShadow, NULL);
- IDirectDrawSurface2_Release(pScreenPriv->pddsShadow);
- pScreenPriv->pddsShadow = NULL;
- }
-
- /* Detach the clipper from the primary surface and release the primary surface, if there is one */
- winReleasePrimarySurfaceShadowDD(pScreen);
-
- /* Release the clipper object */
- if (pScreenPriv->pddcPrimary) {
- IDirectDrawClipper_Release(pScreenPriv->pddcPrimary);
- pScreenPriv->pddcPrimary = NULL;
- }
-
- /* Free the DirectDraw2 object, if there is one */
- if (pScreenPriv->pdd2) {
- IDirectDraw2_RestoreDisplayMode(pScreenPriv->pdd2);
- IDirectDraw2_Release(pScreenPriv->pdd2);
- pScreenPriv->pdd2 = NULL;
- }
-
- /* Free the DirectDraw object, if there is one */
- if (pScreenPriv->pdd) {
- IDirectDraw_Release(pScreenPriv->pdd);
- pScreenPriv->pdd = NULL;
- }
-
- /* Invalidate the ScreenInfo's fb pointer */
- pScreenInfo->pfb = NULL;
-}
-
-/*
- * Transfer the damaged regions of the shadow framebuffer to the display.
- */
-
-static void
-winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RegionPtr damage = shadowDamage(pBuf);
- HRESULT ddrval = DD_OK;
- RECT rcDest, rcSrc;
- POINT ptOrigin;
- DWORD dwBox = RegionNumRects(damage);
- BoxPtr pBox = RegionRects(damage);
- HRGN hrgnCombined = NULL;
-
- /*
- * Return immediately if the app is not active
- * and we are fullscreen, or if we have a bad display depth
- */
- if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
- || pScreenPriv->fBadDepth)
- return;
-
- /* Return immediately if we didn't get needed surfaces */
- if (!pScreenPriv->pddsPrimary || !pScreenPriv->pddsShadow)
- return;
-
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
- MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
-
- /* Unlock the shadow surface, so we can blit */
- ddrval = IDirectDrawSurface2_Unlock(pScreenPriv->pddsShadow, NULL);
- if (FAILED(ddrval)) {
- ErrorF("winShadowUpdateDD - Unlock failed\n");
- return;
- }
-
- /*
- * Handle small regions with multiple blits,
- * handle large regions by creating a clipping region and
- * doing a single blit constrained to that clipping region.
- */
- if (pScreenInfo->dwClipUpdatesNBoxes == 0
- || dwBox < pScreenInfo->dwClipUpdatesNBoxes) {
- /* Loop through all boxes in the damaged region */
- while (dwBox--) {
- /* Assign damage box to source rectangle */
- rcSrc.left = pBox->x1;
- rcSrc.top = pBox->y1;
- rcSrc.right = pBox->x2;
- rcSrc.bottom = pBox->y2;
-
- /* Calculate destination rectange */
- rcDest.left = ptOrigin.x + rcSrc.left;
- rcDest.top = ptOrigin.y + rcSrc.top;
- rcDest.right = ptOrigin.x + rcSrc.right;
- rcDest.bottom = ptOrigin.y + rcSrc.bottom;
-
- /* Blit the damaged areas */
- ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
- &rcDest,
- pScreenPriv->pddsShadow,
- &rcSrc, DDBLT_WAIT, NULL);
-
- /* Get a pointer to the next box */
- ++pBox;
- }
- }
- else {
- BoxPtr pBoxExtents = RegionExtents(damage);
-
- /* Compute a GDI region from the damaged region */
- hrgnCombined =
- CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2,
- pBoxExtents->y2);
-
- /* Install the GDI region as a clipping region */
- SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);
- DeleteObject(hrgnCombined);
- hrgnCombined = NULL;
-
- /* Calculating a bounding box for the source is easy */
- rcSrc.left = pBoxExtents->x1;
- rcSrc.top = pBoxExtents->y1;
- rcSrc.right = pBoxExtents->x2;
- rcSrc.bottom = pBoxExtents->y2;
-
- /* Calculating a bounding box for the destination is trickier */
- rcDest.left = ptOrigin.x + rcSrc.left;
- rcDest.top = ptOrigin.y + rcSrc.top;
- rcDest.right = ptOrigin.x + rcSrc.right;
- rcDest.bottom = ptOrigin.y + rcSrc.bottom;
-
- /* Our Blt should be clipped to the invalidated region */
- ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
- &rcDest,
- pScreenPriv->pddsShadow,
- &rcSrc, DDBLT_WAIT, NULL);
-
- /* Reset the clip region */
- SelectClipRgn(pScreenPriv->hdcScreen, NULL);
- }
-
- /* Relock the shadow surface */
- ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsShadow,
- NULL,
- pScreenPriv->pddsdShadow,
- DDLOCK_WAIT, NULL);
- if (FAILED(ddrval)) {
- ErrorF("winShadowUpdateDD - Lock failed\n");
- return;
- }
-
- /* Has our memory pointer changed? */
- if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) {
- ErrorF("winShadowUpdateDD - Memory location of the shadow "
- "surface has changed, trying to update the root window "
- "pixmap header to point to the new address. If you get "
- "this message and " PROJECT_NAME " freezes or crashes "
- "after this message then send a problem report and your "
- "%s file to " BUILDERADDR "\n", g_pszLogFile);
-
- /* Location of shadow framebuffer has changed */
- winUpdateFBPointer(pScreen, pScreenPriv->pddsdShadow->lpSurface);
- }
-}
-
-static Bool
-winInitScreenShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
-
- /* Get a device context for the screen */
- pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen);
-
- return winAllocateFBShadowDD(pScreen);
-}
-
-/*
- * Call the wrapped CloseScreen function.
- *
- * Free our resources and private structures.
- */
-
-static Bool
-winCloseScreenShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- Bool fReturn;
-
-#if CYGDEBUG
- winDebug("winCloseScreenShadowDD - Freeing screen resources\n");
-#endif
-
- /* Flag that the screen is closed */
- pScreenPriv->fClosed = TRUE;
- pScreenPriv->fActive = FALSE;
-
- /* Call the wrapped CloseScreen procedure */
- WIN_UNWRAP(CloseScreen);
- if (pScreen->CloseScreen)
- fReturn = (*pScreen->CloseScreen) (pScreen);
-
- winFreeFBShadowDD(pScreen);
-
- /* Free the screen DC */
- ReleaseDC(pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
-
- /* Delete the window property */
- RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
-
- /* Delete tray icon, if we have one */
- if (!pScreenInfo->fNoTrayIcon)
- winDeleteNotifyIcon(pScreenPriv);
-
- /* Free the exit confirmation dialog box, if it exists */
- if (g_hDlgExit != NULL) {
- DestroyWindow(g_hDlgExit);
- g_hDlgExit = NULL;
- }
-
- /* Kill our window */
- if (pScreenPriv->hwndScreen) {
- DestroyWindow(pScreenPriv->hwndScreen);
- pScreenPriv->hwndScreen = NULL;
- }
-
-#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
- /* Destroy the thread startup mutex */
- pthread_mutex_destroy(&pScreenPriv->pmServerStarted);
-#endif
-
- /* Kill our screeninfo's pointer to the screen */
- pScreenInfo->pScreen = NULL;
-
- /* Free the screen privates for this screen */
- free((void *) pScreenPriv);
-
- return fReturn;
-}
-
-/*
- * Tell mi what sort of visuals we need.
- *
- * Generally we only need one visual, as our screen can only
- * handle one format at a time, I believe. You may want
- * to verify that last sentence.
- */
-
-static Bool
-winInitVisualsShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- DWORD dwRedBits, dwGreenBits, dwBlueBits;
-
- /* Count the number of ones in each color mask */
- dwRedBits = winCountBits(pScreenPriv->dwRedMask);
- dwGreenBits = winCountBits(pScreenPriv->dwGreenMask);
- dwBlueBits = winCountBits(pScreenPriv->dwBlueMask);
-
- /* Store the maximum number of ones in a color mask as the bitsPerRGB */
- if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0)
- pScreenPriv->dwBitsPerRGB = 8;
- else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwRedBits;
- else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
- pScreenPriv->dwBitsPerRGB = dwGreenBits;
- else
- pScreenPriv->dwBitsPerRGB = dwBlueBits;
-
- ErrorF("winInitVisualsShadowDD - Masks %08x %08x %08x BPRGB %d d %d "
- "bpp %d\n",
- (unsigned int) pScreenPriv->dwRedMask,
- (unsigned int) pScreenPriv->dwGreenMask,
- (unsigned int) pScreenPriv->dwBlueMask,
- (int) pScreenPriv->dwBitsPerRGB,
- (int) pScreenInfo->dwDepth, (int) pScreenInfo->dwBPP);
-
- /* Create a single visual according to the Windows screen depth */
- switch (pScreenInfo->dwDepth) {
- case 24:
- case 16:
- case 15:
- /* Create the real visual */
- if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
- TrueColorMask,
- pScreenPriv->dwBitsPerRGB,
- TrueColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask)) {
- ErrorF("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
- "failed for TrueColor\n");
- return FALSE;
- }
-
-#ifdef XWIN_EMULATEPSEUDO
- if (!pScreenInfo->fEmulatePseudo)
- break;
-
- /* Setup a pseudocolor visual */
- if (!miSetVisualTypesAndMasks(8, PseudoColorMask, 8, -1, 0, 0, 0)) {
- ErrorF("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
- "failed for PseudoColor\n");
- return FALSE;
- }
-#endif
- break;
-
- case 8:
- if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
- pScreenInfo->fFullScreen
- ? PseudoColorMask : StaticColorMask,
- pScreenPriv->dwBitsPerRGB,
- pScreenInfo->fFullScreen
- ? PseudoColor : StaticColor,
- pScreenPriv->dwRedMask,
- pScreenPriv->dwGreenMask,
- pScreenPriv->dwBlueMask)) {
- ErrorF("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
- "failed\n");
- return FALSE;
- }
- break;
-
- default:
- ErrorF("winInitVisualsShadowDD - Unknown screen depth\n");
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug("winInitVisualsShadowDD - Returning\n");
-#endif
-
- return TRUE;
-}
-
-/*
- * Adjust the user proposed video mode
- */
-
-static Bool
-winAdjustVideoModeShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HDC hdc = NULL;
- DWORD dwBPP;
-
- /* We're in serious trouble if we can't get a DC */
- hdc = GetDC(NULL);
- if (hdc == NULL) {
- ErrorF("winAdjustVideoModeShadowDD - GetDC () failed\n");
- return FALSE;
- }
-
- /* Query GDI for current display depth */
- dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
-
- /* DirectDraw can only change the depth in fullscreen mode */
- if (!(pScreenInfo->fFullScreen && (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) {
- /* Otherwise, We'll use GDI's depth */
- pScreenInfo->dwBPP = dwBPP;
- }
-
- /* Release our DC */
- ReleaseDC(NULL, hdc);
- return TRUE;
-}
-
-/*
- * Blt exposed regions to the screen
- */
-
-static Bool
-winBltExposedRegionsShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RECT rcSrc, rcDest;
- POINT ptOrigin;
- HDC hdcUpdate = NULL;
- PAINTSTRUCT ps;
- HRESULT ddrval = DD_OK;
- Bool fReturn = TRUE;
- Bool fLocked = TRUE;
- int i;
-
- /* BeginPaint gives us an hdc that clips to the invalidated region */
- hdcUpdate = BeginPaint(pScreenPriv->hwndScreen, &ps);
- if (hdcUpdate == NULL) {
- ErrorF("winBltExposedRegionsShadowDD - BeginPaint () returned "
- "a NULL device context handle. Aborting blit attempt.\n");
- return FALSE;
- }
-
- /* Unlock the shadow surface, so we can blit */
- ddrval = IDirectDrawSurface2_Unlock(pScreenPriv->pddsShadow, NULL);
- if (FAILED(ddrval)) {
- fReturn = FALSE;
- goto winBltExposedRegionsShadowDD_Exit;
- }
- else {
- /* Flag that we have unlocked the shadow surface */
- fLocked = FALSE;
- }
-
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
-
- MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
- rcDest.left = ptOrigin.x;
- rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
- rcDest.top = ptOrigin.y;
- rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
-
- /* Source can be enter shadow surface, as Blt should clip */
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.right = pScreenInfo->dwWidth;
- rcSrc.bottom = pScreenInfo->dwHeight;
-
- /* Try to regain the primary surface and blit again if we've lost it */
- for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i) {
- /* Our Blt should be clipped to the invalidated region */
- ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
- &rcDest,
- pScreenPriv->pddsShadow,
- &rcSrc, DDBLT_WAIT, NULL);
- if (ddrval == DDERR_SURFACELOST) {
- /* Surface was lost */
- ErrorF("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt "
- "reported that the primary surface was lost, "
- "trying to restore, retry: %d\n", i + 1);
-
- /* Try to restore the surface, once */
- ddrval = IDirectDrawSurface2_Restore(pScreenPriv->pddsPrimary);
- ErrorF("winBltExposedRegionsShadowDD - "
- "IDirectDrawSurface2_Restore returned: ");
- if (ddrval == DD_OK)
- ErrorF("DD_OK\n");
- else if (ddrval == DDERR_WRONGMODE)
- ErrorF("DDERR_WRONGMODE\n");
- else if (ddrval == DDERR_INCOMPATIBLEPRIMARY)
- ErrorF("DDERR_INCOMPATIBLEPRIMARY\n");
- else if (ddrval == DDERR_UNSUPPORTED)
- ErrorF("DDERR_UNSUPPORTED\n");
- else if (ddrval == DDERR_INVALIDPARAMS)
- ErrorF("DDERR_INVALIDPARAMS\n");
- else if (ddrval == DDERR_INVALIDOBJECT)
- ErrorF("DDERR_INVALIDOBJECT\n");
- else
- ErrorF("unknown error: %08x\n", (unsigned int) ddrval);
-
- /* Loop around to try the blit one more time */
- continue;
- }
- else if (FAILED(ddrval)) {
- fReturn = FALSE;
- ErrorF("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt "
- "failed, but surface not lost: %08x %d\n",
- (unsigned int) ddrval, (int) ddrval);
- goto winBltExposedRegionsShadowDD_Exit;
- }
- else {
- /* Success, stop looping */
- break;
- }
- }
-
- /* Relock the shadow surface */
- ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsShadow,
- NULL,
- pScreenPriv->pddsdShadow,
- DDLOCK_WAIT, NULL);
- if (FAILED(ddrval)) {
- fReturn = FALSE;
- ErrorF("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Lock "
- "failed\n");
- goto winBltExposedRegionsShadowDD_Exit;
- }
- else {
- /* Indicate that we have relocked the shadow surface */
- fLocked = TRUE;
- }
-
- /* Has our memory pointer changed? */
- if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
- winUpdateFBPointer(pScreen, pScreenPriv->pddsdShadow->lpSurface);
-
- winBltExposedRegionsShadowDD_Exit:
- /* EndPaint frees the DC */
- if (hdcUpdate != NULL)
- EndPaint(pScreenPriv->hwndScreen, &ps);
-
- /*
- * Relock the surface if it is not locked. We don't care if locking fails,
- * as it will cause the server to shutdown within a few more operations.
- */
- if (!fLocked) {
- IDirectDrawSurface2_Lock(pScreenPriv->pddsShadow,
- NULL,
- pScreenPriv->pddsdShadow, DDLOCK_WAIT, NULL);
-
- /* Has our memory pointer changed? */
- if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
- winUpdateFBPointer(pScreen, pScreenPriv->pddsdShadow->lpSurface);
-
- fLocked = TRUE;
- }
- return fReturn;
-}
-
-/*
- * Do any engine-specific appliation-activation processing
- */
-
-static Bool
-winActivateAppShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
-
- /*
- * Do we have a surface?
- * Are we active?
- * Are we fullscreen?
- */
- if (pScreenPriv != NULL
- && pScreenPriv->pddsPrimary != NULL && pScreenPriv->fActive) {
- /* Primary surface was lost, restore it */
- IDirectDrawSurface2_Restore(pScreenPriv->pddsPrimary);
- }
-
- return TRUE;
-}
-
-/*
- * Reblit the shadow framebuffer to the screen.
- */
-
-static Bool
-winRedrawScreenShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- HRESULT ddrval = DD_OK;
- RECT rcSrc, rcDest;
- POINT ptOrigin;
-
- /* Get the origin of the window in the screen coords */
- ptOrigin.x = pScreenInfo->dwXOffset;
- ptOrigin.y = pScreenInfo->dwYOffset;
- MapWindowPoints(pScreenPriv->hwndScreen,
- HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
- rcDest.left = ptOrigin.x;
- rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
- rcDest.top = ptOrigin.y;
- rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
-
- /* Source can be entire shadow surface, as Blt should clip for us */
- rcSrc.left = 0;
- rcSrc.top = 0;
- rcSrc.right = pScreenInfo->dwWidth;
- rcSrc.bottom = pScreenInfo->dwHeight;
-
- /* Redraw the whole window, to take account for the new colors */
- ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
- &rcDest,
- pScreenPriv->pddsShadow,
- &rcSrc, DDBLT_WAIT, NULL);
- if (FAILED(ddrval)) {
- ErrorF("winRedrawScreenShadowDD - IDirectDrawSurface_Blt () "
- "failed: %08x\n", (unsigned int) ddrval);
- }
-
- return TRUE;
-}
-
-/*
- * Realize the currently installed colormap
- */
-
-static Bool
-winRealizeInstalledPaletteShadowDD(ScreenPtr pScreen)
-{
- return TRUE;
-}
-
-/*
- * Install the specified colormap
- */
-
-static Bool
-winInstallColormapShadowDD(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
-
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
- HRESULT ddrval = DD_OK;
-
- /* Install the DirectDraw palette on the primary surface */
- ddrval = IDirectDrawSurface2_SetPalette(pScreenPriv->pddsPrimary,
- pCmapPriv->lpDDPalette);
- if (FAILED(ddrval)) {
- ErrorF("winInstallColormapShadowDD - Failed installing the "
- "DirectDraw palette.\n");
- return FALSE;
- }
-
- /* Save a pointer to the newly installed colormap */
- pScreenPriv->pcmapInstalled = pColormap;
-
- return TRUE;
-}
-
-/*
- * Store the specified colors in the specified colormap
- */
-
-static Bool
-winStoreColorsShadowDD(ColormapPtr pColormap, int ndef, xColorItem * pdefs)
-{
- ScreenPtr pScreen = pColormap->pScreen;
-
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
- ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
- HRESULT ddrval = DD_OK;
-
- /* Put the X colormap entries into the Windows logical palette */
- ddrval = IDirectDrawPalette_SetEntries(pCmapPriv->lpDDPalette,
- 0,
- pdefs[0].pixel,
- ndef,
- pCmapPriv->peColors
- + pdefs[0].pixel);
- if (FAILED(ddrval)) {
- ErrorF("winStoreColorsShadowDD - SetEntries () failed\n");
- return FALSE;
- }
-
- /* Don't install the DirectDraw palette if the colormap is not installed */
- if (pColormap != curpmap) {
- return TRUE;
- }
-
- if (!winInstallColormapShadowDD(pColormap)) {
- ErrorF("winStoreColorsShadowDD - Failed installing colormap\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * Colormap initialization procedure
- */
-
-static Bool
-winCreateColormapShadowDD(ColormapPtr pColormap)
-{
- HRESULT ddrval = DD_OK;
- ScreenPtr pScreen = pColormap->pScreen;
-
- winScreenPriv(pScreen);
- winCmapPriv(pColormap);
-
- /* Create a DirectDraw palette */
- ddrval = IDirectDraw2_CreatePalette(pScreenPriv->pdd,
- DDPCAPS_8BIT | DDPCAPS_ALLOW256,
- pCmapPriv->peColors,
- &pCmapPriv->lpDDPalette, NULL);
- if (FAILED(ddrval)) {
- ErrorF("winCreateColormapShadowDD - CreatePalette failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * Colormap destruction procedure
- */
-
-static Bool
-winDestroyColormapShadowDD(ColormapPtr pColormap)
-{
- winScreenPriv(pColormap->pScreen);
- winCmapPriv(pColormap);
- HRESULT ddrval = DD_OK;
-
- /*
- * Is colormap to be destroyed the default?
- *
- * Non-default colormaps should have had winUninstallColormap
- * called on them before we get here. The default colormap
- * will not have had winUninstallColormap called on it. Thus,
- * we need to handle the default colormap in a special way.
- */
- if (pColormap->flags & IsDefault) {
-#if CYGDEBUG
- winDebug("winDestroyColormapShadowDD - Destroying default "
- "colormap\n");
-#endif
-
- /*
- * FIXME: Walk the list of all screens, popping the default
- * palette out of each screen device context.
- */
-
- /* Pop the palette out of the primary surface */
- ddrval = IDirectDrawSurface2_SetPalette(pScreenPriv->pddsPrimary, NULL);
- if (FAILED(ddrval)) {
- ErrorF("winDestroyColormapShadowDD - Failed freeing the "
- "default colormap DirectDraw palette.\n");
- return FALSE;
- }
-
- /* Clear our private installed colormap pointer */
- pScreenPriv->pcmapInstalled = NULL;
- }
-
- /* Release the palette */
- IDirectDrawPalette_Release(pCmapPriv->lpDDPalette);
-
- /* Invalidate the colormap privates */
- pCmapPriv->lpDDPalette = NULL;
-
- return TRUE;
-}
-
-/*
- * Set engine specific functions
- */
-
-Bool
-winSetEngineFunctionsShadowDD(ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
- /* Set our pointers */
- pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD;
- pScreenPriv->pwinFreeFB = winFreeFBShadowDD;
- pScreenPriv->pwinShadowUpdate = winShadowUpdateDD;
- pScreenPriv->pwinInitScreen = winInitScreenShadowDD;
- pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD;
- pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD;
- pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD;
- if (pScreenInfo->fFullScreen)
- pScreenPriv->pwinCreateBoundingWindow =
- winCreateBoundingWindowFullScreen;
- else
- pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
- pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
- pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDD;
- pScreenPriv->pwinActivateApp = winActivateAppShadowDD;
- pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDD;
- pScreenPriv->pwinRealizeInstalledPalette
- = winRealizeInstalledPaletteShadowDD;
- pScreenPriv->pwinInstallColormap = winInstallColormapShadowDD;
- pScreenPriv->pwinStoreColors = winStoreColorsShadowDD;
- pScreenPriv->pwinCreateColormap = winCreateColormapShadowDD;
- pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDD;
- pScreenPriv->pwinHotKeyAltTab =
- (winHotKeyAltTabProcPtr) (void (*)(void)) NoopDDA;
- pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDD;
- pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDD;
-#ifdef XWIN_MULTIWINDOW
- pScreenPriv->pwinFinishCreateWindowsWindow =
- (winFinishCreateWindowsWindowProcPtr) (void (*)(void)) NoopDDA;
-#endif
-
- return TRUE;
-}
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c
index 1bf3f5cde..3228fa481 100644
--- a/xorg-server/hw/xwin/winwndproc.c
+++ b/xorg-server/hw/xwin/winwndproc.c
@@ -162,8 +162,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
* their own mode when they become active.
*/
if (s_pScreenInfo->fFullScreen
- && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
- || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) {
+ || (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) {
break;
}
@@ -186,8 +185,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
*/
if (s_pScreenInfo->dwBPP !=
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)) {
- if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD ||
- s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) {
+ if (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) {
/* Cannot display the visual until the depth is restored */
ErrorF("winWindowProc - Disruptive change in depth\n");
diff --git a/xorg-server/include/Makefile.am b/xorg-server/include/Makefile.am
index 168b00f70..738b582e9 100644
--- a/xorg-server/include/Makefile.am
+++ b/xorg-server/include/Makefile.am
@@ -33,6 +33,7 @@ sdk_HEADERS = \
misc.h \
miscstruct.h \
opaque.h \
+ nonsdk_extinit.h \
optionstr.h \
os.h \
pixmap.h \
diff --git a/xorg-server/include/extinit.h b/xorg-server/include/extinit.h
index fa5f29378..4ad4fcac0 100644
--- a/xorg-server/include/extinit.h
+++ b/xorg-server/include/extinit.h
@@ -163,11 +163,6 @@ extern void SELinuxExtensionInit(void);
extern void XTestExtensionInit(void);
#endif
-#ifdef INXQUARTZ
-extern _X_EXPORT Bool noPseudoramiXExtension;
-extern void PseudoramiXExtensionInit(void);
-#endif
-
#if defined(XV)
#include <X11/extensions/Xv.h>
#include <X11/extensions/XvMC.h>
diff --git a/xorg-server/include/nonsdk_extinit.h b/xorg-server/include/nonsdk_extinit.h
new file mode 100644
index 000000000..da8d370bd
--- /dev/null
+++ b/xorg-server/include/nonsdk_extinit.h
@@ -0,0 +1,35 @@
+/***********************************************************
+
+Copyright 2014 Jon TURNEY
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+******************************************************************/
+
+#ifndef NONSDK_EXT_INIT_H
+#define NONSDK_EXT_INIT_H
+
+/* this is separate from extinit.h to avoid references to these symbols being
+ pulled in by sdksyms */
+
+extern _X_EXPORT Bool noPseudoramiXExtension;
+extern void PseudoramiXExtensionInit(void);
+
+#endif
diff --git a/xorg-server/include/protocol-versions.h b/xorg-server/include/protocol-versions.h
index fc428c8cf..be532ff55 100644
--- a/xorg-server/include/protocol-versions.h
+++ b/xorg-server/include/protocol-versions.h
@@ -73,7 +73,7 @@
/* RandR */
#define SERVER_RANDR_MAJOR_VERSION 1
-#define SERVER_RANDR_MINOR_VERSION 4
+#define SERVER_RANDR_MINOR_VERSION 5
/* Record */
#define SERVER_RECORD_MAJOR_VERSION 1
diff --git a/xorg-server/mi/mifillarc.c b/xorg-server/mi/mifillarc.c
index 246d70ff4..888519edf 100644
--- a/xorg-server/mi/mifillarc.c
+++ b/xorg-server/mi/mifillarc.c
@@ -660,6 +660,11 @@ miPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs_all, xArc * parcs)
if (narcs && nspans + arc->height > MAX_SPANS_PER_LOOP)
break;
nspans += arc->height;
+
+ /* A pie-slice arc may add another pile of spans */
+ if (pGC->arcMode == ArcPieSlice &&
+ (-FULLCIRCLE < arc->angle2 && arc->angle2 < FULLCIRCLE))
+ nspans += (arc->height + 1) >> 1;
}
pts = points = malloc (sizeof (DDXPointRec) * nspans +
diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c
index 5872bf534..086d2c3fb 100644
--- a/xorg-server/mi/miinitext.c
+++ b/xorg-server/mi/miinitext.c
@@ -108,6 +108,9 @@ SOFTWARE.
#include "misc.h"
#include "extension.h"
#include "extinit.h"
+#ifdef INXQUARTZ
+#include "nonsdk_extinit.h"
+#endif
#include "micmap.h"
#include "globals.h"
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index 0532c2eb7..3db5c5333 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -355,6 +355,7 @@ vpnprintf(char *string, int size_in, const char *f, va_list args)
uint64_t ui;
int64_t si;
size_t size = size_in;
+ int precision;
for (; f_idx < f_len && s_idx < size - 1; f_idx++) {
int length_modifier = 0;
@@ -365,9 +366,29 @@ vpnprintf(char *string, int size_in, const char *f, va_list args)
f_idx++;
- /* silently swallow digit length modifiers */
- while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9') || f[f_idx] == '.'))
+ /* silently swallow minimum field width */
+ if (f[f_idx] == '*') {
f_idx++;
+ va_arg(args, int);
+ } else {
+ while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9')))
+ f_idx++;
+ }
+
+ /* is there a precision? */
+ precision = size;
+ if (f[f_idx] == '.') {
+ f_idx++;
+ if (f[f_idx] == '*') {
+ f_idx++;
+ /* precision is supplied in an int argument */
+ precision = va_arg(args, int);
+ } else {
+ /* silently swallow precision digits */
+ while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9')))
+ f_idx++;
+ }
+ }
/* non-digit length modifiers */
if (f_idx < f_len) {
@@ -383,9 +404,8 @@ vpnprintf(char *string, int size_in, const char *f, va_list args)
switch (f[f_idx]) {
case 's':
string_arg = va_arg(args, char*);
- p_len = strlen_sigsafe(string_arg);
- for (i = 0; i < p_len && s_idx < size - 1; i++)
+ for (i = 0; string_arg[i] != 0 && s_idx < size - 1 && s_idx < precision; i++)
string[s_idx++] = string_arg[i];
break;
diff --git a/xorg-server/os/xdmcp.c b/xorg-server/os/xdmcp.c
index b6e97c928..bc5a70706 100644
--- a/xorg-server/os/xdmcp.c
+++ b/xorg-server/os/xdmcp.c
@@ -48,6 +48,11 @@
#include <netdir.h>
#endif
+#define XSERV_t
+#define TRANS_SERVER
+#define TRANS_REOPEN
+#include <X11/Xtrans/Xtrans.h>
+
#ifdef XDMCP
#undef REQUEST
@@ -242,6 +247,14 @@ XdmcpUseMsg(void)
ErrorF("-displayID display-id manufacturer display ID for request\n");
}
+static void
+XdmcpDefaultListen(void)
+{
+ /* Even when configured --disable-listen-tcp, we should listen on tcp in
+ XDMCP modes */
+ _XSERVTransListen("tcp");
+}
+
int
XdmcpOptions(int argc, char **argv, int i)
{
@@ -249,11 +262,13 @@ XdmcpOptions(int argc, char **argv, int i)
get_manager_by_name(argc, argv, i++);
XDM_INIT_STATE = XDM_QUERY;
AccessUsingXdmcp();
+ XdmcpDefaultListen();
return i + 1;
}
if (strcmp(argv[i], "-broadcast") == 0) {
XDM_INIT_STATE = XDM_BROADCAST;
AccessUsingXdmcp();
+ XdmcpDefaultListen();
return i + 1;
}
#if defined(IPv6) && defined(AF_INET6)
@@ -261,6 +276,7 @@ XdmcpOptions(int argc, char **argv, int i)
i = get_mcast_options(argc, argv, ++i);
XDM_INIT_STATE = XDM_MULTICAST;
AccessUsingXdmcp();
+ XdmcpDefaultListen();
return i + 1;
}
#endif
@@ -268,6 +284,7 @@ XdmcpOptions(int argc, char **argv, int i)
get_manager_by_name(argc, argv, i++);
XDM_INIT_STATE = XDM_INDIRECT;
AccessUsingXdmcp();
+ XdmcpDefaultListen();
return i + 1;
}
if (strcmp(argv[i], "-port") == 0) {
diff --git a/xorg-server/pseudoramiX/pseudoramiX.c b/xorg-server/pseudoramiX/pseudoramiX.c
index f47c7836d..e59ca1312 100644
--- a/xorg-server/pseudoramiX/pseudoramiX.c
+++ b/xorg-server/pseudoramiX/pseudoramiX.c
@@ -39,7 +39,7 @@
#include "pseudoramiX.h"
#include "extnsionst.h"
-#include "extinit.h"
+#include "nonsdk_extinit.h"
#include "dixstruct.h"
#include "window.h"
#include <X11/extensions/panoramiXproto.h>
@@ -49,6 +49,7 @@
#define DEBUG_LOG PseudoramiXDebug
Bool noPseudoramiXExtension = FALSE;
+extern Bool noRRXineramaExtension;
extern int
ProcPanoramiXQueryVersion(ClientPtr client);
@@ -190,6 +191,9 @@ PseudoramiXExtensionInit(void)
}
}
+ /* Do not allow RRXinerama to initialize if we did */
+ noRRXineramaExtension = success;
+
if (!success) {
ErrorF("%s Extension (PseudoramiX) failed to initialize\n",
PANORAMIX_PROTOCOL_NAME);
diff --git a/xorg-server/pseudoramiX/pseudoramiX.h b/xorg-server/pseudoramiX/pseudoramiX.h
index f063919dd..5393062ee 100644
--- a/xorg-server/pseudoramiX/pseudoramiX.h
+++ b/xorg-server/pseudoramiX/pseudoramiX.h
@@ -2,8 +2,6 @@
* Minimal implementation of PanoramiX/Xinerama
*/
-extern int noPseudoramiXExtension;
-
void
PseudoramiXAddScreen(int x, int y, int w, int h);
void
diff --git a/xorg-server/randr/Makefile.am b/xorg-server/randr/Makefile.am
index ccaff3f02..90dc9ec9a 100644
--- a/xorg-server/randr/Makefile.am
+++ b/xorg-server/randr/Makefile.am
@@ -15,6 +15,7 @@ librandr_la_SOURCES = \
rrdispatch.c \
rrinfo.c \
rrmode.c \
+ rrmonitor.c \
rroutput.c \
rrpointer.c \
rrproperty.c \
diff --git a/xorg-server/randr/randr.c b/xorg-server/randr/randr.c
index 6e3f14b4e..ad1dda227 100644
--- a/xorg-server/randr/randr.c
+++ b/xorg-server/randr/randr.c
@@ -98,6 +98,8 @@ RRCloseScreen(ScreenPtr pScreen)
if (pScrPriv->provider)
RRProviderDestroy(pScrPriv->provider);
+ RRMonitorClose(pScreen);
+
free(pScrPriv->crtcs);
free(pScrPriv->outputs);
free(pScrPriv);
@@ -333,6 +335,8 @@ RRScreenInit(ScreenPtr pScreen)
pScrPriv->numCrtcs = 0;
pScrPriv->crtcs = NULL;
+ RRMonitorInit(pScreen);
+
RRNScreens += 1; /* keep count of screens that implement randr */
return TRUE;
}
diff --git a/xorg-server/randr/randrstr.h b/xorg-server/randr/randrstr.h
index 13e6a8596..438a52aeb 100644
--- a/xorg-server/randr/randrstr.h
+++ b/xorg-server/randr/randrstr.h
@@ -80,6 +80,7 @@ typedef struct _rrProperty RRPropertyRec, *RRPropertyPtr;
typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
typedef struct _rrOutput RROutputRec, *RROutputPtr;
typedef struct _rrProvider RRProviderRec, *RRProviderPtr;
+typedef struct _rrMonitor RRMonitorRec, *RRMonitorPtr;
struct _rrMode {
int refcnt;
@@ -169,6 +170,22 @@ struct _rrProvider {
struct _rrProvider *output_source;
};
+typedef struct _rrMonitorGeometry {
+ BoxRec box;
+ CARD32 mmWidth;
+ CARD32 mmHeight;
+} RRMonitorGeometryRec, *RRMonitorGeometryPtr;
+
+struct _rrMonitor {
+ Atom name;
+ ScreenPtr pScreen;
+ int numOutputs;
+ RROutput *outputs;
+ Bool primary;
+ Bool automatic;
+ RRMonitorGeometryRec geometry;
+};
+
#if RANDR_12_INTERFACE
typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
CARD16 width,
@@ -338,6 +355,9 @@ typedef struct _rrScrPriv {
RRProviderDestroyProcPtr rrProviderDestroy;
+ int numMonitors;
+ RRMonitorPtr *monitors;
+
} rrScrPrivRec, *rrScrPrivPtr;
extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
@@ -981,6 +1001,30 @@ extern _X_EXPORT void
RRXineramaExtensionInit(void);
#endif
+void
+RRMonitorInit(ScreenPtr screen);
+
+Bool
+RRMonitorMakeList(ScreenPtr screen, Bool get_active, RRMonitorPtr *monitors_ret, int *nmon_ret);
+
+int
+RRMonitorCountList(ScreenPtr screen);
+
+void
+RRMonitorFreeList(RRMonitorPtr monitors, int nmon);
+
+void
+RRMonitorClose(ScreenPtr screen);
+
+int
+ProcRRGetMonitors(ClientPtr client);
+
+int
+ProcRRSetMonitor(ClientPtr client);
+
+int
+ProcRRDeleteMonitor(ClientPtr client);
+
#endif /* _RANDRSTR_H_ */
/*
diff --git a/xorg-server/randr/rrdispatch.c b/xorg-server/randr/rrdispatch.c
index b9346d3f9..13ac6b117 100644
--- a/xorg-server/randr/rrdispatch.c
+++ b/xorg-server/randr/rrdispatch.c
@@ -254,4 +254,7 @@ int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = {
ProcRRChangeProviderProperty, /* 39 */
ProcRRDeleteProviderProperty, /* 40 */
ProcRRGetProviderProperty, /* 41 */
+ ProcRRGetMonitors, /* 42 */
+ ProcRRSetMonitor, /* 43 */
+ ProcRRDeleteMonitor, /* 44 */
};
diff --git a/xorg-server/randr/rrmonitor.c b/xorg-server/randr/rrmonitor.c
new file mode 100644
index 000000000..fbdd352f6
--- /dev/null
+++ b/xorg-server/randr/rrmonitor.c
@@ -0,0 +1,748 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "randrstr.h"
+#include "swaprep.h"
+
+static Atom
+RRMonitorCrtcName(RRCrtcPtr crtc)
+{
+ char name[20];
+
+ if (crtc->numOutputs) {
+ RROutputPtr output = crtc->outputs[0];
+ return MakeAtom(output->name, output->nameLength, TRUE);
+ }
+ sprintf(name, "Monitor-%08x", crtc->id);
+ return MakeAtom(name, strlen(name), TRUE);
+}
+
+static Bool
+RRMonitorCrtcPrimary(RRCrtcPtr crtc)
+{
+ ScreenPtr screen = crtc->pScreen;
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+ int o;
+
+ for (o = 0; o < crtc->numOutputs; o++)
+ if (crtc->outputs[o] == pScrPriv->primaryOutput)
+ return TRUE;
+ return FALSE;
+}
+
+#define DEFAULT_PIXELS_PER_MM (96.0 / 25.4)
+
+static void
+RRMonitorGetCrtcGeometry(RRCrtcPtr crtc, RRMonitorGeometryPtr geometry)
+{
+ ScreenPtr screen = crtc->pScreen;
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+ BoxRec panned_area;
+
+ /* Check to see if crtc is panned and return the full area when applicable. */
+ if (pScrPriv && pScrPriv->rrGetPanning &&
+ pScrPriv->rrGetPanning(screen, crtc, &panned_area, NULL, NULL) &&
+ (panned_area.x2 > panned_area.x1) &&
+ (panned_area.y2 > panned_area.y1)) {
+ geometry->box = panned_area;
+ }
+ else {
+ int width, height;
+
+ RRCrtcGetScanoutSize(crtc, &width, &height);
+ geometry->box.x1 = crtc->x;
+ geometry->box.y1 = crtc->y;
+ geometry->box.x2 = geometry->box.x1 + width;
+ geometry->box.y2 = geometry->box.y1 + height;
+ }
+ if (crtc->numOutputs && crtc->outputs[0]->mmWidth && crtc->outputs[0]->mmHeight) {
+ RROutputPtr output = crtc->outputs[0];
+ geometry->mmWidth = output->mmWidth;
+ geometry->mmHeight = output->mmHeight;
+ } else {
+ geometry->mmWidth = floor ((geometry->box.x2 - geometry->box.x1) / DEFAULT_PIXELS_PER_MM + 0.5);
+ geometry->mmHeight = floor ((geometry->box.y2 - geometry->box.y1) / DEFAULT_PIXELS_PER_MM + 0.5);
+ }
+}
+
+static Bool
+RRMonitorSetFromServer(RRCrtcPtr crtc, RRMonitorPtr monitor)
+{
+ int o;
+
+ monitor->name = RRMonitorCrtcName(crtc);
+ monitor->pScreen = crtc->pScreen;
+ monitor->numOutputs = crtc->numOutputs;
+ monitor->outputs = calloc(crtc->numOutputs, sizeof(RRCrtc));
+ if (!monitor->outputs)
+ return FALSE;
+ for (o = 0; o < crtc->numOutputs; o++)
+ monitor->outputs[o] = crtc->outputs[o]->id;
+ monitor->primary = RRMonitorCrtcPrimary(crtc);
+ monitor->automatic = TRUE;
+ RRMonitorGetCrtcGeometry(crtc, &monitor->geometry);
+ return TRUE;
+}
+
+static Bool
+RRMonitorAutomaticGeometry(RRMonitorPtr monitor)
+{
+ return (monitor->geometry.box.x1 == 0 &&
+ monitor->geometry.box.y1 == 0 &&
+ monitor->geometry.box.x2 == 0 &&
+ monitor->geometry.box.y2 == 0);
+}
+
+static void
+RRMonitorGetGeometry(RRMonitorPtr monitor, RRMonitorGeometryPtr geometry)
+{
+ if (RRMonitorAutomaticGeometry(monitor) && monitor->numOutputs > 0) {
+ ScreenPtr screen = monitor->pScreen;
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+ RRMonitorGeometryRec first = { .box = { 0, 0, 0, 0 }, .mmWidth = 0, .mmHeight = 0 };
+ RRMonitorGeometryRec this;
+ int c, o, co;
+ int active_crtcs = 0;
+
+ *geometry = first;
+ for (o = 0; o < monitor->numOutputs; o++) {
+ RRCrtcPtr crtc = NULL;
+ Bool in_use = FALSE;
+
+ for (c = 0; !in_use && c < pScrPriv->numCrtcs; c++) {
+ crtc = pScrPriv->crtcs[c];
+ if (!crtc->mode)
+ continue;
+ for (co = 0; !in_use && co < crtc->numOutputs; co++)
+ if (monitor->outputs[o] == crtc->outputs[co]->id)
+ in_use = TRUE;
+ }
+
+ if (!in_use)
+ continue;
+
+ RRMonitorGetCrtcGeometry(crtc, &this);
+
+ if (active_crtcs == 0) {
+ first = this;
+ *geometry = this;
+ } else {
+ geometry->box.x1 = min(this.box.x1, geometry->box.x1);
+ geometry->box.x2 = max(this.box.x2, geometry->box.x2);
+ geometry->box.y1 = min(this.box.y1, geometry->box.y1);
+ geometry->box.y2 = max(this.box.y2, geometry->box.y2);
+ }
+ active_crtcs++;
+ }
+
+ /* Adjust physical sizes to account for total area */
+ if (active_crtcs > 1 && first.box.x2 != first.box.x1 && first.box.y2 != first.box.y1) {
+ geometry->mmWidth = (this.box.x2 - this.box.x1) / (first.box.x2 - first.box.x1) * first.mmWidth;
+ geometry->mmHeight = (this.box.y2 - this.box.y1) / (first.box.y2 - first.box.y1) * first.mmHeight;
+ }
+ } else {
+ *geometry = monitor->geometry;
+ }
+}
+
+static Bool
+RRMonitorSetFromClient(RRMonitorPtr client_monitor, RRMonitorPtr monitor)
+{
+ monitor->name = client_monitor->name;
+ monitor->pScreen = client_monitor->pScreen;
+ monitor->numOutputs = client_monitor->numOutputs;
+ monitor->outputs = calloc(client_monitor->numOutputs, sizeof (RROutput));
+ if (!monitor->outputs && client_monitor->numOutputs)
+ return FALSE;
+ memcpy(monitor->outputs, client_monitor->outputs, client_monitor->numOutputs * sizeof (RROutput));
+ monitor->primary = client_monitor->primary;
+ monitor->automatic = client_monitor->automatic;
+ RRMonitorGetGeometry(client_monitor, &monitor->geometry);
+ return TRUE;
+}
+
+typedef struct _rrMonitorList {
+ int num_client;
+ int num_server;
+ RRCrtcPtr *server_crtc;
+ int num_crtcs;
+ int client_primary;
+ int server_primary;
+} RRMonitorListRec, *RRMonitorListPtr;
+
+static Bool
+RRMonitorInitList(ScreenPtr screen, RRMonitorListPtr mon_list, Bool get_active)
+{
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+ int m, o, c, sc;
+ int numCrtcs;
+ ScreenPtr slave;
+
+ if (!RRGetInfo(screen, FALSE))
+ return FALSE;
+
+ /* Count the number of crtcs in this and any slave screens */
+ numCrtcs = pScrPriv->numCrtcs;
+ xorg_list_for_each_entry(slave, &screen->output_slave_list, output_head) {
+ rrScrPrivPtr pSlavePriv;
+ pSlavePriv = rrGetScrPriv(slave);
+ numCrtcs += pSlavePriv->numCrtcs;
+ }
+ mon_list->num_crtcs = numCrtcs;
+
+ mon_list->server_crtc = calloc(numCrtcs * 2, sizeof (RRCrtcPtr));
+ if (!mon_list->server_crtc)
+ return FALSE;
+
+ /* Collect pointers to all of the active crtcs */
+ c = 0;
+ for (sc = 0; sc < pScrPriv->numCrtcs; sc++, c++) {
+ if (pScrPriv->crtcs[sc]->mode != NULL)
+ mon_list->server_crtc[c] = pScrPriv->crtcs[sc];
+ }
+
+ xorg_list_for_each_entry(slave, &screen->output_slave_list, output_head) {
+ rrScrPrivPtr pSlavePriv;
+ pSlavePriv = rrGetScrPriv(slave);
+ for (sc = 0; sc < pSlavePriv->numCrtcs; sc++, c++) {
+ if (pSlavePriv->crtcs[sc]->mode != NULL)
+ mon_list->server_crtc[c] = pSlavePriv->crtcs[sc];
+ }
+ }
+
+ /* Walk the list of client-defined monitors, clearing the covered
+ * CRTCs from the full list and finding whether one of the
+ * monitors is primary
+ */
+ mon_list->num_client = pScrPriv->numMonitors;
+ mon_list->client_primary = -1;
+
+ for (m = 0; m < pScrPriv->numMonitors; m++) {
+ RRMonitorPtr monitor = pScrPriv->monitors[m];
+ if (get_active) {
+ RRMonitorGeometryRec geom;
+
+ RRMonitorGetGeometry(monitor, &geom);
+ if (geom.box.x2 - geom.box.x1 == 0 ||
+ geom.box.y2 - geom.box.y1 == 0) {
+ mon_list->num_client--;
+ continue;
+ }
+ }
+ if (monitor->primary && mon_list->client_primary == -1)
+ mon_list->client_primary = m;
+ for (o = 0; o < monitor->numOutputs; o++) {
+ for (c = 0; c < numCrtcs; c++) {
+ RRCrtcPtr crtc = mon_list->server_crtc[c];
+ if (crtc) {
+ int co;
+ for (co = 0; co < crtc->numOutputs; co++)
+ if (crtc->outputs[co]->id == monitor->outputs[o]) {
+ mon_list->server_crtc[c] = NULL;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /* Now look at the active CRTCs, and count
+ * those not covered by a client monitor, as well
+ * as finding whether one of them is marked primary
+ */
+ mon_list->num_server = 0;
+ mon_list->server_primary = -1;
+
+ for (c = 0; c < mon_list->num_crtcs; c++) {
+ RRCrtcPtr crtc = mon_list->server_crtc[c];
+
+ if (!crtc)
+ continue;
+
+ mon_list->num_server++;
+
+ if (RRMonitorCrtcPrimary(crtc) && mon_list->server_primary == -1)
+ mon_list->server_primary = c;
+ }
+ return TRUE;
+}
+
+static void
+RRMonitorFiniList(RRMonitorListPtr list)
+{
+ free(list->server_crtc);
+}
+
+/* Construct a complete list of protocol-visible monitors, including
+ * the manually generated ones as well as those generated
+ * automatically from the remaining CRCTs
+ */
+
+Bool
+RRMonitorMakeList(ScreenPtr screen, Bool get_active, RRMonitorPtr *monitors_ret, int *nmon_ret)
+{
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+ RRMonitorListRec list;
+ int m, c;
+ RRMonitorPtr mon, monitors;
+ Bool has_primary = FALSE;
+
+ if (!pScrPriv)
+ return FALSE;
+
+ if (!RRMonitorInitList(screen, &list, get_active))
+ return FALSE;
+
+ monitors = calloc(list.num_client + list.num_server, sizeof (RRMonitorRec));
+ if (!monitors) {
+ RRMonitorFiniList(&list);
+ return FALSE;
+ }
+
+ mon = monitors;
+
+ /* Fill in the primary monitor data first
+ */
+ if (list.client_primary >= 0) {
+ RRMonitorSetFromClient(pScrPriv->monitors[list.client_primary], mon);
+ mon++;
+ } else if (list.server_primary >= 0) {
+ RRMonitorSetFromServer(pScrPriv->crtcs[list.server_primary], mon);
+ mon++;
+ }
+
+ /* Fill in the client-defined monitors next
+ */
+ for (m = 0; m < pScrPriv->numMonitors; m++) {
+ if (m == list.client_primary)
+ continue;
+ if (get_active) {
+ RRMonitorGeometryRec geom;
+
+ RRMonitorGetGeometry(pScrPriv->monitors[m], &geom);
+ if (geom.box.x2 - geom.box.x1 == 0 ||
+ geom.box.y2 - geom.box.y1 == 0) {
+ continue;
+ }
+ }
+ RRMonitorSetFromClient(pScrPriv->monitors[m], mon);
+ if (has_primary)
+ mon->primary = FALSE;
+ else if (mon->primary)
+ has_primary = TRUE;
+ mon++;
+ }
+
+ /* And finish with the list of crtc-inspired monitors
+ */
+ for (c = 0; c < pScrPriv->numCrtcs; c++) {
+ RRCrtcPtr crtc = pScrPriv->crtcs[c];
+ if (c == list.server_primary && list.client_primary < 0)
+ continue;
+
+ if (!list.server_crtc[c])
+ continue;
+
+ RRMonitorSetFromServer(crtc, mon);
+ if (has_primary)
+ mon->primary = FALSE;
+ else if (mon->primary)
+ has_primary = TRUE;
+ mon++;
+ }
+
+ RRMonitorFiniList(&list);
+ *nmon_ret = list.num_client + list.num_server;
+ *monitors_ret = monitors;
+ return TRUE;
+}
+
+int
+RRMonitorCountList(ScreenPtr screen)
+{
+ RRMonitorListRec list;
+ int nmon;
+
+ if (!RRMonitorInitList(screen, &list, FALSE))
+ return -1;
+ nmon = list.num_client + list.num_server;
+ RRMonitorFiniList(&list);
+ return nmon;
+}
+
+static void
+RRMonitorFree(RRMonitorPtr monitor)
+{
+ free(monitor);
+}
+
+static RRMonitorPtr
+RRMonitorAlloc(int noutput)
+{
+ RRMonitorPtr monitor;
+
+ monitor = calloc(1, sizeof (RRMonitorRec) + noutput * sizeof (RROutput));
+ if (!monitor)
+ return NULL;
+ monitor->numOutputs = noutput;
+ monitor->outputs = (RROutput *) (monitor + 1);
+ return monitor;
+}
+
+static int
+RRMonitorDelete(ClientPtr client, ScreenPtr screen, Atom name)
+{
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+ int m;
+
+ if (!pScrPriv) {
+ client->errorValue = name;
+ return BadAtom;
+ }
+
+ for (m = 0; m < pScrPriv->numMonitors; m++) {
+ RRMonitorPtr monitor = pScrPriv->monitors[m];
+ if (monitor->name == name) {
+ memmove(pScrPriv->monitors + m, pScrPriv->monitors + m + 1,
+ (pScrPriv->numMonitors - (m + 1)) * sizeof (RRMonitorPtr));
+ --pScrPriv->numMonitors;
+ RRMonitorFree(monitor);
+ return Success;
+ }
+ }
+
+ client->errorValue = name;
+ return BadValue;
+}
+
+static Bool
+RRMonitorMatchesOutputName(ScreenPtr screen, Atom name)
+{
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+ int o;
+ const char *str = NameForAtom(name);
+ int len = strlen(str);
+
+ for (o = 0; o < pScrPriv->numOutputs; o++) {
+ RROutputPtr output = pScrPriv->outputs[o];
+
+ if (output->nameLength == len && !memcmp(output->name, str, len))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static int
+RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor)
+{
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+ int m;
+ ScreenPtr slave;
+ RRMonitorPtr *monitors;
+
+ if (!pScrPriv)
+ return BadAlloc;
+
+ /* 'name' must not match the name of any Output on the screen, or
+ * a Value error results.
+ */
+
+ if (RRMonitorMatchesOutputName(screen, monitor->name)) {
+ client->errorValue = monitor->name;
+ return BadValue;
+ }
+
+ xorg_list_for_each_entry(slave, &screen->output_slave_list, output_head) {
+ if (RRMonitorMatchesOutputName(slave, monitor->name)) {
+ client->errorValue = monitor->name;
+ return BadValue;
+ }
+ }
+
+ /* 'name' must not match the name of any Monitor on the screen, or
+ * a Value error results.
+ */
+
+ for (m = 0; m < pScrPriv->numMonitors; m++) {
+ if (pScrPriv->monitors[m]->name == monitor->name) {
+ client->errorValue = monitor->name;
+ return BadValue;
+ }
+ }
+
+ /* Allocate space for the new pointer. This is done before
+ * removing matching monitors as it may fail, and the request
+ * needs to not have any side-effects on failure
+ */
+ if (pScrPriv->numMonitors)
+ monitors = realloc(pScrPriv->monitors,
+ (pScrPriv->numMonitors + 1) * sizeof (RRMonitorPtr));
+ else
+ monitors = malloc(sizeof (RRMonitorPtr));
+
+ if (!monitors)
+ return BadAlloc;
+
+ pScrPriv->monitors = monitors;
+
+ for (m = 0; m < pScrPriv->numMonitors; m++) {
+ RRMonitorPtr existing = pScrPriv->monitors[m];
+ int o, eo;
+
+ /* If 'name' matches an existing Monitor on the screen, the
+ * existing one will be deleted as if RRDeleteMonitor were called.
+ */
+ if (existing->name == monitor->name) {
+ (void) RRMonitorDelete(client, screen, existing->name);
+ continue;
+ }
+
+ /* For each output in 'info.outputs', each one is removed from all
+ * pre-existing Monitors. If removing the output causes the list
+ * of outputs for that Monitor to become empty, then that
+ * Monitor will be deleted as if RRDeleteMonitor were called.
+ */
+
+ for (eo = 0; eo < existing->numOutputs; eo++) {
+ for (o = 0; o < monitor->numOutputs; o++) {
+ if (monitor->outputs[o] == existing->outputs[eo]) {
+ memmove(existing->outputs + eo, existing->outputs + eo + 1,
+ (existing->numOutputs - (eo + 1)) * sizeof (RROutput));
+ --existing->numOutputs;
+ --eo;
+ break;
+ }
+ }
+ if (existing->numOutputs == 0) {
+ (void) RRMonitorDelete(client, screen, existing->name);
+ break;
+ }
+ }
+ if (monitor->primary)
+ existing->primary = FALSE;
+ }
+
+ /* Add the new one to the list
+ */
+ pScrPriv->monitors[pScrPriv->numMonitors++] = monitor;
+
+ return Success;
+}
+
+void
+RRMonitorFreeList(RRMonitorPtr monitors, int nmon)
+{
+ int m;
+
+ for (m = 0; m < nmon; m++)
+ free(monitors[m].outputs);
+ free(monitors);
+}
+
+void
+RRMonitorInit(ScreenPtr screen)
+{
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+
+ if (!pScrPriv)
+ return;
+
+ pScrPriv->numMonitors = 0;
+ pScrPriv->monitors = NULL;
+}
+
+void
+RRMonitorClose(ScreenPtr screen)
+{
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+ int m;
+
+ if (!pScrPriv)
+ return;
+
+ for (m = 0; m < pScrPriv->numMonitors; m++)
+ RRMonitorFree(pScrPriv->monitors[m]);
+ free(pScrPriv->monitors);
+ pScrPriv->monitors = NULL;
+ pScrPriv->numMonitors = 0;
+}
+
+static CARD32
+RRMonitorTimestamp(ScreenPtr screen)
+{
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(screen);
+
+ /* XXX should take client monitor changes into account */
+ return pScrPriv->lastConfigTime.milliseconds;
+}
+
+int
+ProcRRGetMonitors(ClientPtr client)
+{
+ REQUEST(xRRGetMonitorsReq);
+ xRRGetMonitorsReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ };
+ WindowPtr window;
+ ScreenPtr screen;
+ int r;
+ RRMonitorPtr monitors;
+ int nmonitors;
+ int noutputs;
+ int m;
+ Bool get_active;
+ REQUEST_SIZE_MATCH(xRRGetMonitorsReq);
+ r = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess);
+ if (r != Success)
+ return r;
+ screen = window->drawable.pScreen;
+
+ get_active = stuff->get_active;
+ if (!RRMonitorMakeList(screen, get_active, &monitors, &nmonitors))
+ return BadAlloc;
+
+ rep.timestamp = RRMonitorTimestamp(screen);
+
+ noutputs = 0;
+ for (m = 0; m < nmonitors; m++) {
+ rep.length += SIZEOF(xRRMonitorInfo) >> 2;
+ rep.length += monitors[m].numOutputs;
+ noutputs += monitors[m].numOutputs;
+ }
+
+ rep.nmonitors = nmonitors;
+ rep.noutputs = noutputs;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.timestamp);
+ swapl(&rep.nmonitors);
+ swapl(&rep.noutputs);
+ }
+ WriteToClient(client, sizeof(xRRGetMonitorsReply), &rep);
+
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
+
+ for (m = 0; m < nmonitors; m++) {
+ RRMonitorPtr monitor = &monitors[m];
+ xRRMonitorInfo info = {
+ .name = monitor->name,
+ .primary = monitor->primary,
+ .automatic = monitor->automatic,
+ .noutput = monitor->numOutputs,
+ .x = monitor->geometry.box.x1,
+ .y = monitor->geometry.box.y1,
+ .width = monitor->geometry.box.x2 - monitor->geometry.box.x1,
+ .height = monitor->geometry.box.y2 - monitor->geometry.box.y1,
+ .widthInMillimeters = monitor->geometry.mmWidth,
+ .heightInMillimeters = monitor->geometry.mmHeight,
+ };
+ if (client->swapped) {
+ swapl(&info.name);
+ swaps(&info.noutput);
+ swaps(&info.x);
+ swaps(&info.y);
+ swaps(&info.width);
+ swaps(&info.height);
+ swapl(&info.widthInMillimeters);
+ swapl(&info.heightInMillimeters);
+ }
+
+ WriteToClient(client, sizeof(xRRMonitorInfo), &info);
+ WriteSwappedDataToClient(client, monitor->numOutputs * sizeof (RROutput), monitor->outputs);
+ }
+
+ RRMonitorFreeList(monitors, nmonitors);
+
+ return Success;
+}
+
+int
+ProcRRSetMonitor(ClientPtr client)
+{
+ REQUEST(xRRSetMonitorReq);
+ WindowPtr window;
+ ScreenPtr screen;
+ RRMonitorPtr monitor;
+ int r;
+
+ REQUEST_AT_LEAST_SIZE(xRRSetMonitorReq);
+
+ if (stuff->monitor.noutput != stuff->length - (SIZEOF(xRRSetMonitorReq) >> 2))
+ return BadLength;
+
+ r = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess);
+ if (r != Success)
+ return r;
+ screen = window->drawable.pScreen;
+
+ if (!ValidAtom(stuff->monitor.name))
+ return BadAtom;
+
+ /* Allocate the new monitor */
+ monitor = RRMonitorAlloc(stuff->monitor.noutput);
+ if (!monitor)
+ return BadAlloc;
+
+ /* Fill in the bits from the request */
+ monitor->pScreen = screen;
+ monitor->name = stuff->monitor.name;
+ monitor->primary = stuff->monitor.primary;
+ monitor->automatic = FALSE;
+ memcpy(monitor->outputs, stuff + 1, stuff->monitor.noutput * sizeof (RROutput));
+ monitor->geometry.box.x1 = stuff->monitor.x;
+ monitor->geometry.box.y1 = stuff->monitor.y;
+ monitor->geometry.box.x2 = stuff->monitor.x + stuff->monitor.width;
+ monitor->geometry.box.y2 = stuff->monitor.y + stuff->monitor.height;
+ monitor->geometry.mmWidth = stuff->monitor.widthInMillimeters;
+ monitor->geometry.mmHeight = stuff->monitor.heightInMillimeters;
+
+ r = RRMonitorAdd(client, screen, monitor);
+ if (r != Success)
+ RRMonitorFree(monitor);
+ return r;
+}
+
+int
+ProcRRDeleteMonitor(ClientPtr client)
+{
+ REQUEST(xRRDeleteMonitorReq);
+ WindowPtr window;
+ ScreenPtr screen;
+ int r;
+
+ REQUEST_SIZE_MATCH(xRRDeleteMonitorReq);
+ r = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess);
+ if (r != Success)
+ return r;
+ screen = window->drawable.pScreen;
+
+ if (!ValidAtom(stuff->name)) {
+ client->errorValue = stuff->name;
+ return BadAtom;
+ }
+
+ return RRMonitorDelete(client, screen, stuff->name);
+}
diff --git a/xorg-server/randr/rrsdispatch.c b/xorg-server/randr/rrsdispatch.c
index 47558cf75..cf2a3b024 100644
--- a/xorg-server/randr/rrsdispatch.c
+++ b/xorg-server/randr/rrsdispatch.c
@@ -565,6 +565,41 @@ static int SProcRRGetProviderProperty(ClientPtr client)
return ProcRandrVector[stuff->randrReqType] (client);
}
+static int SProcRRGetMonitors(ClientPtr client) {
+ REQUEST(xRRGetMonitorsReq);
+
+ REQUEST_SIZE_MATCH(xRRGetMonitorsReq);
+ swaps(&stuff->length);
+ swapl(&stuff->window);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRSetMonitor(ClientPtr client) {
+ REQUEST(xRRSetMonitorReq);
+
+ REQUEST_AT_LEAST_SIZE(xRRGetMonitorsReq);
+ swaps(&stuff->length);
+ swapl(&stuff->window);
+ swapl(&stuff->monitor.name);
+ swaps(&stuff->monitor.noutput);
+ swaps(&stuff->monitor.x);
+ swaps(&stuff->monitor.y);
+ swaps(&stuff->monitor.width);
+ swaps(&stuff->monitor.height);
+ SwapRestL(stuff);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRDeleteMonitor(ClientPtr client) {
+ REQUEST(xRRDeleteMonitorReq);
+
+ REQUEST_SIZE_MATCH(xRRDeleteMonitorReq);
+ swaps(&stuff->length);
+ swapl(&stuff->window);
+ swapl(&stuff->name);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {
SProcRRQueryVersion, /* 0 */
/* we skip 1 to make old clients fail pretty immediately */
@@ -614,4 +649,7 @@ int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {
SProcRRChangeProviderProperty, /* 39 */
SProcRRDeleteProviderProperty, /* 40 */
SProcRRGetProviderProperty, /* 41 */
+ SProcRRGetMonitors, /* 42 */
+ SProcRRSetMonitor, /* 43 */
+ SProcRRDeleteMonitor, /* 44 */
};
diff --git a/xorg-server/randr/rrxinerama.c b/xorg-server/randr/rrxinerama.c
index b336bd7cd..b6e9586d7 100644
--- a/xorg-server/randr/rrxinerama.c
+++ b/xorg-server/randr/rrxinerama.c
@@ -84,6 +84,8 @@ static int ProcRRXineramaIsActive(ClientPtr client);
static int ProcRRXineramaQueryScreens(ClientPtr client);
static int SProcRRXineramaDispatch(ClientPtr client);
+Bool noRRXineramaExtension = FALSE;
+
/* Proc */
int
@@ -147,35 +149,10 @@ ProcRRXineramaGetState(ClientPtr client)
return Success;
}
-static Bool
-RRXineramaCrtcActive(RRCrtcPtr crtc)
-{
- return crtc->mode != NULL && crtc->numOutputs > 0;
-}
-
static int
RRXineramaScreenCount(ScreenPtr pScreen)
{
- int i, n;
- ScreenPtr slave;
-
- n = 0;
- if (rrGetScrPriv(pScreen)) {
- rrScrPriv(pScreen);
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- if (RRXineramaCrtcActive(pScrPriv->crtcs[i]))
- n++;
- }
-
- xorg_list_for_each_entry(slave, &pScreen->output_slave_list, output_head) {
- rrScrPrivPtr pSlavePriv;
- pSlavePriv = rrGetScrPriv(slave);
- for (i = 0; i < pSlavePriv->numCrtcs; i++)
- if (RRXineramaCrtcActive(pSlavePriv->crtcs[i]))
- n++;
- }
-
- return n;
+ return RRMonitorCountList(pScreen);
}
static Bool
@@ -274,42 +251,16 @@ ProcRRXineramaIsActive(ClientPtr client)
}
static void
-RRXineramaWriteCrtc(ClientPtr client, RRCrtcPtr crtc)
+RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr monitor)
{
xXineramaScreenInfo scratch;
- if (RRXineramaCrtcActive(crtc)) {
- ScreenPtr pScreen = crtc->pScreen;
- rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
- BoxRec panned_area;
-
- /* Check to see if crtc is panned and return the full area when applicable. */
- if (pScrPriv && pScrPriv->rrGetPanning &&
- pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
- (panned_area.x2 > panned_area.x1) &&
- (panned_area.y2 > panned_area.y1)) {
- scratch.x_org = panned_area.x1;
- scratch.y_org = panned_area.y1;
- scratch.width = panned_area.x2 - panned_area.x1;
- scratch.height = panned_area.y2 - panned_area.y1;
- }
- else {
- int width, height;
-
- RRCrtcGetScanoutSize(crtc, &width, &height);
- scratch.x_org = crtc->x;
- scratch.y_org = crtc->y;
- scratch.width = width;
- scratch.height = height;
- }
- if (client->swapped) {
- swaps(&scratch.x_org);
- swaps(&scratch.y_org);
- swaps(&scratch.width);
- swaps(&scratch.height);
- }
- WriteToClient(client, sz_XineramaScreenInfo, &scratch);
- }
+ scratch.x_org = monitor->geometry.box.x1;
+ scratch.y_org = monitor->geometry.box.y1;
+ scratch.width = monitor->geometry.box.x2 - monitor->geometry.box.x1;
+ scratch.height = monitor->geometry.box.y2 - monitor->geometry.box.y1;
+
+ WriteToClient(client, sz_XineramaScreenInfo, &scratch);
}
int
@@ -317,21 +268,23 @@ ProcRRXineramaQueryScreens(ClientPtr client)
{
xXineramaQueryScreensReply rep;
ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN];
- int n = 0;
- int i;
+ int m;
+ RRMonitorPtr monitors = NULL;
+ int nmonitors = 0;
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
if (RRXineramaScreenActive(pScreen)) {
RRGetInfo(pScreen, FALSE);
- n = RRXineramaScreenCount(pScreen);
+ if (!RRMonitorMakeList(pScreen, TRUE, &monitors, &nmonitors))
+ return BadAlloc;
}
rep = (xXineramaQueryScreensReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
- .length = bytes_to_int32(n * sz_XineramaScreenInfo),
- .number = n
+ .length = bytes_to_int32(nmonitors * sz_XineramaScreenInfo),
+ .number = nmonitors
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -340,40 +293,11 @@ ProcRRXineramaQueryScreens(ClientPtr client)
}
WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
- if (n) {
- ScreenPtr slave;
- rrScrPriv(pScreen);
- int has_primary = 0;
- RRCrtcPtr primary_crtc = NULL;
-
- if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) {
- has_primary = 1;
- primary_crtc = pScrPriv->primaryOutput->crtc;
- RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc);
- }
-
- for (i = 0; i < pScrPriv->numCrtcs; i++) {
- if (has_primary &&
- primary_crtc == pScrPriv->crtcs[i]) {
- has_primary = 0;
- continue;
- }
- RRXineramaWriteCrtc(client, pScrPriv->crtcs[i]);
- }
-
- xorg_list_for_each_entry(slave, &pScreen->output_slave_list, output_head) {
- rrScrPrivPtr pSlavePriv;
- pSlavePriv = rrGetScrPriv(slave);
- for (i = 0; i < pSlavePriv->numCrtcs; i++) {
- if (has_primary &&
- primary_crtc == pSlavePriv->crtcs[i]) {
- has_primary = 0;
- continue;
- }
- RRXineramaWriteCrtc(client, pSlavePriv->crtcs[i]);
- }
- }
- }
+ for (m = 0; m < nmonitors; m++)
+ RRXineramaWriteMonitor(client, &monitors[m]);
+
+ if (monitors)
+ RRMonitorFreeList(monitors, nmonitors);
return Success;
}
@@ -488,6 +412,9 @@ RRXineramaExtensionInit(void)
return;
#endif
+ if (noRRXineramaExtension)
+ return;
+
/*
* Xinerama isn't capable enough to have multiple protocol screens each
* with their own output geometry. So if there's more than one protocol
diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in
index 803de50ac..a75f02942 100644
--- a/xorg-server/xkeyboard-config/rules/base.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.xml.in
@@ -3833,6 +3833,12 @@
<_description>Spanish (Latin American, Sun dead keys)</_description>
</configItem>
</variant>
+ <variant>
+ <configItem>
+ <name>dvorak</name>
+ <_description>Spanish (Latin American, Dvorak)</_description>
+ </configItem>
+ </variant>
</variantList>
</layout>
<layout>
diff --git a/xorg-server/xkeyboard-config/symbols/de b/xorg-server/xkeyboard-config/symbols/de
index fa3c7ec97..1687bc810 100644
--- a/xorg-server/xkeyboard-config/symbols/de
+++ b/xorg-server/xkeyboard-config/symbols/de
@@ -43,6 +43,7 @@ xkb_symbols "basic" {
key <AB08> { [ comma, semicolon, periodcentered, multiply ] };
key <AB09> { [ period, colon, U2026, division ] };
key <AB10> { [ minus, underscore, endash, emdash ] };
+ key <LSGT> { [ less, greater, bar, NoSymbol ] };
include "kpdl(comma)"
diff --git a/xorg-server/xkeyboard-config/symbols/latam b/xorg-server/xkeyboard-config/symbols/latam
index 47c8976e7..f6717a415 100644
--- a/xorg-server/xkeyboard-config/symbols/latam
+++ b/xorg-server/xkeyboard-config/symbols/latam
@@ -66,3 +66,64 @@ xkb_symbols "deadtilde" {
key <AD12> { [ plus, asterisk, dead_tilde, dead_macron ] };
};
+
+// Latin American Spanish Dvorak mapping (note R-H exchange)
+partial alphanumeric_keys
+xkb_symbols "dvorak" {
+
+ name[Group1]="Spanish (Latin American, Dvorak)";
+
+ key <TLDE> {[ bar, degree, notsign, notsign ]};
+ key <AE01> {[ 1, exclam, bar, exclamdown ]};
+ key <AE02> {[ 2, quotedbl, at, oneeighth ]};
+ key <AE03> {[ 3, numbersign, periodcentered, sterling ]};
+ key <AE04> {[ 4, dollar, asciitilde, dollar ]};
+ key <AE05> {[ 5, percent, onehalf, threeeighths ]};
+ key <AE06> {[ 6, ampersand, notsign, fiveeighths ]};
+ key <AE07> {[ 7, slash, braceleft, seveneighths ]};
+ key <AE08> {[ 8, parenleft, bracketleft, trademark ]};
+ key <AE09> {[ 9, parenright, bracketright, plusminus ]};
+ key <AE10> {[ 0, equal, braceright, degree ]};
+ key <AE11> {[ apostrophe, question, backslash, questiondown ]};
+ key <AE12> {[ questiondown, exclamdown, dead_cedilla, dead_ogonek ]};
+
+ key <AD01> {[ period, colon, at ]};
+ key <AD02> {[ comma, semicolon ]};
+ key <AD03> {[ ntilde, Ntilde, lstroke, Lstroke ]};
+ key <AD04> {[ p, P, paragraph ]};
+ key <AD05> {[ y, Y, yen ]};
+ key <AD06> {[ f, F, tslash, Tslash ]};
+ key <AD07> {[ g, G, dstroke, Dstroke ]};
+ key <AD08> {[ c, C, cent, copyright ]};
+ key <AD09> {[ h, H, hstroke, Hstroke ]};
+ key <AD10> {[ l, L, sterling ]};
+ key <AD11> {[ dead_acute, dead_diaeresis, dead_diaeresis, dead_abovering ]};
+ key <AD12> {[ plus, asterisk, asciitilde, dead_macron ]};
+
+ key <AC01> {[ a, A, ae, AE ]};
+ key <AC02> {[ o, O, oslash, Oslash ]};
+ key <AC03> {[ e, E, EuroSign ]};
+ key <AC04> {[ u, U, aring, Aring ]};
+ key <AC05> {[ i, I, oe, OE ]};
+ key <AC06> {[ d, D, eth, ETH ]};
+ key <AC07> {[ r, R, registered, trademark ]};
+ key <AC08> {[ t, T, thorn, THORN ]};
+ key <AC09> {[ n, N, eng, ENG ]};
+ key <AC10> {[ s, S, ssharp, section ]};
+ key <AC11> {[ braceleft, bracketleft, dead_circumflex, braceleft ]};
+ key <BKSL> {[ braceright, bracketright, dead_grave, braceright ]};
+
+ key <LSGT> {[ less, greater, guillemotleft, guillemotright ]};
+ key <AB01> {[ minus, underscore, hyphen, macron ]};
+ key <AB02> {[ q, Q, currency ]};
+ key <AB03> {[ j, J ]};
+ key <AB04> {[ k, K, kra ]};
+ key <AB05> {[ x, X, multiply, division ]};
+ key <AB06> {[ b, B ]};
+ key <AB07> {[ m, M, mu ]};
+ key <AB08> {[ w, W ]};
+ key <AB09> {[ v, V ]};
+ key <AB10> {[ z, Z ]};
+
+ include "level3(ralt_switch)"
+};
diff --git a/xorg-server/xkeyboard-config/symbols/typo b/xorg-server/xkeyboard-config/symbols/typo
index 3b555f8c3..cce79f7ef 100644
--- a/xorg-server/xkeyboard-config/symbols/typo
+++ b/xorg-server/xkeyboard-config/symbols/typo
@@ -1,56 +1,67 @@
-// typographic keyboard
+// Typographic Keyboard
// Sergei Stolyarov <sergei@regolit.com>
-//
+
// Initial contribution by Alexey Ten <alexeyten+deb@gmail.com>
// Additional contribution and code cleanup by Artur Dryomov <artur.dryomov@gmail.com>
-//
-// Mainly based on the layout proposed by Ilya Birman,
+
+// Mainly based on the layout proposed by Ilya Birman
// http://ilyabirman.ru/projects/typography-layout/
-// default layout
default partial
xkb_symbols "base" {
-// 1st keyboard row
- key <TLDE> { [NoSymbol, NoSymbol, NoSymbol, approxeq] };
- key <AE01> { [NoSymbol, NoSymbol, onesuperior, exclamdown] }; // "1"
- key <AE02> { [NoSymbol, NoSymbol, twosuperior, onehalf] }; // "2"
- key <AE03> { [NoSymbol, NoSymbol, threesuperior, onethird] }; // "3"
- key <AE04> { [NoSymbol, NoSymbol, dollar, onequarter] }; // "4"
- key <AE05> { [NoSymbol, NoSymbol, permille] }; // "5"
- key <AE06> { [NoSymbol, NoSymbol, uparrow] }; // "6"
- key <AE07> { [NoSymbol, NoSymbol, ampersand, questiondown] }; // "7"
- key <AE08> { [NoSymbol, NoSymbol, infinity, oneeighth] }; // "8"
- key <AE09> { [NoSymbol, NoSymbol, leftarrow] }; // "9"
- key <AE10> { [NoSymbol, NoSymbol, rightarrow] }; // "0"
- key <AE11> { [NoSymbol, NoSymbol, emdash, endash] }; // "-"
- key <AE12> { [NoSymbol, NoSymbol, notequal, plusminus] }; // "="
-
-// 2nd keyboard row
- key <AD03> { [NoSymbol, NoSymbol, EuroSign] }; // "e"
- key <AD04> { [NoSymbol, NoSymbol, registered] }; // "r"
- key <AD05> { [NoSymbol, NoSymbol, trademark] }; // "t"
- key <AD06> { [NoSymbol, NoSymbol, yen] }; // "y"
- key <AD10> { [NoSymbol, NoSymbol, acute, doubleacute] }; // "p"
- key <AD11> { [NoSymbol, NoSymbol, bracketleft, braceleft] }; // [
- key <AD12> { [NoSymbol, NoSymbol, bracketright, braceright] }; // ]
-
-// 3rd keyboard row
- key <AC01> { [NoSymbol, NoSymbol, U0301] }; // "a"
- key <AC02> { [NoSymbol, NoSymbol, section] }; // "s"
- key <AC03> { [NoSymbol, NoSymbol, degree, division] }; // "d"
- key <AC04> { [NoSymbol, NoSymbol, sterling] }; // "f"
- key <AC07> { [NoSymbol, NoSymbol, doublelowquotemark, singlelowquotemark] }; // "j"
- key <AC08> { [NoSymbol, NoSymbol, leftdoublequotemark, leftsinglequotemark] }; // "k"
- key <AC09> { [NoSymbol, NoSymbol, rightdoublequotemark, rightsinglequotemark] }; // "l"
- key <AC10> { [NoSymbol, NoSymbol, leftsinglequotemark, minutes] }; // ";"
- key <AC11> { [NoSymbol, NoSymbol, rightsinglequotemark, seconds] }; // "'"
-
-// 4th keyboard row
- key <AB02> { [NoSymbol, NoSymbol, multiply, U22C5] }; // "x"
- key <AB03> { [NoSymbol, NoSymbol, copyright, cent] }; // "c"
- key <AB04> { [NoSymbol, NoSymbol, downarrow, U25CA] }; // "v"
- key <AB07> { [NoSymbol, NoSymbol, U2212, enfilledcircbullet] }; // "m"
- key <AB08> { [NoSymbol, NoSymbol, guillemotleft, less] }; // ","
- key <AB09> { [NoSymbol, NoSymbol, guillemotright, greater] }; // "."
- key <AB10> { [NoSymbol, NoSymbol, ellipsis] }; // "/"
+
+ // 1st keyboard row
+ key <TLDE> { [ NoSymbol, NoSymbol, NoSymbol, approxeq ] }; // "~"
+ key <AE01> { [ NoSymbol, NoSymbol, onesuperior, exclamdown ] }; // "1"
+ key <AE02> { [ NoSymbol, NoSymbol, twosuperior, onehalf ] }; // "2"
+ key <AE03> { [ NoSymbol, NoSymbol, threesuperior, onethird ] }; // "3"
+ key <AE04> { [ NoSymbol, NoSymbol, dollar, onequarter ] }; // "4"
+ key <AE05> { [ NoSymbol, NoSymbol, U2030, NoSymbol ] }; // "5"
+ key <AE06> { [ NoSymbol, NoSymbol, uparrow, NoSymbol ] }; // "6"
+ key <AE07> { [ NoSymbol, NoSymbol, ampersand, questiondown ] }; // "7"
+ key <AE08> { [ NoSymbol, NoSymbol, infinity, oneeighth ] }; // "8"
+ key <AE09> { [ NoSymbol, NoSymbol, leftarrow, NoSymbol ] }; // "9"
+ key <AE10> { [ NoSymbol, NoSymbol, rightarrow, NoSymbol ] }; // "0"
+ key <AE11> { [ NoSymbol, NoSymbol, emdash, endash ] }; // "-"
+ key <AE12> { [ NoSymbol, NoSymbol, notequal, plusminus ] }; // "="
+
+ // 2nd keyboard row
+ key <AD03> { [ NoSymbol, NoSymbol, EuroSign, NoSymbol ] }; // "e"
+ key <AD04> { [ NoSymbol, NoSymbol, registered, NoSymbol ] }; // "r"
+ key <AD05> { [ NoSymbol, NoSymbol, trademark, NoSymbol ] }; // "t"
+ key <AD06> { [ NoSymbol, NoSymbol, yen, NoSymbol ] }; // "y"
+ key <AD10> { [ NoSymbol, NoSymbol, acute, doubleacute ] }; // "p"
+ key <AD11> { [ NoSymbol, NoSymbol, bracketleft, braceleft ] }; // "["
+ key <AD12> { [ NoSymbol, NoSymbol, bracketright, braceright ] }; // "]"
+
+ // 3rd keyboard row
+ key <AC01> { [ NoSymbol, NoSymbol, U0301, NoSymbol ] }; // "a"
+ key <AC02> { [ NoSymbol, NoSymbol, section, NoSymbol ] }; // "s"
+ key <AC03> { [ NoSymbol, NoSymbol, degree, division ] }; // "d"
+ key <AC04> { [ NoSymbol, NoSymbol, sterling, NoSymbol ] }; // "f"
+ key <AC07> { [ NoSymbol, NoSymbol, doublelowquotemark, singlelowquotemark ] }; // "j"
+ key <AC08> { [ NoSymbol, NoSymbol, leftdoublequotemark, leftsinglequotemark ] }; // "k"
+ key <AC09> { [ NoSymbol, NoSymbol, rightdoublequotemark, rightsinglequotemark ] }; // "l"
+ key <AC10> { [ NoSymbol, NoSymbol, leftsinglequotemark, minutes ] }; // ";"
+ key <AC11> { [ NoSymbol, NoSymbol, rightsinglequotemark, seconds ] }; // "'"
+
+ // 4th keyboard row
+ key <AB02> { [ NoSymbol, NoSymbol, multiply, U22C5 ] }; // "x"
+ key <AB03> { [ NoSymbol, NoSymbol, copyright, cent ] }; // "c"
+ key <AB04> { [ NoSymbol, NoSymbol, downarrow, U25CA ] }; // "v"
+ key <AB07> { [ NoSymbol, NoSymbol, U2212, enfilledcircbullet ] }; // "m"
+ key <AB08> { [ NoSymbol, NoSymbol, guillemotleft, less ] }; // ","
+ key <AB09> { [ NoSymbol, NoSymbol, guillemotright, greater ] }; // "."
+ key <AB10> { [ NoSymbol, NoSymbol, ellipsis, NoSymbol ] }; // "/"
+
+ // 5th keyboard row
+ key <SPCE> { [ space, space, nobreakspace, nobreakspace ] }; // " "
+
+ // Reference
+ // U+2030 PER MILLE SIGN
+ // U+0301 COMBINING ACUTE ACCENT
+ // U+22C5 DOT OPERATOR
+ // U+25CA LOZENGE
+ // U+2212 MINUS SIGN
+
};