-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 1/15/21 8:06 PM, Marek Marczykowski-Górecki wrote:
> On Fri, Jan 15, 2021 at 05:29:43PM +0000, Jinoh Kang wrote:
>> Is qubes-xorg-x11-drv-intel an option?  Upstream hasn't released for years 
>> after all...
> 
> Something like this. In fact the current (Fedora) package is already
> built from git snapshot.

Here's the catch: Fedora hasn't been bumping gitdate for almost a year,
as seen in Pagure [1].

> We do backport this package from newer Fedora already:
> https://github.com/QubesOS/qubes-linux-dom0-updates

That one from Fedora 28 is a bit behind, too.

> 
> But I would prefer to get it upstream anyway (and then possibly build
> xorg-x11-drv-intel from newer git snapshot).

Something like this?  (haven't built it yet, will fix later)

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 6a35067c..8a7af809 100644
- --- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -7023,6 +7023,8 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem,
        struct kgem_bo *bo;
        uintptr_t first_page, last_page;
        uint32_t handle;
+       struct drm_i915_gem_set_domain set_domain;
+       bool move_to_gtt = false;
 
        assert(MAP(ptr) == ptr);
 
@@ -7043,20 +7045,10 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem,
                             read_only);
        if (handle == 0) {
                if (read_only && kgem->has_wc_mmap) {
- -                     struct drm_i915_gem_set_domain set_domain;
- -
                        handle = gem_userptr(kgem->fd,
                                             (void *)first_page, 
last_page-first_page,
                                             false);
- -
- -                     VG_CLEAR(set_domain);
- -                     set_domain.handle = handle;
- -                     set_domain.read_domains = I915_GEM_DOMAIN_GTT;
- -                     set_domain.write_domain = 0;
- -                     if (do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, 
&set_domain)) {
- -                             gem_close(kgem->fd, handle);
- -                             handle = 0;
- -                     }
+                       move_to_gtt = true;
                }
                if (handle == 0) {
                        DBG(("%s: import failed, errno=%d\n", __FUNCTION__, 
errno));
@@ -7064,6 +7056,21 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem,
                }
        }
 
+       VG_CLEAR(set_domain);
+       set_domain.handle = handle;
+       if (move_to_gtt) {
+               set_domain.read_domains = I915_GEM_DOMAIN_GTT;
+               set_domain.write_domain = 0;
+       } else {
+               set_domain.read_domains = I915_GEM_DOMAIN_CPU;
+               set_domain.write_domain = I915_GEM_DOMAIN_CPU;
+       }
+       if (do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain)) {
+               gem_close(kgem->fd, handle);
+               DBG(("%s: set_domain in import failed, errno=%d\n", 
__FUNCTION__, errno));
+               return NULL;
+       }
+
        bo = __kgem_bo_alloc(handle, (last_page - first_page) / PAGE_SIZE);
        if (bo == NULL) {
                gem_close(kgem->fd, handle);

- ---

[1] 
https://src.fedoraproject.org/rpms/xorg-x11-drv-intel/blob/master/f/xorg-x11-drv-intel.spec#_3

- -- 
Sincerely,
Jinoh Kang
-----BEGIN PGP SIGNATURE-----

iQJMBAEBCAA2FiEEzGktrvc/U3kFXd9AGlqQRGyEq/UFAmACRfgYHGppbm9oLmth
bmcua3JAZ21haWwuY29tAAoJEBpakERshKv1rUcP/iymJetru96CXG3m0PTDLH37
fUenxVbuSc6J9xjPCzV7p39QBziQ2LBaIA6uL4csp7scaw+AHqKqQhxSSFb7Z4x0
zyiax7UyYuH5yGx6+Jn9E5Bf/sWarWw5fq3v61vgTs/0VUQs7tm3zKCj3uhyR4rG
pdhQEaFtqKFZVB26qNBiUsDwv1hibi0dqVvy+LHgXQqhsR39pCSBzrYFwLgf+7C8
9uD+Kbl1/CVmq+bQR9eYmRUQlkibmzzwGgtGrfHUT3dwYrGM+Q3VgsVHr9lOWQa5
F+AET7KkGLqq/iq81BWvJOOKBwPEpczp4TK1DBbI60RR/xIwShHMBxsTxRbvITIw
3ezYdRj7ArROA7XBkLw2LZo09jctG2BqO8USmWdif2wah82LLJrUmswTEWWE3R1Z
lxVnQKEA8LgNc+RICMr3bfN8+MxMErMs4rByF+Od7UUye8u/TjJvTMITvDpnskLW
L9kRrzCL5CZQoklyysvbIgyIwdb+n4OsIUhZ2guMGPly7rksmKOhfXmqFMCCMQCm
EXMDJ7mYQqVN+ajDKOWyQVUlMX9IsD37QtMLhGAA7+uvQJVGGUWiXeF+fgdtiE2v
wBC+EwuEFCnUV1Ich9T9+dBiXB3BX9gKkWJa9+YPLfw0yEwHziiBSMF10V7V/A4k
or2d3f2JMHUnVT4yJBES
=Edlh
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/c6534d9b-5d44-d45a-58f6-510efec265e3%40gmail.com.

Reply via email to