[Bug 254472] graphics/drm-fbsd13-kmod Xorg crash on resume

[email protected]
Newsgroups gmane.os.freebsd.devel.x11
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254472

--- Comment #6 from Maurizio <[email protected]> ---
I have found a workaround for this bug, an i915kms kernel driver patch.
I have tested  the patch on a Lenovo Thinkpad T450.

NOTICE: I don’t know if this  patch can damage your laptop, if it happens it is
not my responsibility.

The patch changes only one line of code in the source file
drm-kmod-drm_v5.4.144_6/drivers/gpu/drm/i915/i915_gem.c in the function
wait_for_timelines:
I have replaced the line:
timeout = i915_request_wait(rq, wait, timeout);
with:      
    timeout = i915_request_wait(rq, wait, MAX_SCHEDULE_TIMEOUT);

the rest of the patch lines are only printf messages to display the time spent
in the function. The i915_request_wait function never timeouts. I have warned
you with the above notice because my laptop can take more than 4 seconds to
resume.

Before applying the patch you must be able to build the
graphics/drm-fbsd13-kmod port from source.

Building the patched i915kms driver:
# cd /usr/ports/graphics/drm-fbsd13-kmod/
# make clean
# make config
select “Build with debugging support”
# mkdir files
Copy the patch file patch-drivers_gpu_drm_i915_i915__gem.c in the files
directory and verify it
# ls /usr/ports/graphics/drm-fbsd13-kmod/files
patch-drivers_gpu_drm_i915_i915__gem.c
# make build deinstall reinstall
should compile and install the patched code without errors. Reboot for running
the new driver.

How this patch works on my laptop in the suspend/resume cycle.
When suspend/resume works fast, I have this output at the console:

vgapci0: child drmn0 requested pci_enable_io

Start of i915_gem_wait_for_idle()
flags=12 (locked), timeout=200

Calling wait_for_timelines()
flags=12 (locked), timeout=2147483647 (forever)

End of i915_gem_wait_for_idle() in 0 tick(s)
rtsx0: Resume

The i915_gem_wait_for_idle function takes less than one ms (tick = ms).  

When the suspend/resume cycle is slow, I have an output similar to:
vgapci0: child drmn0 requested pci_enable_io

Start of i915_gem_wait_for_idle()
flags=12 (locked), timeout=200

Calling wait_for_timelines()
drmn0: Resetting rcs0 for hang on rcs0
flags=12 (locked), timeout=2147483647 (forever)

End of i915_gem_wait_for_idle() in 4138 tick(s)

Start of i915_gem_wait_for_idle()
flags=12 (locked), timeout=200

Calling wait_for_timelines()
flags=12 (locked), timeout=2147483647 (forever)

End of i915_gem_wait_for_idle() in 0 tick(s)
rtsx0: Resume

The message “drmn0: Resetting rcs0 for hang on rcs0” is written to the console
and the i915_gem_wait_for_idle function takes more than 4 seconds to finish.
The i915_gem_wait_for_idle is called again without errors and the laptop
resumes.

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.