Merge branch 'X11Libre:master' into master

This commit is contained in:
Xgui4 Studio 2025-07-01 15:49:10 -04:00 committed by GitHub
commit 30a51f4e81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 144 additions and 55 deletions

View File

@ -1280,7 +1280,7 @@ ProcVidModeGetMonitor(ClientPtr client)
+ nHsync + nVrefresh + nVendorItems + nModelItems
};
const int buflen = nHsync * nVrefresh + nVendorItems + nModelItems;
const int buflen = nHsync + nVrefresh + nVendorItems + nModelItems;
CARD32 *sendbuf = calloc(buflen, sizeof(CARD32));
if (!sendbuf)
@ -1302,22 +1302,22 @@ ProcVidModeGetMonitor(ClientPtr client)
bufwalk++;
}
memcpy(sendbuf,
memcpy(bufwalk,
pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VENDOR, 0).ptr,
vendorLength);
sendbuf += nVendorItems;
bufwalk += nVendorItems;
memcpy(sendbuf,
memcpy(bufwalk,
pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_MODEL, 0).ptr,
modelLength);
sendbuf += nModelItems;
bufwalk += nModelItems;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), &rep);
WriteToClient(client, sizeof(xXF86VidModeGetMonitorReply), &rep);
WriteToClient(client, buflen * sizeof(CARD32), sendbuf);
free(sendbuf);

View File

@ -647,7 +647,6 @@ ProcXF86BigfontDispatch(ClientPtr client)
static int _X_COLD
SProcXF86BigfontQueryVersion(ClientPtr client)
{
REQUEST(xXF86BigfontQueryVersionReq);
return ProcXF86BigfontQueryVersion(client);
}

View File

@ -1435,12 +1435,11 @@ MouseFini(KdPointerInfo * pi)
}
KdPointerDriver EphyrMouseDriver = {
"ephyr",
MouseInit,
MouseEnable,
MouseDisable,
MouseFini,
NULL,
.name = "ephyr",
.Init = MouseInit,
.Enable = MouseEnable,
.Disable = MouseDisable,
.Fini = MouseFini,
};
/* Keyboard */
@ -1509,12 +1508,11 @@ EphyrKeyboardBell(KdKeyboardInfo * ki, int volume, int frequency, int duration)
}
KdKeyboardDriver EphyrKeyboardDriver = {
"ephyr",
EphyrKeyboardInit,
EphyrKeyboardEnable,
EphyrKeyboardLeds,
EphyrKeyboardBell,
EphyrKeyboardDisable,
EphyrKeyboardFini,
NULL,
.name = "ephyr",
.Init = EphyrKeyboardInit,
.Enable = EphyrKeyboardEnable,
.Leds = EphyrKeyboardLeds,
.Bell = EphyrKeyboardBell,
.Disable = EphyrKeyboardDisable,
.Fini = EphyrKeyboardFini,
};

View File

@ -370,6 +370,23 @@ ddxProcessArgument(int argc, char **argv, int i)
return KdProcessArgument(argc, argv, i);
}
static int
EphyrInit(void)
{
/*
* make sure at least one screen
* has been added to the system.
*/
if (!KdCardInfoLast()) {
processScreenArg("640x480", NULL);
}
return hostx_init();
}
KdOsFuncs EphyrOsFuncs = {
.Init = EphyrInit,
};
void
OsVendorInit(void)
{
@ -381,32 +398,23 @@ OsVendorInit(void)
if (hostx_want_host_cursor())
ephyrFuncs.initCursor = &ephyrCursorInit;
if (serverGeneration == 1) {
if (!KdCardInfoLast()) {
processScreenArg("640x480", NULL);
}
hostx_init();
}
KdOsInit(&EphyrOsFuncs);
}
KdCardFuncs ephyrFuncs = {
ephyrCardInit, /* cardinit */
ephyrScreenInitialize, /* scrinit */
ephyrInitScreen, /* initScreen */
ephyrFinishInitScreen, /* finishInitScreen */
ephyrCreateResources, /* createRes */
ephyrScreenFini, /* scrfini */
ephyrCardFini, /* cardfini */
.cardinit = ephyrCardInit,
.scrinit = ephyrScreenInitialize,
.initScreen = ephyrInitScreen,
.finishInitScreen = ephyrFinishInitScreen,
.createRes = ephyrCreateResources,
0, /* initCursor */
.scrfini = ephyrScreenFini,
.cardfini = ephyrCardFini,
0, /* initAccel */
0, /* enableAccel */
0, /* disableAccel */
0, /* finiAccel */
/* no cursor or accel funcs here */
ephyrGetColors, /* getColors */
ephyrPutColors, /* putColors */
.getColors = ephyrGetColors,
.putColors = ephyrPutColors,
ephyrCloseScreen, /* closeScreen */
.closeScreen = ephyrCloseScreen,
};

