summaryrefslogtreecommitdiff
path: root/libdrm/intel
AgeCommit message (Collapse)Author
2009-10-08intel: Remove the asserts about the ignored alignment parameter.Eric Anholt
I slipped it in with the alloc_tiled changes, since we were explicitly throwing the parameter away. It caught some bogus released code, which we've now fixed, so remove the asserts to keep old drivers working.
2009-10-06intel: Add a bo_alloc function for tiled BOs.Jesse Barnes
This simplifies driver code in handling object allocation, and also gives us an opportunity to possibly cache tiled buffers if it turns out to be a win. [anholt: This is chopped out of the execbuf2 patch, as it seems to be useful separately and cleans up the execbuf2 changes to be more obvious]
2009-10-06intel: Fix up some stale doxygen comments.Eric Anholt
2009-10-06intel: Reformat to the kernel coding style. Welcome to the 8-space future.Eric Anholt
This is done with: Lindent *.[ch] perl -pi -e 's|drm_intel_bo \* |drm_intel_bo *|g' *.[ch] perl -pi -e 's|drm_intel_bufmgr \* |drm_intel_bufmgr *|g' *.[ch] perl -pi -e 's|drm_intel_bo_gem \* |drm_intel_bo_gem *|g' *.[ch] perl -pi -e 's|drm_intel_bufmgr_gem \* |drm_intel_bufmgr_gem *|g' *.[ch] perl -pi -e 's|_fake \* |_fake *|g' *.[ch] hand-editing to whack indented comments into line and other touchups.
2009-10-06intel: Don't allocate more relocation entries than the BO could support.Eric Anholt
This saves 32k of relocation entry storage for many 965 state buffers. No noticeable impact on performance for cairo-gl firefox.
2009-10-03intel: report errnoChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-10-02intel: Use atomic refcountersChris Wilson
As the target architecture for Intel GPUs is the x86, we can presume to have reasonable compiler support for Intel atomic intrinsics, i.e. gcc, and so use those in preference to pulling in a complicated mess of fragile assembly. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> [anholt: hand-resolved against my previous commit. This brings cairo-gl firefox-talos-gfx time from 65 seconds back down to 62 seconds.] Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-02intel: Mark cached bo as purgeableChris Wilson
Set the DONTNEED flag on cached buffers so that the kernel is free to discard those when under memory pressure. [anholt: This takes firefox-talos-gfx time from ~62 seconds to ~65 seconds on my GM965, but it seems like a hit worth taking for the improved functionality from saving memory] Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
2009-10-02intel: Don't free the reloc list when putting a freed BO in the cache.Eric Anholt
This takes firefox-talos-gfx from 74 seconds to 70 seconds on my GM965.
2009-10-01intel: Add a new function to check if a BO's reloc tree references some BO.Eric Anholt
There are a bunch of places in GL where if we can't do this we have to flush the batchbuffer, and the cost of lookups here is outweighed by flush savings. /** * \file drm_drawable.c * IOCTLs for drawables * * \author Rickard E. (Rik) Faith <faith@valinux.com> * \author Gareth Hughes <gareth@valinux.com> * \author Michel Dänzer <michel@tungstengraphics.com> */ /* * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * Copyright 2006 Tungsten Graphics, Inc., Bismarck, North Dakota. * 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, 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 (including the next * paragraph) 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 * VA LINUX SYSTEMS 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. */ #include "drmP.h" /** * Allocate drawable ID and memory to store information about it. */ int drm_adddraw(struct drm_device *dev, void *data, struct drm_file *file_priv) { unsigned long irqflags; struct drm_draw *draw = data; int new_id = 0; int ret; again: if (idr_pre_get(&dev->drw_idr, GFP_KERNEL) == 0) { DRM_ERROR("Out of memory expanding drawable idr\n"); return -ENOMEM; } spin_lock_irqsave(&dev->drw_lock, irqflags); ret = idr_get_new_above(&dev->drw_idr, NULL, 1, &new_id); if (ret == -EAGAIN) { spin_unlock_irqrestore(&dev->drw_lock, irqflags); goto again; } spin_unlock_irqrestore(&dev->drw_lock, irqflags); draw->handle = new_id; DRM_DEBUG("%d\n", draw->handle); return 0; } /** * Free drawable ID and memory to store information about it. */ int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_draw *draw = data; unsigned long irqflags; spin_lock_irqsave(&dev->drw_lock, irqflags); drm_free(drm_get_drawable_info(dev, draw->handle), sizeof(struct drm_drawable_info), DRM_MEM_BUFS); idr_remove(&dev->drw_idr, draw->handle); spin_unlock_irqrestore(&dev->drw_lock, irqflags); DRM_DEBUG("%d\n", draw->handle); return 0; } int drm_update_drawable_info(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_update_draw *update = data; unsigned long irqflags; struct drm_clip_rect *rects; struct drm_drawable_info *info; int err; info = idr_find(&dev->drw_idr, update->handle); if (!info) { info = drm_calloc(1, sizeof(*info), DRM_MEM_BUFS); if (!info) return -ENOMEM; if (IS_ERR(idr_replace(&dev->drw_idr, info, update->handle))) { DRM_ERROR("No such drawable %d\n", update->handle); drm_free(info, sizeof(*info), DRM_MEM_BUFS); return -EINVAL; } } switch (update->type) { case DRM_DRAWABLE_CLIPRECTS: if (update->num != info->num_rects) { rects = drm_alloc(update->num * sizeof(struct drm_clip_rect), DRM_MEM_BUFS); } else rects = info->rects; if (update->num && !rects) { DRM_ERROR("Failed to allocate cliprect memory\n"); err = -ENOMEM; goto error; } if (update->num && DRM_COPY_FROM_USER(rects, (struct drm_clip_rect __user *) (unsigned long)update->data, update->num * sizeof(*rects))) { DRM_ERROR("Failed to copy cliprects from userspace\n"); err = -EFAULT; goto error; } spin_lock_irqsave(&dev->drw_lock, irqflags); if (rects != info->rects) { drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect), DRM_MEM_BUFS); } info->rects = rects; info->num_rects = update->num; spin_unlock_irqrestore(&dev->drw_lock, irqflags); DRM_DEBUG("Updated %d cliprects for drawable %d\n", info->num_rects, update->handle); break; default: DRM_ERROR("Invalid update type %d\n", update->type); return -EINVAL; } return 0; error: if (rects != info->rects) drm_free(rects, update->num * sizeof(struct drm_clip_rect), DRM_MEM_BUFS); return err;f the buffers in the GTT. This is usually caused by the DRM client attempting to use too much memory in a single request. Dumping out the requested and available memory values should help point out failures in the DRM code to catch over commitments of this form. Signed-off-by: Keith Packard <keithp@keithp.com>
2008-12-17libdrm: add mode setting filesJesse Barnes
Add mode setting files to libdrm, including xf86drmMode.* and the new drm_mode.h header. Also add a couple of tests to sanity check the kernel interfaces and update code to support them.
2008-12-14intel: don't skip set_domain on mapping of shared buffers.Eric Anholt
2008-12-14intel: don't let named buffers into the BO cache.Eric Anholt
We wouldn't want some remaining 3D rendering to scribble on our batchbuffer.
2008-12-14intel: Remove the mapped flag, which is adequately covered by bo_gem->virtual.Eric Anholt
2008-12-10Revert "Merge branch 'modesetting-gem'"Jesse Barnes
This reverts commit 6656db10551bbb8770dd945b6d81d5138521f208. We really just want the libdrm and ioctl bits, not all the driver stuff.
2008-12-03Merge branch 'master' into modesetting-gemJesse Barnes
2008-12-02intel: Add a function for setting (GTT,GTT) domain, for use by UXA.Eric Anholt
This function can also serve the role that the bo_wait_rendering did, when write_enable is unset.
2008-11-19libdrm_intel: fix merge errorJesse Barnes
don't take the lock twice
2008-11-13Merge branch 'master' into modesetting-gemJesse Barnes
Conflicts: libdrm/Makefile.am libdrm/intel/intel_bufmgr.h libdrm/intel/intel_bufmgr_fake.c libdrm/intel/intel_bufmgr_gem.c shared-core/drm.h shared-core/i915_dma.c shared-core/i915_irq.c shared-core/radeon_cp.c shared-core/radeon_drv.h
2008-11-13libdrm_intel: fix warnings on 64 bitJesse Barnes
Cast a couple of %llx args to unsigned long long.