From 23f01c9fe8e6170459fe46ad5fc9757bbe967d96 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 29 Aug 2006 18:40:08 +0200 Subject: Checkpoint commit. Buffer object flags and IOCTL argument list. --- libdrm/xf86mm.h | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 libdrm/xf86mm.h (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h new file mode 100644 index 00000000..5fb78723 --- /dev/null +++ b/libdrm/xf86mm.h @@ -0,0 +1,105 @@ +/************************************************************************** + * + * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND. USA. + * All Rights Reserved. + * + * 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, sub license, 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * + **************************************************************************/ + +#ifndef _XF86MM_H_ +#define _XF86MM_H_ +#include + + +/* + * List macros heavily inspired by the Linux kernel + * list handling. No list looping yet. + */ + +typedef struct _drmMMListHead +{ + struct _drmMMListHead *prev; + struct _drmMMListHead *next; +} DrmMMListHead; + +#define DRMINITLISTHEAD(__item) \ + do{ \ + (__item)->prev = (__item); \ + (__item)->next = (__item); \ + } while (0) + +#define DRMLISTADD(__item, __list) \ + do { \ + (__item)->prev = (__list); \ + (__item)->next = (__list)->next; \ + (__list)->next->prev = (__item); \ + (__list)->next = (__item); \ + } while (0) + +#define DRMLISTADDTAIL(__item, __list) \ + do { \ + (__item)->next = (__list); \ + (__item)->prev = (__list)->prev; \ + (__list)->prev->next = (__item); \ + (__list)->prev = (__item); \ + } while(0) + +#define DRMLISTDEL(__item) \ + do { \ + (__item)->prev->next = (__item)->next; \ + (__item)->next->prev = (__item)->prev; \ + } while(0) + +#define DRMLISTDELINIT(__item) \ + do { \ + (__item)->prev->next = (__item)->next; \ + (__item)->next->prev = (__item)->prev; \ + (__item)->next = (__item); \ + (__item)->prev = (__item); \ + } while(0) + +#define DRMLISTENTRY(__type, __item, __field) \ + ((__type *)(((char *) (__item)) - offsetof(__type, __field))) + + +typedef struct _DrmBuf{ + unsigned handle; +} DrmBuf; + + +typedef struct _DrmBufNode { + DrmMMListHead head; + DrmBuf *buf; + drm_bo_arg_t bo_arg; +} DrmBufNode; + +typedef struct _DrmMMBufList { + unsigned numTarget; + unsigned numCurrent; + unsigned numOnList; + DrmMMListHead list; + DrmMMListHead free; +} DrmBufList; + + +#endif -- cgit v1.2.3 From de144ba23c1245cf021a63cc739c7c9903568272 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 29 Aug 2006 21:57:37 +0200 Subject: Part of buffer object libdrm interface. --- libdrm/xf86mm.h | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 5fb78723..08149d08 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -29,7 +29,7 @@ #ifndef _XF86MM_H_ #define _XF86MM_H_ #include - +#include "xf86drm.h" /* * List macros heavily inspired by the Linux kernel @@ -40,7 +40,7 @@ typedef struct _drmMMListHead { struct _drmMMListHead *prev; struct _drmMMListHead *next; -} DrmMMListHead; +} drmMMListHead; #define DRMINITLISTHEAD(__item) \ do{ \ @@ -82,24 +82,37 @@ typedef struct _drmMMListHead ((__type *)(((char *) (__item)) - offsetof(__type, __field))) -typedef struct _DrmBuf{ +typedef struct _drmBO{ + drm_bo_type_t type; unsigned handle; -} DrmBuf; - - -typedef struct _DrmBufNode { - DrmMMListHead head; - DrmBuf *buf; + drm_handle_t map_handle; + unsigned flags; + unsigned mask; + unsigned hint; + unsigned map_flags; + unsigned long size; + unsigned long offset; + unsigned long start; + void *virtual; + void *map_virtual; + int map_count; + drmTTM *ttm; +} drmBO; + + +typedef struct _drmBONode { + drmMMListHead head; + drmBO *buf; drm_bo_arg_t bo_arg; -} DrmBufNode; +} drmBONode; -typedef struct _DrmMMBufList { +typedef struct _drmBOList { unsigned numTarget; unsigned numCurrent; unsigned numOnList; - DrmMMListHead list; - DrmMMListHead free; -} DrmBufList; + drmMMListHead list; + drmMMListHead free; +} drmBOList; #endif -- cgit v1.2.3 From e47a4fda2ef7aada45b7799ad20e8012102dc12e Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 30 Aug 2006 13:04:08 +0200 Subject: Memory manager init and takedown. --- libdrm/xf86mm.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 08149d08..8711a144 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -29,7 +29,7 @@ #ifndef _XF86MM_H_ #define _XF86MM_H_ #include -#include "xf86drm.h" +#include "drm.h" /* * List macros heavily inspired by the Linux kernel @@ -114,5 +114,12 @@ typedef struct _drmBOList { drmMMListHead free; } drmBOList; +extern int drmBOCreate(int fd, drmTTM *ttm, unsigned long start, unsigned long size, + void *user_buffer, drm_bo_type_t type, unsigned mask, + unsigned hint, drmBO *buf); +extern int drmBODestroy(int fd, drmBO *buf); +extern int drmBOReference(int fd, unsigned handle, drmBO *buf); +extern int drmBOUnReference(int fd, drmBO *buf); + #endif -- cgit v1.2.3 From 14a835be616183e733a2d6a7dcc697b8a6f46caf Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 30 Aug 2006 15:08:40 +0200 Subject: Buffer object mapping and mapping synchronization for multiple clients. --- libdrm/xf86mm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 8711a144..c811892f 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -85,17 +85,17 @@ typedef struct _drmMMListHead typedef struct _drmBO{ drm_bo_type_t type; unsigned handle; - drm_handle_t map_handle; + drm_handle_t mapHandle; unsigned flags; unsigned mask; unsigned hint; - unsigned map_flags; + unsigned mapFlags; unsigned long size; unsigned long offset; unsigned long start; void *virtual; - void *map_virtual; - int map_count; + void *mapVirtual; + int mapCount; drmTTM *ttm; } drmBO; -- cgit v1.2.3 From d39055174b5a487f0d848e1af4c3459fb4261bf1 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 30 Aug 2006 17:40:07 +0200 Subject: Remove the buffer object hint field and use it only as an argument. Validate stub. --- libdrm/xf86mm.h | 1 - 1 file changed, 1 deletion(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index c811892f..21fed6cf 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -88,7 +88,6 @@ typedef struct _drmBO{ drm_handle_t mapHandle; unsigned flags; unsigned mask; - unsigned hint; unsigned mapFlags; unsigned long size; unsigned long offset; -- cgit v1.2.3 From ec8c79b79de6544cc09b5a2c85213a5f30e0d906 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 31 Aug 2006 14:10:13 +0200 Subject: More mapping synchronization. libdrm validate and fencing functions. --- libdrm/xf86mm.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 21fed6cf..aaee3c0b 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -103,6 +103,8 @@ typedef struct _drmBONode { drmMMListHead head; drmBO *buf; drm_bo_arg_t bo_arg; + unsigned long arg0; + unsigned long arg1; } drmBONode; typedef struct _drmBOList { -- cgit v1.2.3 From ef8e618cf30ab7dcbe8c7211e0c2508c5520a669 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 1 Sep 2006 16:38:06 +0200 Subject: Export buffer info on map and validate ioctls. Add an info ioctl operation. --- libdrm/xf86mm.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index aaee3c0b..a8458b15 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -92,6 +92,8 @@ typedef struct _drmBO{ unsigned long size; unsigned long offset; unsigned long start; + unsigned replyFlags; + unsigned fenceFlags; void *virtual; void *mapVirtual; int mapCount; -- cgit v1.2.3 From f88c32fd4cb93fe8b9dfa543a26d74733d0cd8ef Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Mon, 4 Sep 2006 22:05:21 +0200 Subject: Libdrm function headers. Some renaming. --- libdrm/xf86mm.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index a8458b15..623f4d58 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -117,12 +117,63 @@ typedef struct _drmBOList { drmMMListHead free; } drmBOList; + +/* + * TTM functions. + */ + +extern int drmTTMCreate(int fd, drmTTM *ttm, unsigned long size, + unsigned flags); +extern int drmTTMDestroy(int fd, const drmTTM *ttm); +extern int drmTTMReference(int fd, unsigned handle, drmTTM *ttm); +extern int drmTTMUnreference(int fd, const drmTTM *ttm); +extern drm_handle_t drmTTMMapHandle(int fd, const drmTTM *ttm); + +/* + * Buffer object list functions. + */ + +extern void drmBOFreeList(drmBOList *list); +extern int drmBOResetList(drmBOList *list); +extern void *drmBOListIterator(drmBOList *list); +extern void *drmBOListNext(drmBOList *list, void *iterator); +extern drmBO *drmBOListBuf(void *iterator); +extern int drmBOCreateList(int numTarget, drmBOList *list); + +/* + * Buffer object functions. + */ + extern int drmBOCreate(int fd, drmTTM *ttm, unsigned long start, unsigned long size, void *user_buffer, drm_bo_type_t type, unsigned mask, unsigned hint, drmBO *buf); extern int drmBODestroy(int fd, drmBO *buf); extern int drmBOReference(int fd, unsigned handle, drmBO *buf); extern int drmBOUnReference(int fd, drmBO *buf); +extern int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint, + void **address); +extern int drmBOUnmap(int fd, drmBO *buf); +extern int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask, + unsigned hint); +extern int drmBOFence(int fd, drmBO *buf, unsigned flags, unsigned fenceHandle); +extern int drmBOInfo(int fd, drmBO *buf); +extern int drmBufBusy(int fd, drmBO *buf, int *busy); + + +extern int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags, + unsigned mask, + int *newItem); +extern int drmBOValidateList(int fd, drmBOList *list); +extern int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle); + + +/* + * Initialization functions. + */ + +extern int drmMMInit(int fd, unsigned long vramPOffset, unsigned long vramPSize, + unsigned long ttPOffset, unsigned long ttPSize); +extern int drmMMTakedown(int fd); #endif -- cgit v1.2.3 From e3f54ecdd9d266607afd7d8b62960b2154b63e9d Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 5 Sep 2006 19:36:45 +0200 Subject: Multithreaded application note. --- libdrm/xf86mm.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 623f4d58..43ea71b8 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -31,6 +31,18 @@ #include #include "drm.h" +/* + * Note on multithreaded applications using this interface. + * Libdrm is not threadsafe, so common buffer, TTM, and fence objects need to + * be protected using an external mutex. + * + * Note: Don't protect the following functions, as it may lead to deadlocks: + * drmBOUnmap(), drmFenceBuffers(). + * The kernel is synchronizing and refcounting buffer maps. + * User space only needs to refcount object usage within the same application. + */ + + /* * List macros heavily inspired by the Linux kernel * list handling. No list looping yet. @@ -82,6 +94,7 @@ typedef struct _drmMMListHead ((__type *)(((char *) (__item)) - offsetof(__type, __field))) + typedef struct _drmBO{ drm_bo_type_t type; unsigned handle; -- cgit v1.2.3 From 191e284709ee792a32124e96e43d5876406b93dc Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 12 Sep 2006 12:01:00 +0200 Subject: More bugfixes. Disable the i915 IRQ turnoff for now since it seems to be causing problems. --- libdrm/xf86mm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 43ea71b8..24e28245 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -185,7 +185,8 @@ extern int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle); */ extern int drmMMInit(int fd, unsigned long vramPOffset, unsigned long vramPSize, - unsigned long ttPOffset, unsigned long ttPSize); + unsigned long ttPOffset, unsigned long ttPSize, + unsigned long max_locked_size); extern int drmMMTakedown(int fd); -- cgit v1.2.3 From 49fbeb339c232804866cd548d6023fe559597353 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 15 Sep 2006 11:18:35 +0200 Subject: Some bugfixes. Change the fence object interface somewhat to allow some more flexibility. Make list IOCTLS really restartable. Try to avoid busy-waits in the kernel using immediate return to user-space with an -EAGAIN. --- libdrm/xf86mm.h | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 24e28245..4cb37e23 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -93,7 +93,22 @@ typedef struct _drmMMListHead #define DRMLISTENTRY(__type, __item, __field) \ ((__type *)(((char *) (__item)) - offsetof(__type, __field))) - +typedef struct _drmFence{ + unsigned handle; + int class; + unsigned type; + unsigned flags; + unsigned signaled; +} drmFence; + +typedef struct _drmTTM{ + unsigned handle; + drm_handle_t user_token; + unsigned flags; + unsigned long size; + void *virtual; + int mapCount; +} drmTTM; typedef struct _drmBO{ drm_bo_type_t type; @@ -130,6 +145,23 @@ typedef struct _drmBOList { drmMMListHead free; } drmBOList; +/* Fencing */ + +extern int drmFenceCreate(int fd, unsigned flags, int class, + unsigned type, + drmFence *fence); +extern int drmFenceDestroy(int fd, const drmFence *fence); +extern int drmFenceReference(int fd, unsigned handle, drmFence *fence); +extern int drmFenceUnreference(int fd, const drmFence *fence); +extern int drmFenceFlush(int fd, drmFence *fence, unsigned flush_type); +extern int drmFenceSignaled(int fd, drmFence *fence, + unsigned fenceType, int *signaled); +extern int drmFenceWait(int fd, unsigned flags, drmFence *fence, + unsigned flush_type); +extern int drmFenceEmit(int fd, unsigned flags, drmFence *fence, + unsigned emit_type); +extern int drmFenceBuffers(int fd, unsigned flags, drmFence *fence); + /* * TTM functions. -- cgit v1.2.3 From c4fad4c96168a3dfabaa8a7e97758fefd014c8a7 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Mon, 18 Sep 2006 16:02:33 +0200 Subject: More verbose error reporting in some cases. Add a buffer object waitIdle user-space function. Fix some names and minor glitches. --- libdrm/xf86mm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 4cb37e23..a62aef47 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -202,7 +202,7 @@ extern int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask, unsigned hint); extern int drmBOFence(int fd, drmBO *buf, unsigned flags, unsigned fenceHandle); extern int drmBOInfo(int fd, drmBO *buf); -extern int drmBufBusy(int fd, drmBO *buf, int *busy); +extern int drmBOBusy(int fd, drmBO *buf, int *busy); extern int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags, @@ -210,7 +210,7 @@ extern int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags, int *newItem); extern int drmBOValidateList(int fd, drmBOList *list); extern int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle); - +extern int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint); /* * Initialization functions. -- cgit v1.2.3 From fa511a3ff5150d932fd963594d1ef67a94bb8b1f Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 20 Sep 2006 16:31:15 +0200 Subject: Allow for 64-bit map handles of ttms and buffer objects. --- libdrm/xf86mm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index a62aef47..c0e4f1b6 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -103,7 +103,7 @@ typedef struct _drmFence{ typedef struct _drmTTM{ unsigned handle; - drm_handle_t user_token; + drm_u64_t user_token; unsigned flags; unsigned long size; void *virtual; @@ -113,7 +113,7 @@ typedef struct _drmTTM{ typedef struct _drmBO{ drm_bo_type_t type; unsigned handle; - drm_handle_t mapHandle; + drm_u64_t mapHandle; unsigned flags; unsigned mask; unsigned mapFlags; -- cgit v1.2.3 From f2db76e2f206d2017f710eaddc4b33add4498898 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 11 Oct 2006 13:40:35 +0200 Subject: Big update: Adapt for new functions in the 2.6.19 kernel. Remove the ability to have multiple regions in one TTM. This simplifies a lot of code. Remove the ability to access TTMs from user space. We don't need it anymore without ttm regions. Don't change caching policy for evicted buffers. Instead change it only when the buffer is accessed by the CPU (on the first page fault). This tremendously speeds up eviction rates. Current code is safe for kernels <= 2.6.14. Should also be OK with 2.6.19 and above. --- libdrm/xf86mm.h | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index c0e4f1b6..78df37c3 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -101,15 +101,6 @@ typedef struct _drmFence{ unsigned signaled; } drmFence; -typedef struct _drmTTM{ - unsigned handle; - drm_u64_t user_token; - unsigned flags; - unsigned long size; - void *virtual; - int mapCount; -} drmTTM; - typedef struct _drmBO{ drm_bo_type_t type; unsigned handle; @@ -125,7 +116,6 @@ typedef struct _drmBO{ void *virtual; void *mapVirtual; int mapCount; - drmTTM *ttm; } drmBO; @@ -163,17 +153,6 @@ extern int drmFenceEmit(int fd, unsigned flags, drmFence *fence, extern int drmFenceBuffers(int fd, unsigned flags, drmFence *fence); -/* - * TTM functions. - */ - -extern int drmTTMCreate(int fd, drmTTM *ttm, unsigned long size, - unsigned flags); -extern int drmTTMDestroy(int fd, const drmTTM *ttm); -extern int drmTTMReference(int fd, unsigned handle, drmTTM *ttm); -extern int drmTTMUnreference(int fd, const drmTTM *ttm); -extern drm_handle_t drmTTMMapHandle(int fd, const drmTTM *ttm); - /* * Buffer object list functions. */ @@ -189,7 +168,7 @@ extern int drmBOCreateList(int numTarget, drmBOList *list); * Buffer object functions. */ -extern int drmBOCreate(int fd, drmTTM *ttm, unsigned long start, unsigned long size, +extern int drmBOCreate(int fd, void *ttm, unsigned long start, unsigned long size, void *user_buffer, drm_bo_type_t type, unsigned mask, unsigned hint, drmBO *buf); extern int drmBODestroy(int fd, drmBO *buf); -- cgit v1.2.3 From 5881ce1b91034fbdf81dda37a23215cfc1310cdf Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 17 Oct 2006 11:05:37 +0200 Subject: Extend generality for more memory types. Fix up init and destruction code. --- libdrm/xf86mm.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 78df37c3..b2ba24d5 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -195,10 +195,11 @@ extern int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint); * Initialization functions. */ -extern int drmMMInit(int fd, unsigned long vramPOffset, unsigned long vramPSize, - unsigned long ttPOffset, unsigned long ttPSize, - unsigned long max_locked_size); -extern int drmMMTakedown(int fd); +extern int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize, + unsigned memType); +extern int drmMMTakedown(int fd, unsigned memType); +extern int drmMMMaxLockedSize(int fd, unsigned long maxLockedSize); + #endif -- cgit v1.2.3 From 5443dbe35f182b9286a96d24d29037d5cb625e3d Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 17 Oct 2006 16:00:25 +0200 Subject: Implement mm_lock and mm_unlock functions. The mm_lock function is used when leaving vt. It evicts _all_ buffers. Buffers with the DRM_BO_NO_MOVE attribute set will be guaranteed to get the same offset when / if they are rebound. --- libdrm/xf86mm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index b2ba24d5..c3112c90 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -199,7 +199,8 @@ extern int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize, unsigned memType); extern int drmMMTakedown(int fd, unsigned memType); extern int drmMMMaxLockedSize(int fd, unsigned long maxLockedSize); - +extern int drmMMLock(int fd, unsigned memType); +extern int drmMMUnlock(int fd, unsigned memType); #endif -- cgit v1.2.3 From c34faf224b959bf61e4c3eb29c66a12edbd31841 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 17 Oct 2006 20:03:26 +0200 Subject: Remove max number of locked pages check and call, since that is now handled by the memory accounting. --- libdrm/xf86mm.h | 1 - 1 file changed, 1 deletion(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index c3112c90..da868fe5 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -198,7 +198,6 @@ extern int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint); extern int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize, unsigned memType); extern int drmMMTakedown(int fd, unsigned memType); -extern int drmMMMaxLockedSize(int fd, unsigned long maxLockedSize); extern int drmMMLock(int fd, unsigned memType); extern int drmMMUnlock(int fd, unsigned memType); -- cgit v1.2.3 From f6d5fecdd20b9fd9e8744d8f43fa276b73a1da78 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 27 Oct 2006 11:28:37 +0200 Subject: Last minute changes to support multi-page size buffer offset alignments. This will come in very handy for tiled buffers on intel hardware. Also add some padding to interface structures to allow future binary backwards compatible changes. --- libdrm/xf86mm.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'libdrm/xf86mm.h') diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index da868fe5..bd0d2812 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -99,6 +99,7 @@ typedef struct _drmFence{ unsigned type; unsigned flags; unsigned signaled; + unsigned pad[4]; /* for future expansion */ } drmFence; typedef struct _drmBO{ @@ -113,9 +114,11 @@ typedef struct _drmBO{ unsigned long start; unsigned replyFlags; unsigned fenceFlags; + unsigned pageAlignment; void *virtual; void *mapVirtual; int mapCount; + unsigned pad[8]; /* for future expansion */ } drmBO; @@ -168,9 +171,10 @@ extern int drmBOCreateList(int numTarget, drmBOList *list); * Buffer object functions. */ -extern int drmBOCreate(int fd, void *ttm, unsigned long start, unsigned long size, - void *user_buffer, drm_bo_type_t type, unsigned mask, - unsigned hint, drmBO *buf); +extern int drmBOCreate(int fd, unsigned long start, unsigned long size, + unsigned pageAlignment,void *user_buffer, + drm_bo_type_t type, unsigned mask, + unsigned hint, drmBO *buf); extern int drmBODestroy(int fd, drmBO *buf); extern int drmBOReference(int fd, unsigned handle, drmBO *buf); extern int drmBOUnReference(int fd, drmBO *buf); -- cgit v1.2.3