update to xorg-x11-drv-vmware

This commit is contained in:
lunankun 2020-07-29 10:26:14 +00:00
parent 67e440774c
commit 250ec1c91d
6 changed files with 244 additions and 1 deletions

View File

@ -0,0 +1,162 @@
From 4ec3d67da829f4e7a35ab08427002b9d7e4e5f4b Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom <thellstrom@vmware.com>
Date: Tue, 27 Nov 2018 16:20:32 +0100
Subject: [PATCH 02/11] vmwgfx: Fix XVideo memory leaks
We were not properly freeing the port privates.
In order to access those at CloseScreen time, don't free the adaptor pointers
at XV screen init, but hold on to them until CloseScreen.
Also properly free the new_adaptors pointer.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
---
vmwgfx/vmwgfx_driver.c | 2 ++
vmwgfx/vmwgfx_driver.h | 9 +++++++-
vmwgfx/vmwgfx_overlay.c | 11 ++++------
vmwgfx/vmwgfx_tex_video.c | 44 ++++++++++++++++++++++++++-------------
4 files changed, 44 insertions(+), 22 deletions(-)
diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
index 665f620..ccddb6f 100644
--- a/vmwgfx/vmwgfx_driver.c
+++ b/vmwgfx/vmwgfx_driver.c
@@ -1327,6 +1327,8 @@ drv_close_screen(CLOSE_SCREEN_ARGS_DECL)
pScrn->LeaveVT(VT_FUNC_ARGS);
vmwgfx_uevent_fini(pScrn, ms);
+ vmw_xv_close(pScreen);
+
pScrn->vtSema = FALSE;
vmwgfx_unwrap(ms, pScrn, EnterVT);
diff --git a/vmwgfx/vmwgfx_driver.h b/vmwgfx/vmwgfx_driver.h
index 05abebe..cfd2ed2 100644
--- a/vmwgfx/vmwgfx_driver.h
+++ b/vmwgfx/vmwgfx_driver.h
@@ -157,6 +157,11 @@ typedef struct _modesettingRec
Bool xa_dri3;
Bool dri3_available;
#endif
+
+ /* Video */
+ XF86VideoAdaptorPtr overlay;
+ XF86VideoAdaptorPtr textured;
+
} modesettingRec, *modesettingPtr;
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
@@ -231,7 +236,9 @@ xorg_xv_init(ScreenPtr pScreen);
XF86VideoAdaptorPtr
vmw_video_init_adaptor(ScrnInfoPtr pScrn);
void
-vmw_video_free_adaptor(XF86VideoAdaptorPtr adaptor, Bool free_ports);
+vmw_video_free_adaptor(XF86VideoAdaptorPtr adaptor);
+void
+vmw_xv_close(ScreenPtr pScreen);
void
vmw_ctrl_ext_init(ScrnInfoPtr pScrn);
diff --git a/vmwgfx/vmwgfx_overlay.c b/vmwgfx/vmwgfx_overlay.c
index c35cebd..94d738c 100644
--- a/vmwgfx/vmwgfx_overlay.c
+++ b/vmwgfx/vmwgfx_overlay.c
@@ -258,15 +258,12 @@ vmwgfx_overlay_port_create(int drm_fd, ScreenPtr pScreen)
}
void
-vmw_video_free_adaptor(XF86VideoAdaptorPtr adaptor, Bool free_ports)
+vmw_video_free_adaptor(XF86VideoAdaptorPtr adaptor)
{
- if (free_ports) {
- int i;
+ int i;
- for(i=0; i<adaptor->nPorts; ++i) {
- free(adaptor->pPortPrivates[i].ptr);
- }
- }
+ for (i = 0; i < adaptor->nPorts; ++i)
+ free(adaptor->pPortPrivates[i].ptr);
free(adaptor->pPortPrivates);
xf86XVFreeVideoAdaptorRec(adaptor);
diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c
index e42a4c6..acc2b56 100644
--- a/vmwgfx/vmwgfx_tex_video.c
+++ b/vmwgfx/vmwgfx_tex_video.c
@@ -904,15 +904,12 @@ port_priv_create(struct xa_tracker *xat, struct xa_context *r,
}
static void
-vmwgfx_free_textured_adaptor(XF86VideoAdaptorPtr adaptor, Bool free_ports)
+vmwgfx_free_textured_adaptor(XF86VideoAdaptorPtr adaptor)
{
- if (free_ports) {
- int i;
+ int i;
- for(i=0; i<adaptor->nPorts; ++i) {
- free(adaptor->pPortPrivates[i].ptr);
- }
- }
+ for (i = 0; i < adaptor->nPorts; ++i)
+ free(adaptor->pPortPrivates[i].ptr);
free(adaptor->pAttributes);
free(adaptor->pPortPrivates);
@@ -986,6 +983,23 @@ xorg_setup_textured_adapter(ScreenPtr pScreen)
return adapt;
}
+void
+vmw_xv_close(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ if (ms->overlay) {
+ vmw_video_free_adaptor(ms->overlay);
+ ms->overlay = NULL;
+ }
+
+ if (ms->textured) {
+ vmwgfx_free_textured_adaptor(ms->textured);
+ ms->textured = NULL;
+ }
+}
+
void
xorg_xv_init(ScreenPtr pScreen)
{
@@ -1025,17 +1039,19 @@ xorg_xv_init(ScreenPtr pScreen)
adaptors[num_adaptors++] = overlay_adaptor;
if (num_adaptors) {
- Bool ret;
- ret = xf86XVScreenInit(pScreen, adaptors, num_adaptors);
- if (textured_adapter)
- vmwgfx_free_textured_adaptor(textured_adapter, !ret);
- if (overlay_adaptor)
- vmw_video_free_adaptor(overlay_adaptor, !ret);
- if (!ret)
+ if (xf86XVScreenInit(pScreen, adaptors, num_adaptors)) {
+ ms->overlay = overlay_adaptor;
+ ms->textured = textured_adapter;
+ } else {
+ ms->overlay = NULL;
+ ms->textured = NULL;
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to initialize Xv.\n");
+ }
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Disabling Xv because no adaptors could be initialized.\n");
}
+
+ free(new_adaptors);
}
--
2.23.0

View File

@ -0,0 +1,28 @@
From 0b34df288f0e163750962e0e59f5e329642ca457 Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom <thellstrom@vmware.com>
Date: Tue, 27 Nov 2018 16:36:21 +0100
Subject: [PATCH 03/11] vmwgfx: Fix a memory leak
We were leaking a pointer to a drm encoder.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
---
vmwgfx/vmwgfx_output.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/vmwgfx/vmwgfx_output.c b/vmwgfx/vmwgfx_output.c
index ec31e2c..f589226 100644
--- a/vmwgfx/vmwgfx_output.c
+++ b/vmwgfx/vmwgfx_output.c
@@ -642,6 +642,7 @@ xorg_output_init(ScrnInfoPtr pScrn)
if (drm_encoder) {
output->possible_crtcs = drm_encoder->possible_crtcs;
output->possible_clones = drm_encoder->possible_clones;
+ drmModeFreeEncoder(drm_encoder);
} else {
output->possible_crtcs = 0;
output->possible_clones = 0;
--
2.23.0

View File

@ -0,0 +1,44 @@
From d31e8e77e1453c26a02f24b26d96b4660d29e1df Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom <thellstrom@vmware.com>
Date: Tue, 27 Nov 2018 08:37:13 +0100
Subject: [PATCH 06/11] vmwgfx: Fix invalid memory accesses in CloseScreen
Some of the CloseScreen callbacks were referencing XA objects so move the
destruction of the XA state tracker to the end of drv_close_screen to avoid
referencing freed resources.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
---
vmwgfx/vmwgfx_driver.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
index ccddb6f..e5f0caf 100644
--- a/vmwgfx/vmwgfx_driver.c
+++ b/vmwgfx/vmwgfx_driver.c
@@ -1314,6 +1314,7 @@ drv_close_screen(CLOSE_SCREEN_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
modesettingPtr ms = modesettingPTR(pScrn);
+ Bool ret;
if (ms->cursor) {
FreeCursor(ms->cursor, None);
@@ -1339,10 +1340,12 @@ drv_close_screen(CLOSE_SCREEN_ARGS_DECL)
vmwgfx_unwrap(ms, pScreen, BlockHandler);
vmwgfx_unwrap(ms, pScreen, CreateScreenResources);
+ ret = (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
+
if (ms->xat)
xa_tracker_destroy(ms->xat);
- return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
+ return ret;
}
static ModeStatus
--
2.23.0

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,7 @@
%undefine _hardened_build
Name: xorg-x11-drv-vmware
Version: 13.2.1
Version: 13.3.0
Release: 1
Summary: Xorg X11 vmware video driver
License: MIT
@ -12,6 +12,9 @@ URL: http://www.x.org
Source0: ftp://ftp.x.org/pub/individual/driver/xf86-video-vmware-%{version}.tar.bz2
Patch0: 0001-saa-Build-compatibility-with-xserver-1.20.patch
Patch1: 0002-vmwgfx-Fix-XVideo-memory-leaks.patch
Patch2: 0003-vmwgfx-Fix-a-memory-leak.patch
Patch3: 0006-vmwgfx-Fix-invalid-memory-accesses-in-CloseScreen.patch
ExclusiveArch: %{ix86} x86_64 ia64
@ -51,5 +54,11 @@ autoreconf -v --install || exit 1
%{_mandir}/man4/vmware.4*
%changelog
* Wed Jul 29 2020 lunankun <lunankun@huawei.com> - 13.3.0-1
- Type:update
- ID:NA
- SUG:restart
- DESC:update to xorg-x11-drv-vmware-13.3.0
* Tue Mar 10 2020 hexiujun <hexiujun1@huawei.com> - 13.2.1-1
- Package init