xfree86: compat: add missing symbols needed by the proprietary nvidia drivers

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111 2025-06-16 17:43:15 +03:00 committed by Enrico Weigelt, metux IT consult
parent a43c9d8719
commit fa7cc111e7
4 changed files with 89 additions and 0 deletions

View File

@ -5,6 +5,7 @@
#include "include/os.h"
#undef xf86Msg
#undef xf86MsgVerb
/*
* this is specifically for NVidia proprietary driver: they're again lagging
@ -26,3 +27,24 @@ void xf86Msg(MessageType type, const char *format, ...)
LogVMessageVerb(type, 1, format, ap);
va_end(ap);
}
/*
* this is only needed for the 570.x nvidia drivers
*/
_X_EXPORT void xf86MsgVerb(MessageType type, int verb, const char *format, ...)
_X_ATTRIBUTE_PRINTF(3, 4);
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");
va_list ap;
va_start(ap, format);
LogVMessageVerb(type, verb, format, ap);
va_end(ap);
}

View File

@ -1,6 +1,8 @@
srcs_xorg_compat = [
'clientexception.c',
'log.c',
'ones.c',
'xf86Helper.c',
]
xorg_compat = static_library('xorg_compat',

33
hw/xfree86/compat/ones.c Normal file
View File

@ -0,0 +1,33 @@
#include <dix-config.h>
#include <X11/Xfuncproto.h>
#undef Ones
/*
* this is specifically for NVidia proprietary driver: they're again lagging
* behind a year, doing at least some minimal cleanup of their code base.
* All attempts to get in direct contact with them have failed.
*/
/*
* this is only needed for the 570.x nvidia drivers
*/
_X_EXPORT int Ones(unsigned long /*mask */ );
int
Ones(unsigned long mask)
{ /* HACKMEM 169 */
/* can't add a message here because this should be fast */
#if __has_builtin(__builtin_popcountl)
return __builtin_popcountl (mask);
#else
unsigned long y;
y = (mask >> 1) & 033333333333;
y = mask - y - ((y >> 1) & 033333333333);
/* x & 077 == x % 077 */
return (((y + (y >> 3)) & 030707070707) & 077);
#endif
}

View File

@ -0,0 +1,32 @@
#include <dix-config.h>
#include <X11/Xfuncproto.h>
#include "xf86Priv.h"
#include "xf86Bus.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.
* All attempts to get in direct contact with them have failed.
*/
/*
* this is only needed for the 570.x nvidia drivers
*/
_X_EXPORT Bool xf86IsScreenPrimary(ScrnInfoPtr pScrn);
Bool
xf86IsScreenPrimary(ScrnInfoPtr pScrn)
{
int i;
for (i = 0; i < pScrn->numEntities; i++) {
if (xf86IsEntityPrimary(i))
return TRUE;
}
return FALSE;
}