summaryrefslogtreecommitdiff
path: root/shared-core/via_drv.h
AgeCommit message (Expand)Author
2008-01-22Merge branch 'master' into vblank-rework, including mach64 supportJesse Barnes
2007-12-21Rename inappropriately named 'mask' fields to 'proposed_flags' instead.Keith Packard
2007-11-05drm: remove lots of spurious whitespace.Dave Airlie
2007-10-30Merge branch 'master' into vblank-rework, fixup remaining driversJesse Barnes
2007-09-22Add fence error member.Thomas Hellstrom
2007-07-20Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.Eric Anholt
2007-07-20Replace filp in ioctl arguments with drm_file *file_priv.Eric Anholt
2007-07-16drm: detypedef ttm/bo/fence codeDave Airlie
2007-07-16drm: remove hashtab/sman and object typedefsDave Airlie
2007-07-16drm: remove drmP.h internal typedefsDave Airlie
2007-06-12Try to make buffer object / fence object ioctl args 64-bit safe.Thomas Hellstrom
2007-02-16Simple fence object sample driver for via, based on idling the GPU.Thomas Hellstrom
2007-02-02via: Try to improve command-buffer chaining.Thomas Hellstrom
2006-12-28Add some new via chipsets.Thomas Hellstrom
2006-08-28drm: lots of small cleanups and whitespace issues fixed upDave Airlie
2006-06-15via:Thomas Hellstrom
2006-06-06Merge in the drm-sman-branchThomas Hellstrom
2006-03-19make some functions static in via driverDave Airlie
2006-02-17via: Change via_drm.h versioning scheme after lenghty discussion onThomas Hellstrom
2006-01-12via: direction bug in get_user_pages call in via_dmablit.c fixed. BumpedThomas Hellstrom
2006-01-06via: Last commit really required a bump of minor. Fix.Thomas Hellstrom
2006-01-06via: Combine PCI DMA transfers with stride==width (Idea from LucThomas Hellstrom
2006-01-02Realign via driver with changes in Linux kernel (mainly whitespace)Dave Airlie
2005-11-16Fixed long standing 64-bit bug in via memory manager. Bumped via date andThomas Hellstrom
2005-11-15Loosen via dmablit alignment checks somewhat. Adapt stride check to maximumThomas Hellstrom
2005-11-11cleanup ioctl/max_ioctl to use header file for extern symbolsDave Airlie
2005-10-22via: Sync via_drm.h with 3D driver. Bump via patchlevel and date.Thomas Hellstrom
2005-10-20via: PCI DMA bugfixes and DOS due to too many mapped pages checks.Thomas Hellstrom
2005-09-25Add the via PCI DMA blit code.Thomas Hellstrom
2005-08-15Port the VIA DRM to FreeBSD. Original patch by Jake, with some cleanup byEric Anholt
2005-08-14VIA bugvixes by Joris van Rantwijk Initial commit.Thomas Hellstrom
2005-08-12Reverting the previous via security-fix commit, since the assumption ofThomas Hellstrom
2005-08-10Security fix on via: Checking that the specified context belongs to theThomas Hellstrom
2005-07-15VIA: Fix sparse warnings (Alexey Dobriyan)Thomas Hellstrom
2005-05-23VIA:Thomas Hellstrom
2005-05-08VIA: Fix for oops when AGP ring-buffer initialization is called and thereThomas Hellstrom
2005-04-20VIA: Interrupt handler bugfixes. Bumped patchlevel to 2.6.2.Thomas Hellstrom
2005-04-18VIA:Thomas Hellstrom
2005-03-28Via updates:Thomas Hellstrom
2005-03-14via changes:Thomas Hellstrom
2005-02-13Fixed Futex release bug. Bumped driver date and patchlevel.Thomas Hellstrom
2005-02-03Via driver: Add missing drm_poll function to via driver in core.Thomas Hellstrom
2005-02-01cleanup patch from Adrian Bunk <bunk@stusta.de>Dave Airlie
2005-01-27Fixed multiple devices DMA bug. Fixed PCI path FIRE command detectionThomas Hellstrom
2005-01-07via updates: moved the verifier state struct to dev_priv. Implemented AGPThomas Hellstrom
2005-01-07Updated via DRM with check for stray FIRE commands primitive list.Thomas Hellstrom
2005-01-06via DRM: Updated the verifier to check the vertex lists more thorough. ThisThomas Hellstrom
2005-01-05Bumped driver date and minor version.Thomas Hellstrom
2005-01-05VIA update:Thomas Hellstrom
2004-12-31VIA DRM: verifier: Added verbose palette error reporting, and support forThomas Hellstrom
span class="hl opt">- 1].free_next = -1; set->free = 0; set->alloc = -1; set->trace = -1; } return set; } int setAdd(set_t * set, ITEM_TYPE item) { int free = set->free; if (free != -1) { set->list[free].val = item; set->free = set->list[free].free_next; } else { return 0; } set->list[free].alloc_next = set->alloc; set->alloc = free; set->list[free].free_next = -1; return 1; } int setDel(set_t * set, ITEM_TYPE item) { int alloc = set->alloc; int prev = -1; while (alloc != -1) { if (set->list[alloc].val == item) { if (prev != -1) set->list[prev].alloc_next = set->list[alloc].alloc_next; else set->alloc = set->list[alloc].alloc_next; break; } prev = alloc; alloc = set->list[alloc].alloc_next; } if (alloc == -1) return 0; set->list[alloc].free_next = set->free; set->free = alloc; set->list[alloc].alloc_next = -1; return 1; } /* setFirst -> setAdd -> setNext is wrong */ int setFirst(set_t * set, ITEM_TYPE * item) { if (set->alloc == -1) return 0; *item = set->list[set->alloc].val; set->trace = set->list[set->alloc].alloc_next; return 1; } int setNext(set_t * set, ITEM_TYPE * item) { if (set->trace == -1) return 0; *item = set->list[set->trace].val; set->trace = set->list[set->trace].alloc_next; return 1; } int setDestroy(set_t * set) { drm_free(set, sizeof(set_t), DRM_MEM_DRIVER); return 1; } /* * GLX Hardware Device Driver common code * Copyright (C) 1999 Wittawat Yamwong * * 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 * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS 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. * */ #define ISFREE(bptr) ((bptr)->free) memHeap_t *mmInit(int ofs, int size) { PMemBlock blocks; if (size <= 0) return NULL; blocks = (TMemBlock *) drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER); if (blocks != NULL) { blocks->ofs = ofs; blocks->size = size; blocks->free = 1; return (memHeap_t *) blocks; } else return NULL; } /* Checks if a pointer 'b' is part of the heap 'heap' */ int mmBlockInHeap(memHeap_t * heap, PMemBlock b) { TMemBlock *p; if (heap == NULL || b == NULL) return 0; p = heap; while (p != NULL && p != b) { p = p->next; } if (p == b) return 1; else return 0; } static TMemBlock *SliceBlock(TMemBlock * p, int startofs, int size, int reserved, int alignment) { TMemBlock *newblock; /* break left */ if (startofs > p->ofs) { newblock = (TMemBlock *) drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER); newblock->ofs = startofs; newblock->size = p->size - (startofs - p->ofs); newblock->free = 1; newblock->next = p->next; p->size -= newblock->size; p->next = newblock; p = newblock; } /* break right */ if (size < p->size) { newblock = (TMemBlock *) drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER); newblock->ofs = startofs + size; newblock->size = p->size - size; newblock->free = 1; newblock->next = p->next; p->size = size; p->next = newblock; } /* p = middle block */ p->align = alignment; p->free = 0; p->reserved = reserved; return p; } PMemBlock mmAllocMem(memHeap_t * heap, int size, int align2, int startSearch) { int mask, startofs, endofs; TMemBlock *p; if (heap == NULL || align2 < 0 || size <= 0) return NULL; mask = (1 << align2) - 1; startofs = 0; p = (TMemBlock *) heap; while (p != NULL) { if (ISFREE(p)) { startofs = (p->ofs + mask) & ~mask; if (startofs < startSearch) { startofs = startSearch; } endofs = startofs + size; if (endofs <= (p->ofs + p->size)) break; } p = p->next; } if (p == NULL) return NULL; p = SliceBlock(p, startofs, size, 0, mask + 1); p->heap = heap; return p; } static __inline__ int Join2Blocks(TMemBlock * p) { if (p->free && p->next && p->next->free) { TMemBlock *q = p->next; p->size += q->size; p->next = q->next; drm_free(q, sizeof(TMemBlock), DRM_MEM_DRIVER); return 1; } return 0; } int mmFreeMem(PMemBlock b) { TMemBlock *p, *prev; if (b == NULL) return 0; if (b->heap == NULL) return -1; p = b->heap; prev = NULL; while (p != NULL && p != b) { prev = p; p = p->next; } if (p == NULL || p->free || p->reserved) return -1; p->free = 1; Join2Blocks(p); if (prev) Join2Blocks(prev); return 0; }