diff --git a/0001-Disallow-byte-swapped-clients-by-default.patch b/0001-Disallow-byte-swapped-clients-by-default.patch deleted file mode 100644 index 2cbf79829350a585528e0d455708614cac47823e..0000000000000000000000000000000000000000 --- a/0001-Disallow-byte-swapped-clients-by-default.patch +++ /dev/null @@ -1,272 +0,0 @@ -From 73d6e888c6058b28a0e87ab65aa4172b17d8327d Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Mon, 19 Dec 2022 10:34:29 +1000 -Subject: [PATCH xserver] Fix some indentation issues - -Signed-off-by: Peter Hutterer ---- - dix/dispatch.c | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -diff --git a/dix/dispatch.c b/dix/dispatch.c -index 210df75c63..e38a8fecaa 100644 ---- a/dix/dispatch.c -+++ b/dix/dispatch.c -@@ -492,10 +492,10 @@ Dispatch(void) - if (!WaitForSomething(clients_are_ready())) - continue; - -- /***************** -- * Handle events in round robin fashion, doing input between -- * each round -- *****************/ -+ /***************** -+ * Handle events in round robin fashion, doing input between -+ * each round -+ *****************/ - - if (!dispatchException && clients_are_ready()) { - client = SmartScheduleClient(); -@@ -3657,11 +3657,11 @@ ProcInitialConnection(ClientPtr client) - prefix = (xConnClientPrefix *) ((char *)stuff + sz_xReq); - order = prefix->byteOrder; - if (order != 'l' && order != 'B' && order != 'r' && order != 'R') -- return client->noClientException = -1; -+ return client->noClientException = -1; - if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) || -- (!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) { -- client->swapped = TRUE; -- SwapConnClientPrefix(prefix); -+ (!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) { -+ client->swapped = TRUE; -+ SwapConnClientPrefix(prefix); - } - stuff->reqType = 2; - stuff->length += bytes_to_int32(prefix->nbytesAuthProto) + -@@ -3670,7 +3670,7 @@ ProcInitialConnection(ClientPtr client) - swaps(&stuff->length); - } - if (order == 'r' || order == 'R') { -- client->local = FALSE; -+ client->local = FALSE; - } - ResetCurrentRequest(client); - return Success; -@@ -3781,8 +3781,8 @@ ProcEstablishConnection(ClientPtr client) - auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto); - - if ((client->req_len << 2) != sz_xReq + sz_xConnClientPrefix + -- pad_to_int32(prefix->nbytesAuthProto) + -- pad_to_int32(prefix->nbytesAuthString)) -+ pad_to_int32(prefix->nbytesAuthProto) + -+ pad_to_int32(prefix->nbytesAuthString)) - reason = "Bad length"; - else if ((prefix->majorVersion != X_PROTOCOL) || - (prefix->minorVersion != X_PROTOCOL_REVISION)) --- -2.39.0 - -From f69280ddcdd3115ee4717f22e85e0f43569b60dd Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 20 Dec 2022 11:40:16 +1000 -Subject: [PATCH xserver] dix: localize two variables - -Signed-off-by: Peter Hutterer ---- - dix/dispatch.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/dix/dispatch.c b/dix/dispatch.c -index c651c3d887..92be773e6c 100644 ---- a/dix/dispatch.c -+++ b/dix/dispatch.c -@@ -3766,14 +3766,11 @@ int - ProcEstablishConnection(ClientPtr client) - { - const char *reason; -- char *auth_proto, *auth_string; - xConnClientPrefix *prefix; - - REQUEST(xReq); - - prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq); -- auth_proto = (char *) prefix + sz_xConnClientPrefix; -- auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto); - - if ((client->req_len << 2) != sz_xReq + sz_xConnClientPrefix + - pad_to_int32(prefix->nbytesAuthProto) + -@@ -3782,12 +3779,15 @@ ProcEstablishConnection(ClientPtr client) - else if ((prefix->majorVersion != X_PROTOCOL) || - (prefix->minorVersion != X_PROTOCOL_REVISION)) - reason = "Protocol version mismatch"; -- else -+ else { -+ char *auth_proto = (char *) prefix + sz_xConnClientPrefix; -+ char *auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto); - reason = ClientAuthorized(client, - (unsigned short) prefix->nbytesAuthProto, - auth_proto, - (unsigned short) prefix->nbytesAuthString, - auth_string); -+ } - - return (SendConnSetup(client, reason)); - } --- -2.39.0 - -From 412777664a20dd3561b936c02c96571a756fe9b2 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 20 Dec 2022 10:42:03 +1000 -Subject: [PATCH xserver] Disallow byte-swapped clients by default - -The X server swapping code is a huge attack surface, much of this code -is untested and prone to security issues. The use-case of byte-swapped -clients is very niche, so let's disable this by default and allow it -only when the respective config option or commandline flag is given. - -For Xorg, this adds the ServerFlag "AllowByteSwappedClients" "on". -For all DDX, this adds the commandline options +byteswappedclients and --byteswappedclients to enable or disable, respectively. - -Fixes #1201 - -https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1029 - -Signed-off-by: Peter Hutterer ---- - dix/dispatch.c | 4 +++- - hw/xfree86/common/xf86Config.c | 8 ++++++++ - hw/xfree86/man/xorg.conf.man | 2 ++ - hw/xwayland/xwayland.pc.in | 1 + - include/opaque.h | 2 ++ - man/Xserver.man | 6 ++++++ - os/utils.c | 9 +++++++++ - 7 files changed, 31 insertions(+), 1 deletion(-) - -diff --git a/dix/dispatch.c b/dix/dispatch.c -index 92be773e6c..9c26753a96 100644 ---- a/dix/dispatch.c -+++ b/dix/dispatch.c -@@ -3772,7 +3772,9 @@ ProcEstablishConnection(ClientPtr client) - - prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq); - -- if ((client->req_len << 2) != sz_xReq + sz_xConnClientPrefix + -+ if (client->swapped && !AllowByteSwappedClients) { -+ reason = "Prohibited client endianess, see the Xserver man page "; -+ } else if ((client->req_len << 2) != sz_xReq + sz_xConnClientPrefix + - pad_to_int32(prefix->nbytesAuthProto) + - pad_to_int32(prefix->nbytesAuthString)) - reason = "Bad length"; -diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c -index 5d814c1485..41acb25aa2 100644 ---- a/hw/xfree86/common/xf86Config.c -+++ b/hw/xfree86/common/xf86Config.c -@@ -646,6 +646,7 @@ typedef enum { - FLAG_MAX_CLIENTS, - FLAG_IGLX, - FLAG_DEBUG, -+ FLAG_ALLOW_BYTE_SWAPPED_CLIENTS, - } FlagValues; - - /** -@@ -705,6 +706,8 @@ static OptionInfoRec FlagOptions[] = { - {0}, FALSE}, - {FLAG_DEBUG, "Debug", OPTV_STRING, - {0}, FALSE}, -+ {FLAG_ALLOW_BYTE_SWAPPED_CLIENTS, "AllowByteSwappedClients", OPTV_BOOLEAN, -+ {0}, FALSE}, - {-1, NULL, OPTV_NONE, - {0}, FALSE}, - }; -@@ -746,6 +749,11 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) - xf86Msg(X_CONFIG, "Ignoring ABI Version\n"); - } - -+ xf86GetOptValBool(FlagOptions, FLAG_ALLOW_BYTE_SWAPPED_CLIENTS, &AllowByteSwappedClients); -+ if (AllowByteSwappedClients) { -+ xf86Msg(X_CONFIG, "Allowing byte-swapped clients\n"); -+ } -+ - if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) { - xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_DEVICES, - &xf86Info.autoAddDevices); -diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man -index 01b47247ee..d057f26ecd 100644 ---- a/hw/xfree86/man/xorg.conf.man -+++ b/hw/xfree86/man/xorg.conf.man -@@ -677,6 +677,8 @@ Possible values are - or - .BR sync . - Unset by default. -+.BI "Option \*qAllowByteSwappedClients\*q \*q" boolean \*q -+Allow clients with a different byte-order than the server. Disabled by default. - .SH "MODULE SECTION" - The - .B Module -diff --git a/include/opaque.h b/include/opaque.h -index 256261c2ad..398d4b4e51 100644 ---- a/include/opaque.h -+++ b/include/opaque.h -@@ -74,4 +74,6 @@ extern _X_EXPORT Bool bgNoneRoot; - extern _X_EXPORT Bool CoreDump; - extern _X_EXPORT Bool NoListenAll; - -+extern _X_EXPORT Bool AllowByteSwappedClients; -+ - #endif /* OPAQUE_H */ -diff --git a/man/Xserver.man b/man/Xserver.man -index 764bd1d907..e7adf9eb35 100644 ---- a/man/Xserver.man -+++ b/man/Xserver.man -@@ -114,6 +114,12 @@ pattern. This is the default unless -retro or -wr is specified. - .B \-bs - disables backing store support on all screens. - .TP 8 -+.B \+byteswappedclients -+Allow connections from clients with an endianess different to that of the server. -+.TP 8 -+.B \-byteswappedclients -+Prohibit connections from clients with an endianess different to that of the server. -+.TP 8 - .B \-c - turns off key-click. - .TP 8 -diff --git a/os/utils.c b/os/utils.c -index fe94912f34..405bf7d8b4 100644 ---- a/os/utils.c -+++ b/os/utils.c -@@ -189,6 +189,8 @@ Bool CoreDump; - - Bool enableIndirectGLX = FALSE; - -+Bool AllowByteSwappedClients = FALSE; -+ - #ifdef PANORAMIX - Bool PanoramiXExtensionDisabledHack = FALSE; - #endif -@@ -523,6 +525,8 @@ UseMsg(void) - ErrorF("-br create root window with black background\n"); - ErrorF("+bs enable any backing store support\n"); - ErrorF("-bs disable any backing store support\n"); -+ ErrorF("+byteswappedclients Allow clients with endianess different to that of the server\n"); -+ ErrorF("-byteswappedclients Prohibit clients with endianess different to that of the server\n"); - ErrorF("-c turns off key-click\n"); - ErrorF("c # key-click volume (0-100)\n"); - ErrorF("-cc int default color visual class\n"); -@@ -720,6 +724,11 @@ ProcessCommandLine(int argc, char *argv[]) - else - UseMsg(); - } -+ else if (strcmp(argv[i], "-byteswappedclients") == 0) { -+ AllowByteSwappedClients = FALSE; -+ } else if (strcmp(argv[i], "+byteswappedclients") == 0) { -+ AllowByteSwappedClients = TRUE; -+ } - else if (strcmp(argv[i], "-br") == 0); /* default */ - else if (strcmp(argv[i], "+bs") == 0) - enableBackingStore = TRUE; --- -2.39.0 - diff --git a/0001-Don-t-hardcode-fps-for-fake-screen.patch b/0001-Don-t-hardcode-fps-for-fake-screen.patch deleted file mode 100644 index 465a92b7cd1958fbbc74e7c86160d467837bde1f..0000000000000000000000000000000000000000 --- a/0001-Don-t-hardcode-fps-for-fake-screen.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 6497eeeb1a6552315132340565a3901d4db2144c Mon Sep 17 00:00:00 2001 -From: Boris-Barboris -Date: Tue, 22 Jun 2021 00:51:08 +0300 -Subject: [PATCH] Don't hardcode fps for fake screen - -Currently, when main hardware screen is powered-off, -X server initializes fake screen's timer with -1 second update interval. - -Streaming software like Nomachine or Vnc, as well as -desktop input automation suffers from it, since it -will forever be stuck on 1 fps until the display is -turned back on. - -This commit adds command line option -fakescreenfps -that allows the user to change the default fake screen -timer. - -Signed-off-by: Baranin Alexander ---- - man/Xserver.man | 3 +++ - os/utils.c | 12 ++++++++++++ - present/present.h | 2 ++ - present/present_fake.c | 28 ++++++++++++++++++---------- - 4 files changed, 35 insertions(+), 10 deletions(-) - -diff --git a/man/Xserver.man b/man/Xserver.man -index 31ffb8c..b1a3f40 100644 ---- a/man/Xserver.man -+++ b/man/Xserver.man -@@ -169,6 +169,9 @@ sets default cursor font. - .B \-fn \fIfont\fP - sets the default font. - .TP 8 -+.B \-fakescreenfps \fFps\fP -+sets fake presenter screen default fps (allowable range: 1-600). -+.TP 8 - .B \-fp \fIfontPath\fP - sets the search path for fonts. This path is a comma separated list - of directories which the X server searches for font databases. -diff --git a/os/utils.c b/os/utils.c -index 2ba1c80..721d4e9 100644 ---- a/os/utils.c -+++ b/os/utils.c -@@ -110,6 +110,8 @@ __stdcall unsigned long GetTickCount(void); - - #include "picture.h" - -+#include "present.h" -+ - Bool noTestExtensions; - - #ifdef COMPOSITE -@@ -526,6 +528,7 @@ UseMsg(void) - ErrorF - ("-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs\n"); - ErrorF("-f # bell base (0-100)\n"); -+ ErrorF("-fakescreenfps # fake screen default fps (1-600)\n"); - ErrorF("-fc string cursor font\n"); - ErrorF("-fn string default font name\n"); - ErrorF("-fp string default font path\n"); -@@ -776,6 +779,15 @@ ProcessCommandLine(int argc, char *argv[]) - else - UseMsg(); - } -+ else if (strcmp(argv[i], "-fakescreenfps") == 0) { -+ if (++i < argc) { -+ FakeScreenFps = (uint32_t) atoi(argv[i]); -+ if (FakeScreenFps < 1 || FakeScreenFps > 600) -+ FatalError("fakescreenfps must be an integer in [1;600] range\n"); -+ } -+ else -+ UseMsg(); -+ } - else if (strcmp(argv[i], "-fc") == 0) { - if (++i < argc) - defaultCursorFont = argv[i]; -diff --git a/present/present.h b/present/present.h -index 3d0b972..e7cc50d 100644 ---- a/present/present.h -+++ b/present/present.h -@@ -190,4 +190,6 @@ present_register_complete_notify(present_complete_notify_proc proc); - extern _X_EXPORT Bool - present_can_window_flip(WindowPtr window); - -+extern _X_EXPORT uint32_t FakeScreenFps; -+ - #endif /* _PRESENT_H_ */ -diff --git a/present/present_fake.c b/present/present_fake.c -index 2350638..d9ac598 100644 ---- a/present/present_fake.c -+++ b/present/present_fake.c -@@ -117,21 +117,29 @@ present_fake_queue_vblank(ScreenPtr screen, - return Success; - } - -+uint32_t FakeScreenFps = 0; -+ - void - present_fake_screen_init(ScreenPtr screen) - { -+ uint32_t fake_fps; - present_screen_priv_ptr screen_priv = present_screen_priv(screen); - -- /* For screens with hardware vblank support, the fake code -- * will be used for off-screen windows and while screens are blanked, -- * in which case we want a slow interval here -- * -- * Otherwise, pretend that the screen runs at 60Hz -- */ -- if (screen_priv->info && screen_priv->info->get_crtc) -- screen_priv->fake_interval = 1000000; -- else -- screen_priv->fake_interval = 16667; -+ if (FakeScreenFps) -+ fake_fps = FakeScreenFps; -+ else { -+ /* For screens with hardware vblank support, the fake code -+ * will be used for off-screen windows and while screens are blanked, -+ * in which case we want a large interval here: 1Hz -+ * -+ * Otherwise, pretend that the screen runs at 60Hz -+ */ -+ if (screen_priv->info && screen_priv->info->get_crtc) -+ fake_fps = 1; -+ else -+ fake_fps = 60; -+ } -+ screen_priv->fake_interval = 1000000 / fake_fps; - } - - void --- -2.34.1 - diff --git a/0001-Xi-fix-potential-use-after-free-in-DeepCopyPointerCl.patch b/0001-Xi-fix-potential-use-after-free-in-DeepCopyPointerCl.patch deleted file mode 100644 index 238989583c9f525b37ec525fcc53871d524f4d6e..0000000000000000000000000000000000000000 --- a/0001-Xi-fix-potential-use-after-free-in-DeepCopyPointerCl.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 7150ba655c0cc08fa6ded309b81265bb672f2869 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 25 Jan 2023 11:41:40 +1000 -Subject: [PATCH xserver] Xi: fix potential use-after-free in - DeepCopyPointerClasses - -CVE-2023-0494, ZDI-CAN 19596 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer ---- - Xi/exevents.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/Xi/exevents.c b/Xi/exevents.c -index 217baa9561..dcd4efb3bc 100644 ---- a/Xi/exevents.c -+++ b/Xi/exevents.c -@@ -619,8 +619,10 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) - memcpy(to->button->xkb_acts, from->button->xkb_acts, - sizeof(XkbAction)); - } -- else -+ else { - free(to->button->xkb_acts); -+ to->button->xkb_acts = NULL; -+ } - - memcpy(to->button->labels, from->button->labels, - from->button->numButtons * sizeof(Atom)); --- -2.39.0 - diff --git a/0001-Xi-randr-fix-handling-of-PropModeAppend-Prepend.patch b/0001-Xi-randr-fix-handling-of-PropModeAppend-Prepend.patch deleted file mode 100644 index 99625ddc045abe0720c75adc158f7ea36d7204e2..0000000000000000000000000000000000000000 --- a/0001-Xi-randr-fix-handling-of-PropModeAppend-Prepend.patch +++ /dev/null @@ -1,80 +0,0 @@ -From a31ba141824a7649e11f0ef7673718ce559d6337 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 3 Oct 2023 11:53:05 +1000 -Subject: [PATCH xserver 1/4] Xi/randr: fix handling of PropModeAppend/Prepend - -The handling of appending/prepending properties was incorrect, with at -least two bugs: the property length was set to the length of the new -part only, i.e. appending or prepending N elements to a property with P -existing elements always resulted in the property having N elements -instead of N + P. - -Second, when pre-pending a value to a property, the offset for the old -values was incorrect, leaving the new property with potentially -uninitalized values and/or resulting in OOB memory writes. -For example, prepending a 3 element value to a 5 element property would -result in this 8 value array: - [N, N, N, ?, ?, P, P, P ] P, P - ^OOB write - -The XI2 code is a copy/paste of the RandR code, so the bug exists in -both. - -CVE-2023-5367, ZDI-CAN-22153 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer ---- - Xi/xiproperty.c | 4 ++-- - randr/rrproperty.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c -index 6ec419e870..563c4f31a5 100644 ---- a/Xi/xiproperty.c -+++ b/Xi/xiproperty.c -@@ -730,7 +730,7 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type, - XIDestroyDeviceProperty(prop); - return BadAlloc; - } -- new_value.size = len; -+ new_value.size = total_len; - new_value.type = type; - new_value.format = format; - -@@ -747,7 +747,7 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type, - case PropModePrepend: - new_data = new_value.data; - old_data = (void *) (((char *) new_value.data) + -- (prop_value->size * size_in_bytes)); -+ (len * size_in_bytes)); - break; - } - if (new_data) -diff --git a/randr/rrproperty.c b/randr/rrproperty.c -index c2fb9585c6..25469f57b2 100644 ---- a/randr/rrproperty.c -+++ b/randr/rrproperty.c -@@ -209,7 +209,7 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, - RRDestroyOutputProperty(prop); - return BadAlloc; - } -- new_value.size = len; -+ new_value.size = total_len; - new_value.type = type; - new_value.format = format; - -@@ -226,7 +226,7 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, - case PropModePrepend: - new_data = new_value.data; - old_data = (void *) (((char *) new_value.data) + -- (prop_value->size * size_in_bytes)); -+ (len * size_in_bytes)); - break; - } - if (new_data) --- -2.41.0 - diff --git a/0001-Xtest-disallow-GenericEvents-in-XTestSwapFakeInput.patch b/0001-Xtest-disallow-GenericEvents-in-XTestSwapFakeInput.patch deleted file mode 100644 index 017f2474b9d0384df4ad8e595d0f3aeddfe217f0..0000000000000000000000000000000000000000 --- a/0001-Xtest-disallow-GenericEvents-in-XTestSwapFakeInput.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 8dba686dc277d6d262ad0c77b4632a5b276697ba Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 29 Nov 2022 12:55:45 +1000 -Subject: [PATCH xserver 1/7] Xtest: disallow GenericEvents in - XTestSwapFakeInput - -XTestSwapFakeInput assumes all events in this request are -sizeof(xEvent) and iterates through these in 32-byte increments. -However, a GenericEvent may be of arbitrary length longer than 32 bytes, -so any GenericEvent in this list would result in subsequent events to be -misparsed. - -Additional, the swapped event is written into a stack-allocated struct -xEvent (size 32 bytes). For any GenericEvent longer than 32 bytes, -swapping the event may thus smash the stack like an avocado on toast. - -Catch this case early and return BadValue for any GenericEvent. -Which is what would happen in unswapped setups anyway since XTest -doesn't support GenericEvent. - -CVE-2022-46340, ZDI-CAN 19265 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xext/xtest.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/Xext/xtest.c b/Xext/xtest.c -index bf27eb590b..2985a4ce6e 100644 ---- a/Xext/xtest.c -+++ b/Xext/xtest.c -@@ -502,10 +502,11 @@ XTestSwapFakeInput(ClientPtr client, xReq * req) - - nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent); - for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) { -+ int evtype = ev->u.u.type & 0x177; - /* Swap event */ -- proc = EventSwapVector[ev->u.u.type & 0177]; -+ proc = EventSwapVector[evtype]; - /* no swapping proc; invalid event type? */ -- if (!proc || proc == NotImplemented) { -+ if (!proc || proc == NotImplemented || evtype == GenericEvent) { - client->errorValue = ev->u.u.type; - return BadValue; - } --- -2.38.1 - diff --git a/0001-add-a-quirk-for-apple-silicon.patch b/0001-add-a-quirk-for-apple-silicon.patch deleted file mode 100644 index 17c40e500ec2c82b1a60efcc8bf2cd2c7e0e0376..0000000000000000000000000000000000000000 --- a/0001-add-a-quirk-for-apple-silicon.patch +++ /dev/null @@ -1,30 +0,0 @@ -commit 39934a656a44722d16a80bf4db411c53e2d67b38 (HEAD -> master, origin/master, origin/HEAD) -Author: Eric Curtin -Date: Fri Dec 16 11:10:12 2022 +0000 - - config: add a quirk for Apple Silicon appledrm - - Xorg server does not correctly select the DCP for the display without a - quirk on Apple Silicon. - - Signed-off-by: Eric Curtin - Suggested-by: Hector Martin - -diff --git a/config/10-quirks.conf b/config/10-quirks.conf -index 47907d82d..54dd908a7 100644 ---- a/config/10-quirks.conf -+++ b/config/10-quirks.conf -@@ -36,3 +36,13 @@ Section "InputClass" - MatchDriver "evdev" - Option "TypeName" "MOUSE" - EndSection -+ -+# https://bugzilla.redhat.com/show_bug.cgi?id=2152414 -+# Xorg server does not correctly select the DCP for the display without -+# a quirk on Apple Silicon -+Section "OutputClass" -+ Identifier "appledrm" -+ MatchDriver "apple" -+ Driver "modesetting" -+ Option "PrimaryGPU" "true" -+EndSection diff --git a/0001-autobind-GPUs-to-the-screen.patch b/0001-autobind-GPUs-to-the-screen.patch deleted file mode 100644 index 86b96a23e4bf454b4362e0e0acc5687b60b887e4..0000000000000000000000000000000000000000 --- a/0001-autobind-GPUs-to-the-screen.patch +++ /dev/null @@ -1,293 +0,0 @@ -From 471289fa1dc359555ceed6302f7d9605ab6be3ea Mon Sep 17 00:00:00 2001 -From: Dave Airlie -Date: Mon, 2 Apr 2018 16:49:02 -0400 -Subject: [PATCH] autobind GPUs to the screen - -This is a modified version of a patch we've been carry-ing in Fedora and -RHEL for years now. This patch automatically adds secondary GPUs to the -master as output sink / offload source making e.g. the use of -slave-outputs just work, with requiring the user to manually run -"xrandr --setprovideroutputsource" before he can hookup an external -monitor to his hybrid graphics laptop. - -There is one problem with this patch, which is why it was not upstreamed -before. What to do when a secondary GPU gets detected really is a policy -decission (e.g. one may want to autobind PCI GPUs but not USB ones) and -as such should be under control of the Desktop Environment. - -Unconditionally adding autobinding support to the xserver will result -in races between the DE dealing with the hotplug of a secondary GPU -and the server itself dealing with it. - -However we've waited for years for any Desktop Environments to actually -start doing some sort of autoconfiguration of secondary GPUs and there -is still not a single DE dealing with this, so I believe that it is -time to upstream this now. - -To avoid potential future problems if any DEs get support for doing -secondary GPU configuration themselves, the new autobind functionality -is made optional. Since no DEs currently support doing this themselves it -is enabled by default. When DEs grow support for doing this themselves -they can disable the servers autobinding through the servers cmdline or a -xorg.conf snippet. - -Signed-off-by: Dave Airlie -[hdegoede@redhat.com: Make configurable, fix with nvidia, submit upstream] -Signed-off-by: Hans de Goede ---- - hw/xfree86/common/xf86Config.c | 19 +++++++++++++++++++ - hw/xfree86/common/xf86Globals.c | 2 ++ - hw/xfree86/common/xf86Init.c | 20 ++++++++++++++++++++ - hw/xfree86/common/xf86Priv.h | 1 + - hw/xfree86/common/xf86Privstr.h | 1 + - hw/xfree86/common/xf86platformBus.c | 4 ++++ - hw/xfree86/man/Xorg.man | 7 +++++++ - hw/xfree86/man/xorg.conf.man | 6 ++++++ - randr/randrstr.h | 3 +++ - randr/rrprovider.c | 22 ++++++++++++++++++++++ - 10 files changed, 85 insertions(+) - -diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c -index 2c1d335..d7d7c2e 100644 ---- a/hw/xfree86/common/xf86Config.c -+++ b/hw/xfree86/common/xf86Config.c -@@ -643,6 +643,7 @@ typedef enum { - FLAG_DRI2, - FLAG_USE_SIGIO, - FLAG_AUTO_ADD_GPU, -+ FLAG_AUTO_BIND_GPU, - FLAG_MAX_CLIENTS, - FLAG_IGLX, - FLAG_DEBUG, -@@ -699,6 +700,8 @@ static OptionInfoRec FlagOptions[] = { - {0}, FALSE}, - {FLAG_AUTO_ADD_GPU, "AutoAddGPU", OPTV_BOOLEAN, - {0}, FALSE}, -+ {FLAG_AUTO_BIND_GPU, "AutoBindGPU", OPTV_BOOLEAN, -+ {0}, FALSE}, - {FLAG_MAX_CLIENTS, "MaxClients", OPTV_INTEGER, - {0}, FALSE }, - {FLAG_IGLX, "IndirectGLX", OPTV_BOOLEAN, -@@ -779,6 +782,22 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) - } - xf86Msg(from, "%sutomatically adding GPU devices\n", - xf86Info.autoAddGPU ? "A" : "Not a"); -+ -+ if (xf86AutoBindGPUDisabled) { -+ xf86Info.autoBindGPU = FALSE; -+ from = X_CMDLINE; -+ } -+ else if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_BIND_GPU)) { -+ xf86GetOptValBool(FlagOptions, FLAG_AUTO_BIND_GPU, -+ &xf86Info.autoBindGPU); -+ from = X_CONFIG; -+ } -+ else { -+ from = X_DEFAULT; -+ } -+ xf86Msg(from, "%sutomatically binding GPU devices\n", -+ xf86Info.autoBindGPU ? "A" : "Not a"); -+ - /* - * Set things up based on the config file information. Some of these - * settings may be overridden later when the command line options are -diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c -index e890f05..7b27b4c 100644 ---- a/hw/xfree86/common/xf86Globals.c -+++ b/hw/xfree86/common/xf86Globals.c -@@ -131,6 +131,7 @@ xf86InfoRec xf86Info = { - #else - .autoAddGPU = FALSE, - #endif -+ .autoBindGPU = TRUE, - }; - - const char *xf86ConfigFile = NULL; -@@ -191,6 +192,7 @@ Bool xf86FlipPixels = FALSE; - Gamma xf86Gamma = { 0.0, 0.0, 0.0 }; - - Bool xf86AllowMouseOpenFail = FALSE; -+Bool xf86AutoBindGPUDisabled = FALSE; - - #ifdef XF86VIDMODE - Bool xf86VidModeDisabled = FALSE; -diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c -index ea42ec9..ec255b6 100644 ---- a/hw/xfree86/common/xf86Init.c -+++ b/hw/xfree86/common/xf86Init.c -@@ -76,6 +76,7 @@ - #include "xf86DDC.h" - #include "xf86Xinput.h" - #include "xf86InPriv.h" -+#include "xf86Crtc.h" - #include "picturestr.h" - #include "randrstr.h" - #include "glxvndabi.h" -@@ -237,6 +238,19 @@ xf86PrivsElevated(void) - return PrivsElevated(); - } - -+static void -+xf86AutoConfigOutputDevices(void) -+{ -+ int i; -+ -+ if (!xf86Info.autoBindGPU) -+ return; -+ -+ for (i = 0; i < xf86NumGPUScreens; i++) -+ RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]), -+ xf86ScrnToScreen(xf86Screens[0])); -+} -+ - static void - TrapSignals(void) - { -@@ -770,6 +784,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) - for (i = 0; i < xf86NumGPUScreens; i++) - AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); - -+ xf86AutoConfigOutputDevices(); -+ - xf86VGAarbiterWrapFunctions(); - if (sigio_blocked) - input_unlock(); -@@ -1278,6 +1294,10 @@ ddxProcessArgument(int argc, char **argv, int i) - xf86Info.iglxFrom = X_CMDLINE; - return 0; - } -+ if (!strcmp(argv[i], "-noautoBindGPU")) { -+ xf86AutoBindGPUDisabled = TRUE; -+ return 1; -+ } - - /* OS-specific processing */ - return xf86ProcessArgument(argc, argv, i); -diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h -index 4fe2b5f..6566622 100644 ---- a/hw/xfree86/common/xf86Priv.h -+++ b/hw/xfree86/common/xf86Priv.h -@@ -46,6 +46,7 @@ - extern _X_EXPORT const char *xf86ConfigFile; - extern _X_EXPORT const char *xf86ConfigDir; - extern _X_EXPORT Bool xf86AllowMouseOpenFail; -+extern _X_EXPORT Bool xf86AutoBindGPUDisabled; - - #ifdef XF86VIDMODE - extern _X_EXPORT Bool xf86VidModeDisabled; -diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h -index 21c2e1f..6c71863 100644 ---- a/hw/xfree86/common/xf86Privstr.h -+++ b/hw/xfree86/common/xf86Privstr.h -@@ -98,6 +98,7 @@ typedef struct { - - Bool autoAddGPU; - const char *debug; -+ Bool autoBindGPU; - } xf86InfoRec, *xf86InfoPtr; - - /* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */ -diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c -index cef47da..913a324 100644 ---- a/hw/xfree86/common/xf86platformBus.c -+++ b/hw/xfree86/common/xf86platformBus.c -@@ -49,6 +49,7 @@ - #include "Pci.h" - #include "xf86platformBus.h" - #include "xf86Config.h" -+#include "xf86Crtc.h" - - #include "randrstr.h" - int platformSlotClaimed; -@@ -665,6 +666,9 @@ xf86platformAddDevice(int index) - } - /* attach unbound to 0 protocol screen */ - AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen); -+ if (xf86Info.autoBindGPU) -+ RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]), -+ xf86ScrnToScreen(xf86Screens[0])); - - RRResourcesChanged(xf86Screens[0]->pScreen); - RRTellChanged(xf86Screens[0]->pScreen); -diff --git a/hw/xfree86/man/Xorg.man b/hw/xfree86/man/Xorg.man -index 13a9dc3..745f986 100644 ---- a/hw/xfree86/man/Xorg.man -+++ b/hw/xfree86/man/Xorg.man -@@ -283,6 +283,13 @@ is a comma separated list of directories to search for - server modules. This option is only available when the server is run - as root (i.e, with real-uid 0). - .TP 8 -+.B \-noautoBindGPU -+Disable automatically setting secondary GPUs up as output sinks and offload -+sources. This is equivalent to setting the -+.B AutoBindGPU -+xorg.conf(__filemansuffix__) file option. To -+.B false. -+.TP 8 - .B \-nosilk - Disable Silken Mouse support. - .TP 8 -diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man -index 9589262..8d51e06 100644 ---- a/hw/xfree86/man/xorg.conf.man -+++ b/hw/xfree86/man/xorg.conf.man -@@ -672,6 +672,12 @@ Enabled by default. - If this option is disabled, then no GPU devices will be added from the udev - backend. Enabled by default. (May need to be disabled to setup Xinerama). - .TP 7 -+.BI "Option \*qAutoBindGPU\*q \*q" boolean \*q -+If enabled then secondary GPUs will be automatically set up as output-sinks and -+offload-sources. Making e.g. laptop outputs connected only to the secondary -+GPU directly available for use without needing to run -+"xrandr --setprovideroutputsource". Enabled by default. -+.TP 7 - .BI "Option \*qLog\*q \*q" string \*q - This option controls whether the log is flushed and/or synced to disk after - each message. -diff --git a/randr/randrstr.h b/randr/randrstr.h -index f94174b..092d726 100644 ---- a/randr/randrstr.h -+++ b/randr/randrstr.h -@@ -1039,6 +1039,9 @@ RRProviderLookup(XID id, RRProviderPtr *provider_p); - extern _X_EXPORT void - RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider); - -+extern _X_EXPORT void -+RRProviderAutoConfigGpuScreen(ScreenPtr pScreen, ScreenPtr masterScreen); -+ - /* rrproviderproperty.c */ - - extern _X_EXPORT void -diff --git a/randr/rrprovider.c b/randr/rrprovider.c -index e4bc2bf..e04c18f 100644 ---- a/randr/rrprovider.c -+++ b/randr/rrprovider.c -@@ -485,3 +485,25 @@ RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider) - - WriteEventsToClient(client, 1, (xEvent *) &pe); - } -+ -+void -+RRProviderAutoConfigGpuScreen(ScreenPtr pScreen, ScreenPtr masterScreen) -+{ -+ rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); -+ rrScrPrivPtr masterPriv = rrGetScrPriv(masterScreen); -+ RRProviderPtr provider = pScrPriv->provider; -+ RRProviderPtr master_provider = masterPriv->provider; -+ -+ if (!provider || !master_provider) -+ return; -+ -+ if ((provider->capabilities & RR_Capability_SinkOutput) && -+ (master_provider->capabilities & RR_Capability_SourceOutput)) { -+ pScrPriv->rrProviderSetOutputSource(pScreen, provider, master_provider); -+ RRInitPrimeSyncProps(pScreen); -+ } -+ -+ if ((provider->capabilities & RR_Capability_SourceOffload) && -+ (master_provider->capabilities & RR_Capability_SinkOffload)) -+ pScrPriv->rrProviderSetOffloadSink(pScreen, provider, master_provider); -+} --- -2.16.2 - diff --git a/0001-composite-Fix-use-after-free-of-the-COW.patch b/0001-composite-Fix-use-after-free-of-the-COW.patch deleted file mode 100644 index bb21d7e1a7df79bf2fee69e4abc124a8eba7defb..0000000000000000000000000000000000000000 --- a/0001-composite-Fix-use-after-free-of-the-COW.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 26ef545b3502f61ca722a7a3373507e88ef64110 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 13 Mar 2023 11:08:47 +0100 -Subject: [PATCH xserver] composite: Fix use-after-free of the COW - -ZDI-CAN-19866/CVE-2023-1393 - -If a client explicitly destroys the compositor overlay window (aka COW), -we would leave a dangling pointer to that window in the CompScreen -structure, which will trigger a use-after-free later. - -Make sure to clear the CompScreen pointer to the COW when the latter gets -destroyed explicitly by the client. - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Adam Jackson ---- - composite/compwindow.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/composite/compwindow.c b/composite/compwindow.c -index 4e2494b86..b30da589e 100644 ---- a/composite/compwindow.c -+++ b/composite/compwindow.c -@@ -620,6 +620,11 @@ compDestroyWindow(WindowPtr pWin) - ret = (*pScreen->DestroyWindow) (pWin); - cs->DestroyWindow = pScreen->DestroyWindow; - pScreen->DestroyWindow = compDestroyWindow; -+ -+ /* Did we just destroy the overlay window? */ -+ if (pWin == cs->pOverlayWin) -+ cs->pOverlayWin = NULL; -+ - /* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/ - return ret; - } --- -2.40.0 - diff --git a/0001-configure.ac-search-for-the-fontrootdir-ourselves.patch b/0001-configure.ac-search-for-the-fontrootdir-ourselves.patch deleted file mode 100644 index 3e293580aede9f1e7ec78c453a5aa13009a01796..0000000000000000000000000000000000000000 --- a/0001-configure.ac-search-for-the-fontrootdir-ourselves.patch +++ /dev/null @@ -1,72 +0,0 @@ -From e67e988730346c63d2f0cdf2531ed36b0c7ad5a6 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 23 Nov 2022 14:50:29 +1000 -Subject: [PATCH xserver] configure.ac: search for the fontrootdir ourselves - -This replaces the use of font-utils' .m4 macro set with a copy of the -only one we actually want: the bit for the fontrootpath. - -We don't need configure options for every single subfont directory, so -let's hardcode those in the default font path. Like meson does upstream -too. - -With this patch we no longer require the font-utils dependency. - -Signed-off-by: Peter Hutterer ---- - configure.ac | 28 +++++++++++++++++----------- - 1 file changed, 17 insertions(+), 11 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 0909cc5b4d..2349320888 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -49,9 +49,6 @@ XORG_WITH_XSLTPROC - XORG_ENABLE_UNIT_TESTS - XORG_LD_WRAP([optional]) - --m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install font-util 1.1 or later before running autoconf/autogen])]) --XORG_FONT_MACROS_VERSION(1.1) -- - dnl this gets generated by autoheader, and thus contains all the defines. we - dnl don't ever actually use it, internally. - AC_CONFIG_HEADERS(include/do-not-use-config.h) -@@ -450,18 +447,27 @@ AC_MSG_RESULT([$FALLBACK_INPUT_DRIVER]) - AC_DEFINE_UNQUOTED(FALLBACK_INPUT_DRIVER, ["$FALLBACK_INPUT_DRIVER"], [ Fallback input driver ]) - - dnl Determine font path --XORG_FONTROOTDIR --XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc) --XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF) --XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF) --XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1) --XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi) --XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi) -+dnl This is a copy of XORG_FONTROOTDIR from font-utils so we can drop the dependency -+AC_MSG_CHECKING([for root directory for font files]) -+AC_ARG_WITH(fontrootdir, -+ AS_HELP_STRING([--with-fontrootdir=DIR], -+ [Path to root directory for font files]), -+ [FONTROOTDIR="$withval"]) -+# if --with-fontrootdir not specified... -+if test "x${FONTROOTDIR}" = "x"; then -+ FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil` -+fi -+# ...and if pkg-config didn't find fontdir in fontutil.pc... -+if test "x${FONTROOTDIR}" = "x"; then -+ FONTROOTDIR="${datadir}/fonts/X11" -+fi -+AC_SUBST(FONTROOTDIR) -+AC_MSG_RESULT([${FONTROOTDIR}]) - - dnl Uses --with-default-font-path if set, otherwise uses standard - dnl subdirectories of FONTROOTDIR. Some distros set the default font path to - dnl "catalogue:/etc/X11/fontpath.d,built-ins" --DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/" -+DEFAULT_FONT_PATH="${FONTROOTDIR}/misc,${FONTROOTDIR}/OTF,${FONTROOTDIR}/TTF,${FONTROOTDIR}/Type1,${FONTROOTDIR}/75dpi,${FONTROOTDIR}/100dpi" - case $host_os in - darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;; - esac --- -2.38.1 - diff --git a/0001-ephyr-Fix-incompatible-pointer-type-build-error.patch b/0001-ephyr-Fix-incompatible-pointer-type-build-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..345e6600f04afc4a271d95c68c71346280108864 --- /dev/null +++ b/0001-ephyr-Fix-incompatible-pointer-type-build-error.patch @@ -0,0 +1,54 @@ +From e89edec497bac581ca9b614fb00c25365580f045 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= +Date: Fri, 19 Jan 2024 13:05:51 +0100 +Subject: [PATCH] ephyr: Fix incompatible pointer type build error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix a compilation error on 32 bits architectures with gcc 14: + + ephyr_glamor_xv.c: In function ‘ephyr_glamor_xv_init’: + ephyr_glamor_xv.c:154:31: error: assignment to ‘SetPortAttributeFuncPtr’ {aka ‘int (*)(struct _KdScreenInfo *, long unsigned int, int, void *)’} from incompatible pointer type ‘int (*)(KdScreenInfo *, Atom, INT32, void *)’ {aka ‘int (*)(struct _KdScreenInfo *, long unsigned int, long int, void *)’} [-Wincompatible-pointer-types] + 154 | adaptor->SetPortAttribute = ephyr_glamor_xv_set_port_attribute; + | ^ + ephyr_glamor_xv.c:155:31: error: assignment to ‘GetPortAttributeFuncPtr’ {aka ‘int (*)(struct _KdScreenInfo *, long unsigned int, int *, void *)’} from incompatible pointer type ‘int (*)(KdScreenInfo *, Atom, INT32 *, void *)’ {aka ‘int (*)(struct _KdScreenInfo *, long unsigned int, long int *, void *)’} [-Wincompatible-pointer-types] + 155 | adaptor->GetPortAttribute = ephyr_glamor_xv_get_port_attribute; + | ^ + +Build error logs: +https://koji.fedoraproject.org/koji/taskinfo?taskID=111964273 + +Signed-off-by: José Expósito +--- + hw/kdrive/ephyr/ephyr_glamor_xv.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/hw/kdrive/ephyr/ephyr_glamor_xv.c b/hw/kdrive/ephyr/ephyr_glamor_xv.c +index 4dd15cf41..b5eae48c8 100644 +--- a/hw/kdrive/ephyr/ephyr_glamor_xv.c ++++ b/hw/kdrive/ephyr/ephyr_glamor_xv.c +@@ -50,16 +50,16 @@ ephyr_glamor_xv_stop_video(KdScreenInfo *screen, void *data, Bool cleanup) + + static int + ephyr_glamor_xv_set_port_attribute(KdScreenInfo *screen, +- Atom attribute, INT32 value, void *data) ++ Atom attribute, int value, void *data) + { +- return glamor_xv_set_port_attribute(data, attribute, value); ++ return glamor_xv_set_port_attribute(data, attribute, (INT32)value); + } + + static int + ephyr_glamor_xv_get_port_attribute(KdScreenInfo *screen, +- Atom attribute, INT32 *value, void *data) ++ Atom attribute, int *value, void *data) + { +- return glamor_xv_get_port_attribute(data, attribute, value); ++ return glamor_xv_get_port_attribute(data, attribute, (INT32 *)value); + } + + static void +-- +2.43.0 + diff --git a/0001-hw-Rename-boolean-config-value-field-from-bool-to-bo.patch b/0001-hw-Rename-boolean-config-value-field-from-bool-to-bo.patch deleted file mode 100644 index 52ea4d01f9243952c186e4b1f2d93056474d13ce..0000000000000000000000000000000000000000 --- a/0001-hw-Rename-boolean-config-value-field-from-bool-to-bo.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 454b3a826edb5fc6d0fea3a9cfd1a5e8fc568747 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Mon, 22 Jul 2019 13:51:06 -0400 -Subject: [PATCH xserver] hw: Rename boolean config value field from bool to - boolean - -"bool" conflicts with C++ (meh) and stdbool.h (ngh alright fine). This -is a driver-visible change and will likely break the build for mach64, -but it can be fixed by simply using xf86ReturnOptValBool like every -other driver. - -Signed-off-by: Adam Jackson ---- - hw/xfree86/common/xf86Opt.h | 2 +- - hw/xfree86/common/xf86Option.c | 10 +++++----- - hw/xwin/winconfig.c | 22 +++++++++++----------- - hw/xwin/winconfig.h | 2 +- - 4 files changed, 18 insertions(+), 18 deletions(-) - -diff --git a/hw/xfree86/common/xf86Opt.h b/hw/xfree86/common/xf86Opt.h -index 3be2a0fc7..3046fbd41 100644 ---- a/hw/xfree86/common/xf86Opt.h -+++ b/hw/xfree86/common/xf86Opt.h -@@ -41,7 +41,7 @@ typedef union { - unsigned long num; - const char *str; - double realnum; -- Bool bool; -+ Bool boolean; - OptFrequency freq; - } ValueUnion; - -diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c -index 06973bca3..ca538cc57 100644 ---- a/hw/xfree86/common/xf86Option.c -+++ b/hw/xfree86/common/xf86Option.c -@@ -213,7 +213,7 @@ LookupBoolOption(XF86OptionPtr optlist, const char *name, int deflt, - o.name = name; - o.type = OPTV_BOOLEAN; - if (ParseOptionValue(-1, optlist, &o, markUsed)) -- deflt = o.value.bool; -+ deflt = o.value.boolean; - return deflt; - } - -@@ -474,7 +474,7 @@ xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr opt) - static Bool - GetBoolValue(OptionInfoPtr p, const char *s) - { -- return xf86getBoolValue(&p->value.bool, s); -+ return xf86getBoolValue(&p->value.boolean, s); - } - - static Bool -@@ -678,7 +678,7 @@ ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p, - if (markUsed) - xf86MarkOptionUsedByName(options, newn); - if (GetBoolValue(&opt, s)) { -- p->value.bool = !opt.value.bool; -+ p->value.boolean = !opt.value.boolean; - p->found = TRUE; - } - else { -@@ -869,7 +869,7 @@ xf86GetOptValBool(const OptionInfoRec * table, int token, Bool *value) - - p = xf86TokenToOptinfo(table, token); - if (p && p->found) { -- *value = p->value.bool; -+ *value = p->value.boolean; - return TRUE; - } - else -@@ -883,7 +883,7 @@ xf86ReturnOptValBool(const OptionInfoRec * table, int token, Bool def) - - p = xf86TokenToOptinfo(table, token); - if (p && p->found) { -- return p->value.bool; -+ return p->value.boolean; - } - else - return def; -diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c -index 31894d2fb..646d69006 100644 ---- a/hw/xwin/winconfig.c -+++ b/hw/xwin/winconfig.c -@@ -623,7 +623,7 @@ winSetBoolOption(void *optlist, const char *name, int deflt) - o.name = name; - o.type = OPTV_BOOLEAN; - if (ParseOptionValue(-1, optlist, &o)) -- deflt = o.value.bool; -+ deflt = o.value.boolean; - return deflt; - } - -@@ -918,7 +918,7 @@ ParseOptionValue(int scrnIndex, void *options, OptionInfoPtr p) - } - if ((s = winFindOptionValue(options, newn)) != NULL) { - if (GetBoolValue(&opt, s)) { -- p->value.bool = !opt.value.bool; -+ p->value.boolean = !opt.value.boolean; - p->found = TRUE; - } - else { -@@ -968,25 +968,25 @@ static Bool - GetBoolValue(OptionInfoPtr p, const char *s) - { - if (*s == 0) { -- p->value.bool = TRUE; -+ p->value.boolean = TRUE; - } - else { - if (winNameCompare(s, "1") == 0) -- p->value.bool = TRUE; -+ p->value.boolean = TRUE; - else if (winNameCompare(s, "on") == 0) -- p->value.bool = TRUE; -+ p->value.boolean = TRUE; - else if (winNameCompare(s, "true") == 0) -- p->value.bool = TRUE; -+ p->value.boolean = TRUE; - else if (winNameCompare(s, "yes") == 0) -- p->value.bool = TRUE; -+ p->value.boolean = TRUE; - else if (winNameCompare(s, "0") == 0) -- p->value.bool = FALSE; -+ p->value.boolean = FALSE; - else if (winNameCompare(s, "off") == 0) -- p->value.bool = FALSE; -+ p->value.boolean = FALSE; - else if (winNameCompare(s, "false") == 0) -- p->value.bool = FALSE; -+ p->value.boolean = FALSE; - else if (winNameCompare(s, "no") == 0) -- p->value.bool = FALSE; -+ p->value.boolean = FALSE; - } - return TRUE; - } -diff --git a/hw/xwin/winconfig.h b/hw/xwin/winconfig.h -index f079368c7..bd1f59650 100644 ---- a/hw/xwin/winconfig.h -+++ b/hw/xwin/winconfig.h -@@ -199,7 +199,7 @@ typedef union { - unsigned long num; - char *str; - double realnum; -- Bool bool; -+ Bool boolean; - OptFrequency freq; - } ValueUnion; - --- -2.39.0 - diff --git a/0001-present-Check-for-NULL-to-prevent-crash.patch b/0001-present-Check-for-NULL-to-prevent-crash.patch deleted file mode 100644 index 894ad0eb1d47791e2f66601131a792921f37b29a..0000000000000000000000000000000000000000 --- a/0001-present-Check-for-NULL-to-prevent-crash.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 94b4a3d45451d29e9539ea234ce8b5e9ed58546c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= -Date: Thu, 13 Jan 2022 00:47:27 +0100 -Subject: [PATCH xserver] present: Check for NULL to prevent crash -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1275 -Signed-off-by: Błażej Szczygieł -Tested-by: Aaron Plattner -(cherry picked from commit 22d5818851967408bb7c903cb345b7ca8766094c) ---- - present/present_scmd.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/present/present_scmd.c b/present/present_scmd.c -index 3c68e690b..11391adbb 100644 ---- a/present/present_scmd.c -+++ b/present/present_scmd.c -@@ -168,6 +168,9 @@ present_scmd_get_crtc(present_screen_priv_ptr screen_priv, WindowPtr window) - if (!screen_priv->info) - return NULL; - -+ if (!screen_priv->info->get_crtc) -+ return NULL; -+ - return (*screen_priv->info->get_crtc)(window); - } - -@@ -206,6 +209,9 @@ present_flush(WindowPtr window) - if (!screen_priv->info) - return; - -+ if (!screen_priv->info->flush) -+ return; -+ - (*screen_priv->info->flush) (window); - } - --- -2.34.1 - diff --git a/0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch b/0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch deleted file mode 100644 index d9eea48785eb62518d48767d5002bdb351d4984a..0000000000000000000000000000000000000000 --- a/0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch +++ /dev/null @@ -1,105 +0,0 @@ -From b98fc07d3442a289c6bef82df50dd0a2d01de71a Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Thu, 2 Feb 2023 12:26:27 -0500 -Subject: [PATCH xserver] present: Send a PresentConfigureNotify event for - destroyed windows -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This enables fixing a deadlock case on the client side, where the client -ends up blocked waiting for a Present event that will never come because -the window was destroyed. The new PresentWindowDestroyed flag allows the -client to avoid blocking indefinitely. - -Signed-off-by: Adam Jackson -See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/116 -See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6685 -Reviewed-by: Michel Dänzer -(cherry picked from commit 462b06033e66a32308d940eb5fc47f5e4c914dc0) ---- - present/present_event.c | 5 +++-- - present/present_priv.h | 7 ++++++- - present/present_screen.c | 11 ++++++++++- - 3 files changed, 19 insertions(+), 4 deletions(-) - -diff --git a/present/present_event.c b/present/present_event.c -index 435b26b70..849732dc8 100644 ---- a/present/present_event.c -+++ b/present/present_event.c -@@ -102,7 +102,8 @@ present_event_swap(xGenericEvent *from, xGenericEvent *to) - } - - void --present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling) -+present_send_config_notify(WindowPtr window, int x, int y, int w, int h, -+ int bw, WindowPtr sibling, CARD32 flags) - { - present_window_priv_ptr window_priv = present_window_priv(window); - -@@ -122,7 +123,7 @@ present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, - .off_y = 0, - .pixmap_width = w, - .pixmap_height = h, -- .pixmap_flags = 0 -+ .pixmap_flags = flags - }; - present_event_ptr event; - -diff --git a/present/present_priv.h b/present/present_priv.h -index 6ebd009a2..4ad729864 100644 ---- a/present/present_priv.h -+++ b/present/present_priv.h -@@ -43,6 +43,11 @@ - #define DebugPresent(x) - #endif - -+/* XXX this belongs in presentproto */ -+#ifndef PresentWindowDestroyed -+#define PresentWindowDestroyed (1 << 0) -+#endif -+ - extern int present_request; - - extern DevPrivateKeyRec present_screen_private_key; -@@ -307,7 +312,7 @@ void - present_free_events(WindowPtr window); - - void --present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling); -+present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling, CARD32 flags); - - void - present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 serial, uint64_t ust, uint64_t msc); -diff --git a/present/present_screen.c b/present/present_screen.c -index 15684eda4..2c29aafd2 100644 ---- a/present/present_screen.c -+++ b/present/present_screen.c -@@ -93,6 +93,15 @@ present_destroy_window(WindowPtr window) - present_screen_priv_ptr screen_priv = present_screen_priv(screen); - present_window_priv_ptr window_priv = present_window_priv(window); - -+ present_send_config_notify(window, -+ window->drawable.x, -+ window->drawable.y, -+ window->drawable.width, -+ window->drawable.height, -+ window->borderWidth, -+ window->nextSib, -+ PresentWindowDestroyed); -+ - if (window_priv) { - present_clear_window_notifies(window); - present_free_events(window); -@@ -123,7 +132,7 @@ present_config_notify(WindowPtr window, - ScreenPtr screen = window->drawable.pScreen; - present_screen_priv_ptr screen_priv = present_screen_priv(screen); - -- present_send_config_notify(window, x, y, w, h, bw, sibling); -+ present_send_config_notify(window, x, y, w, h, bw, sibling, 0); - - unwrap(screen_priv, screen, ConfigNotify); - if (screen->ConfigNotify) --- -2.40.0 - diff --git a/0001-render-Fix-build-with-gcc-12.patch b/0001-render-Fix-build-with-gcc-12.patch deleted file mode 100644 index 22f2e5a724dca9d0fc1d40cfe9f76e9ff440de09..0000000000000000000000000000000000000000 --- a/0001-render-Fix-build-with-gcc-12.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 53173fdab492f0f638f6616fcf01af0b9ea6338d Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Thu, 20 Jan 2022 10:20:38 +0100 -Subject: [PATCH xserver] render: Fix build with gcc 12 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The xserver fails to compile with the latest gcc 12: - - render/picture.c: In function ‘CreateSolidPicture’: - render/picture.c:874:26: error: array subscript ‘union _SourcePict[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Werror=array-bounds] - 874 | pPicture->pSourcePict->type = SourcePictTypeSolidFill; - | ^~ - render/picture.c:868:45: note: object of size 16 allocated by ‘malloc’ - 868 | pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill)); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - render/picture.c: In function ‘CreateLinearGradientPicture’: - render/picture.c:906:26: error: array subscript ‘union _SourcePict[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Werror=array-bounds] - 906 | pPicture->pSourcePict->linear.type = SourcePictTypeLinear; - | ^~ - render/picture.c:899:45: note: object of size 32 allocated by ‘malloc’ - 899 | pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient)); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - render/picture.c: In function ‘CreateConicalGradientPicture’: - render/picture.c:989:26: error: array subscript ‘union _SourcePict[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Werror=array-bounds] - 989 | pPicture->pSourcePict->conical.type = SourcePictTypeConical; - | ^~ - render/picture.c:982:45: note: object of size 32 allocated by ‘malloc’ - 982 | pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictConicalGradient)); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - cc1: some warnings being treated as errors - ninja: build stopped: subcommand failed. - -This is because gcc 12 has become stricter and raises a warning now. - -Fix the warning/error by allocating enough memory to store the union -struct. - -Signed-off-by: Olivier Fourdan -Acked-by: Michel Dänzer -Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1256 -(cherry picked from commit c6b0dcb82d4db07a2f32c09a8c09c85a5f57248e) ---- - render/picture.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/render/picture.c b/render/picture.c -index afa0d258f..2be4b1954 100644 ---- a/render/picture.c -+++ b/render/picture.c -@@ -865,7 +865,7 @@ CreateSolidPicture(Picture pid, xRenderColor * color, int *error) - } - - pPicture->id = pid; -- pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill)); -+ pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict)); - if (!pPicture->pSourcePict) { - *error = BadAlloc; - free(pPicture); -@@ -896,7 +896,7 @@ CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2, - } - - pPicture->id = pid; -- pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient)); -+ pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict)); - if (!pPicture->pSourcePict) { - *error = BadAlloc; - free(pPicture); -@@ -936,7 +936,7 @@ CreateRadialGradientPicture(Picture pid, xPointFixed * inner, - } - - pPicture->id = pid; -- pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictRadialGradient)); -+ pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict)); - if (!pPicture->pSourcePict) { - *error = BadAlloc; - free(pPicture); -@@ -979,7 +979,7 @@ CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle, - } - - pPicture->id = pid; -- pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictConicalGradient)); -+ pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict)); - if (!pPicture->pSourcePict) { - *error = BadAlloc; - free(pPicture); --- -2.34.1 - diff --git a/0001-xf86-Accept-devices-with-the-simpledrm-driver.patch b/0001-xf86-Accept-devices-with-the-simpledrm-driver.patch deleted file mode 100644 index 3dc57966ade9b9e446aba28e0219aa1395a98b71..0000000000000000000000000000000000000000 --- a/0001-xf86-Accept-devices-with-the-simpledrm-driver.patch +++ /dev/null @@ -1,34 +0,0 @@ -From b9218fadf3c09d83566549279d68886d8258f79c Mon Sep 17 00:00:00 2001 -From: nerdopolis -Date: Thu, 30 Sep 2021 08:51:18 -0400 -Subject: [PATCH] xf86: Accept devices with the 'simpledrm' driver. - -SimpleDRM 'devices' are a fallback device, and do not have a busid -so they are getting skipped. This will allow simpledrm to work -with the modesetting driver ---- - hw/xfree86/common/xf86platformBus.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c -index 0e0a995ac..45028f7a6 100644 ---- a/hw/xfree86/common/xf86platformBus.c -+++ b/hw/xfree86/common/xf86platformBus.c -@@ -557,8 +557,13 @@ xf86platformProbeDev(DriverPtr drvp) - } - else { - /* for non-seat0 servers assume first device is the master */ -- if (ServerIsNotSeat0()) -+ if (ServerIsNotSeat0()) { - break; -+ } else { -+ /* Accept the device if the driver is simpledrm */ -+ if (strcmp(xf86_platform_devices[j].attribs->driver, "simpledrm") == 0) -+ break; -+ } - - if (xf86IsPrimaryPlatform(&xf86_platform_devices[j])) - break; --- -2.35.1 - diff --git a/0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch b/0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch index cce03489beb7aec963396f1851d42b93fbda0301..2134a44719cb6e9649286814513b6c48258b08d1 100644 --- a/0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch +++ b/0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch @@ -52,7 +52,7 @@ index 6619e3aa7..1f8ad14bc 100644 /* For non-PCI devices and drmGetDevice fail, just assume that * the 3D driver is named the same as the kernel driver. This is * currently true for vc4 and msm (freedreno). -@@ -1456,12 +1460,14 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) +@@ -1454,12 +1458,14 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) xf86DrvMsg(pScreen->myNum, X_ERROR, "[DRI2] Couldn't drmGetVersion() on non-PCI device, " "no driver name found.\n"); @@ -70,7 +70,7 @@ index 6619e3aa7..1f8ad14bc 100644 } for (i = 0; driver_map[i].driver; i++) { -@@ -1469,13 +1475,15 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) +@@ -1467,13 +1473,15 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) continue; if (driver_map[i].num_chips_ids == -1) { @@ -88,7 +88,7 @@ index 6619e3aa7..1f8ad14bc 100644 goto out; } } -@@ -1487,9 +1495,9 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) +@@ -1485,9 +1493,9 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info) dev->deviceinfo.pci->vendor_id, dev->deviceinfo.pci->device_id); out: drmFreeDevice(&dev); @@ -100,21 +100,21 @@ index 6619e3aa7..1f8ad14bc 100644 #endif } -@@ -1610,7 +1618,8 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) - if (info->driverName) { - ds->driverNames[0] = info->driverName; +@@ -1604,7 +1612,8 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) } else { + /* FIXME dri2_probe_driver_name() returns a strdup-ed string, + * currently this gets leaked */ - ds->driverNames[0] = ds->driverNames[1] = dri2_probe_driver_name(pScreen, info); + dri2_probe_driver_name(pScreen, info, + &ds->driverNames[0], &ds->driverNames[1]); if (!ds->driverNames[0]) return FALSE; - } + diff --git a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h b/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h index da7ea1c1e..7036d1003 100644 --- a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h +++ b/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h -@@ -66,21 +66,22 @@ static const int vmwgfx_chip_ids[] = { +@@ -60,23 +60,24 @@ static const int vmwgfx_chip_ids[] = { static const struct { int vendor_id; const char *driver; @@ -124,8 +124,10 @@ index da7ea1c1e..7036d1003 100644 } driver_map[] = { - { 0x8086, "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) }, - { 0x8086, "i965", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) }, +- { 0x8086, "i965", NULL, -1 }, + { 0x8086, "i915", "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) }, + { 0x8086, "i965", "va_gl", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) }, ++ { 0x8086, "i965", "va_gl", NULL, -1 }, #ifndef DRIVER_MAP_GALLIUM_ONLY - { 0x1002, "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) }, - { 0x1002, "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) }, @@ -134,19 +136,18 @@ index da7ea1c1e..7036d1003 100644 #endif - { 0x1002, "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) }, - { 0x1002, "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) }, -- { 0x1002, "radeonsi", radeonsi_chip_ids, ARRAY_SIZE(radeonsi_chip_ids) }, +- { 0x1002, "radeonsi", NULL, -1 }, - { 0x10de, "nouveau", NULL, -1 }, - { 0x1af4, "virtio_gpu", virtio_gpu_chip_ids, ARRAY_SIZE(virtio_gpu_chip_ids) }, - { 0x15ad, "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids) }, +- { 0x0000, NULL, NULL, 0 }, + { 0x1002, "r300", "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) }, -+ { 0x1002, "r600","r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) }, -+ { 0x1002, "radeonsi", "radeonsi", radeonsi_chip_ids, ARRAY_SIZE(radeonsi_chip_ids) }, ++ { 0x1002, "r600", "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) }, ++ { 0x1002, "radeonsi", "radeonsi", NULL, -1 }, + { 0x10de, "nouveau", "nouveau", NULL, -1 }, + { 0x1af4, "virtio_gpu", "virtio_gpu", virtio_gpu_chip_ids, ARRAY_SIZE(virtio_gpu_chip_ids) }, + { 0x15ad, "vmwgfx", "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids) }, - { 0x0000, NULL, NULL, 0 }, ++ { 0x0000, NULL, NULL, NULL, 0 }, }; --- -2.19.0 - + #endif /* _PCI_ID_DRIVER_MAP_H_ */ diff --git a/0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch b/0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch deleted file mode 100644 index 6e5ebb5a684e41f04daae116eed6439d0117f284..0000000000000000000000000000000000000000 --- a/0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 18f91b950e22c2a342a4fbc55e9ddf7534a707d2 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 13 Jul 2022 11:23:09 +1000 -Subject: [PATCH xserver] xkb: fix some possible memleaks in XkbGetKbdByName - -GetComponentByName returns an allocated string, so let's free that if we -fail somewhere. - -Signed-off-by: Peter Hutterer ---- - xkb/xkb.c | 26 ++++++++++++++++++++------ - 1 file changed, 20 insertions(+), 6 deletions(-) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 4692895db..b79a269e3 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5935,18 +5935,32 @@ ProcXkbGetKbdByName(ClientPtr client) - xkb = dev->key->xkbInfo->desc; - status = Success; - str = (unsigned char *) &stuff[1]; -- if (GetComponentSpec(&str, TRUE, &status)) /* keymap, unsupported */ -- return BadMatch; -+ { -+ char *keymap = GetComponentSpec(&str, TRUE, &status); /* keymap, unsupported */ -+ if (keymap) { -+ free(keymap); -+ return BadMatch; -+ } -+ } - names.keycodes = GetComponentSpec(&str, TRUE, &status); - names.types = GetComponentSpec(&str, TRUE, &status); - names.compat = GetComponentSpec(&str, TRUE, &status); - names.symbols = GetComponentSpec(&str, TRUE, &status); - names.geometry = GetComponentSpec(&str, TRUE, &status); -- if (status != Success) -+ if (status == Success) { -+ len = str - ((unsigned char *) stuff); -+ if ((XkbPaddedSize(len) / 4) != stuff->length) -+ status = BadLength; -+ } -+ -+ if (status != Success) { -+ free(names.keycodes); -+ free(names.types); -+ free(names.compat); -+ free(names.symbols); -+ free(names.geometry); - return status; -- len = str - ((unsigned char *) stuff); -- if ((XkbPaddedSize(len) / 4) != stuff->length) -- return BadLength; -+ } - - CHK_MASK_LEGAL(0x01, stuff->want, XkbGBN_AllComponentsMask); - CHK_MASK_LEGAL(0x02, stuff->need, XkbGBN_AllComponentsMask); --- -2.38.1 - diff --git a/0001-xkb-proof-GetCountedString-against-request-length-at.patch b/0001-xkb-proof-GetCountedString-against-request-length-at.patch deleted file mode 100644 index d358a3201d80a3d38f9524ab3001bfd2f169876d..0000000000000000000000000000000000000000 --- a/0001-xkb-proof-GetCountedString-against-request-length-at.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 11beef0b7f1ed290348e45618e5fa0d2bffcb72e Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 5 Jul 2022 12:06:20 +1000 -Subject: [PATCH xserver] xkb: proof GetCountedString against request length - attacks - -GetCountedString did a check for the whole string to be within the -request buffer but not for the initial 2 bytes that contain the length -field. A swapped client could send a malformed request to trigger a -swaps() on those bytes, writing into random memory. - -Signed-off-by: Peter Hutterer ---- - xkb/xkb.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index f42f59ef3..1841cff26 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5137,6 +5137,11 @@ _GetCountedString(char **wire_inout, ClientPtr client, char **str) - CARD16 len; - - wire = *wire_inout; -+ -+ if (client->req_len < -+ bytes_to_int32(wire + 2 - (char *) client->requestBuffer)) -+ return BadValue; -+ - len = *(CARD16 *) wire; - if (client->swapped) { - swaps(&len); --- -2.38.1 - diff --git a/0001-xkb-switch-to-array-index-loops-to-moving-pointers.patch b/0001-xkb-switch-to-array-index-loops-to-moving-pointers.patch deleted file mode 100644 index a4efb7a3da7d30617811ebe2d2c0106c830bc0fb..0000000000000000000000000000000000000000 --- a/0001-xkb-switch-to-array-index-loops-to-moving-pointers.patch +++ /dev/null @@ -1,76 +0,0 @@ -From f1070c01d616c5f21f939d5ebc533738779451ac Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 5 Jul 2022 12:40:47 +1000 -Subject: [PATCH xserver 1/3] xkb: switch to array index loops to moving - pointers - -Most similar loops here use a pointer that advances with each loop -iteration, let's do the same here for consistency. - -No functional changes. - -Signed-off-by: Peter Hutterer -Reviewed-by: Olivier Fourdan ---- - xkb/xkb.c | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index a29262c24..64e52611e 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5368,16 +5368,16 @@ _CheckSetSections(XkbGeometryPtr geom, - row->left = rWire->left; - row->vertical = rWire->vertical; - kWire = (xkbKeyWireDesc *) &rWire[1]; -- for (k = 0; k < rWire->nKeys; k++) { -+ for (k = 0; k < rWire->nKeys; k++, kWire++) { - XkbKeyPtr key; - - key = XkbAddGeomKey(row); - if (!key) - return BadAlloc; -- memcpy(key->name.name, kWire[k].name, XkbKeyNameLength); -- key->gap = kWire[k].gap; -- key->shape_ndx = kWire[k].shapeNdx; -- key->color_ndx = kWire[k].colorNdx; -+ memcpy(key->name.name, kWire->name, XkbKeyNameLength); -+ key->gap = kWire->gap; -+ key->shape_ndx = kWire->shapeNdx; -+ key->color_ndx = kWire->colorNdx; - if (key->shape_ndx >= geom->num_shapes) { - client->errorValue = _XkbErrCode3(0x10, key->shape_ndx, - geom->num_shapes); -@@ -5389,7 +5389,7 @@ _CheckSetSections(XkbGeometryPtr geom, - return BadMatch; - } - } -- rWire = (xkbRowWireDesc *) &kWire[rWire->nKeys]; -+ rWire = (xkbRowWireDesc *)kWire; - } - wire = (char *) rWire; - if (sWire->nDoodads > 0) { -@@ -5454,16 +5454,16 @@ _CheckSetShapes(XkbGeometryPtr geom, - return BadAlloc; - ol->corner_radius = olWire->cornerRadius; - ptWire = (xkbPointWireDesc *) &olWire[1]; -- for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) { -- pt->x = ptWire[p].x; -- pt->y = ptWire[p].y; -+ for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++, ptWire++) { -+ pt->x = ptWire->x; -+ pt->y = ptWire->y; - if (client->swapped) { - swaps(&pt->x); - swaps(&pt->y); - } - } - ol->num_points = olWire->nPoints; -- olWire = (xkbOutlineWireDesc *) (&ptWire[olWire->nPoints]); -+ olWire = (xkbOutlineWireDesc *)ptWire; - } - if (shapeWire->primaryNdx != XkbNoShape) - shape->primary = &shape->outlines[shapeWire->primaryNdx]; --- -2.36.1 - diff --git a/0002-Xi-return-an-error-from-XI-property-changes-if-verif.patch b/0002-Xi-return-an-error-from-XI-property-changes-if-verif.patch deleted file mode 100644 index 72bcadbdcc36b82d77d7d732bcb53616fedb2190..0000000000000000000000000000000000000000 --- a/0002-Xi-return-an-error-from-XI-property-changes-if-verif.patch +++ /dev/null @@ -1,41 +0,0 @@ -From c5ff57676698f19ed3a1402aef58a15552e32d27 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 29 Nov 2022 13:24:00 +1000 -Subject: [PATCH xserver 2/7] Xi: return an error from XI property changes if - verification failed - -Both ProcXChangeDeviceProperty and ProcXIChangeProperty checked the -property for validity but didn't actually return the potential error. - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xi/xiproperty.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c -index a36f7d61df..68c362c628 100644 ---- a/Xi/xiproperty.c -+++ b/Xi/xiproperty.c -@@ -902,6 +902,8 @@ ProcXChangeDeviceProperty(ClientPtr client) - - rc = check_change_property(client, stuff->property, stuff->type, - stuff->format, stuff->mode, stuff->nUnits); -+ if (rc != Success) -+ return rc; - - len = stuff->nUnits; - if (len > (bytes_to_int32(0xffffffff - sizeof(xChangeDevicePropertyReq)))) -@@ -1141,6 +1143,9 @@ ProcXIChangeProperty(ClientPtr client) - - rc = check_change_property(client, stuff->property, stuff->type, - stuff->format, stuff->mode, stuff->num_items); -+ if (rc != Success) -+ return rc; -+ - len = stuff->num_items; - if (len > bytes_to_int32(0xffffffff - sizeof(xXIChangePropertyReq))) - return BadLength; --- -2.38.1 - diff --git a/0002-mi-reset-the-PointerWindows-reference-on-screen-swit.patch b/0002-mi-reset-the-PointerWindows-reference-on-screen-swit.patch deleted file mode 100644 index cbe980412d8f9491835c5916b1dc2ed9ff0fd149..0000000000000000000000000000000000000000 --- a/0002-mi-reset-the-PointerWindows-reference-on-screen-swit.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 004f461c440cb6611eefb48fbbb4fa53a6d49f80 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Thu, 5 Oct 2023 12:19:45 +1000 -Subject: [PATCH xserver 2/4] mi: reset the PointerWindows reference on screen - switch - -PointerWindows[] keeps a reference to the last window our sprite -entered - changes are usually handled by CheckMotion(). - -If we switch between screens via XWarpPointer our -dev->spriteInfo->sprite->win is set to the new screen's root window. -If there's another window at the cursor location CheckMotion() will -trigger the right enter/leave events later. If there is not, it skips -that process and we never trigger LeaveWindow() - PointerWindows[] for -the device still refers to the previous window. - -If that window is destroyed we have a dangling reference that will -eventually cause a use-after-free bug when checking the window hierarchy -later. - -To trigger this, we require: -- two protocol screens -- XWarpPointer to the other screen's root window -- XDestroyWindow before entering any other window - -This is a niche bug so we hack around it by making sure we reset the -PointerWindows[] entry so we cannot have a dangling pointer. This -doesn't handle Enter/Leave events correctly but the previous code didn't -either. - -CVE-2023-5380, ZDI-CAN-21608 - -This vulnerability was discovered by: -Sri working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Reviewed-by: Adam Jackson ---- - dix/enterleave.h | 2 -- - include/eventstr.h | 3 +++ - mi/mipointer.c | 17 +++++++++++++++-- - 3 files changed, 18 insertions(+), 4 deletions(-) - -diff --git a/dix/enterleave.h b/dix/enterleave.h -index 4b833d8a3b..e8af924c68 100644 ---- a/dix/enterleave.h -+++ b/dix/enterleave.h -@@ -58,8 +58,6 @@ extern void DeviceFocusEvent(DeviceIntPtr dev, - - extern void EnterWindow(DeviceIntPtr dev, WindowPtr win, int mode); - --extern void LeaveWindow(DeviceIntPtr dev); -- - extern void CoreFocusEvent(DeviceIntPtr kbd, - int type, int mode, int detail, WindowPtr pWin); - -diff --git a/include/eventstr.h b/include/eventstr.h -index bf3b95fe4a..2bae3b0767 100644 ---- a/include/eventstr.h -+++ b/include/eventstr.h -@@ -296,4 +296,7 @@ union _InternalEvent { - #endif - }; - -+extern void -+LeaveWindow(DeviceIntPtr dev); -+ - #endif -diff --git a/mi/mipointer.c b/mi/mipointer.c -index 75be1aeeb8..b12ae9be1d 100644 ---- a/mi/mipointer.c -+++ b/mi/mipointer.c -@@ -397,8 +397,21 @@ miPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) - #ifdef PANORAMIX - && noPanoramiXExtension - #endif -- ) -- UpdateSpriteForScreen(pDev, pScreen); -+ ) { -+ DeviceIntPtr master = GetMaster(pDev, MASTER_POINTER); -+ /* Hack for CVE-2023-5380: if we're moving -+ * screens PointerWindows[] keeps referring to the -+ * old window. If that gets destroyed we have a UAF -+ * bug later. Only happens when jumping from a window -+ * to the root window on the other screen. -+ * Enter/Leave events are incorrect for that case but -+ * too niche to fix. -+ */ -+ LeaveWindow(pDev); -+ if (master) -+ LeaveWindow(master); -+ UpdateSpriteForScreen(pDev, pScreen); -+ } - } - - /** --- -2.41.0 - diff --git a/0002-xkb-swap-XkbSetDeviceInfo-and-XkbSetDeviceInfoCheck.patch b/0002-xkb-swap-XkbSetDeviceInfo-and-XkbSetDeviceInfoCheck.patch deleted file mode 100644 index 8973a0e3c8179b35e2b23f037befdeb040742b75..0000000000000000000000000000000000000000 --- a/0002-xkb-swap-XkbSetDeviceInfo-and-XkbSetDeviceInfoCheck.patch +++ /dev/null @@ -1,179 +0,0 @@ -From dd8caf39e9e15d8f302e54045dd08d8ebf1025dc Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 5 Jul 2022 09:50:41 +1000 -Subject: [PATCH xserver 2/3] xkb: swap XkbSetDeviceInfo and - XkbSetDeviceInfoCheck - -XKB often uses a FooCheck and Foo function pair, the former is supposed -to check all values in the request and error out on BadLength, -BadValue, etc. The latter is then called once we're confident the values -are good (they may still fail on an individual device, but that's a -different topic). - -In the case of XkbSetDeviceInfo, those functions were incorrectly -named, with XkbSetDeviceInfo ending up as the checker function and -XkbSetDeviceInfoCheck as the setter function. As a result, the setter -function was called before the checker function, accessing request -data and modifying device state before we ensured that the data is -valid. - -In particular, the setter function relied on values being already -byte-swapped. This in turn could lead to potential OOB memory access. - -Fix this by correctly naming the functions and moving the length checks -over to the checker function. These were added in 87c64fc5b0 to the -wrong function, probably due to the incorrect naming. - -Fixes ZDI-CAN 16070, CVE-2022-2320. - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Introduced in c06e27b2f6fd9f7b9f827623a48876a225264132 - -Signed-off-by: Peter Hutterer ---- - xkb/xkb.c | 46 +++++++++++++++++++++++++--------------------- - 1 file changed, 25 insertions(+), 21 deletions(-) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 64e52611e..34b2c290b 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -6550,7 +6550,8 @@ ProcXkbGetDeviceInfo(ClientPtr client) - static char * - CheckSetDeviceIndicators(char *wire, - DeviceIntPtr dev, -- int num, int *status_rtrn, ClientPtr client) -+ int num, int *status_rtrn, ClientPtr client, -+ xkbSetDeviceInfoReq * stuff) - { - xkbDeviceLedsWireDesc *ledWire; - int i; -@@ -6558,6 +6559,11 @@ CheckSetDeviceIndicators(char *wire, - - ledWire = (xkbDeviceLedsWireDesc *) wire; - for (i = 0; i < num; i++) { -+ if (!_XkbCheckRequestBounds(client, stuff, ledWire, ledWire + 1)) { -+ *status_rtrn = BadLength; -+ return (char *) ledWire; -+ } -+ - if (client->swapped) { - swaps(&ledWire->ledClass); - swaps(&ledWire->ledID); -@@ -6585,6 +6591,11 @@ CheckSetDeviceIndicators(char *wire, - atomWire = (CARD32 *) &ledWire[1]; - if (nNames > 0) { - for (n = 0; n < nNames; n++) { -+ if (!_XkbCheckRequestBounds(client, stuff, atomWire, atomWire + 1)) { -+ *status_rtrn = BadLength; -+ return (char *) atomWire; -+ } -+ - if (client->swapped) { - swapl(atomWire); - } -@@ -6596,6 +6607,10 @@ CheckSetDeviceIndicators(char *wire, - mapWire = (xkbIndicatorMapWireDesc *) atomWire; - if (nMaps > 0) { - for (n = 0; n < nMaps; n++) { -+ if (!_XkbCheckRequestBounds(client, stuff, mapWire, mapWire + 1)) { -+ *status_rtrn = BadLength; -+ return (char *) mapWire; -+ } - if (client->swapped) { - swaps(&mapWire->virtualMods); - swapl(&mapWire->ctrls); -@@ -6647,11 +6662,6 @@ SetDeviceIndicators(char *wire, - xkbIndicatorMapWireDesc *mapWire; - XkbSrvLedInfoPtr sli; - -- if (!_XkbCheckRequestBounds(client, stuff, ledWire, ledWire + 1)) { -- *status_rtrn = BadLength; -- return (char *) ledWire; -- } -- - namec = mapc = statec = 0; - sli = XkbFindSrvLedInfo(dev, ledWire->ledClass, ledWire->ledID, - XkbXI_IndicatorMapsMask); -@@ -6670,10 +6680,6 @@ SetDeviceIndicators(char *wire, - memset((char *) sli->names, 0, XkbNumIndicators * sizeof(Atom)); - for (n = 0, bit = 1; n < XkbNumIndicators; n++, bit <<= 1) { - if (ledWire->namesPresent & bit) { -- if (!_XkbCheckRequestBounds(client, stuff, atomWire, atomWire + 1)) { -- *status_rtrn = BadLength; -- return (char *) atomWire; -- } - sli->names[n] = (Atom) *atomWire; - if (sli->names[n] == None) - ledWire->namesPresent &= ~bit; -@@ -6691,10 +6697,6 @@ SetDeviceIndicators(char *wire, - if (ledWire->mapsPresent) { - for (n = 0, bit = 1; n < XkbNumIndicators; n++, bit <<= 1) { - if (ledWire->mapsPresent & bit) { -- if (!_XkbCheckRequestBounds(client, stuff, mapWire, mapWire + 1)) { -- *status_rtrn = BadLength; -- return (char *) mapWire; -- } - sli->maps[n].flags = mapWire->flags; - sli->maps[n].which_groups = mapWire->whichGroups; - sli->maps[n].groups = mapWire->groups; -@@ -6730,13 +6732,17 @@ SetDeviceIndicators(char *wire, - } - - static int --_XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev, -+_XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev, - xkbSetDeviceInfoReq * stuff) - { - char *wire; - - wire = (char *) &stuff[1]; - if (stuff->change & XkbXI_ButtonActionsMask) { -+ int sz = stuff->nBtns * SIZEOF(xkbActionWireDesc); -+ if (!_XkbCheckRequestBounds(client, stuff, wire, (char *) wire + sz)) -+ return BadLength; -+ - if (!dev->button) { - client->errorValue = _XkbErrCode2(XkbErr_BadClass, ButtonClass); - return XkbKeyboardErrorCode; -@@ -6747,13 +6753,13 @@ _XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev, - dev->button->numButtons); - return BadMatch; - } -- wire += (stuff->nBtns * SIZEOF(xkbActionWireDesc)); -+ wire += sz; - } - if (stuff->change & XkbXI_IndicatorsMask) { - int status = Success; - - wire = CheckSetDeviceIndicators(wire, dev, stuff->nDeviceLedFBs, -- &status, client); -+ &status, client, stuff); - if (status != Success) - return status; - } -@@ -6764,8 +6770,8 @@ _XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev, - } - - static int --_XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev, -- xkbSetDeviceInfoReq * stuff) -+_XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev, -+ xkbSetDeviceInfoReq * stuff) - { - char *wire; - xkbExtensionDeviceNotify ed; -@@ -6789,8 +6795,6 @@ _XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev, - if (stuff->firstBtn + stuff->nBtns > nBtns) - return BadValue; - sz = stuff->nBtns * SIZEOF(xkbActionWireDesc); -- if (!_XkbCheckRequestBounds(client, stuff, wire, (char *) wire + sz)) -- return BadLength; - memcpy((char *) &acts[stuff->firstBtn], (char *) wire, sz); - wire += sz; - ed.reason |= XkbXI_ButtonActionsMask; --- -2.36.1 - diff --git a/0003-Xi-avoid-integer-truncation-in-length-check-of-ProcX.patch b/0003-Xi-avoid-integer-truncation-in-length-check-of-ProcX.patch deleted file mode 100644 index d3c654169caee98204e1c9d282878eef9e103dae..0000000000000000000000000000000000000000 --- a/0003-Xi-avoid-integer-truncation-in-length-check-of-ProcX.patch +++ /dev/null @@ -1,71 +0,0 @@ -From f9c435822c852659e3926502829f1b13ce6efc37 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 29 Nov 2022 13:26:57 +1000 -Subject: [PATCH xserver 3/7] Xi: avoid integer truncation in length check of - ProcXIChangeProperty - -This fixes an OOB read and the resulting information disclosure. - -Length calculation for the request was clipped to a 32-bit integer. With -the correct stuff->num_items value the expected request size was -truncated, passing the REQUEST_FIXED_SIZE check. - -The server then proceeded with reading at least stuff->num_items bytes -(depending on stuff->format) from the request and stuffing whatever it -finds into the property. In the process it would also allocate at least -stuff->num_items bytes, i.e. 4GB. - -The same bug exists in ProcChangeProperty and ProcXChangeDeviceProperty, -so let's fix that too. - -CVE-2022-46344, ZDI-CAN 19405 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xi/xiproperty.c | 4 ++-- - dix/property.c | 3 ++- - 2 files changed, 4 insertions(+), 3 deletions(-) - -diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c -index 68c362c628..066ba21fba 100644 ---- a/Xi/xiproperty.c -+++ b/Xi/xiproperty.c -@@ -890,7 +890,7 @@ ProcXChangeDeviceProperty(ClientPtr client) - REQUEST(xChangeDevicePropertyReq); - DeviceIntPtr dev; - unsigned long len; -- int totalSize; -+ uint64_t totalSize; - int rc; - - REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq); -@@ -1130,7 +1130,7 @@ ProcXIChangeProperty(ClientPtr client) - { - int rc; - DeviceIntPtr dev; -- int totalSize; -+ uint64_t totalSize; - unsigned long len; - - REQUEST(xXIChangePropertyReq); -diff --git a/dix/property.c b/dix/property.c -index 94ef5a0ec0..acce94b2c6 100644 ---- a/dix/property.c -+++ b/dix/property.c -@@ -205,7 +205,8 @@ ProcChangeProperty(ClientPtr client) - WindowPtr pWin; - char format, mode; - unsigned long len; -- int sizeInBytes, totalSize, err; -+ int sizeInBytes, err; -+ uint64_t totalSize; - - REQUEST(xChangePropertyReq); - --- -2.38.1 - diff --git a/0003-xkb-add-request-length-validation-for-XkbSetGeometry.patch b/0003-xkb-add-request-length-validation-for-XkbSetGeometry.patch deleted file mode 100644 index dca4d7cf64edf96e5532cf762998ff50c0e5ed44..0000000000000000000000000000000000000000 --- a/0003-xkb-add-request-length-validation-for-XkbSetGeometry.patch +++ /dev/null @@ -1,182 +0,0 @@ -From 6907b6ea2b4ce949cb07271f5b678d5966d9df42 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 5 Jul 2022 11:11:06 +1000 -Subject: [PATCH xserver 3/3] xkb: add request length validation for - XkbSetGeometry - -No validation of the various fields on that report were done, so a -malicious client could send a short request that claims it had N -sections, or rows, or keys, and the server would process the request for -N sections, running out of bounds of the actual request data. - -Fix this by adding size checks to ensure our data is valid. - -ZDI-CAN 16062, CVE-2022-2319. - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer ---- - xkb/xkb.c | 43 ++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 38 insertions(+), 5 deletions(-) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 34b2c290b..4692895db 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5156,7 +5156,7 @@ _GetCountedString(char **wire_inout, ClientPtr client, char **str) - } - - static Status --_CheckSetDoodad(char **wire_inout, -+_CheckSetDoodad(char **wire_inout, xkbSetGeometryReq *req, - XkbGeometryPtr geom, XkbSectionPtr section, ClientPtr client) - { - char *wire; -@@ -5167,6 +5167,9 @@ _CheckSetDoodad(char **wire_inout, - Status status; - - dWire = (xkbDoodadWireDesc *) (*wire_inout); -+ if (!_XkbCheckRequestBounds(client, req, dWire, dWire + 1)) -+ return BadLength; -+ - any = dWire->any; - wire = (char *) &dWire[1]; - if (client->swapped) { -@@ -5269,7 +5272,7 @@ _CheckSetDoodad(char **wire_inout, - } - - static Status --_CheckSetOverlay(char **wire_inout, -+_CheckSetOverlay(char **wire_inout, xkbSetGeometryReq *req, - XkbGeometryPtr geom, XkbSectionPtr section, ClientPtr client) - { - register int r; -@@ -5280,6 +5283,9 @@ _CheckSetOverlay(char **wire_inout, - - wire = *wire_inout; - olWire = (xkbOverlayWireDesc *) wire; -+ if (!_XkbCheckRequestBounds(client, req, olWire, olWire + 1)) -+ return BadLength; -+ - if (client->swapped) { - swapl(&olWire->name); - } -@@ -5291,6 +5297,9 @@ _CheckSetOverlay(char **wire_inout, - xkbOverlayKeyWireDesc *kWire; - XkbOverlayRowPtr row; - -+ if (!_XkbCheckRequestBounds(client, req, rWire, rWire + 1)) -+ return BadLength; -+ - if (rWire->rowUnder > section->num_rows) { - client->errorValue = _XkbErrCode4(0x20, r, section->num_rows, - rWire->rowUnder); -@@ -5299,6 +5308,9 @@ _CheckSetOverlay(char **wire_inout, - row = XkbAddGeomOverlayRow(ol, rWire->rowUnder, rWire->nKeys); - kWire = (xkbOverlayKeyWireDesc *) &rWire[1]; - for (k = 0; k < rWire->nKeys; k++, kWire++) { -+ if (!_XkbCheckRequestBounds(client, req, kWire, kWire + 1)) -+ return BadLength; -+ - if (XkbAddGeomOverlayKey(ol, row, - (char *) kWire->over, - (char *) kWire->under) == NULL) { -@@ -5332,6 +5344,9 @@ _CheckSetSections(XkbGeometryPtr geom, - register int r; - xkbRowWireDesc *rWire; - -+ if (!_XkbCheckRequestBounds(client, req, sWire, sWire + 1)) -+ return BadLength; -+ - if (client->swapped) { - swapl(&sWire->name); - swaps(&sWire->top); -@@ -5357,6 +5372,9 @@ _CheckSetSections(XkbGeometryPtr geom, - XkbRowPtr row; - xkbKeyWireDesc *kWire; - -+ if (!_XkbCheckRequestBounds(client, req, rWire, rWire + 1)) -+ return BadLength; -+ - if (client->swapped) { - swaps(&rWire->top); - swaps(&rWire->left); -@@ -5371,6 +5389,9 @@ _CheckSetSections(XkbGeometryPtr geom, - for (k = 0; k < rWire->nKeys; k++, kWire++) { - XkbKeyPtr key; - -+ if (!_XkbCheckRequestBounds(client, req, kWire, kWire + 1)) -+ return BadLength; -+ - key = XkbAddGeomKey(row); - if (!key) - return BadAlloc; -@@ -5396,7 +5417,7 @@ _CheckSetSections(XkbGeometryPtr geom, - register int d; - - for (d = 0; d < sWire->nDoodads; d++) { -- status = _CheckSetDoodad(&wire, geom, section, client); -+ status = _CheckSetDoodad(&wire, req, geom, section, client); - if (status != Success) - return status; - } -@@ -5405,7 +5426,7 @@ _CheckSetSections(XkbGeometryPtr geom, - register int o; - - for (o = 0; o < sWire->nOverlays; o++) { -- status = _CheckSetOverlay(&wire, geom, section, client); -+ status = _CheckSetOverlay(&wire, req, geom, section, client); - if (status != Success) - return status; - } -@@ -5439,6 +5460,9 @@ _CheckSetShapes(XkbGeometryPtr geom, - xkbOutlineWireDesc *olWire; - XkbOutlinePtr ol; - -+ if (!_XkbCheckRequestBounds(client, req, shapeWire, shapeWire + 1)) -+ return BadLength; -+ - shape = - XkbAddGeomShape(geom, shapeWire->name, shapeWire->nOutlines); - if (!shape) -@@ -5449,12 +5473,18 @@ _CheckSetShapes(XkbGeometryPtr geom, - XkbPointPtr pt; - xkbPointWireDesc *ptWire; - -+ if (!_XkbCheckRequestBounds(client, req, olWire, olWire + 1)) -+ return BadLength; -+ - ol = XkbAddGeomOutline(shape, olWire->nPoints); - if (!ol) - return BadAlloc; - ol->corner_radius = olWire->cornerRadius; - ptWire = (xkbPointWireDesc *) &olWire[1]; - for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++, ptWire++) { -+ if (!_XkbCheckRequestBounds(client, req, ptWire, ptWire + 1)) -+ return BadLength; -+ - pt->x = ptWire->x; - pt->y = ptWire->y; - if (client->swapped) { -@@ -5560,12 +5590,15 @@ _CheckSetGeom(XkbGeometryPtr geom, xkbSetGeometryReq * req, ClientPtr client) - return status; - - for (i = 0; i < req->nDoodads; i++) { -- status = _CheckSetDoodad(&wire, geom, NULL, client); -+ status = _CheckSetDoodad(&wire, req, geom, NULL, client); - if (status != Success) - return status; - } - - for (i = 0; i < req->nKeyAliases; i++) { -+ if (!_XkbCheckRequestBounds(client, req, wire, wire + XkbKeyNameLength)) -+ return BadLength; -+ - if (XkbAddGeomKeyAlias(geom, &wire[XkbKeyNameLength], wire) == NULL) - return BadAlloc; - wire += 2 * XkbKeyNameLength; --- -2.36.1 - diff --git a/0004-Xi-disallow-passive-grabs-with-a-detail-255.patch b/0004-Xi-disallow-passive-grabs-with-a-detail-255.patch deleted file mode 100644 index 5b189ea8a3d6835b38a40bb93be1ec0e7aac75d3..0000000000000000000000000000000000000000 --- a/0004-Xi-disallow-passive-grabs-with-a-detail-255.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 0dab0b527ac5c4fe0272ea679522bd87238a733b Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 29 Nov 2022 13:55:32 +1000 -Subject: [PATCH xserver 4/7] Xi: disallow passive grabs with a detail > 255 - -The XKB protocol effectively prevents us from ever using keycodes above -255. For buttons it's theoretically possible but realistically too niche -to worry about. For all other passive grabs, the detail must be zero -anyway. - -This fixes an OOB write: - -ProcXIPassiveUngrabDevice() calls DeletePassiveGrabFromList with a -temporary grab struct which contains tempGrab->detail.exact = stuff->detail. -For matching existing grabs, DeleteDetailFromMask is called with the -stuff->detail value. This function creates a new mask with the one bit -representing stuff->detail cleared. - -However, the array size for the new mask is 8 * sizeof(CARD32) bits, -thus any detail above 255 results in an OOB array write. - -CVE-2022-46341, ZDI-CAN 19381 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xi/xipassivegrab.c | 22 ++++++++++++++-------- - 1 file changed, 14 insertions(+), 8 deletions(-) - -diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c -index 2769fb7c94..c9ac2f8553 100644 ---- a/Xi/xipassivegrab.c -+++ b/Xi/xipassivegrab.c -@@ -137,6 +137,12 @@ ProcXIPassiveGrabDevice(ClientPtr client) - return BadValue; - } - -+ /* XI2 allows 32-bit keycodes but thanks to XKB we can never -+ * implement this. Just return an error for all keycodes that -+ * cannot work anyway, same for buttons > 255. */ -+ if (stuff->detail > 255) -+ return XIAlreadyGrabbed; -+ - if (XICheckInvalidMaskBits(client, (unsigned char *) &stuff[1], - stuff->mask_len * 4) != Success) - return BadValue; -@@ -207,14 +213,8 @@ ProcXIPassiveGrabDevice(ClientPtr client) - ¶m, XI2, &mask); - break; - case XIGrabtypeKeycode: -- /* XI2 allows 32-bit keycodes but thanks to XKB we can never -- * implement this. Just return an error for all keycodes that -- * cannot work anyway */ -- if (stuff->detail > 255) -- status = XIAlreadyGrabbed; -- else -- status = GrabKey(client, dev, mod_dev, stuff->detail, -- ¶m, XI2, &mask); -+ status = GrabKey(client, dev, mod_dev, stuff->detail, -+ ¶m, XI2, &mask); - break; - case XIGrabtypeEnter: - case XIGrabtypeFocusIn: -@@ -334,6 +334,12 @@ ProcXIPassiveUngrabDevice(ClientPtr client) - return BadValue; - } - -+ /* We don't allow passive grabs for details > 255 anyway */ -+ if (stuff->detail > 255) { -+ client->errorValue = stuff->detail; -+ return BadValue; -+ } -+ - rc = dixLookupWindow(&win, stuff->grab_window, client, DixSetAttrAccess); - if (rc != Success) - return rc; --- -2.38.1 - diff --git a/0005-Xext-free-the-screen-saver-resource-when-replacing-i.patch b/0005-Xext-free-the-screen-saver-resource-when-replacing-i.patch deleted file mode 100644 index dc2a9d9b521f2de3351969f1c432485f8ce40563..0000000000000000000000000000000000000000 --- a/0005-Xext-free-the-screen-saver-resource-when-replacing-i.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 94f6fe99d87cf6ba0adadd95c595158c345b7d29 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 29 Nov 2022 14:53:07 +1000 -Subject: [PATCH xserver 5/7] Xext: free the screen saver resource when - replacing it - -This fixes a use-after-free bug: - -When a client first calls ScreenSaverSetAttributes(), a struct -ScreenSaverAttrRec is allocated and added to the client's -resources. - -When the same client calls ScreenSaverSetAttributes() again, a new -struct ScreenSaverAttrRec is allocated, replacing the old struct. The -old struct was freed but not removed from the clients resources. - -Later, when the client is destroyed the resource system invokes -ScreenSaverFreeAttr and attempts to clean up the already freed struct. - -Fix this by letting the resource system free the old attrs instead. - -CVE-2022-46343, ZDI-CAN 19404 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xext/saver.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Xext/saver.c b/Xext/saver.c -index f813ba08d1..fd6153c313 100644 ---- a/Xext/saver.c -+++ b/Xext/saver.c -@@ -1051,7 +1051,7 @@ ScreenSaverSetAttributes(ClientPtr client) - pVlist++; - } - if (pPriv->attr) -- FreeScreenAttr(pPriv->attr); -+ FreeResource(pPriv->attr->resource, AttrType); - pPriv->attr = pAttr; - pAttr->resource = FakeClientID(client->index); - if (!AddResource(pAttr->resource, AttrType, (void *) pAttr)) --- -2.38.1 - diff --git a/0006-Xext-free-the-XvRTVideoNotify-when-turning-off-from-.patch b/0006-Xext-free-the-XvRTVideoNotify-when-turning-off-from-.patch deleted file mode 100644 index ba8b8fa05a4a4324623a24d32ba8bfdcab196db9..0000000000000000000000000000000000000000 --- a/0006-Xext-free-the-XvRTVideoNotify-when-turning-off-from-.patch +++ /dev/null @@ -1,74 +0,0 @@ -From a42635ee3c01f71a49052d83a372933504c9db04 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 30 Nov 2022 11:20:40 +1000 -Subject: [PATCH xserver 6/7] Xext: free the XvRTVideoNotify when turning off - from the same client - -This fixes a use-after-free bug: - -When a client first calls XvdiSelectVideoNotify() on a drawable with a -TRUE onoff argument, a struct XvVideoNotifyRec is allocated. This struct -is added twice to the resources: - - as the drawable's XvRTVideoNotifyList. This happens only once per - drawable, subsequent calls append to this list. - - as the client's XvRTVideoNotify. This happens for every client. - -The struct keeps the ClientPtr around once it has been added for a -client. The idea, presumably, is that if the client disconnects we can remove -all structs from the drawable's list that match the client (by resetting -the ClientPtr to NULL), but if the drawable is destroyed we can remove -and free the whole list. - -However, if the same client then calls XvdiSelectVideoNotify() on the -same drawable with a FALSE onoff argument, only the ClientPtr on the -existing struct was set to NULL. The struct itself remained in the -client's resources. - -If the drawable is now destroyed, the resource system invokes -XvdiDestroyVideoNotifyList which frees the whole list for this drawable -- including our struct. This function however does not free the resource -for the client since our ClientPtr is NULL. - -Later, when the client is destroyed and the resource system invokes -XvdiDestroyVideoNotify, we unconditionally set the ClientPtr to NULL. On -a struct that has been freed previously. This is generally frowned upon. - -Fix this by calling FreeResource() on the second call instead of merely -setting the ClientPtr to NULL. This removes the struct from the client -resources (but not from the list), ensuring that it won't be accessed -again when the client quits. - -Note that the assignment tpn->client = NULL; is superfluous since the -XvdiDestroyVideoNotify function will do this anyway. But it's left for -clarity and to match a similar invocation in XvdiSelectPortNotify. - -CVE-2022-46342, ZDI-CAN 19400 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xext/xvmain.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/Xext/xvmain.c b/Xext/xvmain.c -index f627471938..2a08f8744a 100644 ---- a/Xext/xvmain.c -+++ b/Xext/xvmain.c -@@ -811,8 +811,10 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff) - tpn = pn; - while (tpn) { - if (tpn->client == client) { -- if (!onoff) -+ if (!onoff) { - tpn->client = NULL; -+ FreeResource(tpn->id, XvRTVideoNotify); -+ } - return Success; - } - if (!tpn->client) --- -2.38.1 - diff --git a/0007-xkb-reset-the-radio_groups-pointer-to-NULL-after-fre.patch b/0007-xkb-reset-the-radio_groups-pointer-to-NULL-after-fre.patch deleted file mode 100644 index c6b235222d80547c97a08e6519cf27c858a96828..0000000000000000000000000000000000000000 --- a/0007-xkb-reset-the-radio_groups-pointer-to-NULL-after-fre.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 774260dbae1fa505cd2848c786baed9a8db5179d Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Mon, 5 Dec 2022 15:55:54 +1000 -Subject: [PATCH xserver 7/7] xkb: reset the radio_groups pointer to NULL after - freeing it - -Unlike other elements of the keymap, this pointer was freed but not -reset. On a subsequent XkbGetKbdByName request, the server may access -already freed memory. - -CVE-2022-46283, ZDI-CAN-19530 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - xkb/xkbUtils.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c -index dd089c2046..3f5791a183 100644 ---- a/xkb/xkbUtils.c -+++ b/xkb/xkbUtils.c -@@ -1326,6 +1326,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) - } - else { - free(dst->names->radio_groups); -+ dst->names->radio_groups = NULL; - } - dst->names->num_rg = src->names->num_rg; - --- -2.38.1 - diff --git a/0008-Xext-fix-invalid-event-type-mask-in-XTestSwapFakeInp.patch b/0008-Xext-fix-invalid-event-type-mask-in-XTestSwapFakeInp.patch deleted file mode 100644 index c84d387f9f75128790ca8ec44e60c7b553b14143..0000000000000000000000000000000000000000 --- a/0008-Xext-fix-invalid-event-type-mask-in-XTestSwapFakeInp.patch +++ /dev/null @@ -1,35 +0,0 @@ -From bb1711b7fba42f2a0c7d1c09beee241a1b2bcc30 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Mon, 19 Dec 2022 10:06:45 +1000 -Subject: [PATCH xserver] Xext: fix invalid event type mask in - XTestSwapFakeInput - -In commit b320ca0 the mask was inadvertently changed from octal 0177 to -hexadecimal 0x177. - -Fixes commit b320ca0ffe4c0c872eeb3a93d9bde21f765c7c63 - Xtest: disallow GenericEvents in XTestSwapFakeInput - -Found by Stuart Cassoff - -Signed-off-by: Peter Hutterer ---- - Xext/xtest.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Xext/xtest.c b/Xext/xtest.c -index 2985a4ce6e..dde5c4cf9d 100644 ---- a/Xext/xtest.c -+++ b/Xext/xtest.c -@@ -502,7 +502,7 @@ XTestSwapFakeInput(ClientPtr client, xReq * req) - - nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent); - for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) { -- int evtype = ev->u.u.type & 0x177; -+ int evtype = ev->u.u.type & 0177; - /* Swap event */ - proc = EventSwapVector[evtype]; - /* no swapping proc; invalid event type? */ --- -2.38.1 - diff --git a/0100-xorg-patch-for-ast-ft-bmc-card-in-s5000c.patch b/0100-xorg-patch-for-ast-ft-bmc-card-in-s5000c.patch deleted file mode 100644 index 5cc93a0b77a09c97e20a5be6477caa45e070bc2f..0000000000000000000000000000000000000000 --- a/0100-xorg-patch-for-ast-ft-bmc-card-in-s5000c.patch +++ /dev/null @@ -1,203 +0,0 @@ -From 2acef96c033f1f67b65c2bd042f6f93c861a197c Mon Sep 17 00:00:00 2001 -From: wanghao -Date: Fri, 24 May 2024 18:37:36 +0800 -Subject: [PATCH] xorg patch for ast&ft bmc card in s5000c - -Signed-off-by: yuan0927 -Signed-off-by: wanghao ---- - hw/xfree86/drivers/modesetting/driver.c | 165 +++++++++++++++++++++++- - 1 file changed, 164 insertions(+), 1 deletion(-) - -diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c -index b3e913a..44f72b8 100644 ---- a/hw/xfree86/drivers/modesetting/driver.c -+++ b/hw/xfree86/drivers/modesetting/driver.c -@@ -1156,12 +1156,171 @@ msUpdateIntersect(modesettingPtr ms, shadowBufPtr pBuf, BoxPtr box, - return dirty; - } - -+static void align_memcpy(void *dest, void *source, size_t size) -+{ -+ char *dst1, *dst2, *p, *src, *dst; -+ -+ src = (char *)source; -+ dst = (char *)dest; -+ -+ dst1 = (char *)(((unsigned long)dst + 0xf) & ~0xf); -+ dst2 = (char *)(((unsigned long)dst + size) & ~0xf); -+ p = dst; -+ -+ while((p< dst1) && size){ -+ *p++ = *src++; -+ size--; -+ }; -+ -+ memcpy(dst1, (char *)src, (size & (~0xf))); -+ -+ src += (size & (~0xf)); -+ size = (size & 0xf); -+ -+ p = dst2; -+ while(size--){ -+ *p++ = *src++; -+ }; -+} -+ -+#define AST_BMC_VENDOR_ID 0x1a03 -+#define FT_BMC_VENDOR_ID 0x1db7 -+#define FT_BMC_DEVICE_ID 0xdc3e -+#define DRM_AST_VRAM_TYPE_DEVICE 0x0 -+#define DRM_IOCTL_AST_VRAM_TYPE_DEVICE DRM_IO(DRM_COMMAND_BASE + DRM_AST_VRAM_TYPE_DEVICE) -+#define DRM_PHYTIUM_VRAM_TYPE_DEVICE 0x0 -+#define DRM_IOCTL_PHYTIUM_VRAM_TYPE_DEVICE DRM_IO(DRM_COMMAND_BASE + DRM_PHYTIUM_VRAM_TYPE_DEVICE) -+ -+static Bool device_is_ast_bmc(struct pci_device *pci) -+{ -+ if (pci->vendor_id == AST_BMC_VENDOR_ID) { -+ return TRUE; -+ } -+ -+ return FALSE; -+} -+ -+static Bool device_is_ft_bmc(struct pci_device *pci) -+{ -+ if (pci->vendor_id == FT_BMC_VENDOR_ID && pci->device_id == FT_BMC_DEVICE_ID) { -+ return TRUE; -+ } -+ -+ return FALSE; -+} -+ -+static void -+msshadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf) -+{ -+ RegionPtr damage = DamageRegion(pBuf->pDamage); -+ PixmapPtr pShadow = pBuf->pPixmap; -+ int nbox = RegionNumRects(damage); -+ BoxPtr pbox = RegionRects(damage); -+ FbBits *shaBase, *shaLine, *sha; -+ FbStride shaStride; -+ int scrBase, scrLine, scr; -+ int shaBpp; -+ _X_UNUSED int shaXoff, shaYoff; -+ int x, y, w, h, width; -+ int i; -+ FbBits *winBase = NULL, *win; -+ CARD32 winSize; -+ static Bool firstQuery_ast = TRUE; -+ static Bool firstQuery_ft = TRUE; -+ static Bool forceAlign = FALSE; -+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); -+ modesettingPtr ms = modesettingPTR(pScrn); -+ -+ if (firstQuery_ast) { -+ if (1 == drmIoctl(ms->fd, DRM_IOCTL_AST_VRAM_TYPE_DEVICE, NULL)) { -+ forceAlign = TRUE; -+ } -+ firstQuery_ast = FALSE; -+ } -+ -+ if (firstQuery_ft) { -+ if (1 == drmIoctl(ms->fd, DRM_IOCTL_PHYTIUM_VRAM_TYPE_DEVICE, NULL)) { -+ forceAlign = TRUE; -+ } -+ firstQuery_ft = FALSE; -+ } -+ -+ fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, -+ shaYoff); -+ while (nbox--) { -+ x = pbox->x1 * shaBpp; -+ y = pbox->y1; -+ w = (pbox->x2 - pbox->x1) * shaBpp; -+ h = pbox->y2 - pbox->y1; -+ -+ scrLine = (x >> FB_SHIFT); -+ shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); -+ -+ x &= FB_MASK; -+ w = (w + x + FB_MASK) >> FB_SHIFT; -+ -+ while (h--) { -+ winSize = 0; -+ scrBase = 0; -+ width = w; -+ scr = scrLine; -+ sha = shaLine; -+ while (width) { -+ /* how much remains in this window */ -+ i = scrBase + winSize - scr; -+ if (i <= 0 || scr < scrBase) { -+ winBase = (FbBits *) (*pBuf->window) (pScreen, -+ y, -+ scr * sizeof(FbBits), -+ SHADOW_WINDOW_WRITE, -+ &winSize, -+ pBuf->closure); -+ if (!winBase) -+ return; -+ scrBase = scr; -+ winSize /= sizeof(FbBits); -+ i = winSize; -+ } -+ win = winBase + (scr - scrBase); -+ if (i > width) -+ i = width; -+ width -= i; -+ scr += i; -+ if (forceAlign) { -+ align_memcpy(win, sha, i * sizeof(FbBits)); -+ } else { -+ memcpy(win, sha, i * sizeof(FbBits)); -+ } -+ sha += i; -+ } -+ shaLine += shaStride; -+ y++; -+ } -+ pbox++; -+ } -+} -+ - static void - msUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf) - { - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - modesettingPtr ms = modesettingPTR(pScrn); - Bool use_3224 = ms->drmmode.force_24_32 && pScrn->bitsPerPixel == 32; -+ Bool isAstBMC = FALSE; -+ Bool isFtBMC = FALSE; -+ struct pci_device *pci = NULL; -+ -+ if (BUS_PLATFORM == ms->pEnt->location.type) { -+ pci = ms->pEnt->location.id.plat->pdev; -+ } else if (BUS_PCI == ms->pEnt->location.type) { -+ pci = ms->pEnt->location.id.pci; -+ } -+ -+ if (pci && device_is_ast_bmc(pci)) { -+ isAstBMC = TRUE; -+ } else if (pci && device_is_ft_bmc(pci)) { -+ isFtBMC = TRUE; -+ } - - if (ms->drmmode.shadow_enable2 && ms->drmmode.shadow_fb2) do { - RegionPtr damage = DamageRegion(pBuf->pDamage), tiles; -@@ -1206,7 +1365,11 @@ msUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf) - if (use_3224) - ms->shadow.Update32to24(pScreen, pBuf); - else -- ms->shadow.UpdatePacked(pScreen, pBuf); -+ if(isAstBMC || isFtBMC) { -+ msshadowUpdatePacked(pScreen, pBuf); -+ } else { -+ ms->shadow.UpdatePacked(pScreen, pBuf); -+ } - } - - static Bool --- -2.25.1 - diff --git a/10-quirks.conf b/10-quirks.conf deleted file mode 100644 index 47907d82de3d2f8e6d5d284f31de9e35bbb1ac3d..0000000000000000000000000000000000000000 --- a/10-quirks.conf +++ /dev/null @@ -1,38 +0,0 @@ -# Collection of quirks and blacklist/whitelists for specific devices. - - -# Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable -# http://bugs.freedesktop.org/show_bug.cgi?id=22442 -Section "InputClass" - Identifier "ThinkPad HDAPS accelerometer blacklist" - MatchProduct "ThinkPad HDAPS accelerometer data" - Option "Ignore" "on" -EndSection - -# https://bugzilla.redhat.com/show_bug.cgi?id=523914 -# Mouse does not move in PV Xen guest -# Explicitly tell evdev to not ignore the absolute axes. -Section "InputClass" - Identifier "Xen Virtual Pointer axis blacklist" - MatchProduct "Xen Virtual Pointer" - Option "IgnoreAbsoluteAxes" "off" - Option "IgnoreRelativeAxes" "off" -EndSection - -# https://bugs.freedesktop.org/show_bug.cgi?id=55867 -# Bug 55867 - Doesn't know how to tag XI_TRACKBALL -Section "InputClass" - Identifier "Tag trackballs as XI_TRACKBALL" - MatchProduct "trackball" - MatchDriver "evdev" - Option "TypeName" "TRACKBALL" -EndSection - -# https://bugs.freedesktop.org/show_bug.cgi?id=62831 -# Bug 62831 - Mionix Naos 5000 mouse detected incorrectly -Section "InputClass" - Identifier "Tag Mionix Naos 5000 mouse XI_MOUSE" - MatchProduct "La-VIEW Technology Naos 5000 Mouse" - MatchDriver "evdev" - Option "TypeName" "MOUSE" -EndSection diff --git a/1000-meson-Fix-libshadow.so-linkage.patch b/1000-meson-Fix-libshadow.so-linkage.patch deleted file mode 100644 index 733a8d36c76bcf98f9a6d686d539eeb11e1574aa..0000000000000000000000000000000000000000 --- a/1000-meson-Fix-libshadow.so-linkage.patch +++ /dev/null @@ -1,30 +0,0 @@ -From e064488cdcfd57ececf820716a3264ac9073b6ca Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Tue, 30 Apr 2019 18:01:27 -0400 -Subject: [PATCH 1000/1005] meson: Fix libshadow.so linkage - -Don't link against fb, it's the driver's responsibility to load that -first. Underlinking like this is unpleasant but this matches what -autotools does. - -Fixes: xorg/xserver#540 ---- - hw/xfree86/dixmods/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/xfree86/dixmods/meson.build b/hw/xfree86/dixmods/meson.build -index 835d232..0562b63 100644 ---- a/hw/xfree86/dixmods/meson.build -+++ b/hw/xfree86/dixmods/meson.build -@@ -34,7 +34,7 @@ shared_module( - c_args: xorg_c_args, - dependencies: common_dep, - link_whole: libxserver_miext_shadow, -- link_with: [fb, e], -+ link_with: e, - - install: true, - install_dir: module_dir, --- -1.8.3.1 - diff --git a/1001-xfree86-Link-fb-statically.patch b/1001-xfree86-Link-fb-statically.patch deleted file mode 100644 index 60c471147dfd8dcc9ccdb402d10fbb9e3933b113..0000000000000000000000000000000000000000 --- a/1001-xfree86-Link-fb-statically.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 2dd9804720bb4a7d5d9295240a4d070e1569d863 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Tue, 23 Jul 2019 11:54:15 -0400 -Subject: [PATCH 1001/1005] xfree86: Link fb statically - -There's no real benefit to leaving this loadable, virtually every driver -is going to load it. - -Reviewed-by: Jon Turney ---- - hw/xfree86/Makefile.am | 1 + - hw/xfree86/dixmods/Makefile.am | 8 +------- - hw/xfree86/dixmods/meson.build | 14 -------------- - hw/xfree86/drivers/modesetting/meson.build | 1 - - hw/xfree86/loader/loadmod.c | 1 + - hw/xfree86/meson.build | 1 + - hw/xfree86/sdksyms.sh | 6 +++--- - test/Makefile.am | 1 + - 8 files changed, 8 insertions(+), 25 deletions(-) - -diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am -index 9aeaea1..1d494cd 100644 ---- a/hw/xfree86/Makefile.am -+++ b/hw/xfree86/Makefile.am -@@ -75,6 +75,7 @@ LOCAL_LIBS = \ - $(DRI2_LIB) \ - $(DRI3_LIB) \ - $(GLXVND_LIB) \ -+ $(top_builddir)/fb/libfb.la \ - $(top_builddir)/miext/sync/libsync.la \ - $(top_builddir)/mi/libmi.la \ - $(top_builddir)/os/libos.la \ -diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am -index 856659f..a1f9705 100644 ---- a/hw/xfree86/dixmods/Makefile.am -+++ b/hw/xfree86/dixmods/Makefile.am -@@ -4,8 +4,7 @@ if GLX - GLXMODS = libglx.la - endif - --module_LTLIBRARIES = libfb.la \ -- libwfb.la \ -+module_LTLIBRARIES = libwfb.la \ - libshadow.la - - extsmoduledir = $(moduledir)/extensions -@@ -17,11 +16,6 @@ AM_CPPFLAGS = @XORG_INCS@ \ - -I$(top_srcdir)/miext/shadow \ - -I$(top_srcdir)/glx - --libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) --libfb_la_LIBADD = $(top_builddir)/fb/libfb.la --libfb_la_SOURCES = fbmodule.c --libfb_la_CFLAGS = $(AM_CFLAGS) -- - libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) - libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la - libwfb_la_SOURCES = fbmodule.c -diff --git a/hw/xfree86/dixmods/meson.build b/hw/xfree86/dixmods/meson.build -index 0562b63..e4ac022 100644 ---- a/hw/xfree86/dixmods/meson.build -+++ b/hw/xfree86/dixmods/meson.build -@@ -1,17 +1,3 @@ --fb = shared_module( -- 'fb', -- 'fbmodule.c', -- -- include_directories: [inc, xorg_inc], -- c_args: xorg_c_args, -- dependencies: common_dep, -- link_whole: libxserver_fb, -- link_with: e, -- -- install: true, -- install_dir: module_dir, --) -- - shared_module( - 'wfb', - 'fbmodule.c', -diff --git a/hw/xfree86/drivers/modesetting/meson.build b/hw/xfree86/drivers/modesetting/meson.build -index 5e13f1a..02852a7 100644 ---- a/hw/xfree86/drivers/modesetting/meson.build -+++ b/hw/xfree86/drivers/modesetting/meson.build -@@ -30,7 +30,6 @@ shared_module( - xorg_build_root = join_paths(meson.build_root(), 'hw', 'xfree86') - symbol_test_args = [] - symbol_test_args += join_paths(xorg_build_root, 'libxorgserver.so') --symbol_test_args += join_paths(xorg_build_root, 'dixmods', 'libfb.so') - symbol_test_args += join_paths(xorg_build_root, 'dixmods', 'libshadow.so') - if gbm_dep.found() - symbol_test_args += join_paths(xorg_build_root, 'glamor_egl', 'libglamoregl.so') -diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c -index a6356bd..f0983b2 100644 ---- a/hw/xfree86/loader/loadmod.c -+++ b/hw/xfree86/loader/loadmod.c -@@ -621,6 +621,7 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent) - - static const char *compiled_in_modules[] = { - "ddc", -+ "fb", - "i2c", - "ramdac", - "dbe", -diff --git a/hw/xfree86/meson.build b/hw/xfree86/meson.build -index cacf56d..c80964e 100644 ---- a/hw/xfree86/meson.build -+++ b/hw/xfree86/meson.build -@@ -61,6 +61,7 @@ xorg_link = [ - xorg_os_support, - xorg_parser, - xorg_ramdac, -+ libxserver_fb, - libxserver_xext_vidmode, - libxserver_main, - libxserver_config, -diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh -index 7897aae..2ebc4c0 100755 ---- a/hw/xfree86/sdksyms.sh -+++ b/hw/xfree86/sdksyms.sh -@@ -21,13 +21,13 @@ cat > sdksyms.c << EOF - #include "picturestr.h" - - --/* fb/Makefile.am -- module */ --/* -+/* fb/Makefile.am */ - #include "fb.h" - #include "fbrop.h" - #include "fboverlay.h" --#include "wfbrename.h" - #include "fbpict.h" -+/* wfb is still a module -+#include "wfbrename.h" - */ - - -diff --git a/test/Makefile.am b/test/Makefile.am -index 12ac327..ce07c35 100644 ---- a/test/Makefile.am -+++ b/test/Makefile.am -@@ -146,6 +146,7 @@ tests_LDADD += \ - $(top_builddir)/hw/xfree86/i2c/libi2c.la \ - $(top_builddir)/hw/xfree86/xkb/libxorgxkb.la \ - $(top_builddir)/Xext/libXvidmode.la \ -+ $(top_builddir)/fb/libfb.la \ - $(XSERVER_LIBS) \ - $(XORG_LIBS) - --- -1.8.3.1 - diff --git a/1002-xfree86-Merge-vbe-into-int10.patch b/1002-xfree86-Merge-vbe-into-int10.patch deleted file mode 100644 index 58c3b84e4c67185f92ef074e648b387ec78f8f44..0000000000000000000000000000000000000000 --- a/1002-xfree86-Merge-vbe-into-int10.patch +++ /dev/null @@ -1,4393 +0,0 @@ -From bad0f343a077a0f70c6c8498444731488b0b6ee2 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Tue, 23 Jul 2019 14:33:45 -0400 -Subject: [PATCH 1002/1005] xfree86: Merge vbe into int10 - -There's not really a good reason to keep these separate, the vbe code -requires int10 and is not very large. This change eliminates the -build-time options for vbe; if you build int10, you get vbe. - -Gitlab: https://gitlab.freedesktop.org/xorg/xserver/issues/692 -Reviewed-by: Emil Velikov ---- - Makefile.am | 1 - - configure.ac | 5 - - hw/xfree86/Makefile.am | 8 +- - hw/xfree86/int10/Makefile.am | 7 +- - hw/xfree86/int10/meson.build | 4 + - hw/xfree86/int10/vbe.c | 1096 ++++++++++++++++++++++++++++++++++++++++++ - hw/xfree86/int10/vbe.h | 357 ++++++++++++++ - hw/xfree86/int10/vbeModes.c | 453 +++++++++++++++++ - hw/xfree86/int10/vbeModes.h | 94 ++++ - hw/xfree86/loader/loadmod.c | 4 + - hw/xfree86/meson.build | 4 - - hw/xfree86/sdksyms.sh | 9 +- - hw/xfree86/vbe/Makefile.am | 14 - - hw/xfree86/vbe/meson.build | 10 - - hw/xfree86/vbe/vbe.c | 1096 ------------------------------------------ - hw/xfree86/vbe/vbe.h | 357 -------------- - hw/xfree86/vbe/vbeModes.c | 453 ----------------- - hw/xfree86/vbe/vbeModes.h | 94 ---- - hw/xfree86/vbe/vbe_module.c | 22 - - meson.build | 11 - - meson_options.txt | 2 - - 21 files changed, 2017 insertions(+), 2084 deletions(-) - create mode 100644 hw/xfree86/int10/vbe.c - create mode 100644 hw/xfree86/int10/vbe.h - create mode 100644 hw/xfree86/int10/vbeModes.c - create mode 100644 hw/xfree86/int10/vbeModes.h - delete mode 100644 hw/xfree86/vbe/Makefile.am - delete mode 100644 hw/xfree86/vbe/meson.build - delete mode 100644 hw/xfree86/vbe/vbe.c - delete mode 100644 hw/xfree86/vbe/vbe.h - delete mode 100644 hw/xfree86/vbe/vbeModes.c - delete mode 100644 hw/xfree86/vbe/vbeModes.h - delete mode 100644 hw/xfree86/vbe/vbe_module.c - -diff --git a/Makefile.am b/Makefile.am -index 19511f7..0c557c4 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -181,7 +181,6 @@ EXTRA_DIST += \ - hw/xfree86/parser/meson.build \ - hw/xfree86/ramdac/meson.build \ - hw/xfree86/shadowfb/meson.build \ -- hw/xfree86/vbe/meson.build \ - hw/xfree86/vgahw/meson.build \ - hw/xfree86/x86emu/meson.build \ - hw/xfree86/xkb/meson.build \ -diff --git a/configure.ac b/configure.ac -index 2349320..1f0e42d 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -577,7 +577,6 @@ AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL - AC_ARG_ENABLE(config-wscons, AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=auto]) - AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes]) - AC_ARG_ENABLE(vgahw, AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes]) --AC_ARG_ENABLE(vbe, AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes]) - AC_ARG_ENABLE(int10-module, AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes]) - AC_ARG_ENABLE(windowswm, AS_HELP_STRING([--enable-windowswm], [Build XWin with WindowsWM extension (default: no)]), [WINDOWSWM=$enableval], [WINDOWSWM=no]) - AC_ARG_ENABLE(windowsdri, AS_HELP_STRING([--enable-windowsdri], [Build XWin with WindowsDRI extension (default: auto)]), [WINDOWSDRI=$enableval], [WINDOWSDRI=auto]) -@@ -669,7 +668,6 @@ case $host_os in - INT10MODULE=no - PCI=no - VGAHW=no -- VBE=no - XF86UTILS=no - XF86VIDMODE=no - XSELINUX=no -@@ -679,7 +677,6 @@ case $host_os in - PCI=no - INT10MODULE=no - VGAHW=no -- VBE=no - DRM=no - DRI2=no - DRI3=no -@@ -1353,7 +1350,6 @@ XI_INC='-I$(top_srcdir)/Xi' - - AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes) - AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes) --AM_CONDITIONAL(VBE, test "x$VBE" = xyes) - AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes) - - AC_DEFINE(SHAPE, 1, [Support SHAPE extension]) -@@ -2509,7 +2505,6 @@ hw/xfree86/os-support/stub/Makefile - hw/xfree86/parser/Makefile - hw/xfree86/ramdac/Makefile - hw/xfree86/shadowfb/Makefile --hw/xfree86/vbe/Makefile - hw/xfree86/vgahw/Makefile - hw/xfree86/x86emu/Makefile - hw/xfree86/xkb/Makefile -diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am -index 1d494cd..baf380d 100644 ---- a/hw/xfree86/Makefile.am -+++ b/hw/xfree86/Makefile.am -@@ -30,22 +30,18 @@ if VGAHW - VGAHW_SUBDIR = vgahw - endif - --if VBE --VBE_SUBDIR = vbe --endif -- - if INT10MODULE - INT10_SUBDIR = int10 - endif - - SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ - ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ -- $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods xkb \ -+ $(DRI2_SUBDIR) . i2c dixmods xkb \ - fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \ - $(GLAMOR_EGL_SUBDIR) drivers - - DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ -- parser ramdac shadowfb vbe vgahw \ -+ parser ramdac shadowfb vgahw \ - loader dixmods xkb dri dri2 exa modes \ - utils doc man glamor_egl drivers - -diff --git a/hw/xfree86/int10/Makefile.am b/hw/xfree86/int10/Makefile.am -index 66cb14d..0248dc7 100644 ---- a/hw/xfree86/int10/Makefile.am -+++ b/hw/xfree86/int10/Makefile.am -@@ -1,6 +1,6 @@ - module_LTLIBRARIES = libint10.la - --sdk_HEADERS = xf86int10.h -+sdk_HEADERS = xf86int10.h vbe.h vbeModes.h - - EXTRA_CFLAGS = - -@@ -8,6 +8,8 @@ libint10_la_LDFLAGS = -avoid-version - libint10_la_LIBADD = $(PCIACCESS_LIBS) - - COMMON_SOURCES = \ -+ vbe.c \ -+ vbeModes.c \ - helper_exec.c \ - helper_mem.c \ - xf86int10.c \ -@@ -17,7 +19,8 @@ if I386_VIDEO - I386_VIDEO_CFLAGS = -D_PC - endif - --AM_CPPFLAGS = $(XORG_INCS) -+AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../modes -I$(srcdir)/../i2c \ -+ -I$(srcdir)/../parser - - if INT10_VM86 - AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS) -diff --git a/hw/xfree86/int10/meson.build b/hw/xfree86/int10/meson.build -index b1ead9c..a309e9b 100644 ---- a/hw/xfree86/int10/meson.build -+++ b/hw/xfree86/int10/meson.build -@@ -1,4 +1,6 @@ - srcs_xorg_int10 = [ -+ 'vbe.c', -+ 'vbeModes.c', - 'helper_exec.c', - 'helper_mem.c', - 'xf86int10.c', -@@ -58,3 +60,5 @@ xorg_int10 = shared_module('int10', - ) - - install_data('xf86int10.h', install_dir: xorgsdkdir) -+install_data('vbe.h', install_dir: xorgsdkdir) -+install_data('vbeModes.h', install_dir: xorgsdkdir) -diff --git a/hw/xfree86/int10/vbe.c b/hw/xfree86/int10/vbe.c -new file mode 100644 -index 0000000..d23e0f5 ---- /dev/null -+++ b/hw/xfree86/int10/vbe.c -@@ -0,0 +1,1096 @@ -+ -+/* -+ * XFree86 vbe module -+ * Copyright 2000 Egbert Eich -+ * -+ * The mode query/save/set/restore functions from the vesa driver -+ * have been moved here. -+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) -+ * Authors: Paulo César Pereira de Andrade -+ */ -+ -+#ifdef HAVE_XORG_CONFIG_H -+#include -+#endif -+ -+#include -+ -+#include "xf86.h" -+#include "xf86Modes.h" -+#include "vbe.h" -+#include -+ -+#define VERSION(x) VBE_VERSION_MAJOR(x),VBE_VERSION_MINOR(x) -+ -+#if X_BYTE_ORDER == X_LITTLE_ENDIAN -+#define B_O16(x) (x) -+#define B_O32(x) (x) -+#else -+#define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8)) -+#define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \ -+ | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24)) -+#endif -+#define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) -+ -+#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) -+#define R16(v) ((v) & 0xffff) -+ -+static unsigned char *vbeReadEDID(vbeInfoPtr pVbe); -+static Bool vbeProbeDDC(vbeInfoPtr pVbe); -+ -+static const char vbeVersionString[] = "VBE2"; -+ -+vbeInfoPtr -+VBEInit(xf86Int10InfoPtr pInt, int entityIndex) -+{ -+ return VBEExtendedInit(pInt, entityIndex, 0); -+} -+ -+vbeInfoPtr -+VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags) -+{ -+ int RealOff; -+ void *page = NULL; -+ ScrnInfoPtr pScrn = xf86FindScreenForEntity(entityIndex); -+ vbeControllerInfoPtr vbe = NULL; -+ Bool init_int10 = FALSE; -+ vbeInfoPtr vip = NULL; -+ int screen; -+ -+ if (!pScrn) -+ return NULL; -+ screen = pScrn->scrnIndex; -+ -+ if (!pInt) { -+ if (!xf86LoadSubModule(pScrn, "int10")) -+ goto error; -+ -+ xf86DrvMsg(screen, X_INFO, "initializing int10\n"); -+ pInt = xf86ExtendedInitInt10(entityIndex, Flags); -+ if (!pInt) -+ goto error; -+ init_int10 = TRUE; -+ } -+ -+ page = xf86Int10AllocPages(pInt, 1, &RealOff); -+ if (!page) -+ goto error; -+ vbe = (vbeControllerInfoPtr) page; -+ memcpy(vbe->VbeSignature, vbeVersionString, 4); -+ -+ pInt->ax = 0x4F00; -+ pInt->es = SEG_ADDR(RealOff); -+ pInt->di = SEG_OFF(RealOff); -+ pInt->num = 0x10; -+ -+ xf86ExecX86int10(pInt); -+ -+ if ((pInt->ax & 0xff) != 0x4f) { -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA BIOS not detected\n"); -+ goto error; -+ } -+ -+ switch (pInt->ax & 0xff00) { -+ case 0: -+ xf86DrvMsg(screen, X_INFO, "VESA BIOS detected\n"); -+ break; -+ case 0x100: -+ xf86DrvMsg(screen, X_INFO, "VESA BIOS function failed\n"); -+ goto error; -+ case 0x200: -+ xf86DrvMsg(screen, X_INFO, "VESA BIOS not supported\n"); -+ goto error; -+ case 0x300: -+ xf86DrvMsg(screen, X_INFO, "VESA BIOS not supported in current mode\n"); -+ goto error; -+ default: -+ xf86DrvMsg(screen, X_INFO, "Invalid\n"); -+ goto error; -+ } -+ -+ xf86DrvMsgVerb(screen, X_INFO, 4, -+ "VbeVersion is %d, OemStringPtr is 0x%08lx,\n" -+ "\tOemVendorNamePtr is 0x%08lx, OemProductNamePtr is 0x%08lx,\n" -+ "\tOemProductRevPtr is 0x%08lx\n", -+ vbe->VbeVersion, (unsigned long) vbe->OemStringPtr, -+ (unsigned long) vbe->OemVendorNamePtr, -+ (unsigned long) vbe->OemProductNamePtr, -+ (unsigned long) vbe->OemProductRevPtr); -+ -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE Version %i.%i\n", -+ VERSION(vbe->VbeVersion)); -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE Total Mem: %i kB\n", -+ vbe->TotalMem * 64); -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM: %s\n", -+ (CARD8 *) xf86int10Addr(pInt, L_ADD(vbe->OemStringPtr))); -+ -+ if (B_O16(vbe->VbeVersion) >= 0x200) { -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Software Rev: %i.%i\n", -+ VERSION(vbe->OemSoftwareRev)); -+ if (vbe->OemVendorNamePtr) -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Vendor: %s\n", -+ (CARD8 *) xf86int10Addr(pInt, -+ L_ADD(vbe-> -+ OemVendorNamePtr))); -+ if (vbe->OemProductNamePtr) -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Product: %s\n", -+ (CARD8 *) xf86int10Addr(pInt, -+ L_ADD(vbe-> -+ OemProductNamePtr))); -+ if (vbe->OemProductRevPtr) -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Product Rev: %s\n", -+ (CARD8 *) xf86int10Addr(pInt, -+ L_ADD(vbe-> -+ OemProductRevPtr))); -+ } -+ vip = (vbeInfoPtr) xnfalloc(sizeof(vbeInfoRec)); -+ vip->version = B_O16(vbe->VbeVersion); -+ vip->pInt10 = pInt; -+ vip->ddc = DDC_UNCHECKED; -+ vip->memory = page; -+ vip->real_mode_base = RealOff; -+ vip->num_pages = 1; -+ vip->init_int10 = init_int10; -+ -+ return vip; -+ -+ error: -+ if (page) -+ xf86Int10FreePages(pInt, page, 1); -+ if (init_int10) -+ xf86FreeInt10(pInt); -+ return NULL; -+} -+ -+void -+vbeFree(vbeInfoPtr pVbe) -+{ -+ if (!pVbe) -+ return; -+ -+ xf86Int10FreePages(pVbe->pInt10, pVbe->memory, pVbe->num_pages); -+ /* If we have initalized int10 we ought to free it, too */ -+ if (pVbe->init_int10) -+ xf86FreeInt10(pVbe->pInt10); -+ free(pVbe); -+ return; -+} -+ -+static Bool -+vbeProbeDDC(vbeInfoPtr pVbe) -+{ -+ const char *ddc_level; -+ int screen = pVbe->pInt10->pScrn->scrnIndex; -+ -+ if (pVbe->ddc == DDC_NONE) -+ return FALSE; -+ if (pVbe->ddc != DDC_UNCHECKED) -+ return TRUE; -+ -+ pVbe->pInt10->ax = 0x4F15; -+ pVbe->pInt10->bx = 0; -+ pVbe->pInt10->cx = 0; -+ pVbe->pInt10->es = 0; -+ pVbe->pInt10->di = 0; -+ pVbe->pInt10->num = 0x10; -+ -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if ((pVbe->pInt10->ax & 0xff) != 0x4f) { -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC not supported\n"); -+ pVbe->ddc = DDC_NONE; -+ return FALSE; -+ } -+ -+ switch ((pVbe->pInt10->ax >> 8) & 0xff) { -+ case 0: -+ xf86DrvMsg(screen, X_INFO, "VESA VBE DDC supported\n"); -+ switch (pVbe->pInt10->bx & 0x3) { -+ case 0: -+ ddc_level = " none"; -+ pVbe->ddc = DDC_NONE; -+ break; -+ case 1: -+ ddc_level = " 1"; -+ pVbe->ddc = DDC_1; -+ break; -+ case 2: -+ ddc_level = " 2"; -+ pVbe->ddc = DDC_2; -+ break; -+ case 3: -+ ddc_level = " 1 + 2"; -+ pVbe->ddc = DDC_1_2; -+ break; -+ default: -+ ddc_level = ""; -+ pVbe->ddc = DDC_NONE; -+ break; -+ } -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC Level%s\n", ddc_level); -+ if (pVbe->pInt10->bx & 0x4) { -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC Screen blanked" -+ "for data transfer\n"); -+ pVbe->ddc_blank = TRUE; -+ } -+ else -+ pVbe->ddc_blank = FALSE; -+ -+ xf86DrvMsgVerb(screen, X_INFO, 3, -+ "VESA VBE DDC transfer in appr. %x sec.\n", -+ (pVbe->pInt10->bx >> 8) & 0xff); -+ } -+ -+ return TRUE; -+} -+ -+typedef enum { -+ VBEOPT_NOVBE, -+ VBEOPT_NODDC -+} VBEOpts; -+ -+static const OptionInfoRec VBEOptions[] = { -+ {VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE}, -+ {VBEOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE}, -+ {-1, NULL, OPTV_NONE, {0}, FALSE}, -+}; -+ -+static unsigned char * -+vbeReadEDID(vbeInfoPtr pVbe) -+{ -+ int RealOff = pVbe->real_mode_base; -+ void *page = pVbe->memory; -+ unsigned char *tmp = NULL; -+ Bool novbe = FALSE; -+ Bool noddc = FALSE; -+ ScrnInfoPtr pScrn = pVbe->pInt10->pScrn; -+ int screen = pScrn->scrnIndex; -+ OptionInfoPtr options; -+ -+ if (!page) -+ return NULL; -+ -+ options = xnfalloc(sizeof(VBEOptions)); -+ (void) memcpy(options, VBEOptions, sizeof(VBEOptions)); -+ xf86ProcessOptions(screen, pScrn->options, options); -+ xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); -+ xf86GetOptValBool(options, VBEOPT_NODDC, &noddc); -+ free(options); -+ if (novbe || noddc) -+ return NULL; -+ -+ if (!vbeProbeDDC(pVbe)) -+ goto error; -+ -+ memset(page, 0, sizeof(vbeInfoPtr)); -+ strcpy(page, vbeVersionString); -+ -+ pVbe->pInt10->ax = 0x4F15; -+ pVbe->pInt10->bx = 0x01; -+ pVbe->pInt10->cx = 0; -+ pVbe->pInt10->dx = 0; -+ pVbe->pInt10->es = SEG_ADDR(RealOff); -+ pVbe->pInt10->di = SEG_OFF(RealOff); -+ pVbe->pInt10->num = 0x10; -+ -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if ((pVbe->pInt10->ax & 0xff) != 0x4f) { -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC invalid\n"); -+ goto error; -+ } -+ switch (pVbe->pInt10->ax & 0xff00) { -+ case 0x0: -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC read successfully\n"); -+ tmp = (unsigned char *) xnfalloc(128); -+ memcpy(tmp, page, 128); -+ break; -+ case 0x100: -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC read failed\n"); -+ break; -+ default: -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC unkown failure %i\n", -+ pVbe->pInt10->ax & 0xff00); -+ break; -+ } -+ -+ error: -+ return tmp; -+} -+ -+xf86MonPtr -+vbeDoEDID(vbeInfoPtr pVbe, void *unused) -+{ -+ unsigned char *DDC_data = NULL; -+ -+ if (!pVbe) -+ return NULL; -+ if (pVbe->version < 0x102) -+ return NULL; -+ -+ DDC_data = vbeReadEDID(pVbe); -+ -+ if (!DDC_data) -+ return NULL; -+ -+ return xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data); -+} -+ -+#define GET_UNALIGNED2(x) \ -+ ((*(CARD16*)(x)) | (*(((CARD16*)(x) + 1))) << 16) -+ -+VbeInfoBlock * -+VBEGetVBEInfo(vbeInfoPtr pVbe) -+{ -+ VbeInfoBlock *block = NULL; -+ int i, pStr, pModes; -+ char *str; -+ CARD16 major, *modes; -+ -+ memset(pVbe->memory, 0, sizeof(VbeInfoBlock)); -+ -+ /* -+ Input: -+ AH := 4Fh Super VGA support -+ AL := 00h Return Super VGA information -+ ES:DI := Pointer to buffer -+ -+ Output: -+ AX := status -+ (All other registers are preserved) -+ */ -+ -+ ((char *) pVbe->memory)[0] = 'V'; -+ ((char *) pVbe->memory)[1] = 'B'; -+ ((char *) pVbe->memory)[2] = 'E'; -+ ((char *) pVbe->memory)[3] = '2'; -+ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f00; -+ pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); -+ pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return NULL; -+ -+ block = calloc(sizeof(VbeInfoBlock), 1); -+ block->VESASignature[0] = ((char *) pVbe->memory)[0]; -+ block->VESASignature[1] = ((char *) pVbe->memory)[1]; -+ block->VESASignature[2] = ((char *) pVbe->memory)[2]; -+ block->VESASignature[3] = ((char *) pVbe->memory)[3]; -+ -+ block->VESAVersion = *(CARD16 *) (((char *) pVbe->memory) + 4); -+ major = (unsigned) block->VESAVersion >> 8; -+ -+ pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 6)); -+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); -+ block->OEMStringPtr = strdup(str); -+ -+ block->Capabilities[0] = ((char *) pVbe->memory)[10]; -+ block->Capabilities[1] = ((char *) pVbe->memory)[11]; -+ block->Capabilities[2] = ((char *) pVbe->memory)[12]; -+ block->Capabilities[3] = ((char *) pVbe->memory)[13]; -+ -+ pModes = GET_UNALIGNED2((((char *) pVbe->memory) + 14)); -+ modes = xf86int10Addr(pVbe->pInt10, FARP(pModes)); -+ i = 0; -+ while (modes[i] != 0xffff) -+ i++; -+ block->VideoModePtr = xallocarray(i + 1, sizeof(CARD16)); -+ memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i); -+ block->VideoModePtr[i] = 0xffff; -+ -+ block->TotalMemory = *(CARD16 *) (((char *) pVbe->memory) + 18); -+ -+ if (major < 2) -+ memcpy(&block->OemSoftwareRev, ((char *) pVbe->memory) + 20, 236); -+ else { -+ block->OemSoftwareRev = *(CARD16 *) (((char *) pVbe->memory) + 20); -+ pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 22)); -+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); -+ block->OemVendorNamePtr = strdup(str); -+ pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 26)); -+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); -+ block->OemProductNamePtr = strdup(str); -+ pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 30)); -+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); -+ block->OemProductRevPtr = strdup(str); -+ memcpy(&block->Reserved, ((char *) pVbe->memory) + 34, 222); -+ memcpy(&block->OemData, ((char *) pVbe->memory) + 256, 256); -+ } -+ -+ return block; -+} -+ -+void -+VBEFreeVBEInfo(VbeInfoBlock * block) -+{ -+ free(block->OEMStringPtr); -+ free(block->VideoModePtr); -+ if (((unsigned) block->VESAVersion >> 8) >= 2) { -+ free(block->OemVendorNamePtr); -+ free(block->OemProductNamePtr); -+ free(block->OemProductRevPtr); -+ } -+ free(block); -+} -+ -+Bool -+VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock * block) -+{ -+ /* -+ Input: -+ AH := 4Fh Super VGA support -+ AL := 02h Set Super VGA video mode -+ BX := Video mode -+ D0-D8 := Mode number -+ D9-D10 := Reserved (must be 0) -+ D11 := 0 Use current default refresh rate -+ := 1 Use user specified CRTC values for refresh rate -+ D12-13 Reserved for VBE/AF (must be 0) -+ D14 := 0 Use windowed frame buffer model -+ := 1 Use linear/flat frame buffer model -+ D15 := 0 Clear video memory -+ := 1 Don't clear video memory -+ ES:DI := Pointer to VbeCRTCInfoBlock structure -+ -+ Output: AX = Status -+ (All other registers are preserved) -+ */ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f02; -+ pVbe->pInt10->bx = mode; -+ if (block) { -+ pVbe->pInt10->bx |= 1 << 11; -+ memcpy(pVbe->memory, block, sizeof(VbeCRTCInfoBlock)); -+ pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); -+ pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); -+ } -+ else -+ pVbe->pInt10->bx &= ~(1 << 11); -+ -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ return (R16(pVbe->pInt10->ax) == 0x4f); -+} -+ -+Bool -+VBEGetVBEMode(vbeInfoPtr pVbe, int *mode) -+{ -+ /* -+ Input: -+ AH := 4Fh Super VGA support -+ AL := 03h Return current video mode -+ -+ Output: -+ AX := Status -+ BX := Current video mode -+ (All other registers are preserved) -+ */ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f03; -+ -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if (R16(pVbe->pInt10->ax) == 0x4f) { -+ *mode = R16(pVbe->pInt10->bx); -+ -+ return TRUE; -+ } -+ -+ return FALSE; -+} -+ -+VbeModeInfoBlock * -+VBEGetModeInfo(vbeInfoPtr pVbe, int mode) -+{ -+ VbeModeInfoBlock *block = NULL; -+ -+ memset(pVbe->memory, 0, sizeof(VbeModeInfoBlock)); -+ -+ /* -+ Input: -+ AH := 4Fh Super VGA support -+ AL := 01h Return Super VGA mode information -+ CX := Super VGA video mode -+ (mode number must be one of those returned by Function 0) -+ ES:DI := Pointer to buffer -+ -+ Output: -+ AX := status -+ (All other registers are preserved) -+ */ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f01; -+ pVbe->pInt10->cx = mode; -+ pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); -+ pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); -+ xf86ExecX86int10(pVbe->pInt10); -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return NULL; -+ -+ block = malloc(sizeof(VbeModeInfoBlock)); -+ if (block) -+ memcpy(block, pVbe->memory, sizeof(*block)); -+ -+ return block; -+} -+ -+void -+VBEFreeModeInfo(VbeModeInfoBlock * block) -+{ -+ free(block); -+} -+ -+Bool -+VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, -+ void **memory, int *size, int *real_mode_pages) -+{ -+ /* -+ Input: -+ AH := 4Fh Super VGA support -+ AL := 04h Save/restore Super VGA video state -+ DL := 00h Return save/restore state buffer size -+ CX := Requested states -+ D0 = Save/restore video hardware state -+ D1 = Save/restore video BIOS data state -+ D2 = Save/restore video DAC state -+ D3 = Save/restore Super VGA state -+ -+ Output: -+ AX = Status -+ BX = Number of 64-byte blocks to hold the state buffer -+ (All other registers are preserved) -+ -+ Input: -+ AH := 4Fh Super VGA support -+ AL := 04h Save/restore Super VGA video state -+ DL := 01h Save Super VGA video state -+ CX := Requested states (see above) -+ ES:BX := Pointer to buffer -+ -+ Output: -+ AX := Status -+ (All other registers are preserved) -+ -+ Input: -+ AH := 4Fh Super VGA support -+ AL := 04h Save/restore Super VGA video state -+ DL := 02h Restore Super VGA video state -+ CX := Requested states (see above) -+ ES:BX := Pointer to buffer -+ -+ Output: -+ AX := Status -+ (All other registers are preserved) -+ */ -+ -+ if ((pVbe->version & 0xff00) > 0x100) { -+ int screen = pVbe->pInt10->pScrn->scrnIndex; -+ -+ if (function == MODE_QUERY || (function == MODE_SAVE && !*memory)) { -+ /* Query amount of memory to save state */ -+ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f04; -+ pVbe->pInt10->dx = 0; -+ pVbe->pInt10->cx = 0x000f; -+ xf86ExecX86int10(pVbe->pInt10); -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return FALSE; -+ -+ if (function == MODE_SAVE) { -+ int npages = (R16(pVbe->pInt10->bx) * 64) / 4096 + 1; -+ -+ if ((*memory = xf86Int10AllocPages(pVbe->pInt10, npages, -+ real_mode_pages)) == NULL) { -+ xf86DrvMsg(screen, X_ERROR, -+ "Cannot allocate memory to save SVGA state.\n"); -+ return FALSE; -+ } -+ } -+ *size = pVbe->pInt10->bx * 64; -+ } -+ -+ /* Save/Restore Super VGA state */ -+ if (function != MODE_QUERY) { -+ -+ if (!*memory) -+ return FALSE; -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f04; -+ switch (function) { -+ case MODE_SAVE: -+ pVbe->pInt10->dx = 1; -+ break; -+ case MODE_RESTORE: -+ pVbe->pInt10->dx = 2; -+ break; -+ case MODE_QUERY: -+ return FALSE; -+ } -+ pVbe->pInt10->cx = 0x000f; -+ -+ pVbe->pInt10->es = SEG_ADDR(*real_mode_pages); -+ pVbe->pInt10->bx = SEG_OFF(*real_mode_pages); -+ xf86ExecX86int10(pVbe->pInt10); -+ return (R16(pVbe->pInt10->ax) == 0x4f); -+ -+ } -+ } -+ return TRUE; -+} -+ -+Bool -+VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window) -+{ -+ /* -+ Input: -+ AH := 4Fh Super VGA support -+ AL := 05h -+ -+ Output: -+ */ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f05; -+ pVbe->pInt10->bx = window; -+ pVbe->pInt10->dx = iBank; -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return FALSE; -+ -+ return TRUE; -+} -+ -+Bool -+VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, -+ int width, int *pixels, int *bytes, int *max) -+{ -+ if (command < SCANWID_SET || command > SCANWID_GET_MAX) -+ return FALSE; -+ -+ /* -+ Input: -+ AX := 4F06h VBE Set/Get Logical Scan Line Length -+ BL := 00h Set Scan Line Length in Pixels -+ := 01h Get Scan Line Length -+ := 02h Set Scan Line Length in Bytes -+ := 03h Get Maximum Scan Line Length -+ CX := If BL=00h Desired Width in Pixels -+ If BL=02h Desired Width in Bytes -+ (Ignored for Get Functions) -+ -+ Output: -+ AX := VBE Return Status -+ BX := Bytes Per Scan Line -+ CX := Actual Pixels Per Scan Line -+ (truncated to nearest complete pixel) -+ DX := Maximum Number of Scan Lines -+ */ -+ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f06; -+ pVbe->pInt10->bx = command; -+ if (command == SCANWID_SET || command == SCANWID_SET_BYTES) -+ pVbe->pInt10->cx = width; -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return FALSE; -+ -+ if (command == SCANWID_GET || command == SCANWID_GET_MAX) { -+ if (pixels) -+ *pixels = R16(pVbe->pInt10->cx); -+ if (bytes) -+ *bytes = R16(pVbe->pInt10->bx); -+ if (max) -+ *max = R16(pVbe->pInt10->dx); -+ } -+ -+ return TRUE; -+} -+ -+Bool -+VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace) -+{ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f07; -+ pVbe->pInt10->bx = wait_retrace ? 0x80 : 0x00; -+ pVbe->pInt10->cx = x; -+ pVbe->pInt10->dx = y; -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return FALSE; -+ -+ return TRUE; -+} -+ -+Bool -+VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y) -+{ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f07; -+ pVbe->pInt10->bx = 0x01; -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return FALSE; -+ -+ *x = pVbe->pInt10->cx; -+ *y = pVbe->pInt10->dx; -+ -+ return TRUE; -+} -+ -+int -+VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits) -+{ -+ /* -+ Input: -+ AX := 4F08h VBE Set/Get Palette Format -+ BL := 00h Set DAC Palette Format -+ := 01h Get DAC Palette Format -+ BH := Desired bits of color per primary -+ (Set DAC Palette Format only) -+ -+ Output: -+ AX := VBE Return Status -+ BH := Current number of bits of color per primary -+ */ -+ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f08; -+ if (!bits) -+ pVbe->pInt10->bx = 0x01; -+ else -+ pVbe->pInt10->bx = (bits & 0x00ff) << 8; -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return 0; -+ -+ return (bits != 0 ? bits : (pVbe->pInt10->bx >> 8) & 0x00ff); -+} -+ -+CARD32 * -+VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, -+ CARD32 *data, Bool secondary, Bool wait_retrace) -+{ -+ /* -+ Input: -+ (16-bit) -+ AX := 4F09h VBE Load/Unload Palette Data -+ BL := 00h Set Palette Data -+ := 01h Get Palette Data -+ := 02h Set Secondary Palette Data -+ := 03h Get Secondary Palette Data -+ := 80h Set Palette Data during Vertical Retrace -+ CX := Number of palette registers to update (to a maximum of 256) -+ DX := First of the palette registers to update (start) -+ ES:DI := Table of palette values (see below for format) -+ -+ Output: -+ AX := VBE Return Status -+ -+ Input: -+ (32-bit) -+ BL := 00h Set Palette Data -+ := 80h Set Palette Data during Vertical Retrace -+ CX := Number of palette registers to update (to a maximum of 256) -+ DX := First of the palette registers to update (start) -+ ES:EDI := Table of palette values (see below for format) -+ DS := Selector for memory mapped registers -+ */ -+ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f09; -+ if (!secondary) -+ pVbe->pInt10->bx = set && wait_retrace ? 0x80 : set ? 0 : 1; -+ else -+ pVbe->pInt10->bx = set ? 2 : 3; -+ pVbe->pInt10->cx = num; -+ pVbe->pInt10->dx = first; -+ pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); -+ pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); -+ if (set) -+ memcpy(pVbe->memory, data, num * sizeof(CARD32)); -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return NULL; -+ -+ if (set) -+ return data; -+ -+ data = xallocarray(num, sizeof(CARD32)); -+ memcpy(data, pVbe->memory, num * sizeof(CARD32)); -+ -+ return data; -+} -+ -+VBEpmi * -+VBEGetVBEpmi(vbeInfoPtr pVbe) -+{ -+ VBEpmi *pmi; -+ -+ /* -+ Input: -+ AH := 4Fh Super VGA support -+ AL := 0Ah Protected Mode Interface -+ BL := 00h Return Protected Mode Table -+ -+ Output: -+ AX := Status -+ ES := Real Mode Segment of Table -+ DI := Offset of Table -+ CX := Lenght of Table including protected mode code in bytes (for copying purposes) -+ (All other registers are preserved) -+ */ -+ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f0a; -+ pVbe->pInt10->bx = 0; -+ pVbe->pInt10->di = 0; -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return NULL; -+ -+ pmi = malloc(sizeof(VBEpmi)); -+ pmi->seg_tbl = R16(pVbe->pInt10->es); -+ pmi->tbl_off = R16(pVbe->pInt10->di); -+ pmi->tbl_len = R16(pVbe->pInt10->cx); -+ -+ return pmi; -+} -+ -+#if 0 -+vbeModeInfoPtr -+VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock * vbe) -+{ -+ vbeModeInfoPtr ModeList = NULL; -+ -+ int i = 0; -+ -+ while (vbe->VideoModePtr[i] != 0xffff) { -+ vbeModeInfoPtr m; -+ VbeModeInfoBlock *mode; -+ int id = vbe->VideoModePtr[i++]; -+ int bpp; -+ -+ if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) -+ continue; -+ -+ bpp = mode->BitsPerPixel; -+ -+ m = xnfcalloc(sizeof(vbeModeInfoRec), 1); -+ m->width = mode->XResolution; -+ m->height = mode->YResolution; -+ m->bpp = bpp; -+ m->n = id; -+ m->next = ModeList; -+ -+ xf86DrvMsgVerb(pVbe->pInt10->pScrn->scrnIndex, X_PROBED, 3, -+ "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n", -+ m->n, m->width, m->height, m->bpp); -+ -+ ModeList = m; -+ -+ VBEFreeModeInfo(mode); -+ } -+ return ModeList; -+} -+ -+unsigned short -+VBECalcVbeModeIndex(vbeModeInfoPtr m, DisplayModePtr mode, int bpp) -+{ -+ while (m) { -+ if (bpp == m->bpp -+ && mode->HDisplay == m->width && mode->VDisplay == m->height) -+ return m->n; -+ m = m->next; -+ } -+ return 0; -+} -+#endif -+ -+void -+VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr, -+ vbeSaveRestoreFunction function) -+{ -+ Bool SaveSucc = FALSE; -+ -+ if (VBE_VERSION_MAJOR(pVbe->version) > 1 -+ && (function == MODE_SAVE || vbe_sr->pstate)) { -+ if (function == MODE_RESTORE) -+ memcpy(vbe_sr->state, vbe_sr->pstate, vbe_sr->stateSize); -+ ErrorF("VBESaveRestore\n"); -+ if ((VBESaveRestore(pVbe, function, -+ (void *) &vbe_sr->state, -+ &vbe_sr->stateSize, &vbe_sr->statePage))) { -+ if (function == MODE_SAVE) { -+ SaveSucc = TRUE; -+ vbe_sr->stateMode = -1; /* invalidate */ -+ /* don't rely on the memory not being touched */ -+ if (vbe_sr->pstate == NULL) -+ vbe_sr->pstate = malloc(vbe_sr->stateSize); -+ memcpy(vbe_sr->pstate, vbe_sr->state, vbe_sr->stateSize); -+ } -+ ErrorF("VBESaveRestore done with success\n"); -+ return; -+ } -+ ErrorF("VBESaveRestore done\n"); -+ } -+ -+ if (function == MODE_SAVE && !SaveSucc) -+ (void) VBEGetVBEMode(pVbe, &vbe_sr->stateMode); -+ -+ if (function == MODE_RESTORE && vbe_sr->stateMode != -1) -+ VBESetVBEMode(pVbe, vbe_sr->stateMode, NULL); -+ -+} -+ -+int -+VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int clock) -+{ -+ /* -+ Input: -+ AX := 4F0Bh VBE Get Pixel Clock -+ BL := 00h Get Pixel Clock -+ ECX := pixel clock in units of Hz -+ DX := mode number -+ -+ Output: -+ AX := VBE Return Status -+ ECX := Closest pixel clock -+ */ -+ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f0b; -+ pVbe->pInt10->bx = 0x00; -+ pVbe->pInt10->cx = clock; -+ pVbe->pInt10->dx = mode; -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if (R16(pVbe->pInt10->ax) != 0x4f) -+ return 0; -+ -+ return pVbe->pInt10->cx; -+} -+ -+Bool -+VBEDPMSSet(vbeInfoPtr pVbe, int mode) -+{ -+ /* -+ Input: -+ AX := 4F10h DPMS -+ BL := 01h Set Display Power State -+ BH := requested power state -+ -+ Output: -+ AX := VBE Return Status -+ */ -+ -+ pVbe->pInt10->num = 0x10; -+ pVbe->pInt10->ax = 0x4f10; -+ pVbe->pInt10->bx = 0x01; -+ switch (mode) { -+ case DPMSModeOn: -+ break; -+ case DPMSModeStandby: -+ pVbe->pInt10->bx |= 0x100; -+ break; -+ case DPMSModeSuspend: -+ pVbe->pInt10->bx |= 0x200; -+ break; -+ case DPMSModeOff: -+ pVbe->pInt10->bx |= 0x400; -+ break; -+ } -+ xf86ExecX86int10(pVbe->pInt10); -+ return (R16(pVbe->pInt10->ax) == 0x4f); -+} -+ -+void -+VBEInterpretPanelID(ScrnInfoPtr pScrn, struct vbePanelID *data) -+{ -+ DisplayModePtr mode; -+ const float PANEL_HZ = 60.0; -+ -+ if (!data) -+ return; -+ -+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n", -+ data->hsize, data->vsize); -+ -+ if (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh) -+ return; -+ -+ if (data->hsize < 320 || data->vsize < 240) { -+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "...which I refuse to believe\n"); -+ return; -+ } -+ -+ mode = xf86CVTMode(data->hsize, data->vsize, PANEL_HZ, 1, 0); -+ -+ pScrn->monitor->nHsync = 1; -+ pScrn->monitor->hsync[0].lo = 29.37; -+ pScrn->monitor->hsync[0].hi = (float) mode->Clock / (float) mode->HTotal; -+ pScrn->monitor->nVrefresh = 1; -+ pScrn->monitor->vrefresh[0].lo = 56.0; -+ pScrn->monitor->vrefresh[0].hi = -+ (float) mode->Clock * 1000.0 / (float) mode->HTotal / -+ (float) mode->VTotal; -+ -+ if (pScrn->monitor->vrefresh[0].hi < 59.47) -+ pScrn->monitor->vrefresh[0].hi = 59.47; -+ -+ free(mode); -+} -+ -+struct vbePanelID * -+VBEReadPanelID(vbeInfoPtr pVbe) -+{ -+ int RealOff = pVbe->real_mode_base; -+ void *page = pVbe->memory; -+ void *tmp = NULL; -+ int screen = pVbe->pInt10->pScrn->scrnIndex; -+ -+ pVbe->pInt10->ax = 0x4F11; -+ pVbe->pInt10->bx = 0x01; -+ pVbe->pInt10->cx = 0; -+ pVbe->pInt10->dx = 0; -+ pVbe->pInt10->es = SEG_ADDR(RealOff); -+ pVbe->pInt10->di = SEG_OFF(RealOff); -+ pVbe->pInt10->num = 0x10; -+ -+ xf86ExecX86int10(pVbe->pInt10); -+ -+ if ((pVbe->pInt10->ax & 0xff) != 0x4f) { -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE PanelID invalid\n"); -+ goto error; -+ } -+ -+ switch (pVbe->pInt10->ax & 0xff00) { -+ case 0x0: -+ xf86DrvMsgVerb(screen, X_INFO, 3, -+ "VESA VBE PanelID read successfully\n"); -+ tmp = xnfalloc(32); -+ memcpy(tmp, page, 32); -+ break; -+ case 0x100: -+ xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE PanelID read failed\n"); -+ break; -+ default: -+ xf86DrvMsgVerb(screen, X_INFO, 3, -+ "VESA VBE PanelID unknown failure %i\n", -+ pVbe->pInt10->ax & 0xff00); -+ break; -+ } -+ -+ error: -+ return tmp; -+} -diff --git a/hw/xfree86/int10/vbe.h b/hw/xfree86/int10/vbe.h -new file mode 100644 -index 0000000..c8fb4e4 ---- /dev/null -+++ b/hw/xfree86/int10/vbe.h -@@ -0,0 +1,357 @@ -+ -+/* -+ * XFree86 vbe module -+ * Copyright 2000 Egbert Eich -+ * -+ * The mode query/save/set/restore functions from the vesa driver -+ * have been moved here. -+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) -+ * Authors: Paulo César Pereira de Andrade -+ */ -+ -+#ifndef _VBE_H -+#define _VBE_H -+#include "xf86int10.h" -+#include "xf86DDC.h" -+ -+typedef enum { -+ DDC_UNCHECKED, -+ DDC_NONE, -+ DDC_1, -+ DDC_2, -+ DDC_1_2 -+} ddc_lvl; -+ -+typedef struct { -+ xf86Int10InfoPtr pInt10; -+ int version; -+ void *memory; -+ int real_mode_base; -+ int num_pages; -+ Bool init_int10; -+ ddc_lvl ddc; -+ Bool ddc_blank; -+} vbeInfoRec, *vbeInfoPtr; -+ -+#define VBE_VERSION_MAJOR(x) *((CARD8*)(&x) + 1) -+#define VBE_VERSION_MINOR(x) (CARD8)(x) -+ -+extern _X_EXPORT vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex); -+extern _X_EXPORT vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt, -+ int entityIndex, int Flags); -+extern _X_EXPORT void vbeFree(vbeInfoPtr pVbe); -+extern _X_EXPORT xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, void *pDDCModule); -+ -+#pragma pack(1) -+ -+typedef struct vbeControllerInfoBlock { -+ CARD8 VbeSignature[4]; -+ CARD16 VbeVersion; -+ CARD32 OemStringPtr; -+ CARD8 Capabilities[4]; -+ CARD32 VideoModePtr; -+ CARD16 TotalMem; -+ CARD16 OemSoftwareRev; -+ CARD32 OemVendorNamePtr; -+ CARD32 OemProductNamePtr; -+ CARD32 OemProductRevPtr; -+ CARD8 Scratch[222]; -+ CARD8 OemData[256]; -+} vbeControllerInfoRec, *vbeControllerInfoPtr; -+ -+#if defined(__GNUC__) || defined(__USLC__) || defined(__SUNPRO_C) -+#pragma pack() /* All GCC versions recognise this syntax */ -+#else -+#pragma pack(0) -+#endif -+ -+#if !( defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) ) -+#define __attribute__(a) -+#endif -+ -+typedef struct _VbeInfoBlock VbeInfoBlock; -+typedef struct _VbeModeInfoBlock VbeModeInfoBlock; -+typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock; -+ -+/* -+ * INT 0 -+ */ -+ -+struct _VbeInfoBlock { -+ /* VESA 1.2 fields */ -+ CARD8 VESASignature[4]; /* VESA */ -+ CARD16 VESAVersion; /* Higher byte major, lower byte minor */ -+ /*CARD32 */ char *OEMStringPtr; -+ /* Pointer to OEM string */ -+ CARD8 Capabilities[4]; /* Capabilities of the video environment */ -+ -+ /*CARD32 */ CARD16 *VideoModePtr; -+ /* pointer to supported Super VGA modes */ -+ -+ CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ -+ /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */ -+ -+ /* VESA 2 fields */ -+ CARD16 OemSoftwareRev; /* VBE implementation Software revision */ -+ /*CARD32 */ char *OemVendorNamePtr; -+ /* Pointer to Vendor Name String */ -+ /*CARD32 */ char *OemProductNamePtr; -+ /* Pointer to Product Name String */ -+ /*CARD32 */ char *OemProductRevPtr; -+ /* Pointer to Product Revision String */ -+ CARD8 Reserved[222]; /* Reserved for VBE implementation */ -+ CARD8 OemData[256]; /* Data Area for OEM Strings */ -+} __attribute__ ((packed)); -+ -+/* Return Super VGA Information */ -+extern _X_EXPORT VbeInfoBlock *VBEGetVBEInfo(vbeInfoPtr pVbe); -+extern _X_EXPORT void VBEFreeVBEInfo(VbeInfoBlock * block); -+ -+/* -+ * INT 1 -+ */ -+ -+struct _VbeModeInfoBlock { -+ CARD16 ModeAttributes; /* mode attributes */ -+ CARD8 WinAAttributes; /* window A attributes */ -+ CARD8 WinBAttributes; /* window B attributes */ -+ CARD16 WinGranularity; /* window granularity */ -+ CARD16 WinSize; /* window size */ -+ CARD16 WinASegment; /* window A start segment */ -+ CARD16 WinBSegment; /* window B start segment */ -+ CARD32 WinFuncPtr; /* real mode pointer to window function */ -+ CARD16 BytesPerScanline; /* bytes per scanline */ -+ -+ /* Mandatory information for VBE 1.2 and above */ -+ CARD16 XResolution; /* horizontal resolution in pixels or characters */ -+ CARD16 YResolution; /* vertical resolution in pixels or characters */ -+ CARD8 XCharSize; /* character cell width in pixels */ -+ CARD8 YCharSize; /* character cell height in pixels */ -+ CARD8 NumberOfPlanes; /* number of memory planes */ -+ CARD8 BitsPerPixel; /* bits per pixel */ -+ CARD8 NumberOfBanks; /* number of banks */ -+ CARD8 MemoryModel; /* memory model type */ -+ CARD8 BankSize; /* bank size in KB */ -+ CARD8 NumberOfImages; /* number of images */ -+ CARD8 Reserved; /* 1 *//* reserved for page function */ -+ -+ /* Direct color fields (required for direct/6 and YUV/7 memory models) */ -+ CARD8 RedMaskSize; /* size of direct color red mask in bits */ -+ CARD8 RedFieldPosition; /* bit position of lsb of red mask */ -+ CARD8 GreenMaskSize; /* size of direct color green mask in bits */ -+ CARD8 GreenFieldPosition; /* bit position of lsb of green mask */ -+ CARD8 BlueMaskSize; /* size of direct color blue mask in bits */ -+ CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */ -+ CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */ -+ CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */ -+ CARD8 DirectColorModeInfo; /* direct color mode attributes */ -+ -+ /* Mandatory information for VBE 2.0 and above */ -+ CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */ -+ CARD32 Reserved32; /* 0 *//* Reserved - always set to 0 */ -+ CARD16 Reserved16; /* 0 *//* Reserved - always set to 0 */ -+ -+ /* Mandatory information for VBE 3.0 and above */ -+ CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */ -+ CARD8 BnkNumberOfImagePages; /* number of images for banked modes */ -+ CARD8 LinNumberOfImagePages; /* number of images for linear modes */ -+ CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */ -+ CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ -+ CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */ -+ CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */ -+ CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ -+ CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */ -+ CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ -+ CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */ -+ CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ -+ CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */ -+} __attribute__ ((packed)); -+ -+/* Return VBE Mode Information */ -+extern _X_EXPORT VbeModeInfoBlock *VBEGetModeInfo(vbeInfoPtr pVbe, int mode); -+extern _X_EXPORT void VBEFreeModeInfo(VbeModeInfoBlock * block); -+ -+/* -+ * INT2 -+ */ -+ -+#define CRTC_DBLSCAN (1<<0) -+#define CRTC_INTERLACE (1<<1) -+#define CRTC_NHSYNC (1<<2) -+#define CRTC_NVSYNC (1<<3) -+ -+struct _VbeCRTCInfoBlock { -+ CARD16 HorizontalTotal; /* Horizontal total in pixels */ -+ CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ -+ CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ -+ CARD16 VerticalTotal; /* Vertical total in lines */ -+ CARD16 VerticalSyncStart; /* Vertical sync start in lines */ -+ CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ -+ CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ -+ CARD32 PixelClock; /* Pixel clock in units of Hz */ -+ CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ -+ CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ -+} __attribute__ ((packed)); -+ -+/* VbeCRTCInfoBlock is in the VESA 3.0 specs */ -+ -+extern _X_EXPORT Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode, -+ VbeCRTCInfoBlock * crtc); -+ -+/* -+ * INT 3 -+ */ -+ -+extern _X_EXPORT Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode); -+ -+/* -+ * INT 4 -+ */ -+ -+/* Save/Restore Super VGA video state */ -+/* function values are (values stored in VESAPtr): -+ * 0 := query & allocate amount of memory to save state -+ * 1 := save state -+ * 2 := restore state -+ * -+ * function 0 called automatically if function 1 called without -+ * a previous call to function 0. -+ */ -+ -+typedef enum { -+ MODE_QUERY, -+ MODE_SAVE, -+ MODE_RESTORE -+} vbeSaveRestoreFunction; -+ -+extern _X_EXPORT Bool -+ -+VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction, -+ void **memory, int *size, int *real_mode_pages); -+ -+/* -+ * INT 5 -+ */ -+ -+extern _X_EXPORT Bool -+ VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window); -+ -+/* -+ * INT 6 -+ */ -+ -+typedef enum { -+ SCANWID_SET, -+ SCANWID_GET, -+ SCANWID_SET_BYTES, -+ SCANWID_GET_MAX -+} vbeScanwidthCommand; -+ -+#define VBESetLogicalScanline(pVbe, width) \ -+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET, width, \ -+ NULL, NULL, NULL) -+#define VBESetLogicalScanlineBytes(pVbe, width) \ -+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET_BYTES, width, \ -+ NULL, NULL, NULL) -+#define VBEGetLogicalScanline(pVbe, pixels, bytes, max) \ -+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET, 0, \ -+ pixels, bytes, max) -+#define VBEGetMaxLogicalScanline(pVbe, pixels, bytes, max) \ -+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET_MAX, 0, \ -+ pixels, bytes, max) -+extern _X_EXPORT Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, -+ vbeScanwidthCommand -+ command, int width, -+ int *pixels, int *bytes, -+ int *max); -+ -+/* -+ * INT 7 -+ */ -+ -+/* 16 bit code */ -+extern _X_EXPORT Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, -+ Bool wait_retrace); -+extern _X_EXPORT Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y); -+ -+/* -+ * INT 8 -+ */ -+ -+/* if bits is 0, then it is a GET */ -+extern _X_EXPORT int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits); -+ -+/* -+ * INT 9 -+ */ -+ -+/* -+ * If getting a palette, the data argument is not used. It will return -+ * the data. -+ * If setting a palette, it will return the pointer received on success, -+ * NULL on failure. -+ */ -+extern _X_EXPORT CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, -+ int first, int num, CARD32 *data, -+ Bool secondary, -+ Bool wait_retrace); -+#define VBEFreePaletteData(data) free(data) -+ -+/* -+ * INT A -+ */ -+ -+typedef struct _VBEpmi { -+ int seg_tbl; -+ int tbl_off; -+ int tbl_len; -+} VBEpmi; -+ -+extern _X_EXPORT VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe); -+ -+#define VESAFreeVBEpmi(pmi) free(pmi) -+ -+/* high level helper functions */ -+ -+typedef struct _vbeModeInfoRec { -+ int width; -+ int height; -+ int bpp; -+ int n; -+ struct _vbeModeInfoRec *next; -+} vbeModeInfoRec, *vbeModeInfoPtr; -+ -+typedef struct { -+ CARD8 *state; -+ CARD8 *pstate; -+ int statePage; -+ int stateSize; -+ int stateMode; -+} vbeSaveRestoreRec, *vbeSaveRestorePtr; -+ -+extern _X_EXPORT void -+ -+VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr, -+ vbeSaveRestoreFunction function); -+ -+extern _X_EXPORT int VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int Clock); -+extern _X_EXPORT Bool VBEDPMSSet(vbeInfoPtr pVbe, int mode); -+ -+struct vbePanelID { -+ short hsize; -+ short vsize; -+ short fptype; -+ char redbpp; -+ char greenbpp; -+ char bluebpp; -+ char reservedbpp; -+ int reserved_offscreen_mem_size; -+ int reserved_offscreen_mem_pointer; -+ char reserved[14]; -+}; -+ -+extern _X_EXPORT void VBEInterpretPanelID(ScrnInfoPtr pScrn, -+ struct vbePanelID *data); -+extern _X_EXPORT struct vbePanelID *VBEReadPanelID(vbeInfoPtr pVbe); -+ -+#endif -diff --git a/hw/xfree86/int10/vbeModes.c b/hw/xfree86/int10/vbeModes.c -new file mode 100644 -index 0000000..50ac50d ---- /dev/null -+++ b/hw/xfree86/int10/vbeModes.c -@@ -0,0 +1,453 @@ -+#define DEBUG_VERB 2 -+/* -+ * Copyright © 2002 David Dawes -+ * -+ * 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 AUTHOR(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 of the author(s) 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 author(s). -+ * -+ * Authors: David Dawes -+ * -+ */ -+ -+#ifdef HAVE_XORG_CONFIG_H -+#include -+#endif -+ -+#include -+#include -+ -+#include "xf86.h" -+#include "vbe.h" -+#include "vbeModes.h" -+ -+static int -+GetDepthFlag(vbeInfoPtr pVbe, int id) -+{ -+ VbeModeInfoBlock *mode; -+ int bpp; -+ -+ if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) -+ return 0; -+ -+ if (VBE_MODE_USABLE(mode, 0)) { -+ int depth; -+ -+ if (VBE_MODE_COLOR(mode)) { -+ depth = mode->RedMaskSize + mode->GreenMaskSize + -+ mode->BlueMaskSize; -+ } -+ else { -+ depth = 1; -+ } -+ bpp = mode->BitsPerPixel; -+ VBEFreeModeInfo(mode); -+ mode = NULL; -+ switch (depth) { -+ case 1: -+ return V_DEPTH_1; -+ case 4: -+ return V_DEPTH_4; -+ case 8: -+ return V_DEPTH_8; -+ case 15: -+ return V_DEPTH_15; -+ case 16: -+ return V_DEPTH_16; -+ case 24: -+ switch (bpp) { -+ case 24: -+ return V_DEPTH_24_24; -+ case 32: -+ return V_DEPTH_24_32; -+ } -+ } -+ } -+ if (mode) -+ VBEFreeModeInfo(mode); -+ return 0; -+} -+ -+/* -+ * Find supported mode depths. -+ */ -+int -+VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock * vbe, int *flags24, -+ int modeTypes) -+{ -+ int i = 0; -+ int depths = 0; -+ -+ if (modeTypes & V_MODETYPE_VBE) { -+ while (vbe->VideoModePtr[i] != 0xffff) { -+ depths |= GetDepthFlag(pVbe, vbe->VideoModePtr[i++]); -+ } -+ } -+ -+ /* -+ * XXX This possibly only works with VBE 3.0 and later. -+ */ -+ if (modeTypes & V_MODETYPE_VGA) { -+ for (i = 0; i < 0x7F; i++) { -+ depths |= GetDepthFlag(pVbe, i); -+ } -+ } -+ -+ if (flags24) { -+ if (depths & V_DEPTH_24_24) -+ *flags24 |= Support24bppFb; -+ if (depths & V_DEPTH_24_32) -+ *flags24 |= Support32bppFb; -+ } -+ -+ return depths; -+} -+ -+static DisplayModePtr -+CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe, int id, -+ int flags) -+{ -+ CARD16 major; -+ VbeModeInfoBlock *mode; -+ DisplayModePtr pMode; -+ VbeModeInfoData *data; -+ Bool modeOK = FALSE; -+ -+ major = (unsigned) (vbe->VESAVersion >> 8); -+ -+ if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) -+ return NULL; -+ -+ /* Does the mode match the depth/bpp? */ -+ /* Some BIOS's set BitsPerPixel to 15 instead of 16 for 15/16 */ -+ if (VBE_MODE_USABLE(mode, flags) && -+ ((pScrn->bitsPerPixel == 1 && !VBE_MODE_COLOR(mode)) || -+ (mode->BitsPerPixel > 8 && -+ (mode->RedMaskSize + mode->GreenMaskSize + -+ mode->BlueMaskSize) == pScrn->depth && -+ mode->BitsPerPixel == pScrn->bitsPerPixel) || -+ (mode->BitsPerPixel == 15 && pScrn->depth == 15) || -+ (mode->BitsPerPixel <= 8 && -+ mode->BitsPerPixel == pScrn->bitsPerPixel))) { -+ modeOK = TRUE; -+ xf86ErrorFVerb(DEBUG_VERB, "*"); -+ } -+ -+ xf86ErrorFVerb(DEBUG_VERB, -+ "Mode: %x (%dx%d)\n", id, mode->XResolution, -+ mode->YResolution); -+ xf86ErrorFVerb(DEBUG_VERB, " ModeAttributes: 0x%x\n", -+ mode->ModeAttributes); -+ xf86ErrorFVerb(DEBUG_VERB, " WinAAttributes: 0x%x\n", -+ mode->WinAAttributes); -+ xf86ErrorFVerb(DEBUG_VERB, " WinBAttributes: 0x%x\n", -+ mode->WinBAttributes); -+ xf86ErrorFVerb(DEBUG_VERB, " WinGranularity: %d\n", -+ mode->WinGranularity); -+ xf86ErrorFVerb(DEBUG_VERB, " WinSize: %d\n", mode->WinSize); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " WinASegment: 0x%x\n", mode->WinASegment); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " WinBSegment: 0x%x\n", mode->WinBSegment); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " WinFuncPtr: 0x%lx\n", (unsigned long) mode->WinFuncPtr); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " BytesPerScanline: %d\n", mode->BytesPerScanline); -+ xf86ErrorFVerb(DEBUG_VERB, " XResolution: %d\n", mode->XResolution); -+ xf86ErrorFVerb(DEBUG_VERB, " YResolution: %d\n", mode->YResolution); -+ xf86ErrorFVerb(DEBUG_VERB, " XCharSize: %d\n", mode->XCharSize); -+ xf86ErrorFVerb(DEBUG_VERB, " YCharSize: %d\n", mode->YCharSize); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " NumberOfPlanes: %d\n", mode->NumberOfPlanes); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " BitsPerPixel: %d\n", mode->BitsPerPixel); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " NumberOfBanks: %d\n", mode->NumberOfBanks); -+ xf86ErrorFVerb(DEBUG_VERB, " MemoryModel: %d\n", mode->MemoryModel); -+ xf86ErrorFVerb(DEBUG_VERB, " BankSize: %d\n", mode->BankSize); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " NumberOfImages: %d\n", mode->NumberOfImages); -+ xf86ErrorFVerb(DEBUG_VERB, " RedMaskSize: %d\n", mode->RedMaskSize); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " RedFieldPosition: %d\n", mode->RedFieldPosition); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " GreenMaskSize: %d\n", mode->GreenMaskSize); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " GreenFieldPosition: %d\n", mode->GreenFieldPosition); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " BlueMaskSize: %d\n", mode->BlueMaskSize); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " BlueFieldPosition: %d\n", mode->BlueFieldPosition); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " RsvdMaskSize: %d\n", mode->RsvdMaskSize); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition); -+ xf86ErrorFVerb(DEBUG_VERB, -+ " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo); -+ if (major >= 2) { -+ xf86ErrorFVerb(DEBUG_VERB, -+ " PhysBasePtr: 0x%lx\n", -+ (unsigned long) mode->PhysBasePtr); -+ if (major >= 3) { -+ xf86ErrorFVerb(DEBUG_VERB, -+ " LinBytesPerScanLine: %d\n", -+ mode->LinBytesPerScanLine); -+ xf86ErrorFVerb(DEBUG_VERB, " BnkNumberOfImagePages: %d\n", -+ mode->BnkNumberOfImagePages); -+ xf86ErrorFVerb(DEBUG_VERB, " LinNumberOfImagePages: %d\n", -+ mode->LinNumberOfImagePages); -+ xf86ErrorFVerb(DEBUG_VERB, " LinRedMaskSize: %d\n", -+ mode->LinRedMaskSize); -+ xf86ErrorFVerb(DEBUG_VERB, " LinRedFieldPosition: %d\n", -+ mode->LinRedFieldPosition); -+ xf86ErrorFVerb(DEBUG_VERB, " LinGreenMaskSize: %d\n", -+ mode->LinGreenMaskSize); -+ xf86ErrorFVerb(DEBUG_VERB, " LinGreenFieldPosition: %d\n", -+ mode->LinGreenFieldPosition); -+ xf86ErrorFVerb(DEBUG_VERB, " LinBlueMaskSize: %d\n", -+ mode->LinBlueMaskSize); -+ xf86ErrorFVerb(DEBUG_VERB, " LinBlueFieldPosition: %d\n", -+ mode->LinBlueFieldPosition); -+ xf86ErrorFVerb(DEBUG_VERB, " LinRsvdMaskSize: %d\n", -+ mode->LinRsvdMaskSize); -+ xf86ErrorFVerb(DEBUG_VERB, " LinRsvdFieldPosition: %d\n", -+ mode->LinRsvdFieldPosition); -+ xf86ErrorFVerb(DEBUG_VERB, " MaxPixelClock: %ld\n", -+ (unsigned long) mode->MaxPixelClock); -+ } -+ } -+ -+ if (!modeOK) { -+ VBEFreeModeInfo(mode); -+ return NULL; -+ } -+ pMode = xnfcalloc(sizeof(DisplayModeRec), 1); -+ -+ pMode->status = MODE_OK; -+ pMode->type = M_T_BUILTIN; -+ -+ /* for adjust frame */ -+ pMode->HDisplay = mode->XResolution; -+ pMode->VDisplay = mode->YResolution; -+ -+ data = xnfcalloc(sizeof(VbeModeInfoData), 1); -+ data->mode = id; -+ data->data = mode; -+ pMode->PrivSize = sizeof(VbeModeInfoData); -+ pMode->Private = (INT32 *) data; -+ pMode->next = NULL; -+ return pMode; -+} -+ -+/* -+ * Check the available BIOS modes, and extract those that match the -+ * requirements into the modePool. Note: modePool is a NULL-terminated -+ * list. -+ */ -+ -+DisplayModePtr -+VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe, -+ int modeTypes) -+{ -+ DisplayModePtr pMode, p = NULL, modePool = NULL; -+ int i = 0; -+ -+ if (modeTypes & V_MODETYPE_VBE) { -+ while (vbe->VideoModePtr[i] != 0xffff) { -+ int id = vbe->VideoModePtr[i++]; -+ -+ if ((pMode = CheckMode(pScrn, pVbe, vbe, id, modeTypes)) != NULL) { -+ ModeStatus status = MODE_OK; -+ -+ /* Check the mode against a specified virtual size (if any) */ -+ if (pScrn->display->virtualX > 0 && -+ pMode->HDisplay > pScrn->display->virtualX) { -+ status = MODE_VIRTUAL_X; -+ } -+ if (pScrn->display->virtualY > 0 && -+ pMode->VDisplay > pScrn->display->virtualY) { -+ status = MODE_VIRTUAL_Y; -+ } -+ if (status != MODE_OK) { -+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, -+ "Not using mode \"%dx%d\" (%s)\n", -+ pMode->HDisplay, pMode->VDisplay, -+ xf86ModeStatusToString(status)); -+ } -+ else { -+ if (p == NULL) { -+ modePool = pMode; -+ } -+ else { -+ p->next = pMode; -+ } -+ pMode->prev = NULL; -+ p = pMode; -+ } -+ } -+ } -+ } -+ if (modeTypes & V_MODETYPE_VGA) { -+ for (i = 0; i < 0x7F; i++) { -+ if ((pMode = CheckMode(pScrn, pVbe, vbe, i, modeTypes)) != NULL) { -+ ModeStatus status = MODE_OK; -+ -+ /* Check the mode against a specified virtual size (if any) */ -+ if (pScrn->display->virtualX > 0 && -+ pMode->HDisplay > pScrn->display->virtualX) { -+ status = MODE_VIRTUAL_X; -+ } -+ if (pScrn->display->virtualY > 0 && -+ pMode->VDisplay > pScrn->display->virtualY) { -+ status = MODE_VIRTUAL_Y; -+ } -+ if (status != MODE_OK) { -+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, -+ "Not using mode \"%dx%d\" (%s)\n", -+ pMode->HDisplay, pMode->VDisplay, -+ xf86ModeStatusToString(status)); -+ } -+ else { -+ if (p == NULL) { -+ modePool = pMode; -+ } -+ else { -+ p->next = pMode; -+ } -+ pMode->prev = NULL; -+ p = pMode; -+ } -+ } -+ } -+ } -+ return modePool; -+} -+ -+void -+VBESetModeNames(DisplayModePtr pMode) -+{ -+ if (!pMode) -+ return; -+ -+ do { -+ if (!pMode->name) { -+ /* Catch "bad" modes. */ -+ if (pMode->HDisplay > 10000 || pMode->HDisplay < 0 || -+ pMode->VDisplay > 10000 || pMode->VDisplay < 0) { -+ pMode->name = strdup("BADMODE"); -+ } -+ else { -+ char *tmp; -+ XNFasprintf(&tmp, "%dx%d", -+ pMode->HDisplay, pMode->VDisplay); -+ pMode->name = tmp; -+ } -+ } -+ pMode = pMode->next; -+ } while (pMode); -+} -+ -+/* -+ * Go through the monitor modes and selecting the best set of -+ * parameters for each BIOS mode. Note: This is only supported in -+ * VBE version 3.0 or later. -+ */ -+void -+VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe) -+{ -+ DisplayModePtr pMode; -+ VbeModeInfoData *data; -+ -+ pMode = pScrn->modes; -+ do { -+ DisplayModePtr p, best = NULL; -+ ModeStatus status; -+ -+ for (p = pScrn->monitor->Modes; p != NULL; p = p->next) { -+ if ((p->HDisplay != pMode->HDisplay) || -+ (p->VDisplay != pMode->VDisplay) || -+ (p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) -+ continue; -+ /* XXX could support the various V_ flags */ -+ status = xf86CheckModeForMonitor(p, pScrn->monitor); -+ if (status != MODE_OK) -+ continue; -+ if (!best || (p->Clock > best->Clock)) -+ best = p; -+ } -+ -+ if (best) { -+ int clock; -+ -+ data = (VbeModeInfoData *) pMode->Private; -+ pMode->HSync = (float) best->Clock * 1000.0 / best->HTotal + 0.5; -+ pMode->VRefresh = pMode->HSync / best->VTotal + 0.5; -+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, -+ "Attempting to use %dHz refresh for mode \"%s\" (%x)\n", -+ (int) pMode->VRefresh, pMode->name, data->mode); -+ data->block = calloc(sizeof(VbeCRTCInfoBlock), 1); -+ data->block->HorizontalTotal = best->HTotal; -+ data->block->HorizontalSyncStart = best->HSyncStart; -+ data->block->HorizontalSyncEnd = best->HSyncEnd; -+ data->block->VerticalTotal = best->VTotal; -+ data->block->VerticalSyncStart = best->VSyncStart; -+ data->block->VerticalSyncEnd = best->VSyncEnd; -+ data->block->Flags = ((best->Flags & V_NHSYNC) ? CRTC_NHSYNC : 0) | -+ ((best->Flags & V_NVSYNC) ? CRTC_NVSYNC : 0); -+ data->block->PixelClock = best->Clock * 1000; -+ /* XXX May not have this. */ -+ clock = VBEGetPixelClock(pVbe, data->mode, data->block->PixelClock); -+ DebugF("Setting clock %.2fMHz, closest is %.2fMHz\n", -+ (double) data->block->PixelClock / 1000000.0, -+ (double) clock / 1000000.0); -+ if (clock) -+ data->block->PixelClock = clock; -+ data->mode |= (1 << 11); -+ data->block->RefreshRate = ((double) (data->block->PixelClock) / -+ (double) (best->HTotal * -+ best->VTotal)) * 100; -+ } -+ pMode = pMode->next; -+ } while (pMode != pScrn->modes); -+} -+ -+/* -+ * These wrappers are to allow (temporary) funtionality divergences. -+ */ -+int -+VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, -+ const char **modeNames, ClockRangePtr clockRanges, -+ int *linePitches, int minPitch, int maxPitch, int pitchInc, -+ int minHeight, int maxHeight, int virtualX, int virtualY, -+ int apertureSize, LookupModeFlags strategy) -+{ -+ return xf86ValidateModes(scrp, availModes, modeNames, clockRanges, -+ linePitches, minPitch, maxPitch, pitchInc, -+ minHeight, maxHeight, virtualX, virtualY, -+ apertureSize, strategy); -+} -+ -+void -+VBEPrintModes(ScrnInfoPtr scrp) -+{ -+ xf86PrintModes(scrp); -+} -diff --git a/hw/xfree86/int10/vbeModes.h b/hw/xfree86/int10/vbeModes.h -new file mode 100644 -index 0000000..ee0257c ---- /dev/null -+++ b/hw/xfree86/int10/vbeModes.h -@@ -0,0 +1,94 @@ -+/* -+ * Copyright © 2002 David Dawes -+ * -+ * 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 AUTHOR(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 of the author(s) 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 author(s). -+ * -+ * Authors: David Dawes -+ * -+ */ -+ -+#ifndef _VBE_MODES_H -+ -+/* -+ * This is intended to be stored in the DisplayModeRec's private area. -+ * It includes all the information necessary to VBE information. -+ */ -+typedef struct _VbeModeInfoData { -+ int mode; -+ VbeModeInfoBlock *data; -+ VbeCRTCInfoBlock *block; -+} VbeModeInfoData; -+ -+#define V_DEPTH_1 0x001 -+#define V_DEPTH_4 0x002 -+#define V_DEPTH_8 0x004 -+#define V_DEPTH_15 0x008 -+#define V_DEPTH_16 0x010 -+#define V_DEPTH_24_24 0x020 -+#define V_DEPTH_24_32 0x040 -+#define V_DEPTH_24 (V_DEPTH_24_24 | V_DEPTH_24_32) -+#define V_DEPTH_30 0x080 -+#define V_DEPTH_32 0x100 -+ -+#define VBE_MODE_SUPPORTED(m) (((m)->ModeAttributes & 0x01) != 0) -+#define VBE_MODE_COLOR(m) (((m)->ModeAttributes & 0x08) != 0) -+#define VBE_MODE_GRAPHICS(m) (((m)->ModeAttributes & 0x10) != 0) -+#define VBE_MODE_VGA(m) (((m)->ModeAttributes & 0x40) == 0) -+#define VBE_MODE_LINEAR(m) (((m)->ModeAttributes & 0x80) != 0 && \ -+ ((m)->PhysBasePtr != 0)) -+ -+#define VBE_MODE_USABLE(m, f) (VBE_MODE_SUPPORTED(m) || \ -+ (f & V_MODETYPE_BAD)) && \ -+ VBE_MODE_GRAPHICS(m) && \ -+ (VBE_MODE_VGA(m) || VBE_MODE_LINEAR(m)) -+ -+#define V_MODETYPE_VBE 0x01 -+#define V_MODETYPE_VGA 0x02 -+#define V_MODETYPE_BAD 0x04 -+ -+extern _X_EXPORT int VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock * vbe, -+ int *flags24, int modeTypes); -+extern _X_EXPORT DisplayModePtr VBEGetModePool(ScrnInfoPtr pScrn, -+ vbeInfoPtr pVbe, -+ VbeInfoBlock * vbe, -+ int modeTypes); -+extern _X_EXPORT void VBESetModeNames(DisplayModePtr pMode); -+extern _X_EXPORT void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe); -+ -+/* -+ * Note: These are alternatives to the standard helpers. They should -+ * usually just wrap the standard helpers. -+ */ -+extern _X_EXPORT int VBEValidateModes(ScrnInfoPtr scrp, -+ DisplayModePtr availModes, -+ const char **modeNames, -+ ClockRangePtr clockRanges, -+ int *linePitches, int minPitch, -+ int maxPitch, int pitchInc, int minHeight, -+ int maxHeight, int virtualX, int virtualY, -+ int apertureSize, -+ LookupModeFlags strategy); -+extern _X_EXPORT void VBEPrintModes(ScrnInfoPtr scrp); -+ -+#endif /* VBE_MODES_H */ -diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c -index f0983b2..a93a76a 100644 ---- a/hw/xfree86/loader/loadmod.c -+++ b/hw/xfree86/loader/loadmod.c -@@ -697,6 +697,10 @@ LoadModule(const char *module, void *options, const XF86ModReqInfo *modreq, - m = (char *) module; - } - -+ /* Backward compatibility, vbe and int10 are merged into int10 now */ -+ if (!strcmp(m, "vbe")) -+ m = name = "int10"; -+ - for (cim = compiled_in_modules; *cim; cim++) - if (!strcmp(m, *cim)) { - LogMessageVerb(X_INFO, 3, "Module \"%s\" already built-in\n", m); -diff --git a/hw/xfree86/meson.build b/hw/xfree86/meson.build -index c80964e..c5847c6 100644 ---- a/hw/xfree86/meson.build -+++ b/hw/xfree86/meson.build -@@ -10,7 +10,6 @@ xorg_inc = include_directories( - 'os-support/bus', - 'parser', - 'ramdac', -- 'vbe', - 'vgahw', - ) - -@@ -126,9 +125,6 @@ if int10 != 'false' - subdir('int10') - endif - subdir('shadowfb') --if build_vbe -- subdir('vbe') --endif - if build_vgahw - subdir('vgahw') - endif -diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh -index 2ebc4c0..ad95646 100755 ---- a/hw/xfree86/sdksyms.sh -+++ b/hw/xfree86/sdksyms.sh -@@ -71,6 +71,8 @@ cat > sdksyms.c << EOF - /* hw/xfree86/int10/Makefile.am -- module */ - /* - #include "xf86int10.h" -+#include "vbe.h" -+#include "vbeModes.h" - */ - - -@@ -185,13 +187,6 @@ cat > sdksyms.c << EOF - #include "xf86Optrec.h" - - --/* hw/xfree86/vbe/Makefile.am -- module */ --/* --#include "vbe.h" --#include "vbeModes.h" -- */ -- -- - /* hw/xfree86/dri/Makefile.am -- module */ - #ifdef XF86DRI - # include "dri.h" -diff --git a/hw/xfree86/vbe/Makefile.am b/hw/xfree86/vbe/Makefile.am -deleted file mode 100644 -index 041b47a..0000000 ---- a/hw/xfree86/vbe/Makefile.am -+++ /dev/null -@@ -1,14 +0,0 @@ --module_LTLIBRARIES = libvbe.la --libvbe_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) --libvbe_la_SOURCES = vbe.c vbeModes.c vbe_module.c --if NO_UNDEFINED --libvbe_la_LIBADD = ../int10/libint10.la --endif -- --sdk_HEADERS = vbe.h vbeModes.h -- --AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) -- --AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -- -I$(srcdir)/../modes -I$(srcdir)/../parser \ -- -I$(srcdir)/../int10 -diff --git a/hw/xfree86/vbe/meson.build b/hw/xfree86/vbe/meson.build -deleted file mode 100644 -index d13991e..0000000 ---- a/hw/xfree86/vbe/meson.build -+++ /dev/null -@@ -1,10 +0,0 @@ --shared_module('vbe', -- [ 'vbe.c', 'vbeModes.c', 'vbe_module.c' ], -- include_directories: [ inc, xorg_inc ], -- dependencies: common_dep, -- c_args: xorg_c_args, -- install: true, -- install_dir: module_dir, --) -- --install_data(['vbe.h', 'vbeModes.h'], install_dir: xorgsdkdir) -diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c -deleted file mode 100644 -index d23e0f5..0000000 ---- a/hw/xfree86/vbe/vbe.c -+++ /dev/null -@@ -1,1096 +0,0 @@ -- --/* -- * XFree86 vbe module -- * Copyright 2000 Egbert Eich -- * -- * The mode query/save/set/restore functions from the vesa driver -- * have been moved here. -- * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) -- * Authors: Paulo César Pereira de Andrade -- */ -- --#ifdef HAVE_XORG_CONFIG_H --#include --#endif -- --#include -- --#include "xf86.h" --#include "xf86Modes.h" --#include "vbe.h" --#include -- --#define VERSION(x) VBE_VERSION_MAJOR(x),VBE_VERSION_MINOR(x) -- --#if X_BYTE_ORDER == X_LITTLE_ENDIAN --#define B_O16(x) (x) --#define B_O32(x) (x) --#else --#define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8)) --#define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \ -- | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24)) --#endif --#define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) -- --#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) --#define R16(v) ((v) & 0xffff) -- --static unsigned char *vbeReadEDID(vbeInfoPtr pVbe); --static Bool vbeProbeDDC(vbeInfoPtr pVbe); -- --static const char vbeVersionString[] = "VBE2"; -- --vbeInfoPtr --VBEInit(xf86Int10InfoPtr pInt, int entityIndex) --{ -- return VBEExtendedInit(pInt, entityIndex, 0); --} -- --vbeInfoPtr --VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags) --{ -- int RealOff; -- void *page = NULL; -- ScrnInfoPtr pScrn = xf86FindScreenForEntity(entityIndex); -- vbeControllerInfoPtr vbe = NULL; -- Bool init_int10 = FALSE; -- vbeInfoPtr vip = NULL; -- int screen; -- -- if (!pScrn) -- return NULL; -- screen = pScrn->scrnIndex; -- -- if (!pInt) { -- if (!xf86LoadSubModule(pScrn, "int10")) -- goto error; -- -- xf86DrvMsg(screen, X_INFO, "initializing int10\n"); -- pInt = xf86ExtendedInitInt10(entityIndex, Flags); -- if (!pInt) -- goto error; -- init_int10 = TRUE; -- } -- -- page = xf86Int10AllocPages(pInt, 1, &RealOff); -- if (!page) -- goto error; -- vbe = (vbeControllerInfoPtr) page; -- memcpy(vbe->VbeSignature, vbeVersionString, 4); -- -- pInt->ax = 0x4F00; -- pInt->es = SEG_ADDR(RealOff); -- pInt->di = SEG_OFF(RealOff); -- pInt->num = 0x10; -- -- xf86ExecX86int10(pInt); -- -- if ((pInt->ax & 0xff) != 0x4f) { -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA BIOS not detected\n"); -- goto error; -- } -- -- switch (pInt->ax & 0xff00) { -- case 0: -- xf86DrvMsg(screen, X_INFO, "VESA BIOS detected\n"); -- break; -- case 0x100: -- xf86DrvMsg(screen, X_INFO, "VESA BIOS function failed\n"); -- goto error; -- case 0x200: -- xf86DrvMsg(screen, X_INFO, "VESA BIOS not supported\n"); -- goto error; -- case 0x300: -- xf86DrvMsg(screen, X_INFO, "VESA BIOS not supported in current mode\n"); -- goto error; -- default: -- xf86DrvMsg(screen, X_INFO, "Invalid\n"); -- goto error; -- } -- -- xf86DrvMsgVerb(screen, X_INFO, 4, -- "VbeVersion is %d, OemStringPtr is 0x%08lx,\n" -- "\tOemVendorNamePtr is 0x%08lx, OemProductNamePtr is 0x%08lx,\n" -- "\tOemProductRevPtr is 0x%08lx\n", -- vbe->VbeVersion, (unsigned long) vbe->OemStringPtr, -- (unsigned long) vbe->OemVendorNamePtr, -- (unsigned long) vbe->OemProductNamePtr, -- (unsigned long) vbe->OemProductRevPtr); -- -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE Version %i.%i\n", -- VERSION(vbe->VbeVersion)); -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE Total Mem: %i kB\n", -- vbe->TotalMem * 64); -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM: %s\n", -- (CARD8 *) xf86int10Addr(pInt, L_ADD(vbe->OemStringPtr))); -- -- if (B_O16(vbe->VbeVersion) >= 0x200) { -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Software Rev: %i.%i\n", -- VERSION(vbe->OemSoftwareRev)); -- if (vbe->OemVendorNamePtr) -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Vendor: %s\n", -- (CARD8 *) xf86int10Addr(pInt, -- L_ADD(vbe-> -- OemVendorNamePtr))); -- if (vbe->OemProductNamePtr) -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Product: %s\n", -- (CARD8 *) xf86int10Addr(pInt, -- L_ADD(vbe-> -- OemProductNamePtr))); -- if (vbe->OemProductRevPtr) -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE OEM Product Rev: %s\n", -- (CARD8 *) xf86int10Addr(pInt, -- L_ADD(vbe-> -- OemProductRevPtr))); -- } -- vip = (vbeInfoPtr) xnfalloc(sizeof(vbeInfoRec)); -- vip->version = B_O16(vbe->VbeVersion); -- vip->pInt10 = pInt; -- vip->ddc = DDC_UNCHECKED; -- vip->memory = page; -- vip->real_mode_base = RealOff; -- vip->num_pages = 1; -- vip->init_int10 = init_int10; -- -- return vip; -- -- error: -- if (page) -- xf86Int10FreePages(pInt, page, 1); -- if (init_int10) -- xf86FreeInt10(pInt); -- return NULL; --} -- --void --vbeFree(vbeInfoPtr pVbe) --{ -- if (!pVbe) -- return; -- -- xf86Int10FreePages(pVbe->pInt10, pVbe->memory, pVbe->num_pages); -- /* If we have initalized int10 we ought to free it, too */ -- if (pVbe->init_int10) -- xf86FreeInt10(pVbe->pInt10); -- free(pVbe); -- return; --} -- --static Bool --vbeProbeDDC(vbeInfoPtr pVbe) --{ -- const char *ddc_level; -- int screen = pVbe->pInt10->pScrn->scrnIndex; -- -- if (pVbe->ddc == DDC_NONE) -- return FALSE; -- if (pVbe->ddc != DDC_UNCHECKED) -- return TRUE; -- -- pVbe->pInt10->ax = 0x4F15; -- pVbe->pInt10->bx = 0; -- pVbe->pInt10->cx = 0; -- pVbe->pInt10->es = 0; -- pVbe->pInt10->di = 0; -- pVbe->pInt10->num = 0x10; -- -- xf86ExecX86int10(pVbe->pInt10); -- -- if ((pVbe->pInt10->ax & 0xff) != 0x4f) { -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC not supported\n"); -- pVbe->ddc = DDC_NONE; -- return FALSE; -- } -- -- switch ((pVbe->pInt10->ax >> 8) & 0xff) { -- case 0: -- xf86DrvMsg(screen, X_INFO, "VESA VBE DDC supported\n"); -- switch (pVbe->pInt10->bx & 0x3) { -- case 0: -- ddc_level = " none"; -- pVbe->ddc = DDC_NONE; -- break; -- case 1: -- ddc_level = " 1"; -- pVbe->ddc = DDC_1; -- break; -- case 2: -- ddc_level = " 2"; -- pVbe->ddc = DDC_2; -- break; -- case 3: -- ddc_level = " 1 + 2"; -- pVbe->ddc = DDC_1_2; -- break; -- default: -- ddc_level = ""; -- pVbe->ddc = DDC_NONE; -- break; -- } -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC Level%s\n", ddc_level); -- if (pVbe->pInt10->bx & 0x4) { -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC Screen blanked" -- "for data transfer\n"); -- pVbe->ddc_blank = TRUE; -- } -- else -- pVbe->ddc_blank = FALSE; -- -- xf86DrvMsgVerb(screen, X_INFO, 3, -- "VESA VBE DDC transfer in appr. %x sec.\n", -- (pVbe->pInt10->bx >> 8) & 0xff); -- } -- -- return TRUE; --} -- --typedef enum { -- VBEOPT_NOVBE, -- VBEOPT_NODDC --} VBEOpts; -- --static const OptionInfoRec VBEOptions[] = { -- {VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE}, -- {VBEOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE}, -- {-1, NULL, OPTV_NONE, {0}, FALSE}, --}; -- --static unsigned char * --vbeReadEDID(vbeInfoPtr pVbe) --{ -- int RealOff = pVbe->real_mode_base; -- void *page = pVbe->memory; -- unsigned char *tmp = NULL; -- Bool novbe = FALSE; -- Bool noddc = FALSE; -- ScrnInfoPtr pScrn = pVbe->pInt10->pScrn; -- int screen = pScrn->scrnIndex; -- OptionInfoPtr options; -- -- if (!page) -- return NULL; -- -- options = xnfalloc(sizeof(VBEOptions)); -- (void) memcpy(options, VBEOptions, sizeof(VBEOptions)); -- xf86ProcessOptions(screen, pScrn->options, options); -- xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); -- xf86GetOptValBool(options, VBEOPT_NODDC, &noddc); -- free(options); -- if (novbe || noddc) -- return NULL; -- -- if (!vbeProbeDDC(pVbe)) -- goto error; -- -- memset(page, 0, sizeof(vbeInfoPtr)); -- strcpy(page, vbeVersionString); -- -- pVbe->pInt10->ax = 0x4F15; -- pVbe->pInt10->bx = 0x01; -- pVbe->pInt10->cx = 0; -- pVbe->pInt10->dx = 0; -- pVbe->pInt10->es = SEG_ADDR(RealOff); -- pVbe->pInt10->di = SEG_OFF(RealOff); -- pVbe->pInt10->num = 0x10; -- -- xf86ExecX86int10(pVbe->pInt10); -- -- if ((pVbe->pInt10->ax & 0xff) != 0x4f) { -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC invalid\n"); -- goto error; -- } -- switch (pVbe->pInt10->ax & 0xff00) { -- case 0x0: -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC read successfully\n"); -- tmp = (unsigned char *) xnfalloc(128); -- memcpy(tmp, page, 128); -- break; -- case 0x100: -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC read failed\n"); -- break; -- default: -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC unkown failure %i\n", -- pVbe->pInt10->ax & 0xff00); -- break; -- } -- -- error: -- return tmp; --} -- --xf86MonPtr --vbeDoEDID(vbeInfoPtr pVbe, void *unused) --{ -- unsigned char *DDC_data = NULL; -- -- if (!pVbe) -- return NULL; -- if (pVbe->version < 0x102) -- return NULL; -- -- DDC_data = vbeReadEDID(pVbe); -- -- if (!DDC_data) -- return NULL; -- -- return xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data); --} -- --#define GET_UNALIGNED2(x) \ -- ((*(CARD16*)(x)) | (*(((CARD16*)(x) + 1))) << 16) -- --VbeInfoBlock * --VBEGetVBEInfo(vbeInfoPtr pVbe) --{ -- VbeInfoBlock *block = NULL; -- int i, pStr, pModes; -- char *str; -- CARD16 major, *modes; -- -- memset(pVbe->memory, 0, sizeof(VbeInfoBlock)); -- -- /* -- Input: -- AH := 4Fh Super VGA support -- AL := 00h Return Super VGA information -- ES:DI := Pointer to buffer -- -- Output: -- AX := status -- (All other registers are preserved) -- */ -- -- ((char *) pVbe->memory)[0] = 'V'; -- ((char *) pVbe->memory)[1] = 'B'; -- ((char *) pVbe->memory)[2] = 'E'; -- ((char *) pVbe->memory)[3] = '2'; -- -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f00; -- pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); -- pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); -- xf86ExecX86int10(pVbe->pInt10); -- -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return NULL; -- -- block = calloc(sizeof(VbeInfoBlock), 1); -- block->VESASignature[0] = ((char *) pVbe->memory)[0]; -- block->VESASignature[1] = ((char *) pVbe->memory)[1]; -- block->VESASignature[2] = ((char *) pVbe->memory)[2]; -- block->VESASignature[3] = ((char *) pVbe->memory)[3]; -- -- block->VESAVersion = *(CARD16 *) (((char *) pVbe->memory) + 4); -- major = (unsigned) block->VESAVersion >> 8; -- -- pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 6)); -- str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); -- block->OEMStringPtr = strdup(str); -- -- block->Capabilities[0] = ((char *) pVbe->memory)[10]; -- block->Capabilities[1] = ((char *) pVbe->memory)[11]; -- block->Capabilities[2] = ((char *) pVbe->memory)[12]; -- block->Capabilities[3] = ((char *) pVbe->memory)[13]; -- -- pModes = GET_UNALIGNED2((((char *) pVbe->memory) + 14)); -- modes = xf86int10Addr(pVbe->pInt10, FARP(pModes)); -- i = 0; -- while (modes[i] != 0xffff) -- i++; -- block->VideoModePtr = xallocarray(i + 1, sizeof(CARD16)); -- memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i); -- block->VideoModePtr[i] = 0xffff; -- -- block->TotalMemory = *(CARD16 *) (((char *) pVbe->memory) + 18); -- -- if (major < 2) -- memcpy(&block->OemSoftwareRev, ((char *) pVbe->memory) + 20, 236); -- else { -- block->OemSoftwareRev = *(CARD16 *) (((char *) pVbe->memory) + 20); -- pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 22)); -- str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); -- block->OemVendorNamePtr = strdup(str); -- pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 26)); -- str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); -- block->OemProductNamePtr = strdup(str); -- pStr = GET_UNALIGNED2((((char *) pVbe->memory) + 30)); -- str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); -- block->OemProductRevPtr = strdup(str); -- memcpy(&block->Reserved, ((char *) pVbe->memory) + 34, 222); -- memcpy(&block->OemData, ((char *) pVbe->memory) + 256, 256); -- } -- -- return block; --} -- --void --VBEFreeVBEInfo(VbeInfoBlock * block) --{ -- free(block->OEMStringPtr); -- free(block->VideoModePtr); -- if (((unsigned) block->VESAVersion >> 8) >= 2) { -- free(block->OemVendorNamePtr); -- free(block->OemProductNamePtr); -- free(block->OemProductRevPtr); -- } -- free(block); --} -- --Bool --VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock * block) --{ -- /* -- Input: -- AH := 4Fh Super VGA support -- AL := 02h Set Super VGA video mode -- BX := Video mode -- D0-D8 := Mode number -- D9-D10 := Reserved (must be 0) -- D11 := 0 Use current default refresh rate -- := 1 Use user specified CRTC values for refresh rate -- D12-13 Reserved for VBE/AF (must be 0) -- D14 := 0 Use windowed frame buffer model -- := 1 Use linear/flat frame buffer model -- D15 := 0 Clear video memory -- := 1 Don't clear video memory -- ES:DI := Pointer to VbeCRTCInfoBlock structure -- -- Output: AX = Status -- (All other registers are preserved) -- */ -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f02; -- pVbe->pInt10->bx = mode; -- if (block) { -- pVbe->pInt10->bx |= 1 << 11; -- memcpy(pVbe->memory, block, sizeof(VbeCRTCInfoBlock)); -- pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); -- pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); -- } -- else -- pVbe->pInt10->bx &= ~(1 << 11); -- -- xf86ExecX86int10(pVbe->pInt10); -- -- return (R16(pVbe->pInt10->ax) == 0x4f); --} -- --Bool --VBEGetVBEMode(vbeInfoPtr pVbe, int *mode) --{ -- /* -- Input: -- AH := 4Fh Super VGA support -- AL := 03h Return current video mode -- -- Output: -- AX := Status -- BX := Current video mode -- (All other registers are preserved) -- */ -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f03; -- -- xf86ExecX86int10(pVbe->pInt10); -- -- if (R16(pVbe->pInt10->ax) == 0x4f) { -- *mode = R16(pVbe->pInt10->bx); -- -- return TRUE; -- } -- -- return FALSE; --} -- --VbeModeInfoBlock * --VBEGetModeInfo(vbeInfoPtr pVbe, int mode) --{ -- VbeModeInfoBlock *block = NULL; -- -- memset(pVbe->memory, 0, sizeof(VbeModeInfoBlock)); -- -- /* -- Input: -- AH := 4Fh Super VGA support -- AL := 01h Return Super VGA mode information -- CX := Super VGA video mode -- (mode number must be one of those returned by Function 0) -- ES:DI := Pointer to buffer -- -- Output: -- AX := status -- (All other registers are preserved) -- */ -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f01; -- pVbe->pInt10->cx = mode; -- pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); -- pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); -- xf86ExecX86int10(pVbe->pInt10); -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return NULL; -- -- block = malloc(sizeof(VbeModeInfoBlock)); -- if (block) -- memcpy(block, pVbe->memory, sizeof(*block)); -- -- return block; --} -- --void --VBEFreeModeInfo(VbeModeInfoBlock * block) --{ -- free(block); --} -- --Bool --VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, -- void **memory, int *size, int *real_mode_pages) --{ -- /* -- Input: -- AH := 4Fh Super VGA support -- AL := 04h Save/restore Super VGA video state -- DL := 00h Return save/restore state buffer size -- CX := Requested states -- D0 = Save/restore video hardware state -- D1 = Save/restore video BIOS data state -- D2 = Save/restore video DAC state -- D3 = Save/restore Super VGA state -- -- Output: -- AX = Status -- BX = Number of 64-byte blocks to hold the state buffer -- (All other registers are preserved) -- -- Input: -- AH := 4Fh Super VGA support -- AL := 04h Save/restore Super VGA video state -- DL := 01h Save Super VGA video state -- CX := Requested states (see above) -- ES:BX := Pointer to buffer -- -- Output: -- AX := Status -- (All other registers are preserved) -- -- Input: -- AH := 4Fh Super VGA support -- AL := 04h Save/restore Super VGA video state -- DL := 02h Restore Super VGA video state -- CX := Requested states (see above) -- ES:BX := Pointer to buffer -- -- Output: -- AX := Status -- (All other registers are preserved) -- */ -- -- if ((pVbe->version & 0xff00) > 0x100) { -- int screen = pVbe->pInt10->pScrn->scrnIndex; -- -- if (function == MODE_QUERY || (function == MODE_SAVE && !*memory)) { -- /* Query amount of memory to save state */ -- -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f04; -- pVbe->pInt10->dx = 0; -- pVbe->pInt10->cx = 0x000f; -- xf86ExecX86int10(pVbe->pInt10); -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return FALSE; -- -- if (function == MODE_SAVE) { -- int npages = (R16(pVbe->pInt10->bx) * 64) / 4096 + 1; -- -- if ((*memory = xf86Int10AllocPages(pVbe->pInt10, npages, -- real_mode_pages)) == NULL) { -- xf86DrvMsg(screen, X_ERROR, -- "Cannot allocate memory to save SVGA state.\n"); -- return FALSE; -- } -- } -- *size = pVbe->pInt10->bx * 64; -- } -- -- /* Save/Restore Super VGA state */ -- if (function != MODE_QUERY) { -- -- if (!*memory) -- return FALSE; -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f04; -- switch (function) { -- case MODE_SAVE: -- pVbe->pInt10->dx = 1; -- break; -- case MODE_RESTORE: -- pVbe->pInt10->dx = 2; -- break; -- case MODE_QUERY: -- return FALSE; -- } -- pVbe->pInt10->cx = 0x000f; -- -- pVbe->pInt10->es = SEG_ADDR(*real_mode_pages); -- pVbe->pInt10->bx = SEG_OFF(*real_mode_pages); -- xf86ExecX86int10(pVbe->pInt10); -- return (R16(pVbe->pInt10->ax) == 0x4f); -- -- } -- } -- return TRUE; --} -- --Bool --VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window) --{ -- /* -- Input: -- AH := 4Fh Super VGA support -- AL := 05h -- -- Output: -- */ -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f05; -- pVbe->pInt10->bx = window; -- pVbe->pInt10->dx = iBank; -- xf86ExecX86int10(pVbe->pInt10); -- -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return FALSE; -- -- return TRUE; --} -- --Bool --VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, -- int width, int *pixels, int *bytes, int *max) --{ -- if (command < SCANWID_SET || command > SCANWID_GET_MAX) -- return FALSE; -- -- /* -- Input: -- AX := 4F06h VBE Set/Get Logical Scan Line Length -- BL := 00h Set Scan Line Length in Pixels -- := 01h Get Scan Line Length -- := 02h Set Scan Line Length in Bytes -- := 03h Get Maximum Scan Line Length -- CX := If BL=00h Desired Width in Pixels -- If BL=02h Desired Width in Bytes -- (Ignored for Get Functions) -- -- Output: -- AX := VBE Return Status -- BX := Bytes Per Scan Line -- CX := Actual Pixels Per Scan Line -- (truncated to nearest complete pixel) -- DX := Maximum Number of Scan Lines -- */ -- -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f06; -- pVbe->pInt10->bx = command; -- if (command == SCANWID_SET || command == SCANWID_SET_BYTES) -- pVbe->pInt10->cx = width; -- xf86ExecX86int10(pVbe->pInt10); -- -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return FALSE; -- -- if (command == SCANWID_GET || command == SCANWID_GET_MAX) { -- if (pixels) -- *pixels = R16(pVbe->pInt10->cx); -- if (bytes) -- *bytes = R16(pVbe->pInt10->bx); -- if (max) -- *max = R16(pVbe->pInt10->dx); -- } -- -- return TRUE; --} -- --Bool --VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace) --{ -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f07; -- pVbe->pInt10->bx = wait_retrace ? 0x80 : 0x00; -- pVbe->pInt10->cx = x; -- pVbe->pInt10->dx = y; -- xf86ExecX86int10(pVbe->pInt10); -- -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return FALSE; -- -- return TRUE; --} -- --Bool --VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y) --{ -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f07; -- pVbe->pInt10->bx = 0x01; -- xf86ExecX86int10(pVbe->pInt10); -- -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return FALSE; -- -- *x = pVbe->pInt10->cx; -- *y = pVbe->pInt10->dx; -- -- return TRUE; --} -- --int --VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits) --{ -- /* -- Input: -- AX := 4F08h VBE Set/Get Palette Format -- BL := 00h Set DAC Palette Format -- := 01h Get DAC Palette Format -- BH := Desired bits of color per primary -- (Set DAC Palette Format only) -- -- Output: -- AX := VBE Return Status -- BH := Current number of bits of color per primary -- */ -- -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f08; -- if (!bits) -- pVbe->pInt10->bx = 0x01; -- else -- pVbe->pInt10->bx = (bits & 0x00ff) << 8; -- xf86ExecX86int10(pVbe->pInt10); -- -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return 0; -- -- return (bits != 0 ? bits : (pVbe->pInt10->bx >> 8) & 0x00ff); --} -- --CARD32 * --VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, -- CARD32 *data, Bool secondary, Bool wait_retrace) --{ -- /* -- Input: -- (16-bit) -- AX := 4F09h VBE Load/Unload Palette Data -- BL := 00h Set Palette Data -- := 01h Get Palette Data -- := 02h Set Secondary Palette Data -- := 03h Get Secondary Palette Data -- := 80h Set Palette Data during Vertical Retrace -- CX := Number of palette registers to update (to a maximum of 256) -- DX := First of the palette registers to update (start) -- ES:DI := Table of palette values (see below for format) -- -- Output: -- AX := VBE Return Status -- -- Input: -- (32-bit) -- BL := 00h Set Palette Data -- := 80h Set Palette Data during Vertical Retrace -- CX := Number of palette registers to update (to a maximum of 256) -- DX := First of the palette registers to update (start) -- ES:EDI := Table of palette values (see below for format) -- DS := Selector for memory mapped registers -- */ -- -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f09; -- if (!secondary) -- pVbe->pInt10->bx = set && wait_retrace ? 0x80 : set ? 0 : 1; -- else -- pVbe->pInt10->bx = set ? 2 : 3; -- pVbe->pInt10->cx = num; -- pVbe->pInt10->dx = first; -- pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); -- pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); -- if (set) -- memcpy(pVbe->memory, data, num * sizeof(CARD32)); -- xf86ExecX86int10(pVbe->pInt10); -- -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return NULL; -- -- if (set) -- return data; -- -- data = xallocarray(num, sizeof(CARD32)); -- memcpy(data, pVbe->memory, num * sizeof(CARD32)); -- -- return data; --} -- --VBEpmi * --VBEGetVBEpmi(vbeInfoPtr pVbe) --{ -- VBEpmi *pmi; -- -- /* -- Input: -- AH := 4Fh Super VGA support -- AL := 0Ah Protected Mode Interface -- BL := 00h Return Protected Mode Table -- -- Output: -- AX := Status -- ES := Real Mode Segment of Table -- DI := Offset of Table -- CX := Lenght of Table including protected mode code in bytes (for copying purposes) -- (All other registers are preserved) -- */ -- -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f0a; -- pVbe->pInt10->bx = 0; -- pVbe->pInt10->di = 0; -- xf86ExecX86int10(pVbe->pInt10); -- -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return NULL; -- -- pmi = malloc(sizeof(VBEpmi)); -- pmi->seg_tbl = R16(pVbe->pInt10->es); -- pmi->tbl_off = R16(pVbe->pInt10->di); -- pmi->tbl_len = R16(pVbe->pInt10->cx); -- -- return pmi; --} -- --#if 0 --vbeModeInfoPtr --VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock * vbe) --{ -- vbeModeInfoPtr ModeList = NULL; -- -- int i = 0; -- -- while (vbe->VideoModePtr[i] != 0xffff) { -- vbeModeInfoPtr m; -- VbeModeInfoBlock *mode; -- int id = vbe->VideoModePtr[i++]; -- int bpp; -- -- if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) -- continue; -- -- bpp = mode->BitsPerPixel; -- -- m = xnfcalloc(sizeof(vbeModeInfoRec), 1); -- m->width = mode->XResolution; -- m->height = mode->YResolution; -- m->bpp = bpp; -- m->n = id; -- m->next = ModeList; -- -- xf86DrvMsgVerb(pVbe->pInt10->pScrn->scrnIndex, X_PROBED, 3, -- "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n", -- m->n, m->width, m->height, m->bpp); -- -- ModeList = m; -- -- VBEFreeModeInfo(mode); -- } -- return ModeList; --} -- --unsigned short --VBECalcVbeModeIndex(vbeModeInfoPtr m, DisplayModePtr mode, int bpp) --{ -- while (m) { -- if (bpp == m->bpp -- && mode->HDisplay == m->width && mode->VDisplay == m->height) -- return m->n; -- m = m->next; -- } -- return 0; --} --#endif -- --void --VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr, -- vbeSaveRestoreFunction function) --{ -- Bool SaveSucc = FALSE; -- -- if (VBE_VERSION_MAJOR(pVbe->version) > 1 -- && (function == MODE_SAVE || vbe_sr->pstate)) { -- if (function == MODE_RESTORE) -- memcpy(vbe_sr->state, vbe_sr->pstate, vbe_sr->stateSize); -- ErrorF("VBESaveRestore\n"); -- if ((VBESaveRestore(pVbe, function, -- (void *) &vbe_sr->state, -- &vbe_sr->stateSize, &vbe_sr->statePage))) { -- if (function == MODE_SAVE) { -- SaveSucc = TRUE; -- vbe_sr->stateMode = -1; /* invalidate */ -- /* don't rely on the memory not being touched */ -- if (vbe_sr->pstate == NULL) -- vbe_sr->pstate = malloc(vbe_sr->stateSize); -- memcpy(vbe_sr->pstate, vbe_sr->state, vbe_sr->stateSize); -- } -- ErrorF("VBESaveRestore done with success\n"); -- return; -- } -- ErrorF("VBESaveRestore done\n"); -- } -- -- if (function == MODE_SAVE && !SaveSucc) -- (void) VBEGetVBEMode(pVbe, &vbe_sr->stateMode); -- -- if (function == MODE_RESTORE && vbe_sr->stateMode != -1) -- VBESetVBEMode(pVbe, vbe_sr->stateMode, NULL); -- --} -- --int --VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int clock) --{ -- /* -- Input: -- AX := 4F0Bh VBE Get Pixel Clock -- BL := 00h Get Pixel Clock -- ECX := pixel clock in units of Hz -- DX := mode number -- -- Output: -- AX := VBE Return Status -- ECX := Closest pixel clock -- */ -- -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f0b; -- pVbe->pInt10->bx = 0x00; -- pVbe->pInt10->cx = clock; -- pVbe->pInt10->dx = mode; -- xf86ExecX86int10(pVbe->pInt10); -- -- if (R16(pVbe->pInt10->ax) != 0x4f) -- return 0; -- -- return pVbe->pInt10->cx; --} -- --Bool --VBEDPMSSet(vbeInfoPtr pVbe, int mode) --{ -- /* -- Input: -- AX := 4F10h DPMS -- BL := 01h Set Display Power State -- BH := requested power state -- -- Output: -- AX := VBE Return Status -- */ -- -- pVbe->pInt10->num = 0x10; -- pVbe->pInt10->ax = 0x4f10; -- pVbe->pInt10->bx = 0x01; -- switch (mode) { -- case DPMSModeOn: -- break; -- case DPMSModeStandby: -- pVbe->pInt10->bx |= 0x100; -- break; -- case DPMSModeSuspend: -- pVbe->pInt10->bx |= 0x200; -- break; -- case DPMSModeOff: -- pVbe->pInt10->bx |= 0x400; -- break; -- } -- xf86ExecX86int10(pVbe->pInt10); -- return (R16(pVbe->pInt10->ax) == 0x4f); --} -- --void --VBEInterpretPanelID(ScrnInfoPtr pScrn, struct vbePanelID *data) --{ -- DisplayModePtr mode; -- const float PANEL_HZ = 60.0; -- -- if (!data) -- return; -- -- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n", -- data->hsize, data->vsize); -- -- if (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh) -- return; -- -- if (data->hsize < 320 || data->vsize < 240) { -- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "...which I refuse to believe\n"); -- return; -- } -- -- mode = xf86CVTMode(data->hsize, data->vsize, PANEL_HZ, 1, 0); -- -- pScrn->monitor->nHsync = 1; -- pScrn->monitor->hsync[0].lo = 29.37; -- pScrn->monitor->hsync[0].hi = (float) mode->Clock / (float) mode->HTotal; -- pScrn->monitor->nVrefresh = 1; -- pScrn->monitor->vrefresh[0].lo = 56.0; -- pScrn->monitor->vrefresh[0].hi = -- (float) mode->Clock * 1000.0 / (float) mode->HTotal / -- (float) mode->VTotal; -- -- if (pScrn->monitor->vrefresh[0].hi < 59.47) -- pScrn->monitor->vrefresh[0].hi = 59.47; -- -- free(mode); --} -- --struct vbePanelID * --VBEReadPanelID(vbeInfoPtr pVbe) --{ -- int RealOff = pVbe->real_mode_base; -- void *page = pVbe->memory; -- void *tmp = NULL; -- int screen = pVbe->pInt10->pScrn->scrnIndex; -- -- pVbe->pInt10->ax = 0x4F11; -- pVbe->pInt10->bx = 0x01; -- pVbe->pInt10->cx = 0; -- pVbe->pInt10->dx = 0; -- pVbe->pInt10->es = SEG_ADDR(RealOff); -- pVbe->pInt10->di = SEG_OFF(RealOff); -- pVbe->pInt10->num = 0x10; -- -- xf86ExecX86int10(pVbe->pInt10); -- -- if ((pVbe->pInt10->ax & 0xff) != 0x4f) { -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE PanelID invalid\n"); -- goto error; -- } -- -- switch (pVbe->pInt10->ax & 0xff00) { -- case 0x0: -- xf86DrvMsgVerb(screen, X_INFO, 3, -- "VESA VBE PanelID read successfully\n"); -- tmp = xnfalloc(32); -- memcpy(tmp, page, 32); -- break; -- case 0x100: -- xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE PanelID read failed\n"); -- break; -- default: -- xf86DrvMsgVerb(screen, X_INFO, 3, -- "VESA VBE PanelID unknown failure %i\n", -- pVbe->pInt10->ax & 0xff00); -- break; -- } -- -- error: -- return tmp; --} -diff --git a/hw/xfree86/vbe/vbe.h b/hw/xfree86/vbe/vbe.h -deleted file mode 100644 -index c8fb4e4..0000000 ---- a/hw/xfree86/vbe/vbe.h -+++ /dev/null -@@ -1,357 +0,0 @@ -- --/* -- * XFree86 vbe module -- * Copyright 2000 Egbert Eich -- * -- * The mode query/save/set/restore functions from the vesa driver -- * have been moved here. -- * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) -- * Authors: Paulo César Pereira de Andrade -- */ -- --#ifndef _VBE_H --#define _VBE_H --#include "xf86int10.h" --#include "xf86DDC.h" -- --typedef enum { -- DDC_UNCHECKED, -- DDC_NONE, -- DDC_1, -- DDC_2, -- DDC_1_2 --} ddc_lvl; -- --typedef struct { -- xf86Int10InfoPtr pInt10; -- int version; -- void *memory; -- int real_mode_base; -- int num_pages; -- Bool init_int10; -- ddc_lvl ddc; -- Bool ddc_blank; --} vbeInfoRec, *vbeInfoPtr; -- --#define VBE_VERSION_MAJOR(x) *((CARD8*)(&x) + 1) --#define VBE_VERSION_MINOR(x) (CARD8)(x) -- --extern _X_EXPORT vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex); --extern _X_EXPORT vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt, -- int entityIndex, int Flags); --extern _X_EXPORT void vbeFree(vbeInfoPtr pVbe); --extern _X_EXPORT xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, void *pDDCModule); -- --#pragma pack(1) -- --typedef struct vbeControllerInfoBlock { -- CARD8 VbeSignature[4]; -- CARD16 VbeVersion; -- CARD32 OemStringPtr; -- CARD8 Capabilities[4]; -- CARD32 VideoModePtr; -- CARD16 TotalMem; -- CARD16 OemSoftwareRev; -- CARD32 OemVendorNamePtr; -- CARD32 OemProductNamePtr; -- CARD32 OemProductRevPtr; -- CARD8 Scratch[222]; -- CARD8 OemData[256]; --} vbeControllerInfoRec, *vbeControllerInfoPtr; -- --#if defined(__GNUC__) || defined(__USLC__) || defined(__SUNPRO_C) --#pragma pack() /* All GCC versions recognise this syntax */ --#else --#pragma pack(0) --#endif -- --#if !( defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) ) --#define __attribute__(a) --#endif -- --typedef struct _VbeInfoBlock VbeInfoBlock; --typedef struct _VbeModeInfoBlock VbeModeInfoBlock; --typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock; -- --/* -- * INT 0 -- */ -- --struct _VbeInfoBlock { -- /* VESA 1.2 fields */ -- CARD8 VESASignature[4]; /* VESA */ -- CARD16 VESAVersion; /* Higher byte major, lower byte minor */ -- /*CARD32 */ char *OEMStringPtr; -- /* Pointer to OEM string */ -- CARD8 Capabilities[4]; /* Capabilities of the video environment */ -- -- /*CARD32 */ CARD16 *VideoModePtr; -- /* pointer to supported Super VGA modes */ -- -- CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ -- /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */ -- -- /* VESA 2 fields */ -- CARD16 OemSoftwareRev; /* VBE implementation Software revision */ -- /*CARD32 */ char *OemVendorNamePtr; -- /* Pointer to Vendor Name String */ -- /*CARD32 */ char *OemProductNamePtr; -- /* Pointer to Product Name String */ -- /*CARD32 */ char *OemProductRevPtr; -- /* Pointer to Product Revision String */ -- CARD8 Reserved[222]; /* Reserved for VBE implementation */ -- CARD8 OemData[256]; /* Data Area for OEM Strings */ --} __attribute__ ((packed)); -- --/* Return Super VGA Information */ --extern _X_EXPORT VbeInfoBlock *VBEGetVBEInfo(vbeInfoPtr pVbe); --extern _X_EXPORT void VBEFreeVBEInfo(VbeInfoBlock * block); -- --/* -- * INT 1 -- */ -- --struct _VbeModeInfoBlock { -- CARD16 ModeAttributes; /* mode attributes */ -- CARD8 WinAAttributes; /* window A attributes */ -- CARD8 WinBAttributes; /* window B attributes */ -- CARD16 WinGranularity; /* window granularity */ -- CARD16 WinSize; /* window size */ -- CARD16 WinASegment; /* window A start segment */ -- CARD16 WinBSegment; /* window B start segment */ -- CARD32 WinFuncPtr; /* real mode pointer to window function */ -- CARD16 BytesPerScanline; /* bytes per scanline */ -- -- /* Mandatory information for VBE 1.2 and above */ -- CARD16 XResolution; /* horizontal resolution in pixels or characters */ -- CARD16 YResolution; /* vertical resolution in pixels or characters */ -- CARD8 XCharSize; /* character cell width in pixels */ -- CARD8 YCharSize; /* character cell height in pixels */ -- CARD8 NumberOfPlanes; /* number of memory planes */ -- CARD8 BitsPerPixel; /* bits per pixel */ -- CARD8 NumberOfBanks; /* number of banks */ -- CARD8 MemoryModel; /* memory model type */ -- CARD8 BankSize; /* bank size in KB */ -- CARD8 NumberOfImages; /* number of images */ -- CARD8 Reserved; /* 1 *//* reserved for page function */ -- -- /* Direct color fields (required for direct/6 and YUV/7 memory models) */ -- CARD8 RedMaskSize; /* size of direct color red mask in bits */ -- CARD8 RedFieldPosition; /* bit position of lsb of red mask */ -- CARD8 GreenMaskSize; /* size of direct color green mask in bits */ -- CARD8 GreenFieldPosition; /* bit position of lsb of green mask */ -- CARD8 BlueMaskSize; /* size of direct color blue mask in bits */ -- CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */ -- CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */ -- CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */ -- CARD8 DirectColorModeInfo; /* direct color mode attributes */ -- -- /* Mandatory information for VBE 2.0 and above */ -- CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */ -- CARD32 Reserved32; /* 0 *//* Reserved - always set to 0 */ -- CARD16 Reserved16; /* 0 *//* Reserved - always set to 0 */ -- -- /* Mandatory information for VBE 3.0 and above */ -- CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */ -- CARD8 BnkNumberOfImagePages; /* number of images for banked modes */ -- CARD8 LinNumberOfImagePages; /* number of images for linear modes */ -- CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */ -- CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ -- CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */ -- CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */ -- CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ -- CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */ -- CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ -- CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */ -- CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ -- CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */ --} __attribute__ ((packed)); -- --/* Return VBE Mode Information */ --extern _X_EXPORT VbeModeInfoBlock *VBEGetModeInfo(vbeInfoPtr pVbe, int mode); --extern _X_EXPORT void VBEFreeModeInfo(VbeModeInfoBlock * block); -- --/* -- * INT2 -- */ -- --#define CRTC_DBLSCAN (1<<0) --#define CRTC_INTERLACE (1<<1) --#define CRTC_NHSYNC (1<<2) --#define CRTC_NVSYNC (1<<3) -- --struct _VbeCRTCInfoBlock { -- CARD16 HorizontalTotal; /* Horizontal total in pixels */ -- CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ -- CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ -- CARD16 VerticalTotal; /* Vertical total in lines */ -- CARD16 VerticalSyncStart; /* Vertical sync start in lines */ -- CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ -- CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ -- CARD32 PixelClock; /* Pixel clock in units of Hz */ -- CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ -- CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ --} __attribute__ ((packed)); -- --/* VbeCRTCInfoBlock is in the VESA 3.0 specs */ -- --extern _X_EXPORT Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode, -- VbeCRTCInfoBlock * crtc); -- --/* -- * INT 3 -- */ -- --extern _X_EXPORT Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode); -- --/* -- * INT 4 -- */ -- --/* Save/Restore Super VGA video state */ --/* function values are (values stored in VESAPtr): -- * 0 := query & allocate amount of memory to save state -- * 1 := save state -- * 2 := restore state -- * -- * function 0 called automatically if function 1 called without -- * a previous call to function 0. -- */ -- --typedef enum { -- MODE_QUERY, -- MODE_SAVE, -- MODE_RESTORE --} vbeSaveRestoreFunction; -- --extern _X_EXPORT Bool -- --VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction, -- void **memory, int *size, int *real_mode_pages); -- --/* -- * INT 5 -- */ -- --extern _X_EXPORT Bool -- VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window); -- --/* -- * INT 6 -- */ -- --typedef enum { -- SCANWID_SET, -- SCANWID_GET, -- SCANWID_SET_BYTES, -- SCANWID_GET_MAX --} vbeScanwidthCommand; -- --#define VBESetLogicalScanline(pVbe, width) \ -- VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET, width, \ -- NULL, NULL, NULL) --#define VBESetLogicalScanlineBytes(pVbe, width) \ -- VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET_BYTES, width, \ -- NULL, NULL, NULL) --#define VBEGetLogicalScanline(pVbe, pixels, bytes, max) \ -- VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET, 0, \ -- pixels, bytes, max) --#define VBEGetMaxLogicalScanline(pVbe, pixels, bytes, max) \ -- VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET_MAX, 0, \ -- pixels, bytes, max) --extern _X_EXPORT Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, -- vbeScanwidthCommand -- command, int width, -- int *pixels, int *bytes, -- int *max); -- --/* -- * INT 7 -- */ -- --/* 16 bit code */ --extern _X_EXPORT Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, -- Bool wait_retrace); --extern _X_EXPORT Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y); -- --/* -- * INT 8 -- */ -- --/* if bits is 0, then it is a GET */ --extern _X_EXPORT int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits); -- --/* -- * INT 9 -- */ -- --/* -- * If getting a palette, the data argument is not used. It will return -- * the data. -- * If setting a palette, it will return the pointer received on success, -- * NULL on failure. -- */ --extern _X_EXPORT CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, -- int first, int num, CARD32 *data, -- Bool secondary, -- Bool wait_retrace); --#define VBEFreePaletteData(data) free(data) -- --/* -- * INT A -- */ -- --typedef struct _VBEpmi { -- int seg_tbl; -- int tbl_off; -- int tbl_len; --} VBEpmi; -- --extern _X_EXPORT VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe); -- --#define VESAFreeVBEpmi(pmi) free(pmi) -- --/* high level helper functions */ -- --typedef struct _vbeModeInfoRec { -- int width; -- int height; -- int bpp; -- int n; -- struct _vbeModeInfoRec *next; --} vbeModeInfoRec, *vbeModeInfoPtr; -- --typedef struct { -- CARD8 *state; -- CARD8 *pstate; -- int statePage; -- int stateSize; -- int stateMode; --} vbeSaveRestoreRec, *vbeSaveRestorePtr; -- --extern _X_EXPORT void -- --VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr, -- vbeSaveRestoreFunction function); -- --extern _X_EXPORT int VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int Clock); --extern _X_EXPORT Bool VBEDPMSSet(vbeInfoPtr pVbe, int mode); -- --struct vbePanelID { -- short hsize; -- short vsize; -- short fptype; -- char redbpp; -- char greenbpp; -- char bluebpp; -- char reservedbpp; -- int reserved_offscreen_mem_size; -- int reserved_offscreen_mem_pointer; -- char reserved[14]; --}; -- --extern _X_EXPORT void VBEInterpretPanelID(ScrnInfoPtr pScrn, -- struct vbePanelID *data); --extern _X_EXPORT struct vbePanelID *VBEReadPanelID(vbeInfoPtr pVbe); -- --#endif -diff --git a/hw/xfree86/vbe/vbeModes.c b/hw/xfree86/vbe/vbeModes.c -deleted file mode 100644 -index 50ac50d..0000000 ---- a/hw/xfree86/vbe/vbeModes.c -+++ /dev/null -@@ -1,453 +0,0 @@ --#define DEBUG_VERB 2 --/* -- * Copyright © 2002 David Dawes -- * -- * 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 AUTHOR(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 of the author(s) 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 author(s). -- * -- * Authors: David Dawes -- * -- */ -- --#ifdef HAVE_XORG_CONFIG_H --#include --#endif -- --#include --#include -- --#include "xf86.h" --#include "vbe.h" --#include "vbeModes.h" -- --static int --GetDepthFlag(vbeInfoPtr pVbe, int id) --{ -- VbeModeInfoBlock *mode; -- int bpp; -- -- if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) -- return 0; -- -- if (VBE_MODE_USABLE(mode, 0)) { -- int depth; -- -- if (VBE_MODE_COLOR(mode)) { -- depth = mode->RedMaskSize + mode->GreenMaskSize + -- mode->BlueMaskSize; -- } -- else { -- depth = 1; -- } -- bpp = mode->BitsPerPixel; -- VBEFreeModeInfo(mode); -- mode = NULL; -- switch (depth) { -- case 1: -- return V_DEPTH_1; -- case 4: -- return V_DEPTH_4; -- case 8: -- return V_DEPTH_8; -- case 15: -- return V_DEPTH_15; -- case 16: -- return V_DEPTH_16; -- case 24: -- switch (bpp) { -- case 24: -- return V_DEPTH_24_24; -- case 32: -- return V_DEPTH_24_32; -- } -- } -- } -- if (mode) -- VBEFreeModeInfo(mode); -- return 0; --} -- --/* -- * Find supported mode depths. -- */ --int --VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock * vbe, int *flags24, -- int modeTypes) --{ -- int i = 0; -- int depths = 0; -- -- if (modeTypes & V_MODETYPE_VBE) { -- while (vbe->VideoModePtr[i] != 0xffff) { -- depths |= GetDepthFlag(pVbe, vbe->VideoModePtr[i++]); -- } -- } -- -- /* -- * XXX This possibly only works with VBE 3.0 and later. -- */ -- if (modeTypes & V_MODETYPE_VGA) { -- for (i = 0; i < 0x7F; i++) { -- depths |= GetDepthFlag(pVbe, i); -- } -- } -- -- if (flags24) { -- if (depths & V_DEPTH_24_24) -- *flags24 |= Support24bppFb; -- if (depths & V_DEPTH_24_32) -- *flags24 |= Support32bppFb; -- } -- -- return depths; --} -- --static DisplayModePtr --CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe, int id, -- int flags) --{ -- CARD16 major; -- VbeModeInfoBlock *mode; -- DisplayModePtr pMode; -- VbeModeInfoData *data; -- Bool modeOK = FALSE; -- -- major = (unsigned) (vbe->VESAVersion >> 8); -- -- if ((mode = VBEGetModeInfo(pVbe, id)) == NULL) -- return NULL; -- -- /* Does the mode match the depth/bpp? */ -- /* Some BIOS's set BitsPerPixel to 15 instead of 16 for 15/16 */ -- if (VBE_MODE_USABLE(mode, flags) && -- ((pScrn->bitsPerPixel == 1 && !VBE_MODE_COLOR(mode)) || -- (mode->BitsPerPixel > 8 && -- (mode->RedMaskSize + mode->GreenMaskSize + -- mode->BlueMaskSize) == pScrn->depth && -- mode->BitsPerPixel == pScrn->bitsPerPixel) || -- (mode->BitsPerPixel == 15 && pScrn->depth == 15) || -- (mode->BitsPerPixel <= 8 && -- mode->BitsPerPixel == pScrn->bitsPerPixel))) { -- modeOK = TRUE; -- xf86ErrorFVerb(DEBUG_VERB, "*"); -- } -- -- xf86ErrorFVerb(DEBUG_VERB, -- "Mode: %x (%dx%d)\n", id, mode->XResolution, -- mode->YResolution); -- xf86ErrorFVerb(DEBUG_VERB, " ModeAttributes: 0x%x\n", -- mode->ModeAttributes); -- xf86ErrorFVerb(DEBUG_VERB, " WinAAttributes: 0x%x\n", -- mode->WinAAttributes); -- xf86ErrorFVerb(DEBUG_VERB, " WinBAttributes: 0x%x\n", -- mode->WinBAttributes); -- xf86ErrorFVerb(DEBUG_VERB, " WinGranularity: %d\n", -- mode->WinGranularity); -- xf86ErrorFVerb(DEBUG_VERB, " WinSize: %d\n", mode->WinSize); -- xf86ErrorFVerb(DEBUG_VERB, -- " WinASegment: 0x%x\n", mode->WinASegment); -- xf86ErrorFVerb(DEBUG_VERB, -- " WinBSegment: 0x%x\n", mode->WinBSegment); -- xf86ErrorFVerb(DEBUG_VERB, -- " WinFuncPtr: 0x%lx\n", (unsigned long) mode->WinFuncPtr); -- xf86ErrorFVerb(DEBUG_VERB, -- " BytesPerScanline: %d\n", mode->BytesPerScanline); -- xf86ErrorFVerb(DEBUG_VERB, " XResolution: %d\n", mode->XResolution); -- xf86ErrorFVerb(DEBUG_VERB, " YResolution: %d\n", mode->YResolution); -- xf86ErrorFVerb(DEBUG_VERB, " XCharSize: %d\n", mode->XCharSize); -- xf86ErrorFVerb(DEBUG_VERB, " YCharSize: %d\n", mode->YCharSize); -- xf86ErrorFVerb(DEBUG_VERB, -- " NumberOfPlanes: %d\n", mode->NumberOfPlanes); -- xf86ErrorFVerb(DEBUG_VERB, -- " BitsPerPixel: %d\n", mode->BitsPerPixel); -- xf86ErrorFVerb(DEBUG_VERB, -- " NumberOfBanks: %d\n", mode->NumberOfBanks); -- xf86ErrorFVerb(DEBUG_VERB, " MemoryModel: %d\n", mode->MemoryModel); -- xf86ErrorFVerb(DEBUG_VERB, " BankSize: %d\n", mode->BankSize); -- xf86ErrorFVerb(DEBUG_VERB, -- " NumberOfImages: %d\n", mode->NumberOfImages); -- xf86ErrorFVerb(DEBUG_VERB, " RedMaskSize: %d\n", mode->RedMaskSize); -- xf86ErrorFVerb(DEBUG_VERB, -- " RedFieldPosition: %d\n", mode->RedFieldPosition); -- xf86ErrorFVerb(DEBUG_VERB, -- " GreenMaskSize: %d\n", mode->GreenMaskSize); -- xf86ErrorFVerb(DEBUG_VERB, -- " GreenFieldPosition: %d\n", mode->GreenFieldPosition); -- xf86ErrorFVerb(DEBUG_VERB, -- " BlueMaskSize: %d\n", mode->BlueMaskSize); -- xf86ErrorFVerb(DEBUG_VERB, -- " BlueFieldPosition: %d\n", mode->BlueFieldPosition); -- xf86ErrorFVerb(DEBUG_VERB, -- " RsvdMaskSize: %d\n", mode->RsvdMaskSize); -- xf86ErrorFVerb(DEBUG_VERB, -- " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition); -- xf86ErrorFVerb(DEBUG_VERB, -- " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo); -- if (major >= 2) { -- xf86ErrorFVerb(DEBUG_VERB, -- " PhysBasePtr: 0x%lx\n", -- (unsigned long) mode->PhysBasePtr); -- if (major >= 3) { -- xf86ErrorFVerb(DEBUG_VERB, -- " LinBytesPerScanLine: %d\n", -- mode->LinBytesPerScanLine); -- xf86ErrorFVerb(DEBUG_VERB, " BnkNumberOfImagePages: %d\n", -- mode->BnkNumberOfImagePages); -- xf86ErrorFVerb(DEBUG_VERB, " LinNumberOfImagePages: %d\n", -- mode->LinNumberOfImagePages); -- xf86ErrorFVerb(DEBUG_VERB, " LinRedMaskSize: %d\n", -- mode->LinRedMaskSize); -- xf86ErrorFVerb(DEBUG_VERB, " LinRedFieldPosition: %d\n", -- mode->LinRedFieldPosition); -- xf86ErrorFVerb(DEBUG_VERB, " LinGreenMaskSize: %d\n", -- mode->LinGreenMaskSize); -- xf86ErrorFVerb(DEBUG_VERB, " LinGreenFieldPosition: %d\n", -- mode->LinGreenFieldPosition); -- xf86ErrorFVerb(DEBUG_VERB, " LinBlueMaskSize: %d\n", -- mode->LinBlueMaskSize); -- xf86ErrorFVerb(DEBUG_VERB, " LinBlueFieldPosition: %d\n", -- mode->LinBlueFieldPosition); -- xf86ErrorFVerb(DEBUG_VERB, " LinRsvdMaskSize: %d\n", -- mode->LinRsvdMaskSize); -- xf86ErrorFVerb(DEBUG_VERB, " LinRsvdFieldPosition: %d\n", -- mode->LinRsvdFieldPosition); -- xf86ErrorFVerb(DEBUG_VERB, " MaxPixelClock: %ld\n", -- (unsigned long) mode->MaxPixelClock); -- } -- } -- -- if (!modeOK) { -- VBEFreeModeInfo(mode); -- return NULL; -- } -- pMode = xnfcalloc(sizeof(DisplayModeRec), 1); -- -- pMode->status = MODE_OK; -- pMode->type = M_T_BUILTIN; -- -- /* for adjust frame */ -- pMode->HDisplay = mode->XResolution; -- pMode->VDisplay = mode->YResolution; -- -- data = xnfcalloc(sizeof(VbeModeInfoData), 1); -- data->mode = id; -- data->data = mode; -- pMode->PrivSize = sizeof(VbeModeInfoData); -- pMode->Private = (INT32 *) data; -- pMode->next = NULL; -- return pMode; --} -- --/* -- * Check the available BIOS modes, and extract those that match the -- * requirements into the modePool. Note: modePool is a NULL-terminated -- * list. -- */ -- --DisplayModePtr --VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock * vbe, -- int modeTypes) --{ -- DisplayModePtr pMode, p = NULL, modePool = NULL; -- int i = 0; -- -- if (modeTypes & V_MODETYPE_VBE) { -- while (vbe->VideoModePtr[i] != 0xffff) { -- int id = vbe->VideoModePtr[i++]; -- -- if ((pMode = CheckMode(pScrn, pVbe, vbe, id, modeTypes)) != NULL) { -- ModeStatus status = MODE_OK; -- -- /* Check the mode against a specified virtual size (if any) */ -- if (pScrn->display->virtualX > 0 && -- pMode->HDisplay > pScrn->display->virtualX) { -- status = MODE_VIRTUAL_X; -- } -- if (pScrn->display->virtualY > 0 && -- pMode->VDisplay > pScrn->display->virtualY) { -- status = MODE_VIRTUAL_Y; -- } -- if (status != MODE_OK) { -- xf86DrvMsg(pScrn->scrnIndex, X_INFO, -- "Not using mode \"%dx%d\" (%s)\n", -- pMode->HDisplay, pMode->VDisplay, -- xf86ModeStatusToString(status)); -- } -- else { -- if (p == NULL) { -- modePool = pMode; -- } -- else { -- p->next = pMode; -- } -- pMode->prev = NULL; -- p = pMode; -- } -- } -- } -- } -- if (modeTypes & V_MODETYPE_VGA) { -- for (i = 0; i < 0x7F; i++) { -- if ((pMode = CheckMode(pScrn, pVbe, vbe, i, modeTypes)) != NULL) { -- ModeStatus status = MODE_OK; -- -- /* Check the mode against a specified virtual size (if any) */ -- if (pScrn->display->virtualX > 0 && -- pMode->HDisplay > pScrn->display->virtualX) { -- status = MODE_VIRTUAL_X; -- } -- if (pScrn->display->virtualY > 0 && -- pMode->VDisplay > pScrn->display->virtualY) { -- status = MODE_VIRTUAL_Y; -- } -- if (status != MODE_OK) { -- xf86DrvMsg(pScrn->scrnIndex, X_INFO, -- "Not using mode \"%dx%d\" (%s)\n", -- pMode->HDisplay, pMode->VDisplay, -- xf86ModeStatusToString(status)); -- } -- else { -- if (p == NULL) { -- modePool = pMode; -- } -- else { -- p->next = pMode; -- } -- pMode->prev = NULL; -- p = pMode; -- } -- } -- } -- } -- return modePool; --} -- --void --VBESetModeNames(DisplayModePtr pMode) --{ -- if (!pMode) -- return; -- -- do { -- if (!pMode->name) { -- /* Catch "bad" modes. */ -- if (pMode->HDisplay > 10000 || pMode->HDisplay < 0 || -- pMode->VDisplay > 10000 || pMode->VDisplay < 0) { -- pMode->name = strdup("BADMODE"); -- } -- else { -- char *tmp; -- XNFasprintf(&tmp, "%dx%d", -- pMode->HDisplay, pMode->VDisplay); -- pMode->name = tmp; -- } -- } -- pMode = pMode->next; -- } while (pMode); --} -- --/* -- * Go through the monitor modes and selecting the best set of -- * parameters for each BIOS mode. Note: This is only supported in -- * VBE version 3.0 or later. -- */ --void --VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe) --{ -- DisplayModePtr pMode; -- VbeModeInfoData *data; -- -- pMode = pScrn->modes; -- do { -- DisplayModePtr p, best = NULL; -- ModeStatus status; -- -- for (p = pScrn->monitor->Modes; p != NULL; p = p->next) { -- if ((p->HDisplay != pMode->HDisplay) || -- (p->VDisplay != pMode->VDisplay) || -- (p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) -- continue; -- /* XXX could support the various V_ flags */ -- status = xf86CheckModeForMonitor(p, pScrn->monitor); -- if (status != MODE_OK) -- continue; -- if (!best || (p->Clock > best->Clock)) -- best = p; -- } -- -- if (best) { -- int clock; -- -- data = (VbeModeInfoData *) pMode->Private; -- pMode->HSync = (float) best->Clock * 1000.0 / best->HTotal + 0.5; -- pMode->VRefresh = pMode->HSync / best->VTotal + 0.5; -- xf86DrvMsg(pScrn->scrnIndex, X_INFO, -- "Attempting to use %dHz refresh for mode \"%s\" (%x)\n", -- (int) pMode->VRefresh, pMode->name, data->mode); -- data->block = calloc(sizeof(VbeCRTCInfoBlock), 1); -- data->block->HorizontalTotal = best->HTotal; -- data->block->HorizontalSyncStart = best->HSyncStart; -- data->block->HorizontalSyncEnd = best->HSyncEnd; -- data->block->VerticalTotal = best->VTotal; -- data->block->VerticalSyncStart = best->VSyncStart; -- data->block->VerticalSyncEnd = best->VSyncEnd; -- data->block->Flags = ((best->Flags & V_NHSYNC) ? CRTC_NHSYNC : 0) | -- ((best->Flags & V_NVSYNC) ? CRTC_NVSYNC : 0); -- data->block->PixelClock = best->Clock * 1000; -- /* XXX May not have this. */ -- clock = VBEGetPixelClock(pVbe, data->mode, data->block->PixelClock); -- DebugF("Setting clock %.2fMHz, closest is %.2fMHz\n", -- (double) data->block->PixelClock / 1000000.0, -- (double) clock / 1000000.0); -- if (clock) -- data->block->PixelClock = clock; -- data->mode |= (1 << 11); -- data->block->RefreshRate = ((double) (data->block->PixelClock) / -- (double) (best->HTotal * -- best->VTotal)) * 100; -- } -- pMode = pMode->next; -- } while (pMode != pScrn->modes); --} -- --/* -- * These wrappers are to allow (temporary) funtionality divergences. -- */ --int --VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, -- const char **modeNames, ClockRangePtr clockRanges, -- int *linePitches, int minPitch, int maxPitch, int pitchInc, -- int minHeight, int maxHeight, int virtualX, int virtualY, -- int apertureSize, LookupModeFlags strategy) --{ -- return xf86ValidateModes(scrp, availModes, modeNames, clockRanges, -- linePitches, minPitch, maxPitch, pitchInc, -- minHeight, maxHeight, virtualX, virtualY, -- apertureSize, strategy); --} -- --void --VBEPrintModes(ScrnInfoPtr scrp) --{ -- xf86PrintModes(scrp); --} -diff --git a/hw/xfree86/vbe/vbeModes.h b/hw/xfree86/vbe/vbeModes.h -deleted file mode 100644 -index ee0257c..0000000 ---- a/hw/xfree86/vbe/vbeModes.h -+++ /dev/null -@@ -1,94 +0,0 @@ --/* -- * Copyright © 2002 David Dawes -- * -- * 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 AUTHOR(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 of the author(s) 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 author(s). -- * -- * Authors: David Dawes -- * -- */ -- --#ifndef _VBE_MODES_H -- --/* -- * This is intended to be stored in the DisplayModeRec's private area. -- * It includes all the information necessary to VBE information. -- */ --typedef struct _VbeModeInfoData { -- int mode; -- VbeModeInfoBlock *data; -- VbeCRTCInfoBlock *block; --} VbeModeInfoData; -- --#define V_DEPTH_1 0x001 --#define V_DEPTH_4 0x002 --#define V_DEPTH_8 0x004 --#define V_DEPTH_15 0x008 --#define V_DEPTH_16 0x010 --#define V_DEPTH_24_24 0x020 --#define V_DEPTH_24_32 0x040 --#define V_DEPTH_24 (V_DEPTH_24_24 | V_DEPTH_24_32) --#define V_DEPTH_30 0x080 --#define V_DEPTH_32 0x100 -- --#define VBE_MODE_SUPPORTED(m) (((m)->ModeAttributes & 0x01) != 0) --#define VBE_MODE_COLOR(m) (((m)->ModeAttributes & 0x08) != 0) --#define VBE_MODE_GRAPHICS(m) (((m)->ModeAttributes & 0x10) != 0) --#define VBE_MODE_VGA(m) (((m)->ModeAttributes & 0x40) == 0) --#define VBE_MODE_LINEAR(m) (((m)->ModeAttributes & 0x80) != 0 && \ -- ((m)->PhysBasePtr != 0)) -- --#define VBE_MODE_USABLE(m, f) (VBE_MODE_SUPPORTED(m) || \ -- (f & V_MODETYPE_BAD)) && \ -- VBE_MODE_GRAPHICS(m) && \ -- (VBE_MODE_VGA(m) || VBE_MODE_LINEAR(m)) -- --#define V_MODETYPE_VBE 0x01 --#define V_MODETYPE_VGA 0x02 --#define V_MODETYPE_BAD 0x04 -- --extern _X_EXPORT int VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock * vbe, -- int *flags24, int modeTypes); --extern _X_EXPORT DisplayModePtr VBEGetModePool(ScrnInfoPtr pScrn, -- vbeInfoPtr pVbe, -- VbeInfoBlock * vbe, -- int modeTypes); --extern _X_EXPORT void VBESetModeNames(DisplayModePtr pMode); --extern _X_EXPORT void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe); -- --/* -- * Note: These are alternatives to the standard helpers. They should -- * usually just wrap the standard helpers. -- */ --extern _X_EXPORT int VBEValidateModes(ScrnInfoPtr scrp, -- DisplayModePtr availModes, -- const char **modeNames, -- ClockRangePtr clockRanges, -- int *linePitches, int minPitch, -- int maxPitch, int pitchInc, int minHeight, -- int maxHeight, int virtualX, int virtualY, -- int apertureSize, -- LookupModeFlags strategy); --extern _X_EXPORT void VBEPrintModes(ScrnInfoPtr scrp); -- --#endif /* VBE_MODES_H */ -diff --git a/hw/xfree86/vbe/vbe_module.c b/hw/xfree86/vbe/vbe_module.c -deleted file mode 100644 -index 3fb8695..0000000 ---- a/hw/xfree86/vbe/vbe_module.c -+++ /dev/null -@@ -1,22 +0,0 @@ --#ifdef HAVE_XORG_CONFIG_H --#include --#endif -- --#include "xf86.h" --#include "xf86str.h" --#include "vbe.h" -- --static XF86ModuleVersionInfo vbeVersRec = { -- "vbe", -- MODULEVENDORSTRING, -- MODINFOSTRING1, -- MODINFOSTRING2, -- XORG_VERSION_CURRENT, -- 1, 1, 0, -- ABI_CLASS_VIDEODRV, /* needs the video driver ABI */ -- ABI_VIDEODRV_VERSION, -- MOD_CLASS_NONE, -- {0, 0, 0, 0} --}; -- --_X_EXPORT XF86ModuleData vbeModuleData = { &vbeVersRec, NULL, NULL }; -diff --git a/meson.build b/meson.build -index ea45ca3..2fa3f86 100644 ---- a/meson.build -+++ b/meson.build -@@ -350,17 +350,6 @@ endif - - build_modesetting = libdrm_dep.found() and dri2proto_dep.found() - --build_vbe = false --if get_option('vbe') == 'auto' -- if (host_machine.system() != 'darwin' and -- host_machine.system() != 'windows' and -- host_machine.system() != 'cygwin') -- build_vbe = true -- endif --else -- build_vbe = get_option('vbe') == 'true' --endif -- - build_vgahw = false - if get_option('vgahw') == 'auto' - if (host_machine.system() != 'darwin' and -diff --git a/meson_options.txt b/meson_options.txt -index 3453b8d..5782aba 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -64,8 +64,6 @@ option('hal', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', - description: 'Enable HAL integration') - option('systemd_logind', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', - description: 'Enable systemd-logind integration') --option('vbe', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', -- description: 'Xorg VBE module') - option('vgahw', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', - description: 'Xorg VGA access module') - option('dpms', type: 'boolean', value: true, --- -1.8.3.1 - diff --git a/1003-loader-Move-LoaderSymbolFromModule-to-public-API.patch b/1003-loader-Move-LoaderSymbolFromModule-to-public-API.patch deleted file mode 100644 index 7c4d4ab34770fd7e5f83c0016d08009e8b7f29c4..0000000000000000000000000000000000000000 --- a/1003-loader-Move-LoaderSymbolFromModule-to-public-API.patch +++ /dev/null @@ -1,40 +0,0 @@ -From ea3823107aad5940f711b1f58bb9e43d624d55d9 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Tue, 8 Oct 2019 13:29:22 -0400 -Subject: [PATCH 1003/1005] loader: Move LoaderSymbolFromModule() to public API - -Bare LoaderSymbol() isn't really a great API, this is more of a direct -map to dlsym like you want. - -Gitlab: https://gitlab.freedesktop.org/xorg/xserver/issues/692 ---- - hw/xfree86/common/xf86Module.h | 1 + - hw/xfree86/loader/loader.h | 1 - - 2 files changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h -index 00aa84a..fab8842 100644 ---- a/hw/xfree86/common/xf86Module.h -+++ b/hw/xfree86/common/xf86Module.h -@@ -156,6 +156,7 @@ extern _X_EXPORT void *LoadSubModule(void *, const char *, const char **, - extern _X_EXPORT void UnloadSubModule(void *); - extern _X_EXPORT void UnloadModule(void *); - extern _X_EXPORT void *LoaderSymbol(const char *); -+extern _X_EXPORT void *LoaderSymbolFromModule(void *, const char *); - extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int); - extern _X_EXPORT Bool LoaderShouldIgnoreABI(void); - extern _X_EXPORT int LoaderGetABIVersion(const char *abiclass); -diff --git a/hw/xfree86/loader/loader.h b/hw/xfree86/loader/loader.h -index 5a2fe6c..4e83730 100644 ---- a/hw/xfree86/loader/loader.h -+++ b/hw/xfree86/loader/loader.h -@@ -72,6 +72,5 @@ extern unsigned long LoaderOptions; - - /* Internal Functions */ - void *LoaderOpen(const char *, int *); --void *LoaderSymbolFromModule(void *, const char *); - - #endif /* _LOADER_H */ --- -1.8.3.1 - diff --git a/1004-modesetting-Indirect-the-shadow-API-through-LoaderSy.patch b/1004-modesetting-Indirect-the-shadow-API-through-LoaderSy.patch deleted file mode 100644 index f71fece53a56bf1f597033c7930bbedfafa9c690..0000000000000000000000000000000000000000 --- a/1004-modesetting-Indirect-the-shadow-API-through-LoaderSy.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 0ee3947ee9eb6a5417cbf702f495585d5d304efc Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Tue, 8 Oct 2019 12:52:28 -0400 -Subject: [PATCH 1004/1005] modesetting: Indirect the shadow API through - LoaderSymbol - -Prerequisite for building all of xserver with -z now. - -Gitlab: https://gitlab.freedesktop.org/xorg/xserver/issues/692 ---- - hw/xfree86/drivers/modesetting/driver.c | 34 +++++++++++++++------------------ - hw/xfree86/drivers/modesetting/driver.h | 12 +++++++++++- - 2 files changed, 26 insertions(+), 20 deletions(-) - -diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c -index 5dc8e20..b3e913a 100644 ---- a/hw/xfree86/drivers/modesetting/driver.c -+++ b/hw/xfree86/drivers/modesetting/driver.c -@@ -50,7 +50,6 @@ - #include "xf86Crtc.h" - #include "miscstruct.h" - #include "dixstruct.h" --#include "shadow.h" - #include "xf86xv.h" - #include - #include -@@ -60,7 +59,6 @@ - #ifdef XSERVER_LIBPCIACCESS - #include - #endif -- - #include "driver.h" - - static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y); -@@ -1092,9 +1090,16 @@ PreInit(ScrnInfoPtr pScrn, int flags) - } - - if (ms->drmmode.shadow_enable) { -- if (!xf86LoadSubModule(pScrn, "shadow")) { -+ void *mod = xf86LoadSubModule(pScrn, "shadow"); -+ -+ if (!mod) - return FALSE; -- } -+ -+ ms->shadow.Setup = LoaderSymbolFromModule(mod, "shadowSetup"); -+ ms->shadow.Add = LoaderSymbolFromModule(mod, "shadowAdd"); -+ ms->shadow.Remove = LoaderSymbolFromModule(mod, "shadowRemove"); -+ ms->shadow.Update32to24 = LoaderSymbolFromModule(mod, "shadowUpdate32to24"); -+ ms->shadow.UpdatePacked = LoaderSymbolFromModule(mod, "shadowUpdatePacked"); - } - - return TRUE; -@@ -1199,9 +1204,9 @@ msUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf) - } while (0); - - if (use_3224) -- shadowUpdate32to24(pScreen, pBuf); -+ ms->shadow.Update32to24(pScreen, pBuf); - else -- shadowUpdatePacked(pScreen, pBuf); -+ ms->shadow.UpdatePacked(pScreen, pBuf); - } - - static Bool -@@ -1388,8 +1393,8 @@ CreateScreenResources(ScreenPtr pScreen) - FatalError("Couldn't adjust screen pixmap\n"); - - if (ms->drmmode.shadow_enable) { -- if (!shadowAdd(pScreen, rootPixmap, msUpdatePacked, msShadowWindow, -- 0, 0)) -+ if (!ms->shadow.Add(pScreen, rootPixmap, msUpdatePacked, msShadowWindow, -+ 0, 0)) - return FALSE; - } - -@@ -1424,15 +1429,6 @@ CreateScreenResources(ScreenPtr pScreen) - } - - static Bool --msShadowInit(ScreenPtr pScreen) --{ -- if (!shadowSetup(pScreen)) { -- return FALSE; -- } -- return TRUE; --} -- --static Bool - msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle) - { - #ifdef GLAMOR_HAS_GBM -@@ -1651,7 +1647,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv) - return FALSE; - } - -- if (ms->drmmode.shadow_enable && !msShadowInit(pScreen)) { -+ if (ms->drmmode.shadow_enable && !ms->shadow.Setup(pScreen)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "shadow fb init failed\n"); - return FALSE; - } -@@ -1895,7 +1891,7 @@ CloseScreen(ScreenPtr pScreen) - } - - if (ms->drmmode.shadow_enable) { -- shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen)); -+ ms->shadow.Remove(pScreen, pScreen->GetScreenPixmap(pScreen)); - free(ms->drmmode.shadow_fb); - ms->drmmode.shadow_fb = NULL; - free(ms->drmmode.shadow_fb2); -diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h -index 28810c0..91b8f1f 100644 ---- a/hw/xfree86/drivers/modesetting/driver.h -+++ b/hw/xfree86/drivers/modesetting/driver.h -@@ -33,7 +33,7 @@ - #include - #include - #include -- -+#include - #ifdef GLAMOR_HAS_GBM - #define GLAMOR_FOR_XORG 1 - #include "glamor.h" -@@ -123,6 +123,16 @@ typedef struct _modesettingRec { - - Bool kms_has_modifiers; - -+ /* shadow API */ -+ struct { -+ Bool (*Setup)(ScreenPtr); -+ Bool (*Add)(ScreenPtr, PixmapPtr, ShadowUpdateProc, ShadowWindowProc, -+ int, void *); -+ void (*Remove)(ScreenPtr, PixmapPtr); -+ void (*Update32to24)(ScreenPtr, shadowBufPtr); -+ void (*UpdatePacked)(ScreenPtr, shadowBufPtr); -+ } shadow; -+ - } modesettingRec, *modesettingPtr; - - #define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate)) --- -1.8.3.1 - diff --git a/1005-modesetting-Indirect-the-glamor-API-through-LoaderSy.patch b/1005-modesetting-Indirect-the-glamor-API-through-LoaderSy.patch deleted file mode 100644 index 84efec4327a051cb50096104f357986b871e35f1..0000000000000000000000000000000000000000 --- a/1005-modesetting-Indirect-the-glamor-API-through-LoaderSy.patch +++ /dev/null @@ -1,322 +0,0 @@ -From 2acec1ff38d80a317181453c78ae7a5c5d110285 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Tue, 8 Oct 2019 13:11:09 -0400 -Subject: [PATCH 1005/1005] modesetting: Indirect the glamor API through - LoaderSymbol - -Prerequisite for building all of xserver with -z now. - -Gitlab: https://gitlab.freedesktop.org/xorg/xserver/issues/692 ---- - hw/xfree86/drivers/modesetting/dri2.c | 10 +++-- - hw/xfree86/drivers/modesetting/driver.c | 49 ++++++++++++++++++------ - hw/xfree86/drivers/modesetting/driver.h | 24 ++++++++++++ - hw/xfree86/drivers/modesetting/drmmode_display.c | 15 +++++--- - hw/xfree86/drivers/modesetting/pageflip.c | 4 +- - hw/xfree86/drivers/modesetting/present.c | 4 +- - 6 files changed, 81 insertions(+), 25 deletions(-) - -diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c -index d89904b..724d9d3 100644 ---- a/hw/xfree86/drivers/modesetting/dri2.c -+++ b/hw/xfree86/drivers/modesetting/dri2.c -@@ -123,6 +123,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable, - unsigned int attachment, unsigned int format) - { - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); -+ modesettingPtr ms = modesettingPTR(scrn); - DRI2Buffer2Ptr buffer; - PixmapPtr pixmap; - CARD32 size; -@@ -200,7 +201,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable, - */ - buffer->flags = 0; - -- buffer->name = glamor_name_from_pixmap(pixmap, &pitch, &size); -+ buffer->name = ms->glamor.name_from_pixmap(pixmap, &pitch, &size); - buffer->pitch = pitch; - if (buffer->name == -1) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, -@@ -509,11 +510,12 @@ update_front(DrawablePtr draw, DRI2BufferPtr front) - ScreenPtr screen = draw->pScreen; - PixmapPtr pixmap = get_drawable_pixmap(draw); - ms_dri2_buffer_private_ptr priv = front->driverPrivate; -+ modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen)); - CARD32 size; - CARD16 pitch; - int name; - -- name = glamor_name_from_pixmap(pixmap, &pitch, &size); -+ name = ms->glamor.name_from_pixmap(pixmap, &pitch, &size); - if (name < 0) - return FALSE; - -@@ -617,7 +619,7 @@ ms_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front, - *front_pix = *back_pix; - *back_pix = tmp_pix; - -- glamor_egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap); -+ ms->glamor.egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap); - - /* Post damage on the front buffer so that listeners, such - * as DisplayLink know take a copy and shove it over the USB. -@@ -1036,7 +1038,7 @@ ms_dri2_screen_init(ScreenPtr screen) - DRI2InfoRec info; - const char *driver_names[2] = { NULL, NULL }; - -- if (!glamor_supports_pixmap_import_export(screen)) { -+ if (!ms->glamor.supports_pixmap_import_export(screen)) { - xf86DrvMsg(scrn->scrnIndex, X_WARNING, - "DRI2: glamor lacks support for pixmap import/export\n"); - } -diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c -index b3e913a..6cb723f 100644 ---- a/hw/xfree86/drivers/modesetting/driver.c -+++ b/hw/xfree86/drivers/modesetting/driver.c -@@ -615,7 +615,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty, int *timeout) - * the shared pixmap, but not all). - */ - if (ms->drmmode.glamor) -- glamor_finish(screen); -+ ms->glamor.finish(screen); - #endif - /* Ensure the slave processes the damage immediately */ - if (timeout) -@@ -744,6 +744,26 @@ FreeRec(ScrnInfoPtr pScrn) - } - - static void -+bind_glamor_api(void *mod, modesettingPtr ms) -+{ -+ ms->glamor.back_pixmap_from_fd = LoaderSymbolFromModule(mod, "glamor_back_pixmap_from_fd"); -+ ms->glamor.block_handler = LoaderSymbolFromModule(mod, "glamor_block_handler"); -+ ms->glamor.egl_create_textured_pixmap = LoaderSymbolFromModule(mod, "glamor_egl_create_textured_pixmap"); -+ ms->glamor.egl_create_textured_pixmap_from_gbm_bo = LoaderSymbolFromModule(mod, "glamor_egl_create_textured_pixmap_from_gbm_bo"); -+ ms->glamor.egl_exchange_buffers = LoaderSymbolFromModule(mod, "glamor_egl_exchange_buffers"); -+ ms->glamor.egl_get_gbm_device = LoaderSymbolFromModule(mod, "glamor_egl_get_gbm_device"); -+ ms->glamor.egl_init = LoaderSymbolFromModule(mod, "glamor_egl_init"); -+ ms->glamor.finish = LoaderSymbolFromModule(mod, "glamor_finish"); -+ ms->glamor.gbm_bo_from_pixmap = LoaderSymbolFromModule(mod, "glamor_gbm_bo_from_pixmap"); -+ ms->glamor.init = LoaderSymbolFromModule(mod, "glamor_init"); -+ ms->glamor.name_from_pixmap = LoaderSymbolFromModule(mod, "glamor_name_from_pixmap"); -+ ms->glamor.set_drawable_modifiers_func = LoaderSymbolFromModule(mod, "glamor_set_drawable_modifiers_func"); -+ ms->glamor.shareable_fd_from_pixmap = LoaderSymbolFromModule(mod, "glamor_shareable_fd_from_pixmap"); -+ ms->glamor.supports_pixmap_import_export = LoaderSymbolFromModule(mod, "glamor_supports_pixmap_import_export"); -+ ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init"); -+} -+ -+static void - try_enable_glamor(ScrnInfoPtr pScrn) - { - modesettingPtr ms = modesettingPTR(pScrn); -@@ -751,6 +771,7 @@ try_enable_glamor(ScrnInfoPtr pScrn) - OPTION_ACCEL_METHOD); - Bool do_glamor = (!accel_method_str || - strcmp(accel_method_str, "glamor") == 0); -+ void *mod; - - ms->drmmode.glamor = FALSE; - -@@ -765,8 +786,10 @@ try_enable_glamor(ScrnInfoPtr pScrn) - return; - } - -- if (xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME)) { -- if (glamor_egl_init(pScrn, ms->fd)) { -+ mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME); -+ if (mod) { -+ bind_glamor_api(mod, ms); -+ if (ms->glamor.egl_init(pScrn, ms->fd)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n"); - ms->drmmode.glamor = TRUE; - } else { -@@ -1432,11 +1455,12 @@ static Bool - msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle) - { - #ifdef GLAMOR_HAS_GBM -+ modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen)); - int ret; - CARD16 stride; - CARD32 size; -- ret = glamor_shareable_fd_from_pixmap(ppix->drawable.pScreen, ppix, -- &stride, &size); -+ ret = ms->glamor.shareable_fd_from_pixmap(ppix->drawable.pScreen, ppix, -+ &stride, &size); - if (ret == -1) - return FALSE; - -@@ -1461,11 +1485,12 @@ msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle) - return drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, 0, 0); - - if (ms->drmmode.reverse_prime_offload_mode) { -- ret = glamor_back_pixmap_from_fd(ppix, ihandle, -- ppix->drawable.width, -- ppix->drawable.height, -- ppix->devKind, ppix->drawable.depth, -- ppix->drawable.bitsPerPixel); -+ ret = ms->glamor.back_pixmap_from_fd(ppix, ihandle, -+ ppix->drawable.width, -+ ppix->drawable.height, -+ ppix->devKind, -+ ppix->drawable.depth, -+ ppix->drawable.bitsPerPixel); - } else { - int size = ppix->devKind * ppix->drawable.height; - ret = drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, ppix->devKind, size); -@@ -1582,7 +1607,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv) - - #ifdef GLAMOR_HAS_GBM - if (ms->drmmode.glamor) -- ms->drmmode.gbm = glamor_egl_get_gbm_device(pScreen); -+ ms->drmmode.gbm = ms->glamor.egl_get_gbm_device(pScreen); - #endif - - /* HW dependent - FIXME */ -@@ -1726,7 +1751,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv) - if (ms->drmmode.glamor) { - XF86VideoAdaptorPtr glamor_adaptor; - -- glamor_adaptor = glamor_xv_init(pScreen, 16); -+ glamor_adaptor = ms->glamor.xv_init(pScreen, 16); - if (glamor_adaptor != NULL) - xf86XVScreenInit(pScreen, &glamor_adaptor, 1); - else -diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h -index 91b8f1f..dffac7f 100644 ---- a/hw/xfree86/drivers/modesetting/driver.h -+++ b/hw/xfree86/drivers/modesetting/driver.h -@@ -133,6 +133,30 @@ typedef struct _modesettingRec { - void (*UpdatePacked)(ScreenPtr, shadowBufPtr); - } shadow; - -+ /* glamor API */ -+ struct { -+ Bool (*back_pixmap_from_fd)(PixmapPtr, int, CARD16, CARD16, CARD16, -+ CARD8, CARD8); -+ void (*block_handler)(ScreenPtr); -+ Bool (*egl_create_textured_pixmap)(PixmapPtr, int, int); -+ Bool (*egl_create_textured_pixmap_from_gbm_bo)(PixmapPtr, -+ struct gbm_bo *, -+ Bool); -+ void (*egl_exchange_buffers)(PixmapPtr, PixmapPtr); -+ struct gbm_device *(*egl_get_gbm_device)(ScreenPtr); -+ Bool (*egl_init)(ScrnInfoPtr, int); -+ void (*finish)(ScreenPtr); -+ struct gbm_bo *(*gbm_bo_from_pixmap)(ScreenPtr, PixmapPtr); -+ Bool (*init)(ScreenPtr, unsigned int); -+ int (*name_from_pixmap)(PixmapPtr, CARD16 *, CARD32 *); -+ void (*set_drawable_modifiers_func)(ScreenPtr, -+ GetDrawableModifiersFuncPtr); -+ int (*shareable_fd_from_pixmap)(ScreenPtr, PixmapPtr, CARD16 *, -+ CARD32 *); -+ Bool (*supports_pixmap_import_export)(ScreenPtr); -+ XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int); -+ } glamor; -+ - } modesettingRec, *modesettingPtr; - - #define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate)) -diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c -index 6f5f8ca..6516fac 100644 ---- a/hw/xfree86/drivers/modesetting/drmmode_display.c -+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c -@@ -1385,6 +1385,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id) - PixmapPtr pixmap = drmmode->fbcon_pixmap; - drmModeFBPtr fbcon; - ScreenPtr pScreen = xf86ScrnToScreen(pScrn); -+ modesettingPtr ms = modesettingPTR(pScrn); - Bool ret; - - if (pixmap) -@@ -1405,7 +1406,8 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id) - if (!pixmap) - goto out_free_fb; - -- ret = glamor_egl_create_textured_pixmap(pixmap, fbcon->handle, fbcon->pitch); -+ ret = ms->glamor.egl_create_textured_pixmap(pixmap, fbcon->handle, -+ fbcon->pitch); - if (!ret) { - FreePixmap(pixmap); - pixmap = NULL; -@@ -1424,6 +1426,7 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) - #ifdef GLAMOR_HAS_GBM - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - ScreenPtr pScreen = xf86ScrnToScreen(pScrn); -+ modesettingPtr ms = modesettingPTR(pScrn); - PixmapPtr src, dst; - int fbcon_id = 0; - GCPtr gc; -@@ -3108,12 +3111,13 @@ drmmode_set_pixmap_bo(drmmode_ptr drmmode, PixmapPtr pixmap, drmmode_bo *bo) - { - #ifdef GLAMOR_HAS_GBM - ScrnInfoPtr scrn = drmmode->scrn; -+ modesettingPtr ms = modesettingPTR(scrn); - - if (!drmmode->glamor) - return TRUE; - -- if (!glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo->gbm, -- bo->used_modifiers)) { -+ if (!ms->glamor.egl_create_textured_pixmap_from_gbm_bo(pixmap, bo->gbm, -+ bo->used_modifiers)) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create pixmap\n"); - return FALSE; - } -@@ -3436,13 +3440,14 @@ drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode) - { - #ifdef GLAMOR_HAS_GBM - ScreenPtr pScreen = xf86ScrnToScreen(pScrn); -+ modesettingPtr ms = modesettingPTR(pScrn); - - if (drmmode->glamor) { -- if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) { -+ if (!ms->glamor.init(pScreen, GLAMOR_USE_EGL_SCREEN)) { - return FALSE; - } - #ifdef GBM_BO_WITH_MODIFIERS -- glamor_set_drawable_modifiers_func(pScreen, get_drawable_modifiers); -+ ms->glamor.set_drawable_modifiers_func(pScreen, get_drawable_modifiers); - #endif - } - #endif -diff --git a/hw/xfree86/drivers/modesetting/pageflip.c b/hw/xfree86/drivers/modesetting/pageflip.c -index 1d54816..841fa91 100644 ---- a/hw/xfree86/drivers/modesetting/pageflip.c -+++ b/hw/xfree86/drivers/modesetting/pageflip.c -@@ -243,9 +243,9 @@ ms_do_pageflip(ScreenPtr screen, - uint32_t flags; - int i; - struct ms_flipdata *flipdata; -- glamor_block_handler(screen); -+ ms->glamor.block_handler(screen); - -- new_front_bo.gbm = glamor_gbm_bo_from_pixmap(screen, new_front); -+ new_front_bo.gbm = ms->glamor.gbm_bo_from_pixmap(screen, new_front); - new_front_bo.dumb = NULL; - - if (!new_front_bo.gbm) { -diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c -index f7a4753..2f683a1 100644 ---- a/hw/xfree86/drivers/modesetting/present.c -+++ b/hw/xfree86/drivers/modesetting/present.c -@@ -166,7 +166,7 @@ ms_present_flush(WindowPtr window) - modesettingPtr ms = modesettingPTR(scrn); - - if (ms->drmmode.glamor) -- glamor_block_handler(screen); -+ ms->glamor.block_handler(screen); - #endif - } - -@@ -265,7 +265,7 @@ ms_present_check_unflip(RRCrtcPtr crtc, - - #ifdef GBM_BO_WITH_MODIFIERS - /* Check if buffer format/modifier is supported by all active CRTCs */ -- gbm = glamor_gbm_bo_from_pixmap(screen, pixmap); -+ gbm = ms->glamor.gbm_bo_from_pixmap(screen, pixmap); - if (gbm) { - uint32_t format; - uint64_t modifier; --- -1.8.3.1 - diff --git a/1006-link-gbm-lib.patch b/1006-link-gbm-lib.patch deleted file mode 100644 index b787104e6276ad489cc076c60ea51ca8a6bdccf3..0000000000000000000000000000000000000000 --- a/1006-link-gbm-lib.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 29fbc931b510371c25015f6f031756ee086e813e Mon Sep 17 00:00:00 2001 -From: Liwei Ge -Date: Thu, 13 Apr 2023 18:35:47 +0800 -Subject: [PATCH] link gbm lib - -Signed-off-by: Liwei Ge ---- - hw/xfree86/drivers/modesetting/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/xfree86/drivers/modesetting/Makefile.am b/hw/xfree86/drivers/modesetting/Makefile.am -index 961c574..ac5091b 100644 ---- a/hw/xfree86/drivers/modesetting/Makefile.am -+++ b/hw/xfree86/drivers/modesetting/Makefile.am -@@ -41,7 +41,7 @@ AM_CPPFLAGS = \ - - modesetting_drv_la_LTLIBRARIES = modesetting_drv.la - modesetting_drv_la_LDFLAGS = -module -avoid-version --modesetting_drv_la_LIBADD = $(UDEV_LIBS) $(DRM_LIBS) -+modesetting_drv_la_LIBADD = $(UDEV_LIBS) $(DRM_LIBS) $(GBM_LIBS) - modesetting_drv_ladir = @moduledir@/drivers - - modesetting_drv_la_SOURCES = \ --- -1.8.3.1 - diff --git a/1007-do-not-link-glamor-directly.patch b/1007-do-not-link-glamor-directly.patch deleted file mode 100644 index 24ce37e5e562386cd67239a7a4e40a86593656a2..0000000000000000000000000000000000000000 --- a/1007-do-not-link-glamor-directly.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 1e4531aec20f604a6e13cc65d91393fe8d6d7839 Mon Sep 17 00:00:00 2001 -From: Liwei Ge -Date: Fri, 14 Apr 2023 20:30:42 +0800 -Subject: [PATCH] do not link glamor directly - -Signed-off-by: Liwei Ge ---- - hw/xfree86/drivers/modesetting/dri2.c | 2 +- - hw/xfree86/drivers/modesetting/driver.c | 1 + - hw/xfree86/drivers/modesetting/driver.h | 1 + - hw/xfree86/drivers/modesetting/drmmode_display.c | 2 +- - 4 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c -index 724d9d3..c484d36 100644 ---- a/hw/xfree86/drivers/modesetting/dri2.c -+++ b/hw/xfree86/drivers/modesetting/dri2.c -@@ -1076,7 +1076,7 @@ ms_dri2_screen_init(ScreenPtr screen) - info.CopyRegion2 = ms_dri2_copy_region2; - - /* Ask Glamor to obtain the DRI driver name via EGL_MESA_query_driver. */ -- driver_names[0] = glamor_egl_get_driver_name(screen); -+ driver_names[0] = ms->glamor.egl_get_driver_name(screen); - - if (driver_names[0]) { - /* There is no VDPAU driver for Intel, fallback to the generic -diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c -index 6cb723f..aef0993 100644 ---- a/hw/xfree86/drivers/modesetting/driver.c -+++ b/hw/xfree86/drivers/modesetting/driver.c -@@ -761,6 +761,7 @@ bind_glamor_api(void *mod, modesettingPtr ms) - ms->glamor.shareable_fd_from_pixmap = LoaderSymbolFromModule(mod, "glamor_shareable_fd_from_pixmap"); - ms->glamor.supports_pixmap_import_export = LoaderSymbolFromModule(mod, "glamor_supports_pixmap_import_export"); - ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init"); -+ ms->glamor.egl_get_driver_name = LoaderSymbolFromModule(mod, "glamor_egl_get_driver_name"); - } - - static void -diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h -index dffac7f..bde4f7a 100644 ---- a/hw/xfree86/drivers/modesetting/driver.h -+++ b/hw/xfree86/drivers/modesetting/driver.h -@@ -155,6 +155,7 @@ typedef struct _modesettingRec { - CARD32 *); - Bool (*supports_pixmap_import_export)(ScreenPtr); - XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int); -+ const char *(*egl_get_driver_name)(ScreenPtr); - } glamor; - - } modesettingRec, *modesettingPtr; -diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c -index 6516fac..28609db 100644 ---- a/hw/xfree86/drivers/modesetting/drmmode_display.c -+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c -@@ -770,7 +770,7 @@ drmmode_crtc_set_mode(xf86CrtcPtr crtc, Bool test_only) - #ifdef GLAMOR_HAS_GBM - /* Make sure any pending drawing will be visible in a new scanout buffer */ - if (drmmode->glamor) -- glamor_finish(screen); -+ ms->glamor.finish(screen); - #endif - - if (ms->atomic_modeset) { --- -1.8.3.1 - diff --git a/1008-Use-glamor_clear_pixmap-in-drmmode_clear_pixmap.patch b/1008-Use-glamor_clear_pixmap-in-drmmode_clear_pixmap.patch deleted file mode 100644 index b804ec69417a1b9cdc4407c01a46a7ec8559ecf8..0000000000000000000000000000000000000000 --- a/1008-Use-glamor_clear_pixmap-in-drmmode_clear_pixmap.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 60003023fa5b301dd621da4797f8a93035ebeeca Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michel=20D=C3=A4nzer?= -Date: Fri, 22 Nov 2019 18:32:38 +0100 -Subject: [PATCH] modesetting: Use glamor_clear_pixmap in drmmode_clear_pixmap - -Should be slightly more efficient. - -Reviewed-by: Adam Jackson ---- - hw/xfree86/drivers/modesetting/driver.c | 1 + - hw/xfree86/drivers/modesetting/driver.h | 1 + - hw/xfree86/drivers/modesetting/drmmode_display.c | 8 ++++++++ - 3 files changed, 10 insertions(+) - -diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c -index 386e33460d..6c7d7eaf06 100644 ---- a/hw/xfree86/drivers/modesetting/driver.c -+++ b/hw/xfree86/drivers/modesetting/driver.c -@@ -748,6 +748,7 @@ bind_glamor_api(void *mod, modesettingPtr ms) - { - ms->glamor.back_pixmap_from_fd = LoaderSymbolFromModule(mod, "glamor_back_pixmap_from_fd"); - ms->glamor.block_handler = LoaderSymbolFromModule(mod, "glamor_block_handler"); -+ ms->glamor.clear_pixmap = LoaderSymbolFromModule(mod, "glamor_clear_pixmap"); - ms->glamor.egl_create_textured_pixmap = LoaderSymbolFromModule(mod, "glamor_egl_create_textured_pixmap"); - ms->glamor.egl_create_textured_pixmap_from_gbm_bo = LoaderSymbolFromModule(mod, "glamor_egl_create_textured_pixmap_from_gbm_bo"); - ms->glamor.egl_exchange_buffers = LoaderSymbolFromModule(mod, "glamor_egl_exchange_buffers"); -diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h -index 4c524c4eb3..5909829a04 100644 ---- a/hw/xfree86/drivers/modesetting/driver.h -+++ b/hw/xfree86/drivers/modesetting/driver.h -@@ -137,6 +137,7 @@ typedef struct _modesettingRec { - Bool (*back_pixmap_from_fd)(PixmapPtr, int, CARD16, CARD16, CARD16, - CARD8, CARD8); - void (*block_handler)(ScreenPtr); -+ void (*clear_pixmap)(PixmapPtr); - Bool (*egl_create_textured_pixmap)(PixmapPtr, int, int); - Bool (*egl_create_textured_pixmap_from_gbm_bo)(PixmapPtr, - struct gbm_bo *, -diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c -index 8a9dc2d800..9a6abc2498 100644 ---- a/hw/xfree86/drivers/modesetting/drmmode_display.c -+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c -@@ -1804,6 +1804,14 @@ drmmode_clear_pixmap(PixmapPtr pixmap) - { - ScreenPtr screen = pixmap->drawable.pScreen; - GCPtr gc; -+#ifdef GLAMOR_HAS_GBM -+ modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen)); -+ -+ if (ms->drmmode.glamor) { -+ ms->glamor.clear_pixmap(pixmap); -+ return; -+ } -+#endif - - gc = GetScratchGC(pixmap->drawable.depth, screen); - if (gc) { --- -GitLab - diff --git a/1009-Fix-build-with-glamor-disabled.patch b/1009-Fix-build-with-glamor-disabled.patch deleted file mode 100644 index 5119346e812607b3637e54e4ae8989ef89d1f1bd..0000000000000000000000000000000000000000 --- a/1009-Fix-build-with-glamor-disabled.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0cb9fa7949d6c5398de220fbdbe1e262e943fcbb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michel=20D=C3=A4nzer?= -Date: Mon, 10 Feb 2020 18:41:44 +0100 -Subject: [PATCH] modesetting: Fix build with glamor disabled - -Fixes: cb1b1e184723 "modesetting: Indirect the glamor API through - LoaderSymbol" -Reviewed-by: Adam Jackson ---- - hw/xfree86/drivers/modesetting/driver.c | 21 +++++++++++++++------ - hw/xfree86/drivers/modesetting/driver.h | 3 ++- - 2 files changed, 17 insertions(+), 7 deletions(-) - -diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c -index d00e4a739e..0c1867f02d 100644 ---- a/hw/xfree86/drivers/modesetting/driver.c -+++ b/hw/xfree86/drivers/modesetting/driver.c -@@ -743,9 +743,17 @@ FreeRec(ScrnInfoPtr pScrn) - - } - --static void --bind_glamor_api(void *mod, modesettingPtr ms) -+#ifdef GLAMOR_HAS_GBM -+ -+static Bool -+load_glamor(ScrnInfoPtr pScrn) - { -+ void *mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME); -+ modesettingPtr ms = modesettingPTR(pScrn); -+ -+ if (!mod) -+ return FALSE; -+ - ms->glamor.back_pixmap_from_fd = LoaderSymbolFromModule(mod, "glamor_back_pixmap_from_fd"); - ms->glamor.block_handler = LoaderSymbolFromModule(mod, "glamor_block_handler"); - ms->glamor.clear_pixmap = LoaderSymbolFromModule(mod, "glamor_clear_pixmap"); -@@ -763,8 +771,12 @@ bind_glamor_api(void *mod, modesettingPtr ms) - ms->glamor.supports_pixmap_import_export = LoaderSymbolFromModule(mod, "glamor_supports_pixmap_import_export"); - ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init"); - ms->glamor.egl_get_driver_name = LoaderSymbolFromModule(mod, "glamor_egl_get_driver_name"); -+ -+ return TRUE; - } - -+#endif -+ - static void - try_enable_glamor(ScrnInfoPtr pScrn) - { -@@ -773,7 +785,6 @@ try_enable_glamor(ScrnInfoPtr pScrn) - OPTION_ACCEL_METHOD); - Bool do_glamor = (!accel_method_str || - strcmp(accel_method_str, "glamor") == 0); -- void *mod; - - ms->drmmode.glamor = FALSE; - -@@ -788,9 +799,7 @@ try_enable_glamor(ScrnInfoPtr pScrn) - return; - } - -- mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME); -- if (mod) { -- bind_glamor_api(mod, ms); -+ if (load_glamor(pScrn)) { - if (ms->glamor.egl_init(pScrn, ms->fd)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n"); - ms->drmmode.glamor = TRUE; -diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h -index 60e4aaa96b..7ee9f6827f 100644 ---- a/hw/xfree86/drivers/modesetting/driver.h -+++ b/hw/xfree86/drivers/modesetting/driver.h -@@ -132,6 +132,7 @@ typedef struct _modesettingRec { - void (*UpdatePacked)(ScreenPtr, shadowBufPtr); - } shadow; - -+#ifdef GLAMOR_HAS_GBM - /* glamor API */ - struct { - Bool (*back_pixmap_from_fd)(PixmapPtr, int, CARD16, CARD16, CARD16, -@@ -157,7 +158,7 @@ typedef struct _modesettingRec { - XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int); - const char *(*egl_get_driver_name)(ScreenPtr); - } glamor; -- -+#endif - } modesettingRec, *modesettingPtr; - - #define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate)) --- -GitLab - diff --git a/1010-Make-LoaderSymbolFromModule-take-a-ModuleDescPtr.patch b/1010-Make-LoaderSymbolFromModule-take-a-ModuleDescPtr.patch deleted file mode 100644 index 610fea2f0f61798a9c5864306f7703716a907c06..0000000000000000000000000000000000000000 --- a/1010-Make-LoaderSymbolFromModule-take-a-ModuleDescPtr.patch +++ /dev/null @@ -1,48 +0,0 @@ -From ab61c16ef07fde6eb7110c63c344c54eb2a2d117 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Mon, 18 Nov 2019 16:43:50 -0500 -Subject: [PATCH] loader: Make LoaderSymbolFromModule take a ModuleDescPtr -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The thing you get back from xf86LoadSubModule is a ModuleDescPtr, not a -dlsym handle. We don't expose ModuleDescPtr to the drivers, so change -LoaderSymbolFromModule to cast its void * argument to a ModuleDescPtr. - -Reviewed-by: Michel Dänzer ---- - hw/xfree86/loader/loader.c | 3 ++- - hw/xfree86/loader/loadmod.c | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c -index 503c47e3ab..2580e93d9b 100644 ---- a/hw/xfree86/loader/loader.c -+++ b/hw/xfree86/loader/loader.c -@@ -135,7 +135,8 @@ LoaderSymbol(const char *name) - void * - LoaderSymbolFromModule(void *handle, const char *name) - { -- return dlsym(handle, name); -+ ModuleDescPtr mod = handle; -+ return dlsym(mod->handle, name); - } - - void -diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c -index a93a76aa90..81a3a1dd94 100644 ---- a/hw/xfree86/loader/loadmod.c -+++ b/hw/xfree86/loader/loadmod.c -@@ -776,7 +776,7 @@ LoadModule(const char *module, void *options, const XF86ModReqInfo *modreq, - *errmaj = LDR_NOMEM; - goto LoadModule_fail; - } -- initdata = LoaderSymbolFromModule(ret->handle, p); -+ initdata = LoaderSymbolFromModule(ret, p); - if (initdata) { - ModuleSetupProc setup; - ModuleTearDownProc teardown; --- -GitLab - diff --git a/1011-fix-call-systemd_logind_vtenter-after-receiving-drm-device-resume.patch b/1011-fix-call-systemd_logind_vtenter-after-receiving-drm-device-resume.patch deleted file mode 100644 index 33cd4e8f03235f3258dde2d47f5fffca053619b2..0000000000000000000000000000000000000000 --- a/1011-fix-call-systemd_logind_vtenter-after-receiving-drm-device-resume.patch +++ /dev/null @@ -1,49 +0,0 @@ -From f5bd039633fa8360a10bd2aabb0111571f6275b0 Mon Sep 17 00:00:00 2001 -From: Jocelyn Falempe -Date: Thu, 18 Nov 2021 14:45:42 +0100 -Subject: [PATCH] xf86/logind: fix call systemd_logind_vtenter after receiving - drm device resume - -logind send the resume event for input devices and drm device, -in any order. if we call vt_enter before logind resume the drm device, -it leads to a driver error, because logind has not done the -DRM_IOCTL_SET_MASTER on it. - -Keep the old workaround to make sure we call systemd_logind_vtenter at -least once if there are no platform device - -Signed-off-by: Jocelyn Falempe -Reviewed-by: Hans de Goede ---- - hw/xfree86/os-support/linux/systemd-logind.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c -index 9f916aa7be..fce52ff93b 100644 ---- a/hw/xfree86/os-support/linux/systemd-logind.c -+++ b/hw/xfree86/os-support/linux/systemd-logind.c -@@ -394,14 +394,16 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data) - /* info->vt_active gets set by systemd_logind_vtenter() */ - info->active = TRUE; - -- if (pdev) -+ if (pdev) { - pdev->flags &= ~XF86_PDEV_PAUSED; -- else -+ systemd_logind_vtenter(); -+ } else - systemd_logind_set_input_fd_for_all_devs(major, minor, fd, - info->vt_active); - -- /* Always call vtenter(), in case there are only legacy video devs */ -- systemd_logind_vtenter(); -+ /* Always call vtenter(), only if there are only legacy video devs */ -+ if (!xf86_num_platform_devices) -+ systemd_logind_vtenter(); - } - return DBUS_HANDLER_RESULT_HANDLED; - } --- -GitLab - - diff --git a/1012-Fix-drm_drop_master-before-vt_reldisp.patch b/1012-Fix-drm_drop_master-before-vt_reldisp.patch deleted file mode 100644 index cb4b86e52e0d6250b7240871e8c4dd1ba971d0f0..0000000000000000000000000000000000000000 --- a/1012-Fix-drm_drop_master-before-vt_reldisp.patch +++ /dev/null @@ -1,95 +0,0 @@ -From da9d012a9c760896941769d4127e3cfb1a7a9f03 Mon Sep 17 00:00:00 2001 -From: Jocelyn Falempe -Date: Thu, 18 Nov 2021 14:51:21 +0100 -Subject: [PATCH] xf86/logind: Fix drm_drop_master before vt_reldisp - -When switching to VT, the ioctl DRM_DROP_MASTER must be done before -the ioctl VT_RELDISP. Otherwise the kernel can't change the modesetting -reliably, and this leads to the console not showing up in some cases, like -after unplugging a docking station with a DP or HDMI monitor. - -Before doing the VT_RELDISP, send a dbus message to logind, to -pause the drm device, so logind will do the ioctl DRM_DROP_MASTER. - -With this patch, it changes the order logind will send the resume -event, and drm will be sent last instead of first. -so there is a also fix to call systemd_logind_vtenter() at the right time. - -Signed-off-by: Jocelyn Falempe -Reviewed-by: Hans de Goede ---- - hw/xfree86/common/xf86Events.c | 11 +++++++++++ - hw/xfree86/os-support/linux/systemd-logind.c | 14 ++++++++++++++ - include/systemd-logind.h | 2 ++ - 3 files changed, 27 insertions(+) - -diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c -index 05fa2bb902..6076efa803 100644 ---- a/hw/xfree86/common/xf86Events.c -+++ b/hw/xfree86/common/xf86Events.c -@@ -382,6 +382,17 @@ xf86VTLeave(void) - for (i = 0; i < xf86NumGPUScreens; i++) - xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]); - -+ if (systemd_logind_controls_session()) { -+ for (i = 0; i < xf86_num_platform_devices; i++) { -+ if (xf86_platform_devices[i].flags & XF86_PDEV_SERVER_FD) { -+ int major, minor; -+ major = xf86_platform_odev_attributes(i)->major; -+ minor = xf86_platform_odev_attributes(i)->minor; -+ systemd_logind_drop_master(major, minor); -+ } -+ } -+ } -+ - if (!xf86VTSwitchAway()) - goto switch_failed; - -diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c -index fce52ff93b..35d5cc75b2 100644 ---- a/hw/xfree86/os-support/linux/systemd-logind.c -+++ b/hw/xfree86/os-support/linux/systemd-logind.c -@@ -303,6 +303,20 @@ cleanup: - dbus_error_free(&error); - } - -+/* -+ * Send a message to logind, to pause the drm device -+ * and ensure the drm_drop_master is done before -+ * VT_RELDISP when switching VT -+ */ -+void systemd_logind_drop_master(int _major, int _minor) -+{ -+ struct systemd_logind_info *info = &logind_info; -+ dbus_int32_t major = _major; -+ dbus_int32_t minor = _minor; -+ -+ systemd_logind_ack_pause(info, minor, major); -+} -+ - static DBusHandlerResult - message_filter(DBusConnection * connection, DBusMessage * message, void *data) - { -diff --git a/include/systemd-logind.h b/include/systemd-logind.h -index a4067d0975..a8af2b96db 100644 ---- a/include/systemd-logind.h -+++ b/include/systemd-logind.h -@@ -33,6 +33,7 @@ int systemd_logind_take_fd(int major, int minor, const char *path, Bool *paus); - void systemd_logind_release_fd(int major, int minor, int fd); - int systemd_logind_controls_session(void); - void systemd_logind_vtenter(void); -+void systemd_logind_drop_master(int major, int minor); - #else - #define systemd_logind_init() - #define systemd_logind_fini() -@@ -40,6 +41,7 @@ void systemd_logind_vtenter(void); - #define systemd_logind_release_fd(major, minor, fd) close(fd) - #define systemd_logind_controls_session() 0 - #define systemd_logind_vtenter() -+#define systemd_logind_drop_master(major, minor) - #endif - - #endif --- -GitLab - diff --git a/1013-Fix-compilation-error-when-built-without-logind_platform-bus.patch b/1013-Fix-compilation-error-when-built-without-logind_platform-bus.patch deleted file mode 100644 index ab23ba55a65221a52dee4bed856262eed34f1b61..0000000000000000000000000000000000000000 --- a/1013-Fix-compilation-error-when-built-without-logind_platform-bus.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 9c66d910cae107cbcda02a8502ac5324a6eca052 Mon Sep 17 00:00:00 2001 -From: Jocelyn Falempe -Date: Thu, 16 Dec 2021 15:46:43 +0100 -Subject: [PATCH] xf86/logind: Fix compilation error when built without - logind/platform bus - -This was introduced by commit 8eb1396d - -Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1269 -Fixes: da9d012a9 - xf86/logind: Fix drm_drop_master before vt_reldisp - -Signed-off-by: Jocelyn Falempe -Reviewed-by: Hans de Goede ---- - hw/xfree86/common/xf86Events.c | 9 +-------- - hw/xfree86/os-support/linux/systemd-logind.c | 16 +++++++++++----- - include/systemd-logind.h | 4 ++-- - 3 files changed, 14 insertions(+), 15 deletions(-) - -diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c -index 6076efa803..395bbc7b31 100644 ---- a/hw/xfree86/common/xf86Events.c -+++ b/hw/xfree86/common/xf86Events.c -@@ -383,14 +383,7 @@ xf86VTLeave(void) - xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]); - - if (systemd_logind_controls_session()) { -- for (i = 0; i < xf86_num_platform_devices; i++) { -- if (xf86_platform_devices[i].flags & XF86_PDEV_SERVER_FD) { -- int major, minor; -- major = xf86_platform_odev_attributes(i)->major; -- minor = xf86_platform_odev_attributes(i)->minor; -- systemd_logind_drop_master(major, minor); -- } -- } -+ systemd_logind_drop_master(); - } - - if (!xf86VTSwitchAway()) -diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c -index 35d5cc75b2..f6a223a553 100644 ---- a/hw/xfree86/os-support/linux/systemd-logind.c -+++ b/hw/xfree86/os-support/linux/systemd-logind.c -@@ -308,13 +308,19 @@ cleanup: - * and ensure the drm_drop_master is done before - * VT_RELDISP when switching VT - */ --void systemd_logind_drop_master(int _major, int _minor) -+void systemd_logind_drop_master(void) - { -- struct systemd_logind_info *info = &logind_info; -- dbus_int32_t major = _major; -- dbus_int32_t minor = _minor; -+ int i; -+ for (i = 0; i < xf86_num_platform_devices; i++) { -+ if (xf86_platform_devices[i].flags & XF86_PDEV_SERVER_FD) { -+ dbus_int32_t major, minor; -+ struct systemd_logind_info *info = &logind_info; - -- systemd_logind_ack_pause(info, minor, major); -+ major = xf86_platform_odev_attributes(i)->major; -+ minor = xf86_platform_odev_attributes(i)->minor; -+ systemd_logind_ack_pause(info, minor, major); -+ } -+ } - } - - static DBusHandlerResult -diff --git a/include/systemd-logind.h b/include/systemd-logind.h -index a8af2b96db..5c04d0130a 100644 ---- a/include/systemd-logind.h -+++ b/include/systemd-logind.h -@@ -33,7 +33,7 @@ int systemd_logind_take_fd(int major, int minor, const char *path, Bool *paus); - void systemd_logind_release_fd(int major, int minor, int fd); - int systemd_logind_controls_session(void); - void systemd_logind_vtenter(void); --void systemd_logind_drop_master(int major, int minor); -+void systemd_logind_drop_master(void); - #else - #define systemd_logind_init() - #define systemd_logind_fini() -@@ -41,7 +41,7 @@ void systemd_logind_drop_master(int major, int minor); - #define systemd_logind_release_fd(major, minor, fd) close(fd) - #define systemd_logind_controls_session() 0 - #define systemd_logind_vtenter() --#define systemd_logind_drop_master(major, minor) -+#define systemd_logind_drop_master() - #endif - - #endif --- -GitLab diff --git a/1014-fix-missing-call-to-vtenter-if-the-platform-device-is-not-paused.patch b/1014-fix-missing-call-to-vtenter-if-the-platform-device-is-not-paused.patch deleted file mode 100644 index e76ff0976e10a18d3500fe5132eaa160406027f7..0000000000000000000000000000000000000000 --- a/1014-fix-missing-call-to-vtenter-if-the-platform-device-is-not-paused.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 38291fa86c00e1d3ee37612c9215b0c15da89051 Mon Sep 17 00:00:00 2001 -From: Jocelyn Falempe -Date: Fri, 17 Dec 2021 10:18:25 +0100 -Subject: [PATCH] xf86/logind: fix missing call to vtenter if the platform - device is not paused - -If there is one platform device, which is not paused nor resumed, -systemd_logind_vtenter() will never get called. -This break suspend/resume, and switching to VT on system with Nvidia -proprietary driver. -This is a regression introduced by f5bd039633fa83 - -So now call systemd_logind_vtenter() if there are no paused -platform devices. - -Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1271 -Fixes: f5bd0396 - xf86/logind: fix call systemd_logind_vtenter after receiving drm device resume - -Signed-off-by: Jocelyn Falempe -Tested-by: Olivier Fourdan -Reviewed-by: Hans de Goede ---- - hw/xfree86/os-support/linux/systemd-logind.c | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - -diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c -index f6a223a553..dbb00cd852 100644 ---- a/hw/xfree86/os-support/linux/systemd-logind.c -+++ b/hw/xfree86/os-support/linux/systemd-logind.c -@@ -316,6 +316,7 @@ void systemd_logind_drop_master(void) - dbus_int32_t major, minor; - struct systemd_logind_info *info = &logind_info; - -+ xf86_platform_devices[i].flags |= XF86_PDEV_PAUSED; - major = xf86_platform_odev_attributes(i)->major; - minor = xf86_platform_odev_attributes(i)->minor; - systemd_logind_ack_pause(info, minor, major); -@@ -323,6 +324,16 @@ void systemd_logind_drop_master(void) - } - } - -+static Bool are_platform_devices_resumed(void) { -+ int i; -+ for (i = 0; i < xf86_num_platform_devices; i++) { -+ if (xf86_platform_devices[i].flags & XF86_PDEV_PAUSED) { -+ return FALSE; -+ } -+ } -+ return TRUE; -+} -+ - static DBusHandlerResult - message_filter(DBusConnection * connection, DBusMessage * message, void *data) - { -@@ -416,13 +427,11 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data) - - if (pdev) { - pdev->flags &= ~XF86_PDEV_PAUSED; -- systemd_logind_vtenter(); - } else - systemd_logind_set_input_fd_for_all_devs(major, minor, fd, - info->vt_active); -- -- /* Always call vtenter(), only if there are only legacy video devs */ -- if (!xf86_num_platform_devices) -+ /* Call vtenter if all platform devices are resumed, or if there are no platform device */ -+ if (are_platform_devices_resumed()) - systemd_logind_vtenter(); - } - return DBUS_HANDLER_RESULT_HANDLED; --- -GitLab diff --git a/1015-x86_logind-fix-suspend_resume-when-there-are-no-input-devices.patch b/1015-x86_logind-fix-suspend_resume-when-there-are-no-input-devices.patch deleted file mode 100644 index 5a5e3b44fb2a1d1b5fc458b0366281ae393d4527..0000000000000000000000000000000000000000 --- a/1015-x86_logind-fix-suspend_resume-when-there-are-no-input-devices.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 6969782b69ffa77d21c64b57e95941d399cc2ad1 Mon Sep 17 00:00:00 2001 -From: Jocelyn Falempe -Date: Fri, 21 Oct 2022 09:06:56 +0200 -Subject: [PATCH] x86/logind fix suspend/resume when there are no input devices - -Make sure info->active and info->vt_active are false after -dropping drm master. -Normally, this is done when pausing the first input device, so it -breaks when there are no input device at all. - -Fixes: da9d012a9 ("xf86/logind: Fix drm_drop_master before vt_reldisp") -Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1387 -Signed-off-by: Jocelyn Falempe ---- - hw/xfree86/os-support/linux/systemd-logind.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c -index dbb00cd852..d97e92ff8d 100644 ---- a/hw/xfree86/os-support/linux/systemd-logind.c -+++ b/hw/xfree86/os-support/linux/systemd-logind.c -@@ -310,15 +310,19 @@ cleanup: - */ - void systemd_logind_drop_master(void) - { -+ struct systemd_logind_info *info = &logind_info; - int i; -+ /* Our VT_PROCESS usage guarantees we've already given up the vt */ -+ info->active = info->vt_active = FALSE; - for (i = 0; i < xf86_num_platform_devices; i++) { - if (xf86_platform_devices[i].flags & XF86_PDEV_SERVER_FD) { - dbus_int32_t major, minor; -- struct systemd_logind_info *info = &logind_info; - - xf86_platform_devices[i].flags |= XF86_PDEV_PAUSED; - major = xf86_platform_odev_attributes(i)->major; - minor = xf86_platform_odev_attributes(i)->minor; -+ LogMessage(X_INFO, "systemd-logind: drop master for %u:%u\n", -+ major, minor); - systemd_logind_ack_pause(info, minor, major); - } - } --- -GitLab diff --git a/driver-abi-rebuild.sh b/driver-abi-rebuild.sh new file mode 100755 index 0000000000000000000000000000000000000000..693297b96606e88cab395a1a13c59f84653a0874 --- /dev/null +++ b/driver-abi-rebuild.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# +# Trivial script to rebuild drivers for ABI changes in the server +# Run me after a new xserver has hit the buildroot + +builddir="abi-rebuild" + +if [ -e "$builddir" ]; then + echo "Path '$builddir' exists. Move out of the way first" + exit 1 +fi + +mkdir -p $builddir +pushd $builddir + +if git config --get remote.origin.url | grep -q redhat.com ; then + pkg=rhpkg +else + pkg=fedpkg +fi + +# figure out the branch we're on +branch=$(git branch | awk '/^\*/ { print $2 }' | grep -v '^master$') +if [ $branch ]; then + branch="-b $branch" +fi + +$pkg co $branch xorg-x11-drivers +pushd xorg-x11-drivers +driverlist=$(grep ^Requires *.spec | awk '{ print $2 }') +popd + +# Things not in -drivers for whatever reason... +extradrivers="xorg-x11-drv-ivtv" + +rm -rf xorg-x11-drivers +echo $driverlist $extradrivers | xargs -n1 $pkg co $branch + +for i in xorg-x11-drv-*/ ; do + [ -e $i/dead.package ] && continue + pushd $i + rpmdev-bumpspec -c "- 1.15 ABI rebuild" *.spec + $pkg commit -c -p && $pkg build --nowait + #$pkg mockbuild + #$pkg srpm + #mockchain -r fedora-20-x86_64 -l $OLDPWD + #mockchain -r rhel-7.0-candidate-x86_64 -l $OLDPWD + + popd +done + +popd + + diff --git a/make-git-snapshot.sh b/make-git-snapshot.sh deleted file mode 100755 index 0d9b2ad3234e18ae8e49c458df5481acd50dbaa6..0000000000000000000000000000000000000000 --- a/make-git-snapshot.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -DIRNAME=xorg-server-$( date +%Y%m%d ) - -rm -rf $DIRNAME -git clone git://git.freedesktop.org/git/xorg/xserver $DIRNAME -cd $DIRNAME -if [ -z "$1" ]; then - git log | head -1 -else - git checkout $1 -fi -git log | head -1 | awk '{ print $2 }' > ../commitid -git repack -a -d -cd .. -tar cf - $DIRNAME | xz -c9 > $DIRNAME.tar.xz -rm -rf $DIRNAME diff --git a/xorg-server-1.20.14.tar.xz b/xorg-server-21.1.13.tar.xz similarity index 40% rename from xorg-server-1.20.14.tar.xz rename to xorg-server-21.1.13.tar.xz index d3b4b4e757671e790efe4ddfdbc08eda9a94b97f..127ff3d4a8c2c80e2dda6b59aae007620add025f 100644 Binary files a/xorg-server-1.20.14.tar.xz and b/xorg-server-21.1.13.tar.xz differ diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 5ee153fee97843a403b5f7b7042168946a58ce74..bf7c7a0add4ada99e70900b6097d2bb175e2a697 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -1,213 +1,234 @@ %define anolis_release 14 +# X.org requires lazy relocations to work. %undefine _hardened_build %undefine _strict_symbol_defs_build + +# Released ABI versions: %global ansic_major 0 %global ansic_minor 4 -%global videodrv_major 24 -%global videodrv_minor 1 +%global videodrv_major 25 +%global videodrv_minor 2 %global xinput_major 24 -%global xinput_minor 1 +%global xinput_minor 4 %global extension_major 10 %global extension_minor 0 -%global inst_srcdir %{buildroot}/%{_datadir}/xorg-x11-server-source - -Name: xorg-x11-server -Epoch: 1 -Version: 1.20.14 -Release: %{anolis_release}%{?dist} -Summary: X.Org X11 X server -URL: http://www.x.org -License: MIT -Source0: https://www.x.org/pub/individual/xserver/xorg-server-%{version}.tar.xz -Source1: 10-quirks.conf -Source10: xserver.pamd -Source20: http://svn.exactcode.de/t2/trunk/package/xorg/xorg-server/xvfb-run.sh -Source30: xserver-sdk-abi-requires.release -Source31: xserver-sdk-abi-requires.git - -Patch0: 06_use-intel-only-on-pre-gen4.diff -Patch1: 0001-xfree86-use-modesetting-driver-by-default-on-GeForce.patch -Patch2: 0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch -Patch3: 0001-autobind-GPUs-to-the-screen.patch -Patch4: 0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch -Patch5: 0001-configure.ac-search-for-the-fontrootdir-ourselves.patch - -# Backports from "master" upstream: -Patch100: 0001-present-Check-for-NULL-to-prevent-crash.patch -Patch101: 0001-render-Fix-build-with-gcc-12.patch -Patch102: 0001-xf86-Accept-devices-with-the-simpledrm-driver.patch -Patch103: 0001-Don-t-hardcode-fps-for-fake-screen.patch -Patch104: 0001-hw-Rename-boolean-config-value-field-from-bool-to-bo.patch -Patch105: 0001-add-a-quirk-for-apple-silicon.patch - -# Fix CVEs -Patch110: 0001-xkb-switch-to-array-index-loops-to-moving-pointers.patch -Patch111: 0002-xkb-swap-XkbSetDeviceInfo-and-XkbSetDeviceInfoCheck.patch -Patch112: 0003-xkb-add-request-length-validation-for-XkbSetGeometry.patch -Patch113: 0001-xkb-proof-GetCountedString-against-request-length-at.patch -Patch114: 0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch -Patch115: 0001-Xtest-disallow-GenericEvents-in-XTestSwapFakeInput.patch -Patch116: 0002-Xi-return-an-error-from-XI-property-changes-if-verif.patch -Patch117: 0003-Xi-avoid-integer-truncation-in-length-check-of-ProcX.patch -Patch118: 0004-Xi-disallow-passive-grabs-with-a-detail-255.patch -Patch119: 0005-Xext-free-the-screen-saver-resource-when-replacing-i.patch -Patch120: 0006-Xext-free-the-XvRTVideoNotify-when-turning-off-from-.patch -Patch121: 0007-xkb-reset-the-radio_groups-pointer-to-NULL-after-fre.patch -Patch122: 0008-Xext-fix-invalid-event-type-mask-in-XTestSwapFakeInp.patch -Patch123: 0001-Xi-fix-potential-use-after-free-in-DeepCopyPointerCl.patch -Patch124: 0001-composite-Fix-use-after-free-of-the-COW.patch -Patch126: 0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch - -Patch200: 0001-Disallow-byte-swapped-clients-by-default.patch -# CVE-2023-5367 -Patch201: 0001-Xi-randr-fix-handling-of-PropModeAppend-Prepend.patch -# CVE-2023-5380 -Patch202: 0002-mi-reset-the-PointerWindows-reference-on-screen-swit.patch - -Patch1000: 1000-meson-Fix-libshadow.so-linkage.patch -Patch1001: 1001-xfree86-Link-fb-statically.patch -Patch1002: 1002-xfree86-Merge-vbe-into-int10.patch -Patch1003: 1003-loader-Move-LoaderSymbolFromModule-to-public-API.patch -Patch1004: 1004-modesetting-Indirect-the-shadow-API-through-LoaderSy.patch -Patch1005: 1005-modesetting-Indirect-the-glamor-API-through-LoaderSy.patch -Patch1006: 1006-link-gbm-lib.patch -Patch1007: 1007-do-not-link-glamor-directly.patch -Patch1008: 1008-Use-glamor_clear_pixmap-in-drmmode_clear_pixmap.patch -Patch1009: 1009-Fix-build-with-glamor-disabled.patch -Patch1010: 1010-Make-LoaderSymbolFromModule-take-a-ModuleDescPtr.patch -Patch1011: 1011-fix-call-systemd_logind_vtenter-after-receiving-drm-device-resume.patch -Patch1012: 1012-Fix-drm_drop_master-before-vt_reldisp.patch -Patch1013: 1013-Fix-compilation-error-when-built-without-logind_platform-bus.patch -Patch1014: 1014-fix-missing-call-to-vtenter-if-the-platform-device-is-not-paused.patch -Patch1015: 1015-x86_logind-fix-suspend_resume-when-there-are-no-input-devices.patch -Patch1016: 0100-xorg-patch-for-ast-ft-bmc-card-in-s5000c.patch - -BuildRequires: automake make autoconf libtool pkgconfig -BuildRequires: dbus-devel libepoxy-devel libudev-devel systemd-devel systemtap-sdt-devel -BuildRequires: libXfont2-devel libXau-devel libxkbfile-devel libXres-devel libXpm-devel -BuildRequires: libX11-devel libXi-devel libXext-devel libXinerama-devel libfontenc-devel -BuildRequires: libXt-devel libdmx-devel libXfixes-devel libXmu-devel libXrender-devel -BuildRequires: libXaw-devel libXtst-devel libXdmcp-devel libXv-devel libdrm-devel >= 2.4.0 -BuildRequires: libpciaccess-devel >= 0.13.1 openssl-devel bison flex -BuildRequires: mesa-libEGL-devel mesa-libgbm-devel mesa-libGL-devel >= 9.2 -%ifarch loongarch64 -BuildRequires: kernel-headers pixman-devel >= 0.30.0 -%else -BuildRequires: libunwind-devel kernel-headers pixman-devel >= 0.30.0 -%endif -BuildRequires: audit-libs-devel libselinux-devel >= 2.0.86-1 -BuildRequires: pkgconfig(xcb-aux) pkgconfig(epoxy) pkgconfig(xcb-image) pkgconfig(xcb-icccm) -BuildRequires: pkgconfig(xcb-keysyms) pkgconfig(xshmfence) >= 1.1 pkgconfig(xcb-renderutil) -BuildRequires: xorg-x11-util-macros >= 1.17 xorg-x11-proto-devel >= 7.7-10 -BuildRequires: xorg-x11-xtrans-devel >= 1.3.2 xorg-x11-font-utils >= 7.2-11 + +%global pkgname xorg-server + +Summary: X.Org X11 X server +Name: xorg-x11-server +Version: 21.1.13 +Release: %{anolis_release}%{?dist} +URL: http://www.x.org +# SPDX +License: Adobe-Display-PostScript AND BSD-3-Clause AND DEC-3-Clause AND HPND AND HPND-sell-MIT-disclaimer-xserver AND HPND-sell-variant AND ICU AND ISC AND MIT AND MIT-open-group AND NTP AND SGI-B-2.0 AND SMLNJ AND X11 AND X11-distribute-modifications-variant + +Source0: https://www.x.org/pub/individual/xserver/%{pkgname}-%{version}.tar.xz + +Source10: xserver.pamd +# "useful" xvfb-run script +Source20: http://svn.exactcode.de/t2/trunk/package/xorg/xorg-server/xvfb-run.sh +# for requires generation in drivers +Source30: xserver-sdk-abi-requires +# maintainer convenience script +Source40: driver-abi-rebuild.sh + +# From Debian use intel ddx driver only for gen4 and older chipsets +Patch0: 06_use-intel-only-on-pre-gen4.diff +# Default to xf86-video-modesetting on GeForce 8 and newer +Patch1: 0001-xfree86-use-modesetting-driver-by-default-on-GeForce.patch +# Default to va_gl on intel i965 as we use the modesetting drv there +# va_gl should probably just be the default everywhere ? +Patch2: 0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch +# because the display-managers are not ready yet, do not upstream +Patch3: 0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch +# Fix compilation error on i686 (21.1.14+) +# https://gitlab.freedesktop.org/xorg/xserver/-/commit/8407181c7dfe14086d99697af0b86120320ab73e +Patch4: 0001-ephyr-Fix-incompatible-pointer-type-build-error.patch + +BuildRequires: bison +BuildRequires: flex +BuildRequires: gawk +BuildRequires: gcc +BuildRequires: kernel-headers +BuildRequires: libXi-devel +BuildRequires: libXinerama-devel +BuildRequires: libXres-devel +BuildRequires: libXv-devel +BuildRequires: make +BuildRequires: mesa-libEGL-devel +BuildRequires: mesa-libGL-devel >= 9.2 +BuildRequires: meson +BuildRequires: pkgconfig +BuildRequires: pkgconfig(audit) +BuildRequires: pkgconfig(bigreqsproto) >= 1.1.0 +BuildRequires: pkgconfig(compositeproto) >= 0.4 +BuildRequires: pkgconfig(damageproto) >= 1.1 +BuildRequires: pkgconfig(dbus-1) >= 1.0 +BuildRequires: pkgconfig(dri2proto) >= 2.8 +BuildRequires: pkgconfig(dri3proto) >= 1.2 +BuildRequires: pkgconfig(epoxy) +BuildRequires: pkgconfig(epoxy) >= 1.5.4 +BuildRequires: pkgconfig(fixesproto) >= 6.0 +BuildRequires: pkgconfig(fontsproto) >= 2.1.3 +BuildRequires: pkgconfig(gbm) >= 10.2 +BuildRequires: pkgconfig(inputproto) >= 2.3.99.1 +BuildRequires: pkgconfig(kbproto) >= 1.0.3 +BuildRequires: pkgconfig(libdrm) >= 2.4.89 +BuildRequires: pkgconfig(libselinux) >= 2.0.86 +BuildRequires: pkgconfig(libsystemd) >= 209 +BuildRequires: pkgconfig(libudev) >= 143 +BuildRequires: pkgconfig(libunwind) +BuildRequires: pkgconfig(libxcvt) +BuildRequires: pkgconfig(openssl) +BuildRequires: pkgconfig(pciaccess) >= 0.12.901 +BuildRequires: pkgconfig(pixman-1) +BuildRequires: pkgconfig(randrproto) >= 1.6.0 +BuildRequires: pkgconfig(recordproto) >= 1.13.99.1 +BuildRequires: pkgconfig(renderproto) >= 0.11 +BuildRequires: pkgconfig(resourceproto) >= 1.2.0 +BuildRequires: pkgconfig(scrnsaverproto) >= 1.1 +BuildRequires: pkgconfig(videoproto) +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(x11-xcb) +BuildRequires: pkgconfig(xau) +BuildRequires: pkgconfig(xcb-aux) +BuildRequires: pkgconfig(xcb-icccm) +BuildRequires: pkgconfig(xcb-image) +BuildRequires: pkgconfig(xcb-keysyms) +BuildRequires: pkgconfig(xcb-renderutil) +BuildRequires: pkgconfig(xcmiscproto) >= 1.2.0 +BuildRequires: pkgconfig(xdmcp) +BuildRequires: pkgconfig(xext) >= 1.0.99.4 +BuildRequires: pkgconfig(xextproto) >= 7.2.99.901 +BuildRequires: pkgconfig(xf86bigfontproto) >= 1.2.0 +BuildRequires: pkgconfig(xf86vidmodeproto) >= 2.2.99.1 +BuildRequires: pkgconfig(xfont2) >= 2.0 +BuildRequires: pkgconfig(xineramaproto) +BuildRequires: pkgconfig(xkbfile) +BuildRequires: pkgconfig(xproto) >= 7.0.31 +BuildRequires: pkgconfig(xshmfence) >= 1.1 +BuildRequires: pkgconfig(xtrans) >= 1.3.5 +BuildRequires: pkgconfig(xtrans) >= 1.3.5 +BuildRequires: systemtap-sdt-devel +BuildRequires: xorg-x11-util-macros >= 1.17 +BuildRequires: xorg-x11-xtrans-devel >= 1.3.2 %description -X.Org X11 X server +X.Org X11 X server. -%package common -Summary: Xorg server common files -Requires: pixman >= 0.30.0 xkeyboard-config xkbcomp -%description common +%package common +Summary: Xorg server common files +Requires: pixman +Requires: xkbcomp +Requires: xkeyboard-config + +%description common Common files shared among all X servers. -%package Xorg -Summary: Xorg X server -Provides: Xorg = %{EVR} -Provides: Xserver -Provides: xorg-x11-server-wrapper = %{EVR} -Provides: xserver-abi(ansic-%{ansic_major}) = %{ansic_minor} -Provides: xserver-abi(videodrv-%{videodrv_major}) = %{videodrv_minor} -Provides: xserver-abi(xinput-%{xinput_major}) = %{xinput_minor} -Provides: xserver-abi(extension-%{extension_major}) = %{extension_minor} -Provides: xorg-x11-glamor = %{EVR} -Obsoletes: xorg-x11-glamor < %{EVR} -Obsoletes: xorg-x11-drv-modesetting < %{EVR} -Provides: xorg-x11-drv-modesetting = %{EVR} -Obsoletes: xorg-x11-drv-vmmouse < 13.1.0-4 - -Requires: xorg-x11-server-common == %{EVR} -Requires: system-setup-keyboard xorg-x11-drv-libinput libEGL - -%description Xorg -X.org X11 is an open source implementation of the X Window System. It -provides the basic low level functionality which full fledged -graphical user interfaces (GUIs) such as GNOME and KDE are designed -upon. - -%package Xnest -Summary: A nested server -Requires: xorg-x11-server-common == %{EVR} -Provides: Xnest - -%description Xnest -Xnest is an X server which has been implemented as an ordinary -X application. It runs in a window just like other X applications, -but it is an X server itself in which you can run other software. - -%package Xdmx -Summary: Distributed Multihead X Server and utilities -Requires: xorg-x11-server-common == %{EVR} -Provides: Xdmx - -%description Xdmx -Xdmx is proxy X server that provides multi-head support for multiple displays -attached to different machines (each of which is running a typical X server). - -%package Xvfb -Summary: A X Windows System virtual framebuffer X server -License: MIT and GPLv2 -Requires: xorg-x11-server-common = %{EVR} -Requires: xorg-x11-xauth -Provides: Xvfb - -%description Xvfb -Xvfb (X Virtual Frame Buffer) is an X server that is able to run on -machines with no display hardware and no physical input devices. - -%package Xephyr -Summary: A nested server -Requires: xorg-x11-server-common == %{EVR} -Provides: Xephyr - -%description Xephyr -Xephyr is a a kdrive server that outputs to a window on a pre-existing -'host' X display. Think Xnest but with support for modern extensions -like composite, damage and randr. - -Unlike Xnest which is an X proxy, i.e. limited to the -capabilities of the host X server, Xephyr is a real X server which -uses the host X server window as "framebuffer" via fast SHM XImages. - -It also has support for 'visually' debugging what the server is -painting. - -%package devel -Summary: SDK for X server driver module development -Requires: xorg-x11-util-macros xorg-x11-proto-devel -Requires: libXfont2-devel pkgconfig pixman-devel libpciaccess-devel - -Provides: xorg-x11-server-static -Obsoletes: xorg-x11-glamor-devel < %{EVR} -Provides: xorg-x11-glamor-devel = %{EVR} + +%package Xorg +Summary: Xorg X server +Requires: libEGL +Requires: system-setup-keyboard +Requires: xorg-x11-drv-libinput +Requires: xorg-x11-server-common >= %{version}-%{release} +Provides: Xorg = %{version}-%{release} +Provides: Xserver +# HdG: This should be moved to the wrapper package once the wrapper gets +# its own sub-package: +Provides: xorg-x11-server-wrapper = %{version}-%{release} +Provides: xserver-abi(ansic-%{ansic_major}) = %{ansic_minor} +Provides: xserver-abi(videodrv-%{videodrv_major}) = %{videodrv_minor} +Provides: xserver-abi(xinput-%{xinput_major}) = %{xinput_minor} +Provides: xserver-abi(extension-%{extension_major}) = %{extension_minor} +# Dropped from xorg-x11-server-21.1 +# https://gitlab.freedesktop.org/xorg/xserver/-/commit/b3b81c8c2090cd49410960a021baf0d27fdd2ab3 +Obsoletes: xorg-x11-server-Xdmx < 1.20.15 +# Legacy fbdev devices have been replaced with simpledrm: +# https://fedoraproject.org/wiki/Changes/ReplaceFbdevDrivers +Obsoletes: xorg-x11-drv-fbdev < 0.5.0-19 +Obsoletes: xorg-x11-drv-vesa < 2.6.0-3 + +%description Xorg +X.org X11 is an open source implementation of the X Window System. It provides +the basic low level functionality which full fledged graphical user interfaces +(GUIs) such as GNOME and KDE are designed upon. + + +%package Xnest +Summary: A nested server +Requires: xorg-x11-server-common >= %{version}-%{release} +Provides: Xnest + +%description Xnest +Xnest is an X server which has been implemented as an ordinary X application. It +runs in a window just like other X applications, but it is an X server itself in +which you can run other software. It is a very useful tool for developers who +wish to test their applications without running them on their real X server. + + +%package Xvfb +Summary: A X Windows System virtual framebuffer X server +# xvfb-run is GPLv2, rest is MIT +License: MIT and GPLv2 +Requires: xorg-x11-server-common >= %{version}-%{release} +# required for xvfb-run +Requires: xorg-x11-xauth +Provides: Xvfb +Requires: util-linux + +%description Xvfb +Xvfb (X Virtual Frame Buffer) is an X server that is able to run on machines +with no display hardware and no physical input devices. Xvfb simulates a dumb +framebuffer using virtual memory. Xvfb does not open any devices, but behaves +otherwise as an X display. Xvfb is normally used for testing servers. + + +%package Xephyr +Summary: A nested server +Requires: xorg-x11-server-common >= %{version}-%{release} +Provides: Xephyr + +%description Xephyr +Xephyr is an X server which has been implemented as an ordinary X application. +It runs in a window just like other X applications, but it is an X server itself +in which you can run other software. It is a very useful tool for developers who +wish to test their applications without running them on their real X server. +Unlike Xnest, Xephyr renders to an X image rather than relaying the X protocol, +and therefore supports the newer X extensions like Render and Composite. + + +%package devel +Summary: SDK for X server driver module development +Requires: libpciaccess-devel +Requires: libXfont2-devel +Requires: xorg-x11-proto-devel +Requires: xorg-x11-util-macros +Requires: pixman-devel +Requires: pkgconfig +Provides: xorg-x11-server-static %description devel -The SDK package contains the developmental files which are necessary for -developing X server driver modules, and for compiling driver modules -outside of the standard X11 source code tree. -You should install this package if you are writing video drivers, -input drivers, or other X modules. +The SDK package provides the developmental files which are necessary for +developing X server driver modules, and for compiling driver modules outside of +the standard X11 source code tree. Developers writing video drivers, input +drivers, or other X modules should install this package. -%package source -Summary: Xserver source code required to build VNC server (Xvnc) -BuildArch: noarch -%description source +%package source +Summary: Xserver source code required to build VNC server (Xvnc) +BuildArch: noarch + +%description source Xserver source code needed to build VNC server (Xvnc). + %prep -%autosetup -p1 -n xorg-server-%{version} +%autosetup -p1 -n %{pkgname}-%{version} +# check the ABI in the source against what we expect. getmajor() { grep -i ^#define.ABI.$1_VERSION hw/xfree86/common/xf86Module.h | tr '(),' ' ' | awk '{ print $4 }' @@ -228,152 +249,153 @@ test `getmajor extension` == %{extension_major} test `getminor extension` == %{extension_minor} %build -autoreconf -fiv - -%configure --enable-xvfb \ - --enable-xnest \ - --enable-kdrive \ - --enable-xephyr \ - --enable-xorg \ - --enable-xselinux \ - --enable-record \ - --enable-present \ - --enable-xcsecurity \ - --enable-config-udev \ - --enable-dmx \ - --enable-dependency-tracking \ - --disable-xwayland \ - --disable-linux-apm \ - --disable-static \ - --disable-unit-tests \ - --disable-linux-acpi \ - --disable-dri \ - --enable-dri2 \ - --enable-dri3 \ - --enable-suid-wrapper \ - --enable-glamor \ - --with-pic \ - --with-default-font-path="catalogue:/etc/X11/fontpath.d,built-ins" \ - --with-module-dir=%{_libdir}/xorg/modules \ - --with-builderstring="Build ID: %{name} %{version}-%{release}" \ - --with-os-name="%{_vendor} $(uname -r)" \ - --with-xkb-output=%{_localstatedir}/lib/xkb \ - --without-dtrace \ -%ifnarch x86_64 - --disable-vbe \ - --disable-int10-module \ -%endif - ${CONFIGURE} - -%make_build +%meson \ + -D agp=auto \ + -D builder_string="Build ID: %{name} %{version}-%{release}" \ + -D default_font_path="catalogue:/etc/X11/fontpath.d,built-ins" \ + -D devel-docs=false \ + -D dga=true \ + -D docs-pdf=false \ + -D docs=false \ + -D dpms=true \ + -D dri1=false \ + -D dri2=true \ + -D dri3=true \ + -D drm=true \ + -D dtrace=false \ + -D fallback_input_driver=libinput \ + -D glamor=true \ + -D glx=true \ + -D hal=false \ + -D input_thread=true \ + -D int10=false \ + -D ipv6=true \ + -D libunwind=true \ + -D linux_acpi=false \ + -D linux_apm=false \ + -D listen_local=true \ + -D listen_tcp=false \ + -D listen_unix=true \ + -D log_dir="%{_localstatedir}/log" \ + -D mitshm=auto \ + -D module_dir="%{_libdir}/xorg/modules" \ + -D pciaccess=true \ + -D screensaver=true \ + -D secure-rpc=false \ + -D sha1=libcrypto \ + -D suid_wrapper=true \ + -D systemd_logind=true \ + -D udev_kms=true \ + -D udev=true \ + -D vgahw=true \ + -D xace=true \ + -D xcsecurity=true \ + -D xdm-auth-1=true \ + -D xdmcp=true \ + -D xephyr=true \ + -D xf86bigfont=false \ + -D xf86-input-inputtest=true \ + -D xinerama=true \ + -D xkb_output_dir="%{_localstatedir}/lib/xkb" \ + -D xnest=true \ + -D xorg=true \ + -D xpbproxy=false \ + -D xquartz=false \ + -D xres=true \ + -D xselinux=true \ + -D xvfb=true \ + -D xvmc=true \ + -D xv=true \ + -D xwin=false + +%meson_build %install -%make_install +%meson_install -mkdir -p $RPM_BUILD_ROOT%{_libdir}/xorg/modules/{drivers,input} +install -D -m 0644 -p xkb/README.compiled %{buildroot}%{_localstatedir}/lib/xkb/README.compiled +install -D -m 0644 %{SOURCE10} %{buildroot}%{_sysconfdir}/pam.d/xserver -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pam.d -install -p -m 644 %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/xserver +# make sure the (empty) /etc/X11/xorg.conf.d is there, system-setup-keyboard +# relies on it more or less. +mkdir -p %{buildroot}%{_sysconfdir}/X11/xorg.conf.d -mkdir -p $RPM_BUILD_ROOT%{_datadir}/X11/xorg.conf.d -install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/X11/xorg.conf.d +install -D -m 0755 %{SOURCE30} %{buildroot}%{_bindir}/xserver-sdk-abi-requires +install -D -m 0755 %{SOURCE20} %{buildroot}%{_bindir}/xvfb-run -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/X11/xorg.conf.d -install -p -m 755 %{SOURCE30} $RPM_BUILD_ROOT%{_bindir}/xserver-sdk-abi-requires -install -p -m 0755 %{SOURCE20} $RPM_BUILD_ROOT%{_bindir}/xvfb-run +# Make the source package +%global xserver_source_dir %{_datadir}/xorg-x11-server-source +%global inst_srcdir %{buildroot}/%{xserver_source_dir} mkdir -p %{inst_srcdir}/{Xext,xkb,GL,hw/{xquartz/bundle,xfree86/common}} mkdir -p %{inst_srcdir}/{hw/dmx/doc,man,doc,hw/dmx/doxygen} cp {,%{inst_srcdir}/}hw/xquartz/bundle/cpprules.in cp {,%{inst_srcdir}/}man/Xserver.man cp {,%{inst_srcdir}/}doc/smartsched -cp {,%{inst_srcdir}/}hw/dmx/doxygen/doxygen.conf.in +#cp {,%{inst_srcdir}/}hw/dmx/doxygen/doxygen.conf.in cp {,%{inst_srcdir}/}xserver.ent.in cp {,%{inst_srcdir}/}hw/xfree86/Xorg.sh.in cp xkb/README.compiled %{inst_srcdir}/xkb cp hw/xfree86/xorgconf.cpp %{inst_srcdir}/hw/xfree86 -install -p xkb/README.compiled %{inst_srcdir}/xkb -install -p hw/xfree86/xorgconf.cpp %{inst_srcdir}/hw/xfree86 -find . -type f | egrep '.*\.(c|h|am|ac|inc|m4|h.in|pc.in|man.pre|pl|txt)$' | +find . -type f -not -path "./%{_vpath_builddir}/*" | egrep '.*\.(c|h|am|ac|inc|m4|h.in|pc.in|man.pre|pl|txt)$' | xargs tar cf - | (cd %{inst_srcdir} && tar xf -) find %{inst_srcdir}/hw/xfree86 -name \*.c -delete -%ifnarch x86_64 -rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/lib{int10,vbe}.so -%endif +# Remove unwanted files/dirs +find %{buildroot} -type f -name '*.la' -delete + %files common +%doc COPYING +%{_mandir}/man1/Xserver.1* %{_libdir}/xorg/protocol.txt %dir %{_localstatedir}/lib/xkb %{_localstatedir}/lib/xkb/README.compiled -%{_mandir}/man1/Xserver.1* -%license COPYING %files Xorg -%dir %{_sysconfdir}/X11/xorg.conf.d %config %attr(0644,root,root) %{_sysconfdir}/pam.d/xserver +%{_bindir}/gtf %{_bindir}/X %{_bindir}/Xorg -%{_bindir}/cvt -%{_bindir}/gtf %{_libexecdir}/Xorg +# Disable until module loading is audited +# %attr(0711,root,root) %caps(cap_sys_admin,cap_sys_rawio,cap_dac_override=pe) %attr(4755, root, root) %{_libexecdir}/Xorg.wrap - %dir %{_libdir}/xorg %dir %{_libdir}/xorg/modules %dir %{_libdir}/xorg/modules/drivers -%dir %{_libdir}/xorg/modules/extensions -%dir %{_libdir}/xorg/modules/input %{_libdir}/xorg/modules/drivers/modesetting_drv.so +%dir %{_libdir}/xorg/modules/extensions %{_libdir}/xorg/modules/extensions/libglx.so -%{_libdir}/xorg/modules/libfbdevhw.so +%dir %{_libdir}/xorg/modules/input +%{_libdir}/xorg/modules/input/inputtest_drv.so %{_libdir}/xorg/modules/libexa.so +%{_libdir}/xorg/modules/libfbdevhw.so +#%%{_libdir}/xorg/modules/libfb.so %{_libdir}/xorg/modules/libglamoregl.so %{_libdir}/xorg/modules/libshadow.so %{_libdir}/xorg/modules/libshadowfb.so %{_libdir}/xorg/modules/libvgahw.so %{_libdir}/xorg/modules/libwfb.so -%ifarch x86_64 -%{_libdir}/xorg/modules/libint10.so -%endif -%dir %{_datadir}/X11/xorg.conf.d -%{_datadir}/X11/xorg.conf.d/10-quirks.conf - %{_mandir}/man1/gtf.1* %{_mandir}/man1/Xorg.1* %{_mandir}/man1/Xorg.wrap.1* -%{_mandir}/man1/cvt.1* -%{_mandir}/man4/fbdevhw.4* %{_mandir}/man4/exa.4* +%{_mandir}/man4/fbdevhw.4* +%{_mandir}/man4/inputtestdrv.4* %{_mandir}/man4/modesetting.4* -%{_mandir}/man5/Xwrapper.config.5* %{_mandir}/man5/xorg.conf.5* %{_mandir}/man5/xorg.conf.d.5* -%license COPYING +%{_mandir}/man5/Xwrapper.config.5* +%dir %{_sysconfdir}/X11/xorg.conf.d +%dir %{_datadir}/X11/xorg.conf.d +%{_datadir}/X11/xorg.conf.d/10-quirks.conf %files Xnest %{_bindir}/Xnest %{_mandir}/man1/Xnest.1* -%files Xdmx -%{_bindir}/Xdmx -%{_bindir}/dmxaddinput -%{_bindir}/dmxaddscreen -%{_bindir}/dmxreconfig -%{_bindir}/dmxresize -%{_bindir}/dmxrminput -%{_bindir}/dmxrmscreen -%{_bindir}/dmxtodmx -%{_bindir}/dmxwininfo -%{_bindir}/vdltodmx -%{_bindir}/dmxinfo -%{_bindir}/xdmxconfig -%{_mandir}/man1/Xdmx.1* -%{_mandir}/man1/dmxtodmx.1* -%{_mandir}/man1/vdltodmx.1* -%{_mandir}/man1/xdmxconfig.1* - %files Xvfb %{_bindir}/Xvfb %{_bindir}/xvfb-run @@ -384,55 +406,162 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/lib{int10,vbe}.so %{_mandir}/man1/Xephyr.1* %files devel +%doc COPYING %{_bindir}/xserver-sdk-abi-requires %{_libdir}/pkgconfig/xorg-server.pc %dir %{_includedir}/xorg %{_includedir}/xorg/*.h %{_datadir}/aclocal/xorg-server.m4 -%license COPYING %files source -%{_datadir}/xorg-x11-server-source +%{xserver_source_dir} + %changelog -* Fri May 24 2024 yuan0927 - 1:1.20.14-14 -- Fix the splash screen issue in the phytium S5000C +* Tue Oct 8 2024 Tingyin Duan - 21.1.13-14 +- initial from Fedora Rawhide + +* Mon Sep 30 2024 Simone Caronni - 21.1.13-5 +- After removal of int10/vbe, obsolete vesa and fbdev X drivers: + https://fedoraproject.org/wiki/Changes/ReplaceFbdevDrivers + +* Sat Sep 28 2024 Simone Caronni - 21.1.13-4 +- Remove all conditionals. Drop int10 everywhere and enable libunwind/dri3 on + ELN. + +* Fri Sep 27 2024 Simone Caronni - 21.1.13-3 +- Switch to meson, drop no longer required patch. +- Drop Obsoletes/Provides that have been removed in ~2014. +- Add build depdendencies as they are searched by meson. +- Format SPEC file. + +* Thu Sep 26 2024 Simone Caronni - 21.1.13-2 +- Drop support for building snapshots. If they need to be built, there are + anyway more simpler ways. +- Trim changelog. +- Drop custom compileri/linker flags that are part of the standard already. + +* Mon Sep 02 2024 Sérgio Basto - 21.1.13-1 +- Update X11-server to 21.1.13 and ABI numbers of videodrv and xinput +- DMX DDX was dropped +- 0001-Disallow-byte-swapped-clients-by-default.patch is upstreamed +- 0001-autobind-GPUs-to-the-screen.patch is upstreamed +- 0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch updated + +* Sat Jul 20 2024 Fedora Release Engineering - 1.20.14-37 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Wed Apr 10 2024 José Expósito - 1.20.14-35 +- Backport fix for invalid Unicode sequence + +* Wed Apr 10 2024 José Expósito - 1.20.14-35 +- Fix regression caused by the fix for CVE-2024-31083 + +* Wed Apr 03 2024 José Expósito - 1.20.14-34 +- CVE fix for: CVE-2024-31080, CVE-2024-31081, CVE-2024-31082 and + CVE-2024-31083 + +* Mon Mar 04 2024 José Expósito - 1.20.14-33 +- Add util-linux as a dependency of Xvfb + +* Sat Jan 27 2024 Fedora Release Engineering - 1.20.14-32 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 José Expósito - 1.20.14-31 +- Fix compilation error on i686 + +* Fri Jan 19 2024 José Expósito - 1.20.14-30 +- Fix use after free related to CVE-2024-21886 + +* Tue Jan 16 2024 José Expósito - 1.20.14-29 +- CVE fix for: CVE-2023-6816, CVE-2024-0229, CVE-2024-21885, CVE-2024-21886, + CVE-2024-0408 and CVE-2024-0409 -* Wed Dec 6 2023 Wenlong Zhang - 1:1.20.14-13 -- delete libunwind for loongarch64 +* Wed Dec 13 2023 Peter Hutterer - 1.20.14-28 +- CVE fix for: CVE-2023-6377, CVE-2023-6478 -* Fri Nov 3 2023 Wenlong Zhang - 1:1.20.14-12 -- fix build error for tigervnc +* Fri Nov 10 2023 Peter Hutterer - 1.20.14-27 +- Update with full SPDX license list -* Sat Oct 28 2023 Funda Wang - 1:1.20.14-11 +* Wed Oct 25 2023 Peter Hutterer - 1.20.14-26 - CVE fix for: CVE-2023-5367, CVE-2023-5380 -* Fri Jun 30 2023 Liwei Ge - 1:1.20.14-10 -- prevent login stuck from resuming +* Fri Oct 20 2023 José Expósito +- SPDX migration: license is already SPDX compatible + +* Fri Sep 29 2023 Orion Poplawski - 1.20.14-25 +- Fix xvfb-run --error-file / auth-file options + +* Sat Jul 22 2023 Fedora Release Engineering - 1.20.14-24 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Tue Apr 25 2023 Olivier Fourdan - 1.20.14-23 +- Backport fix for a deadlock with DRI3 (#2189434) + +* Thu Apr 13 2023 Florian Weimer - 1.20.14-22 +- Make more functions available in fb.h with !FB_ACCESS_WRAPPER + +* Wed Mar 29 2023 Olivier Fourdan - 1.20.14-21 +- CVE fix for: CVE-2023-1393 + +* Thu Feb 23 2023 Olivier Fourdan - 1.20.14-20 +- Fix xvfb-run script with --listen-tcp + +* Thu Feb 09 2023 Iker Pedrosa - 1.20.14-19 +- Remove pam_console from service file (#1822209) + +* Thu Feb 02 2023 Peter Hutterer - 1.20.14-18 +- CVE-2023-0494: potential use-after-free + +* Wed Feb 01 2023 Peter Hutterer - 1.20.14-17 +- Updated conditional fedora statement + +* Tue Jan 17 2023 Olivier Fourdan - 1.20.14-16 +- Use the recommended way to apply conditional patches without + conditionalizing the sources (for byte-swapped clients). + +* Fri Jan 13 2023 Leif Liddy 1.20.14-15 +- Xorg server does not correctly select the DCP for the display + without a quirk on Apple silicon machines (#2152414) + +* Fri Jan 13 2023 Peter Hutterer - 1.20.14-14 +- Disallow byte-swapped clients (#2159489) + +* Wed Jan 11 2023 Olivier Fourdan - 1.20.14-13 +- Rename boolean config value field from bool to boolean to fix drivers + build failures due to a conflict with C++ and stdbool.h + +* Mon Dec 19 2022 Peter Hutterer - 1.20.14-12 +- Fix buggy patch to CVE-2022-46340 + +* Wed Dec 14 2022 Peter Hutterer 1.20.14-11 +- CVE fix for: CVE-2022-4283, CVE-2022-46340, CVE-2022-46341, + CVE-2022-46342, CVE-2022-46343, CVE-2022-46344 -* Wed May 31 2023 Funda Wang - 1:1.20.14-9 -- Fix CVE-2023-1393 +* Wed Nov 23 2022 Peter Hutterer - 1.20.14-10 +- Drop dependency on xorg-x11-font-utils, it was only there for on + build-time variable that's always the same value anyway (#2145088) -* Wed Apr 19 2023 Liwei Ge - 1:1.20.14-8 -- make modesetting link gbm +* Tue Nov 8 2022 Olivier Fourdan - 1.20.14-9 +- Fix CVE-2022-3550, CVE-2022-3551 -* Wed Apr 19 2023 Liwei Ge - 1:1.20.14-7 -- make build fit ld -z now +* Sat Jul 23 2022 Fedora Release Engineering - 1.20.14-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild -* Fri Apr 14 2023 Yuanhong Peng - 1:1.20.14-6 -- Refactor the specfile +* Tue Jul 12 2022 Olivier Fourdan - 1.20.14-7 +- Fix CVE-2022-2319/ZDI-CAN-16062, CVE-2022-2320/ZDI-CAN-16070 -* Sun Feb 26 2023 Funda Wang - 1:1.20.14-5 -- Sync with upstream patches +* Wed Apr 13 2022 Dominik Mierzejewski - 1.20.14-6 +- Don't hardcode fps for fake screen (#2054188) -* Thu Dec 15 2022 Funda Wang - 1:1.20.14-4 -- Disable int10 only under non-x86 arch +* Fri Apr 8 2022 Jocelyn Falempe - 1.20.14-5 +- Fix basic graphic mode not working with simpledrm (#2067151) -* Tue Oct 25 2022 Chunmei Xu - 1:1.20.14-3 -- xf86: Accept devices with the 'simpledrm' driver +* Fri Jan 28 2022 Olivier Fourdan - 1.20.14-4 +- Fix build with GCC 12 (#2047134) -* Tue Jul 12 2022 happy_orange - 1:1.20.14-2 -- bugfix the some xorg modules loading error in iso +* Tue Jan 25 2022 Olivier Fourdan - 1.20.14-3 +- Fix crash with NVIDIA proprietary driver with Present (#2046147) -* Fri Apr 22 2022 mgb01105731 - 1:1.20.14-1 -- Init from upstream version 1.20.14 +* Sat Jan 22 2022 Fedora Release Engineering - 1.20.14-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/xserver-sdk-abi-requires.git b/xserver-sdk-abi-requires.git deleted file mode 100755 index c033061bb8de88dea20d956a59af8c37c74c59f9..0000000000000000000000000000000000000000 --- a/xserver-sdk-abi-requires.git +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# -# The X server provides capabilities of the form: -# -# Provides: xserver-abi(ansic-0) = 4 -# -# for an ABI version of 0.4. The major number is encoded into the name so -# that major number changes force upgrades. If we didn't, then -# -# Requires: xserver-abi(ansic) >= 0.4 -# -# would also match 1.0, which is wrong since major numbers mean an ABI break. - -echo "xserver-abi($1-@MAJOR@) >= @MINOR@" diff --git a/xserver-sdk-abi-requires.release b/xserver-sdk-abi-requires.release deleted file mode 100755 index 30d77bf1bb08e9e6ad1d70c74f5761b32f1f22d1..0000000000000000000000000000000000000000 --- a/xserver-sdk-abi-requires.release +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# -# The X server provides capabilities of the form: -# -# Provides: xserver-abi(ansic-0) = 4 -# -# for an ABI version of 0.4. The major number is encoded into the name so -# that major number changes force upgrades. If we didn't, then -# -# Requires: xserver-abi(ansic) >= 0.4 -# -# would also match 1.0, which is wrong since major numbers mean an ABI break. - -ver=$(pkg-config --variable abi_$1 xorg-server) - -major=$(echo $ver | cut -f 1 -d .) -minor=$(echo $ver | cut -f 2 -d .) - -echo "xserver-abi($1-$major) >= $minor" diff --git a/xserver.pamd b/xserver.pamd index bf799304b6c401e1e92e389c3b95ecc10ed007e2..9374ff674cb7dee30102732fed0ff40594ecc0d3 100644 --- a/xserver.pamd +++ b/xserver.pamd @@ -1,5 +1,4 @@ #%PAM-1.0 auth sufficient pam_rootok.so -auth required pam_console.so account required pam_permit.so session optional pam_keyinit.so force revoke diff --git a/xvfb-run.sh b/xvfb-run.sh index 9d088c1c28ec13649eaef4deb24b75a0039c19a1..dec7dfccf4b896cb948301c589945a79bc410eb6 100644 --- a/xvfb-run.sh +++ b/xvfb-run.sh @@ -101,7 +101,7 @@ find_free_servernum() { # Parse the command line. ARGS=$(getopt --options +ade:f:hn:lp:s:w: \ - --long auto-servernum,error-file:auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: \ + --long auto-servernum,error-file:,auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: \ --name "$PROGNAME" -- "$@") GETOPT_STATUS=$? @@ -120,7 +120,7 @@ while :; do -f|--auth-file) AUTHFILE="$2"; shift ;; -h|--help) SHOWHELP="yes" ;; -n|--server-num) SERVERNUM="$2"; shift ;; - -l|--listen-tcp) LISTENTCP="" ;; + -l|--listen-tcp) LISTENTCP="-listen tcp" ;; -p|--xauth-protocol) XAUTHPROTO="$2"; shift ;; -s|--server-args) XVFBARGS="$2"; shift ;; -w|--wait) STARTWAIT="$2"; shift ;;