From: "andrés ramírez" <rrandresf@hotmail.com>
To: Po Lu <luangruo@yahoo.com>
Cc: 57364@debbugs.gnu.org
Subject: bug#57364: [PATCH] (was: bug#57364: 28.1.91; asynchronous X server error when creating a second frame on alternate DISPLAY)
Date: Tue, 30 Aug 2022 07:29:50 +0000 [thread overview]
Message-ID: <SJ1PR12MB6363FCCBC2D7D31C0743E039A6799@SJ1PR12MB6363.namprd12.prod.outlook.com> (raw)
In-Reply-To: <87h71up62o.fsf@yahoo.com>
[-- Attachment #1: Type: text/plain, Size: 588 bytes --]
Hi. Po.
>>>>> "Po" == Po Lu <luangruo@yahoo.com> writes:
Po> andrés ramírez <rrandresf@hotmail.com> writes:
[...]
Po> We already know it's cairo-side, since it goes away upon switching Cairo backends, and Emacs
Po> doesn't make RenderFreeGlyphs requests itself.
Ok. Should we let the cairo guys know about it. For giving them the
opportunity of fixing it?.
Po> That's unnecessary, since the Cairo XCB surface is present everywhere. I'd rather put a
Po> mention of the crash in etc/PROBLEMS for Emacs 28.
Are You going to apply the patch?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: the_patch --]
[-- Type: text/x-patch, Size: 4946 bytes --]
--- /tmp/emacs-28.1.91/configure.ac.bak 2022-08-01 06:29:22.000000000 -0500
+++ /tmp/emacs-28.1.91/configure.ac 2022-08-30 00:53:07.706555433 -0500
@@ -3320,6 +3320,13 @@
CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
EMACS_CHECK_MODULES(CAIRO, $CAIRO_MODULE)
if test $HAVE_CAIRO = yes; then
+ CAIRO_XCB_MODULE="cairo-xcb >= $CAIRO_REQUIRED"
+ EMACS_CHECK_MODULES(CAIRO_XCB, $CAIRO_XCB_MODULE)
+ if test $HAVE_CAIRO_XCB = yes; then
+ CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_XCB_CFLAGS"
+ CAIRO_LIBS="$CAIRO_LIBS $CAIRO_XCB_LIBS"
+ AC_DEFINE(USE_CAIRO_XCB, 1, [Define to 1 if cairo XCB surfaces are available.])
+ fi
AC_DEFINE(USE_CAIRO, 1, [Define to 1 if using cairo.])
CFLAGS="$CFLAGS $CAIRO_CFLAGS"
LIBS="$LIBS $CAIRO_LIBS"
--- /tmp/emacs-28.1.91/src/xterm.h.bak 2022-08-01 06:29:23.000000000 -0500
+++ /tmp/emacs-28.1.91/src/xterm.h 2022-08-30 01:14:37.623171629 -0500
@@ -78,6 +78,9 @@
#ifdef CAIRO_HAS_SVG_SURFACE
#include <cairo-svg.h>
#endif
+#ifdef USE_CAIRO_XCB
+#include <cairo-xcb.h>
+#endif
#endif
#ifdef HAVE_X_I18N
@@ -469,6 +472,7 @@
#ifdef USE_XCB
xcb_connection_t *xcb_connection;
+ xcb_visualtype_t *xcb_visual;
#endif
#ifdef HAVE_XDBE
diff -u /tmp/emacs-28.1.91/src/xterm.c.bak /tmp/emacs-28.1.91/src/xterm.c
--- /tmp/emacs-28.1.91/src/xterm.c.bak 2022-08-01 06:29:23.000000000 -0500
+++ /tmp/emacs-28.1.91/src/xterm.c 2022-08-30 01:11:39.213178617 -0500
@@ -33,6 +33,10 @@
#include "xterm.h"
#include <X11/cursorfont.h>
+#ifdef USE_XCB
+#include <xcb/xproto.h>
+#endif
+
/* If we have Xfixes extension, use it for pointer blanking. */
#ifdef HAVE_XFIXES
#include <X11/extensions/Xfixes.h>
@@ -132,6 +136,10 @@
#include <X11/XKBlib.h>
#endif
+#if defined USE_XCB && defined USE_CAIRO_XCB
+#define USE_CAIRO_XCB_SURFACE
+#endif
+
/* Default to using XIM if available. */
#ifdef USE_XIM
bool use_xim = true;
@@ -385,11 +393,20 @@
{
int width = FRAME_CR_SURFACE_DESIRED_WIDTH (f);
int height = FRAME_CR_SURFACE_DESIRED_HEIGHT (f);
- cairo_surface_t *surface
- = cairo_xlib_surface_create (FRAME_X_DISPLAY (f),
- FRAME_X_RAW_DRAWABLE (f),
- FRAME_X_VISUAL (f),
- width, height);
+ cairo_surface_t *surface;
+
+#ifdef USE_CAIRO_XCB_SURFACE
+ if (FRAME_DISPLAY_INFO (f)->xcb_visual)
+ surface = cairo_xcb_surface_create (FRAME_DISPLAY_INFO (f)->xcb_connection,
+ (xcb_drawable_t) FRAME_X_RAW_DRAWABLE (f),
+ FRAME_DISPLAY_INFO (f)->xcb_visual,
+ width, height);
+ else
+#endif
+ surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f),
+ FRAME_X_RAW_DRAWABLE (f),
+ FRAME_X_VISUAL (f),
+ width, height);
cr = FRAME_CR_CONTEXT (f) = cairo_create (surface);
cairo_surface_destroy (surface);
@@ -458,6 +475,10 @@
switch (cairo_surface_get_type (surface))
{
case CAIRO_SURFACE_TYPE_XLIB:
+#ifdef USE_CAIRO_XCB_SURFACE
+ case CAIRO_SURFACE_TYPE_XCB:
+#endif
+
cairo_surface_flush (surface);
return true;
@@ -4436,6 +4457,19 @@
x, to_y);
cairo_surface_mark_dirty_rectangle (surface, x, to_y, width, height);
}
+#ifdef USE_CAIRO_XCB_SURFACE
+ else if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_XCB)
+ {
+ cairo_surface_flush (surface);
+ xcb_copy_area (FRAME_DISPLAY_INFO (f)->xcb_connection,
+ (xcb_drawable_t) FRAME_X_DRAWABLE (f),
+ (xcb_drawable_t) FRAME_X_DRAWABLE (f),
+ (xcb_gcontext_t) XGContextFromGC (f->output_data.x->normal_gc),
+ x, from_y, x, to_y, width, height);
+ cairo_surface_mark_dirty_rectangle (surface, x, to_y, width, height);
+ }
+#endif
+
else
{
cairo_surface_t *s
@@ -13062,6 +13096,40 @@
dpyinfo->supports_xdbe = true;
#endif
+#ifdef USE_XCB
+ xcb_screen_t *xcb_screen = NULL;
+ xcb_screen_iterator_t iter;
+ xcb_visualid_t wanted = { XVisualIDFromVisual (dpyinfo->visual) };
+ xcb_depth_iterator_t depth_iter;
+ xcb_visualtype_iterator_t visual_iter;
+
+ int screen = DefaultScreen (dpyinfo->display);
+
+ iter = xcb_setup_roots_iterator (xcb_get_setup (dpyinfo->xcb_connection));
+ for (; iter.rem; --screen, xcb_screen_next (&iter))
+ {
+ if (!screen)
+ xcb_screen = iter.data;
+ }
+
+ if (xcb_screen)
+ {
+ depth_iter = xcb_screen_allowed_depths_iterator (xcb_screen);
+ for (; depth_iter.rem; xcb_depth_next (&depth_iter))
+ {
+ visual_iter = xcb_depth_visuals_iterator (depth_iter.data);
+ for (; visual_iter.rem; xcb_visualtype_next (&visual_iter))
+ {
+ if (wanted == visual_iter.data->visual_id)
+ {
+ dpyinfo->xcb_visual = visual_iter.data;
+ break;
+ }
+ }
+ }
+ }
+#endif
+
#if defined USE_CAIRO || defined HAVE_XFT
{
/* If we are using Xft, the following precautions should be made:
Diff finished. Tue Aug 30 01:36:19 2022
Diff finished. Tue Aug 30 01:36:19 2022
Diff finished. Tue Aug 30 01:36:20 2022
[-- Attachment #3: Type: text/plain, Size: 14 bytes --]
Best Regards
next prev parent reply other threads:[~2022-08-30 7:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 17:51 bug#57364: 28.1.91; asynchronous X server error when creating a second frame on alternate DISPLAY Andrés Ramírez
2022-08-24 1:56 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-25 14:29 ` andrés ramírez
2022-08-25 15:13 ` andrés ramírez
2022-08-26 1:07 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-26 1:50 ` andrés ramírez
2022-08-26 3:08 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-26 3:43 ` andrés ramírez
2022-08-26 5:44 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-26 13:59 ` andrés ramírez
2022-08-27 1:17 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-29 19:58 ` andrés ramírez
2022-08-30 1:19 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-30 5:28 ` andrés ramírez
2022-08-30 7:02 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-30 7:29 ` andrés ramírez [this message]
2022-08-30 10:07 ` bug#57364: [PATCH] Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-27 12:49 ` bug#57364: 28.1.91; asynchronous X server error when creating a second frame on alternate DISPLAY Lars Ingebrigtsen
2022-09-27 13:46 ` andrés ramírez
2022-09-27 17:32 ` Lars Ingebrigtsen
2022-08-30 8:02 ` bug#57364: 28.1; emacs segfaulted when debugging emacs form within emacs for bug#57364 Andrés Ramírez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SJ1PR12MB6363FCCBC2D7D31C0743E039A6799@SJ1PR12MB6363.namprd12.prod.outlook.com \
--to=rrandresf@hotmail.com \
--cc=57364@debbugs.gnu.org \
--cc=luangruo@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).