View File

@ -91,6 +91,14 @@ const char *kdGlobalXkbLayout = NULL;
const char *kdGlobalXkbVariant = NULL;
const char *kdGlobalXkbOptions = NULL;
/*
* Carry arguments from InitOutput through driver initialization
* to KdScreenInit
*/
KdOsFuncs *kdOsFuncs = NULL;
void
KdDisableScreen(ScreenPtr pScreen)
{
@ -517,6 +525,19 @@ KdProcessArgument(int argc, char **argv, int i)
return 0;
}
void
KdOsInit(KdOsFuncs * pOsFuncs)
{
kdOsFuncs = pOsFuncs;
if (pOsFuncs) {
if (serverGeneration == 1) {
KdDoSwitchCmd("start");
if (pOsFuncs->Init)
(*pOsFuncs->Init) ();
}
}
}
static Bool
KdAllocatePrivates(ScreenPtr pScreen)
{

View File

@ -278,6 +278,16 @@ int KdAddConfigKeyboard(char *pointer);
int KdAddKeyboard(KdKeyboardInfo * ki);
void KdRemoveKeyboard(KdKeyboardInfo * ki);
typedef struct _KdOsFuncs {
int (*Init) (void); /* Only called when the X server is started, when serverGeneration == 1 */
void (*Enable) (void);
Bool (*SpecialKey) (KeySym);
void (*Disable) (void);
void (*Fini) (void);
void (*pollEvents) (void);
void (*Bell) (int, int, int);
} KdOsFuncs;
typedef struct _KdPointerMatrix {
int matrix[2][3];
} KdPointerMatrix;
@ -289,6 +299,8 @@ extern DevPrivateKeyRec kdScreenPrivateKeyRec;
extern Bool kdEmulateMiddleButton;
extern Bool kdDisableZaphod;
extern KdOsFuncs *kdOsFuncs;
#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey))
#define KdSetScreenPriv(pScreen,v) \
@ -345,6 +357,9 @@ void
int
KdProcessArgument(int argc, char **argv, int i);
void
KdOsInit(KdOsFuncs * pOsFuncs);
void
KdOsAddInputDrivers(void);

View File

@ -1 +1,5 @@
special compat code for legacy drivers, namely Nvidia proprietary
NVidia is lacking behind for at least a year and don't actually clean up
their spaghetti code. That's why we need to keep several special compat
functions to emulate prehistoric behaviour.

View File

@ -4,6 +4,8 @@
#include "dix/dix_priv.h"
#include "xf86_compat.h"
/*
* this is specifically for NVidia proprietary driver: they're again lagging
* behind a year, doing at least some minimal cleanup of their code base.
@ -13,12 +15,7 @@ _X_EXPORT void MarkClientException(ClientPtr pClient);
void MarkClientException(ClientPtr pClient)
{
LogMessageVerb(X_WARNING, 0, "Bogus driver calling DIX-internal function MarkClientException() !\n");
LogMessageVerb(X_WARNING, 0, "External drivers really should never ever call this function.\n");
LogMessageVerb(X_WARNING, 0, "Nor should they ever DIX-internal fields like ClientRec->noClientException\n");
LogMessageVerb(X_WARNING, 0, "File a bug report to driver vendor or use a FOSS driver.\n");
LogMessageVerb(X_WARNING, 0, "Proprietary drivers are inherently unstable, they just can't be done right.\n");
LogMessageVerb(X_WARNING, 0, "And just don't buy Nvidia hardware, ever.\n");
xf86NVidiaBugInternalFunc("MarkClientException()");
dixMarkClientException(pClient);
}

View File

@ -4,6 +4,8 @@
#include "include/os.h"
#include "xf86_compat.h"
#undef xf86Msg
#undef xf86MsgVerb
@ -17,9 +19,7 @@ _X_EXPORT void xf86Msg(MessageType type, const char *format, ...)
void xf86Msg(MessageType type, const char *format, ...)
{
LogMessageVerb(X_WARNING, 0, "Outdated driver still using xf86Msg() !\n");
LogMessageVerb(X_WARNING, 0, "File a bug report to driver vendor or use a FOSS driver.\n");
LogMessageVerb(X_WARNING, 0, "Proprietary drivers are inherently unstable, they just can't be done right.\n");
xf86NVidiaBugInternalFunc("xf86Msg()");
va_list ap;
@ -39,9 +39,7 @@ _X_EXPORT void xf86MsgVerb(MessageType type, int verb, const char *format, ...)
void
xf86MsgVerb(MessageType type, int verb, const char *format, ...)
{
LogMessageVerb(X_WARNING, 0, "Outdated driver still using xf86MsgVerb() !\n");
LogMessageVerb(X_WARNING, 0, "File a bug report to driver vendor or use a FOSS driver.\n");
LogMessageVerb(X_WARNING, 0, "Proprietary drivers are inherently unstable, they just can't be done right.\n");
xf86NVidiaBugInternalFunc("xf86MsgVerb()");
va_list ap;
va_start(ap, format);

View File

@ -1,6 +1,7 @@
srcs_xorg_compat = [
'clientexception.c',
'log.c',
'nvidiabug.c',
'ones.c',
'xf86Helper.c',
]

View File

@ -0,0 +1,31 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#include <dix-config.h>
#include "include/os.h"
#include "xf86_compat.h"
void xf86NVidiaBug(void)
{
LogMessageVerb(X_WARNING, 0, "[DRIVER BUG] file a bug report to driver vendor or use a free Xlibre driver.\n");
LogMessageVerb(X_WARNING, 0, "[DRIVER BUG] Proprietary drivers are inherently unstable, they just can't be done right.\n");
LogMessageVerb(X_WARNING, 0, "[DRIVER BUG] For NVidia report here: https://forums.developer.nvidia.com/c/gpu-graphics/linux/148\n");
LogMessageVerb(X_WARNING, 0, "[DRIVER BUG] And better don't buy NVidia HW until they've fixed their mess.\n");
}
void xf86NVidiaBugInternalFunc(const char* name)
{
LogMessageVerb(X_WARNING, 0, "[DRIVER BUG] calling internal function: %s\n", name);
LogMessageVerb(X_WARNING, 0, "[DRIVER BUG] this function is not supposed to be by drivers ever\n");
xf86NVidiaBug();
}
void xf86NVidiaBugObsoleteFunc(const char* name)
{
LogMessageVerb(X_WARNING, 0, "[DRIVER BUG] calling obsolete function: %s\n", name);
LogMessageVerb(X_WARNING, 0, "[DRIVER BUG] this function is not supposed to be by drivers ever\n");
xf86NVidiaBug();
}

View File

@ -0,0 +1,12 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#ifndef __XFREE86_COMPAT_XF86_COMPAT_H
#define __XFREE86_COMPAT_XF86_COMPAT_H
void xf86NVidiaBug(void);
void xf86NVidiaBugInternalFunc(const char* name);
void xf86NVidiaBugObsoleteFunc(const char* name);
#endif /* __XFREE86_COMPAT_XF86_COMPAT_H */

View File

@ -417,7 +417,6 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
{
int vercode[4];
long ver = data->xf86version;
MessageType errtype;
LogMessage(X_INFO, "Module %s: vendor=\"%s\"\n",
data->modname ? data->modname : "UNKNOWN!",
@ -458,6 +457,7 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
vermaj = GET_ABI_MAJOR(ver);
vermin = GET_ABI_MINOR(ver);
if (abimaj != vermaj) {
MessageType errtype;
if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
errtype = X_WARNING;
else
@ -469,6 +469,7 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
return FALSE;
}
else if (abimin > vermin) {
MessageType errtype;
if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
errtype = X_WARNING;
else

View File

@ -410,6 +410,10 @@ vpnprintf(char *string, int size_in, const char *f, va_list args)
f_idx++;
/* silently ignore reverse justification */
if (f[f_idx] == '-')
f_idx++;
/* silently swallow minimum field width */
if (f[f_idx] == '*') {
f_idx++;