Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/i915 Pull upstream fix to avo...



details:   https://anonhg.NetBSD.org/src/rev/6e421b789a18
branches:  trunk
changeset: 339633:6e421b789a18
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Aug 01 13:42:32 2015 +0000

description:
Pull upstream fix to avoid kernel panic on starting X on Intel 855GM machines.

Reported in PR kern/49875, and ok'ed to commit by riastradh@.

Should be pulled up to netbsd-7.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (64 lines):

diff -r c6b36de7ee01 -r 6e421b789a18 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c    Sat Aug 01 10:05:51 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c    Sat Aug 01 13:42:32 2015 +0000
@@ -4390,6 +4390,15 @@
 
 static bool is_pin_display(struct drm_i915_gem_object *obj)
 {
+       struct i915_vma *vma;
+
+       if (list_empty(&obj->vma_list))
+               return false;
+
+       vma = i915_gem_obj_to_ggtt(obj);
+       if (!vma)
+               return false;
+
        /* There are 3 sources that pin objects:
         *   1. The display engine (scanouts, sprites, cursors);
         *   2. Reservations for execbuffer;
@@ -4401,7 +4410,7 @@
         * subtracting the potential reference by the user, any pin_count
         * remains, it must be due to another use by the display engine.
         */
-       return i915_gem_obj_to_ggtt(obj)->pin_count - !!obj->user_pin_count;
+       return vma->pin_count - !!obj->user_pin_count;
 }
 
 /*
@@ -4415,6 +4424,7 @@
                                     struct intel_ring_buffer *pipelined)
 {
        u32 old_read_domains, old_write_domain;
+       bool was_pin_display;
        int ret;
 
        if (pipelined != obj->ring) {
@@ -4426,6 +4436,7 @@
        /* Mark the pin_display early so that we account for the
         * display coherency whilst setting up the cache domains.
         */
+       was_pin_display = obj->pin_display;
        obj->pin_display = true;
 
        /* The display engine is not coherent with the LLC cache on gen6.  As
@@ -4468,7 +4479,8 @@
        return 0;
 
 err_unpin_display:
-       obj->pin_display = is_pin_display(obj);
+       WARN_ON(was_pin_display != is_pin_display(obj));
+       obj->pin_display = was_pin_display;
        return ret;
 }
 
@@ -5684,6 +5696,9 @@
 {
        struct i915_vma *vma;
 
+       /* This WARN has probably outlived its usefulness (callers already
+        * WARN if they don't find the GGTT vma they expect). When removing,
+        * remember to remove the pre-check in is_pin_display() as well */
        if (WARN_ON(list_empty(&obj->vma_list)))
                return NULL;
 



Home | Main Index | Thread Index | Old Index