Bug 256354 - x11-drivers/xf86-video-intel: work around execbuffer2 test failure
Summary: x11-drivers/xf86-video-intel: work around execbuffer2 test failure
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-x11 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-01 20:20 UTC by Jung-uk Kim
Modified: 2021-07-01 19:02 UTC (History)
2 users (show)

See Also:
manu: maintainer-feedback+


Attachments
work around execbuffer2 test failure (1.35 KB, patch)
2021-06-01 20:20 UTC, Jung-uk Kim
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jung-uk Kim freebsd_committer freebsd_triage 2021-06-01 20:20:50 UTC
Created attachment 225476 [details]
work around execbuffer2 test failure

For long time, I was not able to enable DRI3 with SNA.  It turned out DRM_IOCTL_I915_GEM_EXECBUFFER2 ioctl returns a different error code, i.e., ENOENT instead of EFAULT.  The attached patch fixed the following error for me.

(WW) intel(0): Detected unsupported/dysfunctional hardware, disabling acceleration.
Comment 1 Jung-uk Kim freebsd_committer freebsd_triage 2021-06-01 20:54:31 UTC
Before and after (without timestamps):

% diff -u Xorg.0.log.old Xorg.0.log 
--- Xorg.0.log.old      2021-06-01 16:52:12.239091000 -0400
+++ Xorg.0.log  2021-06-01 16:52:34.902882000 -0400
@@ -11,7 +11,7 @@
 Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
-(==) Log file: "/var/log/Xorg.0.log", Time: Tue Jun  1 16:46:01 2021
+(==) Log file: "/var/log/Xorg.0.log", Time: Tue Jun  1 16:48:22 2021
 (==) Using config directory: "/usr/local/etc/X11/xorg.conf.d"
 (==) Using system config directory "/usr/local/share/X11/xorg.conf.d"
 (==) No Layout section.  Using the first Screen section.
@@ -79,7 +79,6 @@
 (==) intel(0): Default visual is TrueColor
 (**) intel(0): Option "AccelMethod" "SNA"
 (**) intel(0): Option "DRI" "3"
-(WW) intel(0): Detected unsupported/dysfunctional hardware, disabling acceleration.
 (II) intel(0): Output eDP-1 has no monitor section
 (II) intel(0): Enabled output eDP-1
 (II) intel(0): Output DP-1 has no monitor section
@@ -106,14 +105,12 @@
 (II) Loading sub module "present"
 (II) LoadModule: "present"
 (II) Module "present" already built-in
-(II) intel(0): SNA initialized with disabled backend
+(II) intel(0): SNA initialized with Kabylake (gen9) backend
 (==) intel(0): Backing store enabled
 (==) intel(0): Silken mouse enabled
 (II) intel(0): HW Cursor enabled
 (==) intel(0): DPMS enabled
 (==) intel(0): Display hotplug detection enabled
-(II) intel(0): Textured video not supported on this hardware or backend
-(WW) intel(0): loading DRI2 whilst acceleration is disabled.
 (II) intel(0): [DRI2] Setup complete
 (II) intel(0): [DRI2]   DRI driver: iris
 (II) intel(0): [DRI2]   VDPAU driver: va_gl
Comment 2 Jung-uk Kim freebsd_committer freebsd_triage 2021-06-01 20:56:07 UTC
FYI, I am using graphics/drm-devel-kmod and graphics/mesa-dri.
Comment 3 Emmanuel Vadot freebsd_committer freebsd_triage 2021-06-02 08:26:50 UTC
Do you know which part is returning ENOENT ?
I'm not finding any difference between linux and freebsd in drm for this
Comment 4 Jung-uk Kim freebsd_committer freebsd_triage 2021-06-02 13:29:33 UTC
(In reply to Emmanuel Vadot from comment #3)
No, I don't.  I'll check.
Comment 5 Jung-uk Kim freebsd_committer freebsd_triage 2021-06-02 18:13:03 UTC
(In reply to Emmanuel Vadot from comment #3)
-ENOENT is set from here:
https://github.com/freebsd/drm-kmod/blob/4024d812abf46d0d1b759bd6e3a885a6b69b37ed/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c#L782

How we got here:

i915_gem_execbuffer2_iocl() ->
i915_gem_do_execbuffer() ->
eb_relocate() ->
eb_relocate_slow() ->
eb_lookup_vmas() ->
i915_gem_object_lookup()
Comment 6 Jung-uk Kim freebsd_committer freebsd_triage 2021-06-02 18:18:06 UTC
(In reply to Jung-uk Kim from comment #5)
I meant "i915_gem_execbuffer2_ioctl()", sorry.
Comment 7 Emmanuel Vadot freebsd_committer freebsd_triage 2021-07-01 16:14:40 UTC
Thanks for digging.
Looks good to me now that I have the explanation.
Comment 8 commit-hook freebsd_committer freebsd_triage 2021-07-01 19:02:11 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ca4de4fd36ff7ca59898ab2910213f060458f528

commit ca4de4fd36ff7ca59898ab2910213f060458f528
Author:     Jung-uk Kim <jkim@FreeBSD.org>
AuthorDate: 2021-07-01 18:40:17 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-07-01 19:01:14 +0000

    x11-drivers/xf86-video-intel: work around execbuffer2 test failure

    Work around execbuffer2 test failure. I was not able to enable DRI3 with
    SNA.  It turned out DRM_IOCTL_I915_GEM_EXECBUFFER2 ioctl returns a
    different error code, i.e., ENOENT instead of EFAULT. Allow both to
    return true.

    PR:             256354
    Approved by:    x11 (manu)

 x11-drivers/xf86-video-intel/Makefile              |  1 +
 .../files/patch-src_sna_kgem.c (new)               | 24 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)