Re: [Intel-gfx] Page flipping not working as expected for compositing - engineering resource available to help fix it
On Monday 10 May 2010, Jesse Barnes jbar...@virtuousgeek.org wrote: What about the indirect bug? Did that also go away when you fixed the perms issue? If not, that sounds like a serious issue, in indirect mode the swap interval should still be honored I think... In indirect mode, the swap interval was being honoured by the page flipping code, but SwapBuffers wasn't blocking; instead, I appeared to be able to continue to draw to the backbuffer after issuing SwapBuffers in my application. In direct mode, SwapBuffers behaved as I'd expect - I blocked as soon as I tried to draw, until the swap had completed. Guessing wildly, when I SwapBuffers in a direct context, I ask the kernel to stall me as soon as I draw to the back buffer (which is presumably still in use as the real front buffer). When I'm in an indirect context, it's the X server process that calls the kernel, which can't block, because that would stop it servicing other clients, and it's not blocking me until it discovers asynchronously that the kernel has pageflipped. -- Simon Farnsworth Software Engineer ONELAN Limited http://www.onelan.com/ ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH] drm/i915: Protect mmaped buffers from casual eviction.
By keeping buffers that are in use by the CPU, having been mmapped and moved to the CPU or GTT domain since their last rendering on a separate inactive list, prevents the first-pass eviction process from unbinding one of these buffers. Those buffers are evicted as normal during evict-everything so that the memory can be recovered under high pressure or a forced idle. References: Bug 20152 - [G45/GM965 UXA] cannot view JPG in firefox when running UXA https://bugs.freedesktop.org/show_bug.cgi?id=20152 Bug 24369 - Hang when scrolling firefox page with window in front https://bugs.freedesktop.org/show_bug.cgi?id=24369 Bug 15911 - Intermittent X crash (freeze) https://bugzilla.kernel.org/show_bug.cgi?id=15911 Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk Tested-by: Christian von Schultz ker...@vonschultz.se --- drivers/gpu/drm/i915/i915_drv.h | 13 +++ drivers/gpu/drm/i915/i915_gem.c | 71 ++ 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 317c9bf..f99936f 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -557,6 +557,19 @@ typedef struct drm_i915_private { */ struct list_head inactive_list; + /** +* LRU list of objects which are not in the ringbuffer and +* are ready to unbind, but are still in the GTT and currently +* mapped and in use by the CPU. +* +* last_rendering_seqno is 0 while an object is in this list. +* +* A reference is not held on the buffer while on this list, +* as merely being GTT-bound shouldn't prevent its being +* freed, and we'll pull it off the list in the free path. +*/ + struct list_head mmap_list; + /** LRU list of objects with fence regs on them. */ struct list_head fence_list; diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 229354e..9a73b20 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -52,6 +52,7 @@ static int i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, static void i915_gem_clear_fence_reg(struct drm_gem_object *obj); static int i915_gem_evict_something(struct drm_device *dev, int min_size); static int i915_gem_evict_from_inactive_list(struct drm_device *dev); +static int i915_gem_evict_from_mmap_list(struct drm_device *dev); static int i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj, struct drm_i915_gem_pwrite *args, struct drm_file *file_priv); @@ -1064,6 +1065,9 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, ret = i915_gem_object_set_to_cpu_domain(obj, write_domain != 0); } + if (ret == 0 obj_priv-gtt_space !obj_priv-active) + list_move_tail(obj_priv-list, dev_priv-mm.mmap_list); + drm_gem_object_unreference(obj); mutex_unlock(dev-struct_mutex); return ret; @@ -1197,6 +1201,9 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) goto unlock; } + if (!obj_priv-active) + list_move_tail(obj_priv-list, dev_priv-mm.mmap_list); + pfn = ((dev-agp-base + obj_priv-gtt_offset) PAGE_SHIFT) + page_offset; @@ -2162,7 +2169,8 @@ i915_gem_evict_everything(struct drm_device *dev) bool lists_empty; spin_lock(dev_priv-mm.active_list_lock); - lists_empty = (list_empty(dev_priv-mm.inactive_list) + lists_empty = (list_empty(dev_priv-mm.mmap_list) + list_empty(dev_priv-mm.inactive_list) list_empty(dev_priv-mm.flushing_list) list_empty(dev_priv-mm.active_list)); spin_unlock(dev_priv-mm.active_list_lock); @@ -2177,12 +2185,17 @@ i915_gem_evict_everything(struct drm_device *dev) BUG_ON(!list_empty(dev_priv-mm.flushing_list)); + ret = i915_gem_evict_from_mmap_list(dev); + if (ret) + return ret; + ret = i915_gem_evict_from_inactive_list(dev); if (ret) return ret; spin_lock(dev_priv-mm.active_list_lock); - lists_empty = (list_empty(dev_priv-mm.inactive_list) + lists_empty = (list_empty(dev_priv-mm.mmap_list) + list_empty(dev_priv-mm.inactive_list) list_empty(dev_priv-mm.flushing_list) list_empty(dev_priv-mm.active_list)); spin_unlock(dev_priv-mm.active_list_lock); @@ -4624,17 +4637,15 @@ void i915_gem_free_object(struct drm_gem_object *obj) kfree(obj-driver_private); } -/** Unbinds all inactive objects. */ static
Re: [Intel-gfx] [PATCH] drm/i915: Protect mmaped buffers from casual eviction.
On Tue, 11 May 2010 16:55:27 +0100, Chris Wilson ch...@chris-wilson.co.uk wrote: By keeping buffers that are in use by the CPU, having been mmapped and moved to the CPU or GTT domain since their last rendering on a separate inactive list, prevents the first-pass eviction process from unbinding one of these buffers. Those buffers are evicted as normal during evict-everything so that the memory can be recovered under high pressure or a forced idle. References: Bug 20152 - [G45/GM965 UXA] cannot view JPG in firefox when running UXA https://bugs.freedesktop.org/show_bug.cgi?id=20152 Bug 24369 - Hang when scrolling firefox page with window in front https://bugs.freedesktop.org/show_bug.cgi?id=24369 Bug 15911 - Intermittent X crash (freeze) https://bugzilla.kernel.org/show_bug.cgi?id=15911 Couldn't this be more easily handled by the times where you would move to the tail of mmap, just move to the tail of inactive? Since inactive is obj_priv-gtt_space !obj_priv-active already. pgpQ5tuTwLcCk.pgp Description: PGP signature ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 2/2] x86 platform driver: intelligent power sharing driver
On Tue, 11 May 2010 07:59:19 -0700 Jesse Barnes jbar...@virtuousgeek.org wrote: On Mon, 10 May 2010 22:00:46 -0400 Andrew Morton a...@linux-foundation.org wrote: +#define thm_readb(off) readb(ips-regmap + (off)) +#define thm_readw(off) readw(ips-regmap + (off)) +#define thm_readl(off) readl(ips-regmap + (off)) +#define thm_readq(off) readq(ips-regmap + (off)) + +#define thm_writeb(off, val) writeb((val), ips-regmap + (off)) +#define thm_writew(off, val) writew((val), ips-regmap + (off)) +#define thm_writel(off, val) writel((val), ips-regmap + (off)) ick. static inline unsigned short thm_readw(struct ips_driver *ips, unsigned offset) { readw(ips-regmap + offset); } would be nicer. Yes, it would. No, I take that back, it just means more typing. This idiom of expecting a given variable to be declared for the IO routines to work is pretty common in drivers, and saves a bunch of redundant (ips, everywhere... afacit these messages might come out at one-per-five-seconds max? I bet the driver blows up and someone's logs get spammed ;) Possibly. :) I added these at the request of Pavel; I could make them just print one time though... These should be dev_warn instead anyway. Updated patch on its way. -- Jesse Barnes, Intel Open Source Technology Center ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Protect mmaped buffers from casual eviction.
On Tue, 11 May 2010 09:38:36 -0700, Eric Anholt e...@anholt.net wrote: Couldn't this be more easily handled by the times where you would move to the tail of mmap, just move to the tail of inactive? Since inactive is obj_priv-gtt_space !obj_priv-active already. The real issue is the inactive list is no longer evicted in LRU, otherwise just moving to the end of inactive list would be ideal. In benchmarks it is faster to evict the appropriately sized object rather than iterate over the inactive list until enough contiguous space has been freed. The consequence is that the page-fault-of-doom is reintroduced unless some measure is taken to avoid it. I don't have any figures to suggest what the average size of the mmap_list will be. As an object is only on the list until it is used or evict-everything, then the list should be kept quite short. As our drivers improve, the frequency at which we have to mmap buffers should reduce as well... -ickle -- Chris Wilson, Intel Open Source Technology Centre ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH] drm/i915: Fix HDMI mode select for Cougarpoint PCH
For real HDMI sink, CPT HDMI port has to set 'HDMI' mode flag in order to make HDMI audio work correctly. This is required patch for drm/i915 to enable HDMI audio on CPT PCH, ALSA patch is at http://mailman.alsa-project.org/pipermail/alsa-devel/2010-May/027601.html Tested-by: Fengguang Wu fengguang...@intel.com Signed-off-by: Zhenyu Wang zhen...@linux.intel.com --- drivers/gpu/drm/i915/i915_reg.h |3 +++ drivers/gpu/drm/i915/intel_hdmi.c |5 - 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index f3e39cc..fb8ffbe 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -2690,6 +2690,9 @@ #define SDVO_ENCODING (0) #define TMDS_ENCODING (2 10) #define NULL_PACKET_VSYNC_ENABLE (1 9) +/* CPT */ +#define HDMI_MODE_SELECT (1 9) +#define DVI_MODE_SELECT (0) #define SDVOB_BORDER_ENABLE(1 7) #define AUDIO_ENABLE (1 6) #define VSYNC_ACTIVE_HIGH (1 4) diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 8a1c4ed..acaca07 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -59,8 +59,11 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder, SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH; - if (hdmi_priv-has_hdmi_sink) + if (hdmi_priv-has_hdmi_sink) { sdvox |= SDVO_AUDIO_ENABLE; + if (HAS_PCH_CPT(dev)) + sdvox |= HDMI_MODE_SELECT; + } if (intel_crtc-pipe == 1) { if (HAS_PCH_CPT(dev)) -- 1.7.0.4 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx