238 lines
10 KiB
Diff
238 lines
10 KiB
Diff
diff --git a/Xext/xfixes/cursor.c b/Xext/xfixes/cursor.c
|
|
index d017da0..a530caa 100644
|
|
--- a/Xext/xfixes/cursor.c
|
|
+++ b/Xext/xfixes/cursor.c
|
|
@@ -122,9 +122,9 @@ typedef struct _CursorHideCountRec {
|
|
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = (func))
|
|
#define Unwrap(as,s,elt,backup) (((backup) = (s)->elt), (s)->elt = (as)->elt)
|
|
|
|
-/* The cursor doesn't show up until the first XDefineCursor() */
|
|
+/* The cursor is permanently disabled for keypad-only hardware */
|
|
Bool CursorVisible = FALSE;
|
|
-Bool EnableCursor = TRUE;
|
|
+Bool EnableCursor = FALSE;
|
|
|
|
static CursorPtr
|
|
CursorForDevice(DeviceIntPtr pDev)
|
|
diff --git a/hw/xfree86/drivers/video/modesetting/drmmode_bo.c b/hw/xfree86/drivers/video/modesetting/drmmode_bo.c
|
|
index b39aa73..71c876e 100644
|
|
--- a/hw/xfree86/drivers/video/modesetting/drmmode_bo.c
|
|
+++ b/hw/xfree86/drivers/video/modesetting/drmmode_bo.c
|
|
@@ -251,6 +251,8 @@ gbm_create_cursor_bo(drmmode_ptr drmmode, Bool do_map,
|
|
|
|
/* For older mesa */
|
|
GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE,
|
|
+ GBM_BO_USE_SCANOUT | GBM_BO_USE_WRITE,
|
|
+ GBM_BO_USE_WRITE,
|
|
};
|
|
|
|
/* Assume whatever bpp we have for the primary plane, we also have for the cursor plane */
|
|
diff --git a/hw/xfree86/drivers/video/modesetting/drmmode_display.c b/hw/xfree86/drivers/video/modesetting/drmmode_display.c
|
|
index e5f694c..98f1f7a 100644
|
|
--- a/hw/xfree86/drivers/video/modesetting/drmmode_display.c
|
|
+++ b/hw/xfree86/drivers/video/modesetting/drmmode_display.c
|
|
@@ -4856,16 +4856,11 @@ drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
|
|
min_width = MIN(width, min_width);
|
|
min_height = MIN(height, min_height);
|
|
|
|
- drmmode_crtc->cursor.bo = gbm_create_best_bo(drmmode, TRUE, width, height, DRMMODE_CURSOR_BO);
|
|
- if (!drmmode_crtc->cursor.bo) {
|
|
- gbm_bo_destroy(drmmode->front_bo);
|
|
- for (int j = 0; j < i; j++) {
|
|
- xf86CrtcPtr free_crtc = xf86_config->crtc[j];
|
|
- drmmode_crtc_private_ptr free_drmmode_crtc = free_crtc->driver_private;
|
|
- gbm_bo_destroy(free_drmmode_crtc->cursor.bo);
|
|
- free_drmmode_crtc->cursor.bo = NULL;
|
|
+ if (!drmmode->sw_cursor) {
|
|
+ drmmode_crtc->cursor.bo = gbm_create_best_bo(drmmode, TRUE, width, height, DRMMODE_CURSOR_BO);
|
|
+ if (!drmmode_crtc->cursor.bo) {
|
|
+ drmmode->sw_cursor = TRUE;
|
|
}
|
|
- return FALSE;
|
|
}
|
|
}
|
|
|
|
@@ -4886,13 +4881,15 @@ drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
|
|
drmmode->fb_id = 0;
|
|
}
|
|
|
|
- gbm_bo_destroy(drmmode->front_bo);
|
|
+ if (drmmode->front_bo)
|
|
+ gbm_bo_destroy(drmmode->front_bo);
|
|
|
|
for (i = 0; i < xf86_config->num_crtc; i++) {
|
|
xf86CrtcPtr crtc = xf86_config->crtc[i];
|
|
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
|
|
|
|
- gbm_bo_destroy(drmmode_crtc->cursor.bo);
|
|
+ if (drmmode_crtc->cursor.bo)
|
|
+ gbm_bo_destroy(drmmode_crtc->cursor.bo);
|
|
drmmode_destroy_tearfree_shadow(crtc);
|
|
}
|
|
}
|
|
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
|
|
index 6653dd9..e04b69c 100644
|
|
--- a/hw/xfree86/os-support/linux/lnx_init.c
|
|
+++ b/hw/xfree86/os-support/linux/lnx_init.c
|
|
@@ -114,35 +114,41 @@ linux_parse_vt_settings(int may_fail)
|
|
if (fd < 0) {
|
|
if (may_fail)
|
|
return 0;
|
|
- FatalError("parse_vt_settings: Cannot open /dev/tty0 (%s), maybe missing for ex. '-seat seat0 -keeptty' parameters? (in case trying to run uid !=0 mode)\n",
|
|
- strerror(errno));
|
|
- }
|
|
-
|
|
- if (xf86Info.ShareVTs) {
|
|
- SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
|
|
- if (ret < 0) {
|
|
- if (may_fail)
|
|
- return 0;
|
|
- FatalError("parse_vt_settings: Cannot find the current"
|
|
- " VT (%s)\n", strerror(errno));
|
|
- }
|
|
- xf86Info.vtno = vts.v_active;
|
|
- }
|
|
- else {
|
|
- SYSCALL(ret = ioctl(fd, VT_OPENQRY, &xf86Info.vtno));
|
|
- if (ret < 0) {
|
|
- if (may_fail)
|
|
- return 0;
|
|
- FatalError("parse_vt_settings: Cannot find a free VT: "
|
|
- "%s\n", strerror(errno));
|
|
+ xf86Info.vtno = 1;
|
|
+ KeepTty = TRUE;
|
|
+ } else {
|
|
+ if (xf86Info.ShareVTs) {
|
|
+ SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
|
|
+ if (ret < 0) {
|
|
+ if (may_fail) {
|
|
+ close(fd);
|
|
+ return 0;
|
|
+ }
|
|
+ FatalError("parse_vt_settings: Cannot find the current"
|
|
+ " VT (%s)\n", strerror(errno));
|
|
+ }
|
|
+ xf86Info.vtno = vts.v_active;
|
|
}
|
|
- if (xf86Info.vtno == -1) {
|
|
- if (may_fail)
|
|
- return 0;
|
|
- FatalError("parse_vt_settings: Cannot find a free VT\n");
|
|
+ else {
|
|
+ SYSCALL(ret = ioctl(fd, VT_OPENQRY, &xf86Info.vtno));
|
|
+ if (ret < 0) {
|
|
+ if (may_fail) {
|
|
+ close(fd);
|
|
+ return 0;
|
|
+ }
|
|
+ FatalError("parse_vt_settings: Cannot find a free VT: "
|
|
+ "%s\n", strerror(errno));
|
|
+ }
|
|
+ if (xf86Info.vtno == -1) {
|
|
+ if (may_fail) {
|
|
+ close(fd);
|
|
+ return 0;
|
|
+ }
|
|
+ FatalError("parse_vt_settings: Cannot find a free VT\n");
|
|
+ }
|
|
}
|
|
+ close(fd);
|
|
}
|
|
- close(fd);
|
|
}
|
|
|
|
LogMessageVerb(from, 1, "using VT number %d\n\n", xf86Info.vtno);
|
|
@@ -218,9 +224,14 @@ xf86OpenConsole(void)
|
|
if (seatd_libseat_controls_session())
|
|
return;
|
|
|
|
- if (xf86Info.consoleFd < 0)
|
|
- FatalError("xf86OpenConsole: Cannot open virtual console"
|
|
- " %d (%s)\n", xf86Info.vtno, strerror(errno));
|
|
+ if (xf86Info.consoleFd < 0) {
|
|
+ LogMessageVerb(X_WARNING, 1,
|
|
+ "xf86OpenConsole: Cannot open virtual console %d (%s), using /dev/null in shared VT mode\n",
|
|
+ xf86Info.vtno, strerror(errno));
|
|
+ xf86Info.consoleFd = open("/dev/null", O_RDWR | O_NDELAY, 0);
|
|
+ xf86Info.ShareVTs = TRUE;
|
|
+ return;
|
|
+ }
|
|
|
|
/*
|
|
* Linux doesn't switch to an active vt after the last close of a vt,
|
|
@@ -237,15 +248,23 @@ xf86OpenConsole(void)
|
|
struct termios nTty;
|
|
|
|
/*
|
|
- * now get the VT. This _must_ succeed, or else fail completely.
|
|
+ * now get the VT. If unprivileged without CAP_SYS_TTY_CONFIG,
|
|
+ * fall back to ShareVTs mode instead of aborting.
|
|
*/
|
|
- if (!switch_to(xf86Info.vtno, "xf86OpenConsole"))
|
|
- FatalError("xf86OpenConsole: Switching VT failed\n");
|
|
+ if (!switch_to(xf86Info.vtno, "xf86OpenConsole")) {
|
|
+ LogMessageVerb(X_WARNING, 1,
|
|
+ "xf86OpenConsole: VT switch not permitted, continuing in shared VT mode\n");
|
|
+ xf86Info.ShareVTs = TRUE;
|
|
+ return;
|
|
+ }
|
|
|
|
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
|
|
- if (ret < 0)
|
|
- FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
|
|
- strerror(errno));
|
|
+ if (ret < 0) {
|
|
+ LogMessageVerb(X_WARNING, 1, "xf86OpenConsole: VT_GETMODE failed %s\n",
|
|
+ strerror(errno));
|
|
+ xf86Info.ShareVTs = TRUE;
|
|
+ return;
|
|
+ }
|
|
|
|
OsSignal(SIGUSR1, xf86VTRequest);
|
|
|
|
@@ -254,15 +273,20 @@ xf86OpenConsole(void)
|
|
VT.acqsig = SIGUSR1;
|
|
|
|
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
|
|
- if (ret < 0)
|
|
- FatalError
|
|
- ("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
|
|
- strerror(errno));
|
|
+ if (ret < 0) {
|
|
+ LogMessageVerb(X_WARNING, 1,
|
|
+ "xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
|
|
+ strerror(errno));
|
|
+ xf86Info.ShareVTs = TRUE;
|
|
+ return;
|
|
+ }
|
|
|
|
SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
|
|
- if (ret < 0)
|
|
- FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
|
|
- strerror(errno));
|
|
+ if (ret < 0) {
|
|
+ LogMessageVerb(X_WARNING, 1,
|
|
+ "xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
|
|
+ strerror(errno));
|
|
+ }
|
|
|
|
tcgetattr(xf86Info.consoleFd, &tty_attr);
|
|
SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode));
|
|
@@ -274,11 +298,11 @@ xf86OpenConsole(void)
|
|
/* fine, just disable special keys */
|
|
SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
|
|
if (ret < 0)
|
|
- FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
|
|
- strerror(errno));
|
|
-
|
|
- /* ... and drain events, else the kernel gets angry */
|
|
- xf86SetConsoleHandler(drain_console, NULL);
|
|
+ LogMessageVerb(X_WARNING, 1,
|
|
+ "xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
|
|
+ strerror(errno));
|
|
+ else
|
|
+ xf86SetConsoleHandler(drain_console, NULL);
|
|
}
|
|
|
|
nTty = tty_attr;
|