diff --git a/0100-phytium-xorg-x11-server-bmc.patch b/0100-phytium-xorg-x11-server-bmc.patch new file mode 100644 index 0000000000000000000000000000000000000000..a4e03d0f268fc59a0bcb0b28e396c31ad2ae406a --- /dev/null +++ b/0100-phytium-xorg-x11-server-bmc.patch @@ -0,0 +1,192 @@ +From 2a96fbdc5b15c1d430151cf5bb4390b97993772f Mon Sep 17 00:00:00 2001 +From: yuan0927 +Date: Tue, 21 May 2024 09:40:12 +0800 +Subject: [PATCH 2/2] modesetting: add support for phytium S5000C BMC + +This patch has been fixed to address the issue of screen distortion in the Phytium S5000C, and it works in conjunction with the patch integrated into the kernel. + +Signed-off-by: yuan0927 +Signed-off-by: WangHao +--- + hw/xfree86/drivers/modesetting/driver.c | 158 +++++++++++++++++++++++- + 1 file changed, 157 insertions(+), 1 deletion(-) + +diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c +index ef4a314..f9555e4 100644 +--- a/hw/xfree86/drivers/modesetting/driver.c ++++ b/hw/xfree86/drivers/modesetting/driver.c +@@ -1143,6 +1143,162 @@ 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 = TRUE; ++ static Bool forceAlign = FALSE; ++ Bool isAstBMC = FALSE; ++ Bool isFtBMC = FALSE; ++ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ++ modesettingPtr ms = modesettingPTR(pScrn); ++ 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; ++ if (firstQuery) { ++ if (1 == drmIoctl(ms->fd, DRM_IOCTL_AST_VRAM_TYPE_DEVICE, NULL)) { ++ forceAlign = TRUE; ++ } ++ firstQuery = FALSE; ++ } ++ } else if (pci && device_is_ft_bmc(pci)) { ++ isFtBMC = TRUE; ++ if (firstQuery) { ++ if (1 == drmIoctl(ms->fd, DRM_IOCTL_PHYTIUM_VRAM_TYPE_DEVICE, NULL)) { ++ forceAlign = TRUE; ++ } ++ firstQuery = 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 ((isFtBMC || isAstBMC) && 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) + { +@@ -1193,7 +1349,7 @@ msUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf) + if (use_3224) + shadowUpdate32to24(pScreen, pBuf); + else +- shadowUpdatePacked(pScreen, pBuf); ++ msshadowUpdatePacked(pScreen, pBuf); + } + + static Bool +-- +2.39.3 + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index b3a07a36bceb36ae2e18237b88e23a95c07fca53..f2b1c1951c71a2a7057ab9e88b5b7fb10af488bf 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -9,7 +9,7 @@ # check out the master branch, pull, cherry-pick, and push. # X.org requires lazy relocations to work. -%define anolis_release .0.5 +%define anolis_release .0.6 %undefine _hardened_build %undefine _strict_symbol_defs_build @@ -103,6 +103,7 @@ Patch18: 0001-mustard-Work-around-broken-fbdev-headers.patch # fix to be upstreamed Patch100: 0001-linux-Make-platform-device-probe-less-fragile.patch Patch102: 0001-xfree86-ensure-the-readlink-buffer-is-null-terminate.patch +Patch103: 0100-phytium-xorg-x11-server-bmc.patch # fix already upstream Patch200: 0001-Fix-segfault-on-probing-a-non-PCI-platform-device-on.patch @@ -647,6 +648,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %changelog +* Thu Sep 05 2024 yuan0927 - 1.20.11-16.0.6 +- Fix the splash screen issue in the phytium S5000C + * Tue Jul 09 2024 lutw - 1.20.11-16.0.5 - Fix ix CVE-2023-5367 CVE-2023-5380 CVE-2023-6377 CVE-2023-6478 CVE-2024-0229 CVE-2024-21885 CVE-2024-21886 CVE-2024-0408 CVE-2024-0409