[openchrome-devel] xf86-video-openchrome: Branch 'main' - 11 commits - configure.ac src/drmmode_display.c src/via_display.c src/via_dri.c src/via_driver.c src/via_drm.h src/via_exa.c src/via_memcpy.c src/via_memmgr.c src/via_memmgr.h src/via_ums.c src/via_xvmc.c src/via_xv_overlay.c
Kevin Brace
kevinbrace at kemper.freedesktop.org
Thu Sep 8 23:45:55 UTC 2022
configure.ac | 2 -
src/drmmode_display.c | 1
src/via_display.c | 1
src/via_dri.c | 3 --
src/via_driver.c | 5 ---
src/via_drm.h | 66 +++++++++++++++++++++++++++++++++++---------------
src/via_exa.c | 2 -
src/via_memcpy.c | 1
src/via_memmgr.c | 65 ++++++++++++-------------------------------------
src/via_memmgr.h | 1
src/via_ums.c | 4 ---
src/via_xv_overlay.c | 4 ---
src/via_xvmc.c | 1
13 files changed, 67 insertions(+), 89 deletions(-)
New commits:
commit 3194fb08b38176111babaebf7fb3e02b2a5edb03
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:31 2022 -0700
Version bumped to 0.6.600
OpenChrome DRM Version 3.6.0 or later is required for KMS.
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/configure.ac b/configure.ac
index 7af9956..e065a51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-video-openchrome],
- [0.6.501],
+ [0.6.600],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
[xf86-video-openchrome])
commit c36a6c45dc4bbdbcdae76e66c658ab334ea04c8c
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:31 2022 -0700
Require OpenChrome DRM Version 3.6.0 or later for KMS
Made many updates to OpenChrome DRM uAPI, so the DDX requires a newer
OpenChrome DRM version.
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_driver.c b/src/via_driver.c
index c4a97bf..0b2bb6a 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -65,7 +65,7 @@
#ifdef OPENCHROMEDRI
static const ViaDRMVersion drmVIADRMExpected = { 1, 3, 0 };
static const ViaDRMVersion drmVIADRMCompat = { 3, 0, 0 };
-static const ViaDRMVersion drmVIADRMKMSSupport = { 3, 5, 0 };
+static const ViaDRMVersion drmVIADRMKMSSupport = { 3, 6, 0 };
#endif /* OPENCHROMEDRI */
/* Prototypes. */
commit 18e1be5b42fc568c55e901d073e158b06423befa
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:31 2022 -0700
Update uAPI header copyright year
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_drm.h b/src/via_drm.h
index 129dfcd..e36c165 100644
--- a/src/via_drm.h
+++ b/src/via_drm.h
@@ -1,5 +1,5 @@
/*
- * Copyright © 2020 Kevin Brace
+ * Copyright © 2020-2022 Kevin Brace
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
*
commit b3a8058649ed06520c566341ac02faf71f326a56
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:30 2022 -0700
Add comments to uAPI IOCTL structs
Suggested-by: Sam Ravnborg <sam at ravnborg.org>
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_drm.h b/src/via_drm.h
index a880b15..129dfcd 100644
--- a/src/via_drm.h
+++ b/src/via_drm.h
@@ -292,18 +292,41 @@ typedef struct drm_via_dmablit {
/*
* OpenChrome DRM IOCTL structs
*/
+
+/**
+ * struct drm_via_gem_alloc - IOCTL argument for allocating a GEM based BO
+ * (Buffer Object).
+ */
struct drm_via_gem_alloc {
+ /* Alignment of the BO. */
__u32 alignment;
__u32 pad;
+
+ /* Size of the BO. Note that the actual size gets returned from DRM.*/
__u64 size;
+
+ /*
+ * TTM domain of the BO. Note that the actual domain gets returned
+ * from DRM.
+ */
__u32 domain;
+
+ /* GEM handle to the BO returned from DRM. */
__u32 handle;
+
+ /* Offset returned from DRM. */
__u64 offset;
};
+/**
+ * struct drm_via_gem_mmap - IOCTL argument for mapping a GEM based BO.
+ */
struct drm_via_gem_mmap {
+ /* GEM handle of the BO. */
__u32 handle;
__u32 pad;
+
+ /* Offset returned from DRM. */
__u64 offset;
};
commit e3405cb7a042886cddaede74af31bb15fef195ea
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:30 2022 -0700
Pad uAPI IOCTL structs to a 64-bit boundary
Suggested-by: Daniel Vetter <daniel at ffwll.ch>
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
Link: https://blog.ffwll.ch/2013/11/botching-up-ioctls.html
diff --git a/src/via_drm.h b/src/via_drm.h
index f2560cb..a880b15 100644
--- a/src/via_drm.h
+++ b/src/via_drm.h
@@ -294,6 +294,7 @@ typedef struct drm_via_dmablit {
*/
struct drm_via_gem_alloc {
__u32 alignment;
+ __u32 pad;
__u64 size;
__u32 domain;
__u32 handle;
@@ -302,6 +303,7 @@ struct drm_via_gem_alloc {
struct drm_via_gem_mmap {
__u32 handle;
+ __u32 pad;
__u64 offset;
};
commit c04190da30a487a074d0a072a362826cd0a258fe
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:30 2022 -0700
Convert from uint*_t to __u*
Examples include conversion to __u32 and __u64 types.
Suggested-by: Daniel Vetter <daniel at ffwll.ch>
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
Link: https://blog.ffwll.ch/2013/11/botching-up-ioctls.html
diff --git a/src/via_drm.h b/src/via_drm.h
index 1cceba5..f2560cb 100644
--- a/src/via_drm.h
+++ b/src/via_drm.h
@@ -293,16 +293,16 @@ typedef struct drm_via_dmablit {
* OpenChrome DRM IOCTL structs
*/
struct drm_via_gem_alloc {
- uint32_t alignment;
- uint64_t size;
- uint32_t domain;
- uint32_t handle;
- uint64_t offset;
+ __u32 alignment;
+ __u64 size;
+ __u32 domain;
+ __u32 handle;
+ __u64 offset;
};
struct drm_via_gem_mmap {
- uint32_t handle;
- uint64_t offset;
+ __u32 handle;
+ __u64 offset;
};
#if defined(__cplusplus)
commit a616d2d47593867aeb89f167a51f3f0e4015a638
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:30 2022 -0700
Rearrange and rename uAPI IOCTL struct members
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_drm.h b/src/via_drm.h
index 55b69ac..1cceba5 100644
--- a/src/via_drm.h
+++ b/src/via_drm.h
@@ -293,8 +293,8 @@ typedef struct drm_via_dmablit {
* OpenChrome DRM IOCTL structs
*/
struct drm_via_gem_alloc {
- uint64_t size;
uint32_t alignment;
+ uint64_t size;
uint32_t domain;
uint32_t handle;
uint64_t offset;
@@ -302,7 +302,7 @@ struct drm_via_gem_alloc {
struct drm_via_gem_mmap {
uint32_t handle;
- uint64_t map_offset;
+ uint64_t offset;
};
#if defined(__cplusplus)
diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index 4d88142..0113d56 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -151,8 +151,8 @@ drm_bo_alloc(ScrnInfoPtr pScrn, unsigned long size,
struct drm_via_gem_alloc args;
memset(&args, 0, sizeof(args));
- args.size = size;
args.alignment = alignment;
+ args.size = size;
args.domain = domain;
ret = drmCommandWriteRead(pVia->drmmode.fd,
DRM_VIA_GEM_ALLOC,
@@ -237,7 +237,7 @@ drm_bo_map(ScrnInfoPtr pScrn, struct buffer_object *obj)
}
obj->ptr = mmap(0, obj->size, PROT_READ | PROT_WRITE,
- MAP_SHARED, pVia->drmmode.fd, args.map_offset);
+ MAP_SHARED, pVia->drmmode.fd, args.offset);
if (obj->ptr == MAP_FAILED) {
DEBUG(ErrorF("mmap failed with error %d\n", -errno));
obj->ptr = NULL;
commit bdef377a506c59cf7d25d8b38bd5700e97c1e888
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:30 2022 -0700
Rename two uAPI IOCTLs to new names
Move them to an address starting from 0x20.
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_drm.h b/src/via_drm.h
index 5c15fc8..55b69ac 100644
--- a/src/via_drm.h
+++ b/src/via_drm.h
@@ -82,8 +82,11 @@ extern "C" {
#define DRM_VIA_DMA_BLIT 0x0e
#define DRM_VIA_BLIT_SYNC 0x0f
-#define DRM_VIA_GEM_CREATE 0x10
-#define DRM_VIA_GEM_MAP 0x11
+/*
+ * OpenChrome DRM IOCTLs
+ */
+#define DRM_VIA_GEM_ALLOC 0x20
+#define DRM_VIA_GEM_MMAP 0x21
#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t)
@@ -102,8 +105,11 @@ extern "C" {
#define DRM_IOCTL_VIA_DMA_BLIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t)
#define DRM_IOCTL_VIA_BLIT_SYNC DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t)
-#define DRM_IOCTL_VIA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_CREATE, struct drm_via_gem_create)
-#define DRM_IOCTL_VIA_GEM_MAP DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_MAP, struct drm_via_gem_map)
+/*
+ * OpenChrome DRM IOCTLs
+ */
+#define DRM_IOCTL_VIA_GEM_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_ALLOC, struct drm_via_gem_alloc)
+#define DRM_IOCTL_VIA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_MMAP, struct drm_via_gem_mmap)
/* Indices into buf.Setup where various bits of state are mirrored per
* context and per buffer. These can be fired at the card as a unit,
@@ -283,7 +289,10 @@ typedef struct drm_via_dmablit {
drm_via_blitsync_t sync;
} drm_via_dmablit_t;
-struct drm_via_gem_create {
+/*
+ * OpenChrome DRM IOCTL structs
+ */
+struct drm_via_gem_alloc {
uint64_t size;
uint32_t alignment;
uint32_t domain;
@@ -291,7 +300,7 @@ struct drm_via_gem_create {
uint64_t offset;
};
-struct drm_via_gem_map {
+struct drm_via_gem_mmap {
uint32_t handle;
uint64_t map_offset;
};
diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index 1f9668a..4d88142 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -148,16 +148,16 @@ drm_bo_alloc(ScrnInfoPtr pScrn, unsigned long size,
obj->handle));
}
} else if (pVia->directRenderingType == DRI_2) {
- struct drm_via_gem_create args;
+ struct drm_via_gem_alloc args;
memset(&args, 0, sizeof(args));
args.size = size;
args.alignment = alignment;
args.domain = domain;
ret = drmCommandWriteRead(pVia->drmmode.fd,
- DRM_VIA_GEM_CREATE,
+ DRM_VIA_GEM_ALLOC,
&args,
- sizeof(struct drm_via_gem_create));
+ sizeof(struct drm_via_gem_alloc));
if (!ret) {
/* Okay the X server expects to know the offset because
* of non-KMS. Once we have KMS working the offset
@@ -201,7 +201,7 @@ drm_bo_map(ScrnInfoPtr pScrn, struct buffer_object *obj)
{
VIAPtr pVia = VIAPTR(pScrn);
#ifdef OPENCHROMEDRI
- struct drm_via_gem_map args;
+ struct drm_via_gem_mmap args;
int ret;
#endif /* OPENCHROMEDRI */
@@ -228,9 +228,9 @@ drm_bo_map(ScrnInfoPtr pScrn, struct buffer_object *obj)
memset(&args, 0, sizeof(args));
args.handle = obj->handle;
ret = drmCommandWriteRead(pVia->drmmode.fd,
- DRM_VIA_GEM_MAP,
+ DRM_VIA_GEM_MMAP,
&args,
- sizeof(struct drm_via_gem_map));
+ sizeof(struct drm_via_gem_mmap));
if (ret) {
obj->ptr = NULL;
goto exit;
commit 61c14ff37dfee8e6b58733d3cc1a265a11f63e6d
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:29 2022 -0700
Use drmCloseBufferHandle() provided by libdrm
This is a better implementation than calling DRM with
DRM_IOCTL_GEM_CLOSE IOCTL.
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index 64c38cf..1f9668a 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -283,12 +283,9 @@ drm_bo_free(ScrnInfoPtr pScrn, struct buffer_object *obj)
return;
}
} else if (pVia->directRenderingType == DRI_2) {
- struct drm_gem_close close;
-
munmap(obj->ptr, obj->size);
- close.handle = obj->handle;
- if (drmIoctl(pVia->drmmode.fd, DRM_IOCTL_GEM_CLOSE, &close) < 0) {
+ if (drmCloseBufferHandle(pVia->drmmode.fd, obj->handle)) {
ErrorF("DRM failed to free for handle %lu.\n", obj->handle);
return;
}
commit 6e71885aa39167534b9dcb3b33c14aa7d1a7da23
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:29 2022 -0700
Discontinue DRM_VIA_GEM_UNMAP uAPI IOCTL
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_drm.h b/src/via_drm.h
index e9da45c..5c15fc8 100644
--- a/src/via_drm.h
+++ b/src/via_drm.h
@@ -84,7 +84,6 @@ extern "C" {
#define DRM_VIA_GEM_CREATE 0x10
#define DRM_VIA_GEM_MAP 0x11
-#define DRM_VIA_GEM_UNMAP 0x12
#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t)
@@ -105,7 +104,6 @@ extern "C" {
#define DRM_IOCTL_VIA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_CREATE, struct drm_via_gem_create)
#define DRM_IOCTL_VIA_GEM_MAP DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_MAP, struct drm_via_gem_map)
-#define DRM_IOCTL_VIA_GEM_UNMAP DRM_IOR(DRM_COMMAND_BASE + DRM_VIA_GEM_UNMAP, struct drm_via_gem_unmap)
/* Indices into buf.Setup where various bits of state are mirrored per
* context and per buffer. These can be fired at the card as a unit,
@@ -298,10 +296,6 @@ struct drm_via_gem_map {
uint64_t map_offset;
};
-struct drm_via_gem_unmap {
- uint32_t handle;
-};
-
#if defined(__cplusplus)
}
#endif
commit 9d426a46c2c485fbe3acfe670658aa800c11cfcc
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Thu Sep 8 16:45:29 2022 -0700
Discontinue drm_bo_unmap()
This discontinues the use of DRM_VIA_GEM_UNMAP uAPI IOCTL as well.
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 86a211a..5caaddd 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -249,7 +249,6 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
/* cursor should be mapped already */
ptr = drm_bo_map(crtc->scrn, drmmode_crtc->cursor_bo);
memcpy(ptr, image, drmmode_crtc->cursor_bo->size);
- drm_bo_unmap(crtc->scrn, drmmode_crtc->cursor_bo);
if (drmModeSetCursor(drmmode_crtc->drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
handle, cursor_info->MaxWidth, cursor_info->MaxHeight)) {
diff --git a/src/via_display.c b/src/via_display.c
index 4054fb4..5284d83 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -3522,7 +3522,6 @@ via_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
dst = drm_bo_map(pScrn, iga->cursor_bo);
memcpy(dst, image, iga->cursor_bo->size);
- drm_bo_unmap(pScrn, iga->cursor_bo);
if (!iga->index) {
viaIGA1InitHI(pScrn);
diff --git a/src/via_dri.c b/src/via_dri.c
index f55c158..cf0a6f5 100644
--- a/src/via_dri.c
+++ b/src/via_dri.c
@@ -929,7 +929,6 @@ viaDRIOffscreenSave(ScrnInfoPtr pScrn)
strerror(-err));
}
memcpy(dst, src, srcSize);
- drm_bo_unmap(pScrn, pVia->driOffScreenMem);
} else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Out of memory trying to backup DRI offscreen memory.\n");
@@ -949,8 +948,6 @@ viaDRIOffscreenRestore(ScrnInfoPtr pScrn)
memcpy(dst, src, pVia->driOffScreenMem->size);
free(pVia->driOffScreenSave);
pVia->driOffScreenSave = NULL;
-
- drm_bo_unmap(pScrn, pVia->driOffScreenMem);
} else {
}
}
diff --git a/src/via_driver.c b/src/via_driver.c
index a24e2cf..c4a97bf 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -803,7 +803,6 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
#endif
if (old_fb_id) {
- drm_bo_unmap(scrn, old_front);
drm_bo_free(scrn, old_front);
}
@@ -815,7 +814,6 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
fail:
if (drmmode->front_bo) {
- drm_bo_unmap(scrn, drmmode->front_bo);
drm_bo_free(scrn, drmmode->front_bo);
}
@@ -1378,7 +1376,6 @@ VIACloseScreen(CLOSE_SCREEN_ARGS_DECL)
#endif
pVia->drmmode.fb_id = 0;
- drm_bo_unmap(pScrn, pVia->drmmode.front_bo);
drm_bo_free(pScrn, pVia->drmmode.front_bo);
}
diff --git a/src/via_exa.c b/src/via_exa.c
index bcc824a..2821eaa 100644
--- a/src/via_exa.c
+++ b/src/via_exa.c
@@ -1080,11 +1080,9 @@ viaExitAccel(ScreenPtr pScreen)
pVia->scratchBuffer = NULL;
}
if (pVia->vq_bo) {
- drm_bo_unmap(pScrn, pVia->vq_bo);
drm_bo_free(pScrn, pVia->vq_bo);
}
if (pVia->exa_sync_bo) {
- drm_bo_unmap(pScrn, pVia->exa_sync_bo);
drm_bo_free(pScrn, pVia->exa_sync_bo);
}
if (pVia->exaDriverPtr) {
diff --git a/src/via_memcpy.c b/src/via_memcpy.c
index 7df19e8..2041176 100644
--- a/src/via_memcpy.c
+++ b/src/via_memcpy.c
@@ -627,7 +627,6 @@ viaVidCopyInit(const char *copyType, ScreenPtr pScreen)
}
free(buf3);
free(buf2);
- drm_bo_unmap(pScrn, tmpFbBuffer);
drm_bo_free(pScrn, tmpFbBuffer);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Using %s YUV42X copy for %s.\n",
diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index e1f2a49..64c38cf 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -251,42 +251,6 @@ exit:
return obj->ptr;
}
-void
-drm_bo_unmap(ScrnInfoPtr pScrn, struct buffer_object *obj)
-{
- VIAPtr pVia = VIAPTR(pScrn);
-#ifdef OPENCHROMEDRI
- struct drm_via_gem_unmap args;
- int ret;
-#endif /* OPENCHROMEDRI */
-
- if ((pVia->directRenderingType == DRI_NONE)
-#ifdef OPENCHROMEDRI
- || (pVia->directRenderingType == DRI_1)
-#endif /* OPENCHROMEDRI */
- ) {
-#ifdef OPENCHROMEDRI
- } else if (pVia->directRenderingType == DRI_2) {
- munmap(obj->ptr, obj->size);
-
- memset(&args, 0, sizeof(struct drm_via_gem_unmap));
- args.handle = obj->handle;
- ret = drmCommandRead(pVia->drmmode.fd,
- DRM_VIA_GEM_UNMAP,
- &args,
- sizeof(struct drm_via_gem_unmap));
- if (ret) {
- goto exit;
- }
-#endif /* OPENCHROMEDRI */
- }
-
-#ifdef OPENCHROMEDRI
-exit:
-#endif /* OPENCHROMEDRI */
- obj->ptr = NULL;
-}
-
void
drm_bo_free(ScrnInfoPtr pScrn, struct buffer_object *obj)
{
@@ -314,14 +278,20 @@ drm_bo_free(ScrnInfoPtr pScrn, struct buffer_object *obj)
drm.index = obj->handle;
if (drmCommandWrite(pVia->drmmode.fd, DRM_VIA_FREEMEM,
- &drm, sizeof(drm_via_mem_t)) < 0)
+ &drm, sizeof(drm_via_mem_t)) < 0) {
ErrorF("DRM failed to free for handle %lu.\n", obj->handle);
+ return;
+ }
} else if (pVia->directRenderingType == DRI_2) {
struct drm_gem_close close;
+ munmap(obj->ptr, obj->size);
+
close.handle = obj->handle;
- if (drmIoctl(pVia->drmmode.fd, DRM_IOCTL_GEM_CLOSE, &close) < 0)
+ if (drmIoctl(pVia->drmmode.fd, DRM_IOCTL_GEM_CLOSE, &close) < 0) {
ErrorF("DRM failed to free for handle %lu.\n", obj->handle);
+ return;
+ }
#endif
}
break;
@@ -329,6 +299,8 @@ drm_bo_free(ScrnInfoPtr pScrn, struct buffer_object *obj)
default:
break;
}
+
+ obj->ptr = NULL;
free(obj);
}
}
diff --git a/src/via_memmgr.h b/src/via_memmgr.h
index 42f714d..464198a 100644
--- a/src/via_memmgr.h
+++ b/src/via_memmgr.h
@@ -45,7 +45,6 @@ struct buffer_object *
drm_bo_alloc(ScrnInfoPtr pScrn, unsigned long size,
unsigned long alignment, int domain);
void *drm_bo_map(ScrnInfoPtr pScrn, struct buffer_object *obj);
-void drm_bo_unmap(ScrnInfoPtr pScrn, struct buffer_object *obj);
void drm_bo_free(ScrnInfoPtr pScrn, struct buffer_object *);
#endif
diff --git a/src/via_ums.c b/src/via_ums.c
index 0c1adce..d3fe8a1 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -696,10 +696,8 @@ viaUMSAccelInit(ScrnInfoPtr pScrn)
ret = TRUE;
err:
if (!ret) {
- if (pVia->markerBuf) {
- drm_bo_unmap(pScrn, pVia->exa_sync_bo);
+ if (pVia->markerBuf)
pVia->markerBuf = NULL;
- }
if (pVia->exa_sync_bo)
drm_bo_free(pScrn, pVia->exa_sync_bo);
if (pVia->vq_bo)
diff --git a/src/via_xv_overlay.c b/src/via_xv_overlay.c
index a9d844e..4f989e0 100644
--- a/src/via_xv_overlay.c
+++ b/src/via_xv_overlay.c
@@ -1161,7 +1161,6 @@ AddHQVSurface(ScrnInfoPtr pScrn, unsigned int numbuf, CARD32 fourcc)
VIASETREG(AddrReg[i] + proReg, addr);
addr += fbsize;
}
- drm_bo_unmap(pScrn, pVia->swov.HQVMem);
return Success;
}
@@ -1325,10 +1324,8 @@ ViaSwovSurfaceDestroy(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv)
case FOURCC_RV15:
pVia->swov.SrcFourCC = 0;
- drm_bo_unmap(pScrn, pVia->swov.SWfbMem);
drm_bo_free(pScrn, pVia->swov.SWfbMem);
if ((pVia->swov.gdwVideoFlagSW & SW_USE_HQV)) {
- drm_bo_unmap(pScrn, pVia->swov.HQVMem);
drm_bo_free(pScrn, pVia->swov.HQVMem);
}
pVia->swov.gdwVideoFlagSW = 0;
@@ -1341,7 +1338,6 @@ ViaSwovSurfaceDestroy(ScrnInfoPtr pScrn, viaPortPrivPtr pPriv)
case FOURCC_YV12:
case FOURCC_I420:
- drm_bo_unmap(pScrn, pVia->swov.SWfbMem);
drm_bo_free(pScrn, pVia->swov.SWfbMem);
case FOURCC_XVMC:
pVia->swov.SrcFourCC = 0;
diff --git a/src/via_xvmc.c b/src/via_xvmc.c
index f4e269e..04f6a0d 100644
--- a/src/via_xvmc.c
+++ b/src/via_xvmc.c
@@ -608,7 +608,6 @@ ViaXvMCCreateSurface(ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf,
memset((unsigned char*)buf + yBufSize, 0x80, yBufSize >> 1);
buf = (unsigned char*)buf + bufSize;
}
- drm_bo_unmap(pScrn, sPriv->memory_ref);
vXvMC->sPrivs[srfNo] = sPriv;
vXvMC->surfaces[srfNo] = pSurf->surface_id;
More information about the openchrome-devel
mailing list