From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon@freedesktop.org Subject: [Bug 101996] Having problems when drawing lots of mesh with texture array Date: Tue, 01 Aug 2017 04:23:47 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1079254646==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [IPv6:2610:10:20:722:a800:ff:fe98:4b55]) by gabe.freedesktop.org (Postfix) with ESMTP id C3BF46EA56 for ; Tue, 1 Aug 2017 04:23:47 +0000 (UTC) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1079254646== Content-Type: multipart/alternative; boundary="15015614270.eDe2B6Af9.20458"; charset="UTF-8" --15015614270.eDe2B6Af9.20458 Date: Tue, 1 Aug 2017 04:23:47 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D101996 Bug ID: 101996 Summary: Having problems when drawing lots of mesh with texture array Product: Mesa Version: 17.2 Hardware: Other OS: Linux (All) Status: NEW Severity: normal Priority: medium Component: Drivers/Gallium/radeonsi Assignee: dri-devel@lists.freedesktop.org Reporter: benau2006@yahoo.com.hk QA Contact: dri-devel@lists.freedesktop.org Hi, I'm developing a new engine for game STK, and is having serious regression = when switching to use texture array for drawing meshes in game: Code: https://github.com/Benau/stk-code/tree/sp_new (Basically only data/shader/sp*.* and src/sp/* is relevant Assets: https://github.com/Benau/sp-assets (In case if real-time testing is needed) Apitrace: http://kobato.stan.hk/bug.trace.lzma Linux is 4.12.4 DRM is using git Mesa version is 17.2.0-rc1 (git-a455f594bb) So when you enter the game with lots of meshes rendering, the game is spend= ing a lot of time waiting in glFlush, (~100ms at worst) in util_queue_fence_wait in gdb with ctrl-c, Full trace: #0 pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185 #1 0x00007f85d8c30d22 in cnd_wait (cond=3D0x1ca8d50, mtx=3D0x1ca8d28) at ../../include/c11/threads_posix.h:159 #2 0x00007f85d8c31221 in util_queue_fence_wait (fence=3D0x1ca8d28) at u_queue.c:106 #3 0x00007f85d90bc6c3 in radeon_drm_cs_sync_flush (rcs=3D0x1c80b70) at radeon_drm_cs.c:489 #4 0x00007f85d90bcb20 in radeon_drm_cs_flush (rcs=3D0x1c80b70, flags=3D1, pfence=3D0x1ad97e8) at radeon_drm_cs.c:614 #5 0x00007f85d9078f00 in si_context_gfx_flush (context=3D0x1ad9430, flags= =3D1, fence=3D0x0) at si_hw_context.c:154 #6 0x00007f85d90fff53 in r600_flush_from_st (ctx=3D0x1ad9430, fence=3D0x0, flags=3D0) at r600_pipe_common.c:396 #7 0x00007f85d8d8fb30 in tc_flush (_pipe=3D0x1ca8da0, fence=3D0x0, flags= =3D0) at util/u_threaded_context.c:1799 #8 0x00007f85d8ada3ec in st_flush (st=3D0x1ce2300, fence=3D0x0, flags=3D0)= at state_tracker/st_cb_flush.c:87 #9 0x00007f85d8ada4b3 in st_glFlush (ctx=3D0x1cb0ec0) at state_tracker/st_cb_flush.c:121 #10 0x00007f85d884cff5 in _mesa_flush (ctx=3D0x1cb0ec0) at main/context.c:1= 846 #11 0x00007seriousf85d884d17d in _mesa_Flush () at main/context.c:1884 #12 0x0000000000f649ce in irr::video::COpenGLDriver::endScene (this=3D0x1cf= e410) at /data/game/stk-code/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp:908 (As you can see in apitrace) When something bad-luck enough, it can even hang / lock the whole linux, th= is is the before journalctl: 8=E6=9C=88 01 10:55:52 kobato kernel: [TTM] Failed allocating page table 8=E6=9C=88 01 10:55:52 kobato kernel: [TTM] Buffer eviction failed 8=E6=9C=88 01 10:55:52 kobato kernel: [TTM] Failed allocating page table 8=E6=9C=88 01 10:55:52 kobato kernel: [TTM] Buffer eviction failed 8=E6=9C=88 01 10:55:52 kobato kernel: BUG: unable to handle kernel NULL poi= nter dereference at 00000000000000b8 8=E6=9C=88 01 10:55:52 kobato kernel: IP: drm_mm_remove_node+0x280/0x2c0 8=E6=9C=88 01 10:55:52 kobato kernel: PGD 295f96067=20 8=E6=9C=88 01 10:55:52 kobato kernel: P4D 295f96067=20 8=E6=9C=88 01 10:55:52 kobato kernel: PUD 20e4a1067=20 8=E6=9C=88 01 10:55:52 kobato kernel: PMD 0=20 8=E6=9C=88 01 10:55:52 kobato kernel:=20 8=E6=9C=88 01 10:55:52 kobato kernel: Oops: 0002 [#1] PREEMPT SMP 8=E6=9C=88 01 10:55:52 kobato kernel: Modules linked in: ctr ccm ipt_MASQUE= RADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_= ipv4 nf_nat nf_conntrack af_packet fuse=E6=9C=88 01 10:55:52 kobato kernel: CPU:= 5 PID: 4349 Comm: radeon_cs:0 Tainted: G O 4.12.4 #4 8=E6=9C=88 01 10:55:52 kobato kernel: Hardware name: To Be Filled By O.E.M.= To Be Filled By O.E.M./Z87 Pro4, BIOS P2.30 07/11/2014 8=E6=9C=88 01 10:55:52 kobato kernel: task: ffff88010c9f8c00 task.stack: ffffc9000ee1c000 8=E6=9C=88 01 10:55:52 kobato kernel: RIP: 0010:drm_mm_remove_node+0x280/0x= 2c0 8=E6=9C=88 01 10:55:52 kobato kernel: RSP: 0018:ffffc9000ee1f600 EFLAGS: 00= 010246 8=E6=9C=88 01 10:55:52 kobato kernel: RAX: 0000000000000000 RBX: 0000000000= 0007d8 RCX: 0000000200000002 8=E6=9C=88 01 10:55:52 kobato kernel: RDX: 0000000000000000 RSI: ffffc9000e= e1f668 RDI: 0000000000000000 8=E6=9C=88 01 10:55:52 kobato kernel: RBP: ffff88011f267780 R08: 0000000000= 000000 R09: ffff88011f2677c0 8=E6=9C=88 01 10:55:52 kobato kernel: R10: ffffea00047c99c0 R11: 0000000000= 000000 R12: 00000000000007f8 8=E6=9C=88 01 10:55:52 kobato kernel: R13: 0000000000000000 R14: ffff88030f= f70980 R15: ffff88020e7f9068 8=E6=9C=88 01 10:55:52 kobato kernel: FS: 00007f7ee903d700(0000) GS:ffff88031ed40000(0000) knlGS:0000000000000000 8=E6=9C=88 01 10:55:52 kobato kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000= 000080050033 8=E6=9C=88 01 10:55:52 kobato kernel: CR2: 00000000000000b8 CR3: 0000000297= b41000 CR4: 00000000001406a0 8=E6=9C=88 01 10:55:52 kobato kernel: Call Trace: 8=E6=9C=88 01 10:55:52 kobato kernel: ? ttm_bo_man_put_node+0x26/0x50 8=E6=9C=88 01 10:55:52 kobato kernel: ? ttm_bo_evict+0x156/0x2a0 8=E6=9C=88 01 10:55:52 kobato kernel: ? ttm_mem_evict_first+0x137/0x190 8=E6=9C=88 01 10:55:52 kobato kernel: ? ttm_bo_mem_space+0x327/0x4a0 8=E6=9C=88 01 10:55:52 kobato kernel: ? ttm_bo_validate+0xa5/0x120 8=E6=9C=88 01 10:55:52 kobato kernel: ? ttm_eu_reserve_buffers+0x28a/0x300 8=E6=9C=88 01 10:55:52 kobato kernel: ? radeon_bo_list_validate+0xbf/0x200 8=E6=9C=88 01 10:55:52 kobato kernel: ? radeon_cs_parser_relocs+0x2c0/0x3d0 8=E6=9C=88 01 10:55:52 kobato kernel: ? radeon_cs_ioctl+0xc0/0x750 8=E6=9C=88 01 10:55:52 kobato kernel: ? drm_ioctl+0x1c8/0x3e0 8=E6=9C=88 01 10:55:52 kobato kernel: ? radeon_cs_parser_init+0x20/0x20 8=E6=9C=88 01 10:55:52 kobato kernel: ? do_futex+0x26d/0xb20 8=E6=9C=88 01 10:55:52 kobato kernel: ? shmem_truncate_range+0x19/0x30 8=E6=9C=88 01 10:55:52 kobato kernel: ? radeon_drm_ioctl+0x44/0x80 8=E6=9C=88 01 10:55:52 kobato kernel: ? do_vfs_ioctl+0x8a/0x5d0 8=E6=9C=88 01 10:55:52 kobato kernel: ? __fget+0x62/0xa0 8=E6=9C=88 01 10:55:52 kobato kernel: ? SyS_ioctl+0x36/0x70 8=E6=9C=88 01 10:55:52 kobato kernel: ? entry_SYSCALL_64_fastpath+0x17/0x98 8=E6=9C=88 01 10:55:52 kobato kernel: Code: 00 00 00 e9 b2 fe ff ff 48 8b 8= 5 88 00 00 00 4c 8b 41 08 49 89 ca 48 89 41 48 48 89 c8 e9 65 fe ff ff 4c 89 51 10 e9 = 8f fe ff ff <49> 89 8d b8 00 00 0 8=E6=9C=88 01 10:55:52 kobato kernel: RIP: drm_mm_remove_node+0x280/0x2c0 R= SP: ffffc9000ee1f600 8=E6=9C=88 01 10:55:52 kobato kernel: CR2: 00000000000000b8 The same code has been tested in windows in same hardware, and other PC with nvidia proprietary driver, and it's working fine. Did I do something wrong with opengl code, or do you think it's a problem in mesa somewhere? Thanks --=20 You are receiving this mail because: You are the assignee for the bug.= --15015614270.eDe2B6Af9.20458 Date: Tue, 1 Aug 2017 04:23:47 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated
Bug ID 101996
Summary Having problems when drawing lots of mesh with texture array
Product Mesa
Version 17.2
Hardware Other
OS Linux (All)
Status NEW
Severity normal
Priority medium
Component Drivers/Gallium/radeonsi
Assignee dri-devel@lists.freedesktop.org
Reporter benau2006@yahoo.com.hk
QA Contact dri-devel@lists.freedesktop.org

Hi,

I'm developing a new engine for game STK, and is having serious regression =
when
switching to use texture array for drawing meshes in game:

Code:
https://github.co=
m/Benau/stk-code/tree/sp_new
(Basically only data/shader/sp*.* and src/sp/* is relevant

Assets:
https://github.com/Benau/sp-=
assets
(In case if real-time testing is needed)

Apitrace:
http://kobato.stan.hk/bug.=
trace.lzma

Linux is 4.12.4
DRM is using git
Mesa version  is 17.2.0-rc1 (git-a455f594bb)

So when you enter the game with lots of meshes rendering, the game is spend=
ing
a lot of time waiting in glFlush,
(~100ms at worst)
in util_queue_fence_wait in gdb with ctrl-c,
Full trace:

#0  pthread_cond_wait@@GLIBC_2.3.2 () at
../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f85d8c30d22 in cnd_wait (cond=3D0x1ca8d50, mtx=3D0x1ca8d28) at
../../include/c11/threads_posix.h:159
#2  0x00007f85d8c31221 in util_queue_fence_wait (fence=3D0x1ca8d28) at
u_queue.c:106
#3  0x00007f85d90bc6c3 in radeon_drm_cs_sync_flush (rcs=3D0x1c80b70) at
radeon_drm_cs.c:489
#4  0x00007f85d90bcb20 in radeon_drm_cs_flush (rcs=3D0x1c80b70, flags=3D1,
pfence=3D0x1ad97e8) at radeon_drm_cs.c:614
#5  0x00007f85d9078f00 in si_context_gfx_flush (context=3D0x1ad9430, flags=
=3D1,
fence=3D0x0) at si_hw_context.c:154
#6  0x00007f85d90fff53 in r600_flush_from_st (ctx=3D0x1ad9430, fence=3D0x0,
flags=3D0) at r600_pipe_common.c:396
#7  0x00007f85d8d8fb30 in tc_flush (_pipe=3D0x1ca8da0, fence=3D0x0, flags=
=3D0) at
util/u_threaded_context.c:1799
#8  0x00007f85d8ada3ec in st_flush (st=3D0x1ce2300, fence=3D0x0, flags=3D0)=
 at
state_tracker/st_cb_flush.c:87
#9  0x00007f85d8ada4b3 in st_glFlush (ctx=3D0x1cb0ec0) at
state_tracker/st_cb_flush.c:121
#10 0x00007f85d884cff5 in _mesa_flush (ctx=3D0x1cb0ec0) at main/context.c:1=
846
#11 0x00007seriousf85d884d17d in _mesa_Flush () at main/context.c:1884
#12 0x0000000000f649ce in irr::video::COpenGLDriver::endScene (this=3D0x1cf=
e410)
at /data/game/stk-code/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp:908
(As you can see in apitrace)


When something bad-luck enough, it can even hang / lock the whole linux, th=
is
is the before journalctl:
8=E6=9C=88 01 10:55:52 kobato kernel: [TTM] Failed allocating page table
8=E6=9C=88 01 10:55:52 kobato kernel: [TTM] Buffer eviction failed
8=E6=9C=88 01 10:55:52 kobato kernel: [TTM] Failed allocating page table
8=E6=9C=88 01 10:55:52 kobato kernel: [TTM] Buffer eviction failed
8=E6=9C=88 01 10:55:52 kobato kernel: BUG: unable to handle kernel NULL poi=
nter
dereference at 00000000000000b8
8=E6=9C=88 01 10:55:52 kobato kernel: IP: drm_mm_remove_node+0x280/0x2c0
8=E6=9C=88 01 10:55:52 kobato kernel: PGD 295f96067=20
8=E6=9C=88 01 10:55:52 kobato kernel: P4D 295f96067=20
8=E6=9C=88 01 10:55:52 kobato kernel: PUD 20e4a1067=20
8=E6=9C=88 01 10:55:52 kobato kernel: PMD 0=20
8=E6=9C=88 01 10:55:52 kobato kernel:=20
8=E6=9C=88 01 10:55:52 kobato kernel: Oops: 0002 [#1] PREEMPT SMP
8=E6=9C=88 01 10:55:52 kobato kernel: Modules linked in: ctr ccm ipt_MASQUE=
RADE
nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_=
ipv4
nf_nat nf_conntrack af_packet fuse=E6=9C=88 01 10:55:52 kobato kernel: CPU:=
 5 PID: 4349
Comm: radeon_cs:0 Tainted: G           O    4.12.4 #4
8=E6=9C=88 01 10:55:52 kobato kernel: Hardware name: To Be Filled By O.E.M.=
 To Be
Filled By O.E.M./Z87 Pro4, BIOS P2.30 07/11/2014
8=E6=9C=88 01 10:55:52 kobato kernel: task: ffff88010c9f8c00 task.stack:
ffffc9000ee1c000
8=E6=9C=88 01 10:55:52 kobato kernel: RIP: 0010:drm_mm_remove_node+0x280/0x=
2c0
8=E6=9C=88 01 10:55:52 kobato kernel: RSP: 0018:ffffc9000ee1f600 EFLAGS: 00=
010246
8=E6=9C=88 01 10:55:52 kobato kernel: RAX: 0000000000000000 RBX: 0000000000=
0007d8 RCX:
0000000200000002
8=E6=9C=88 01 10:55:52 kobato kernel: RDX: 0000000000000000 RSI: ffffc9000e=
e1f668 RDI:
0000000000000000
8=E6=9C=88 01 10:55:52 kobato kernel: RBP: ffff88011f267780 R08: 0000000000=
000000 R09:
ffff88011f2677c0
8=E6=9C=88 01 10:55:52 kobato kernel: R10: ffffea00047c99c0 R11: 0000000000=
000000 R12:
00000000000007f8
8=E6=9C=88 01 10:55:52 kobato kernel: R13: 0000000000000000 R14: ffff88030f=
f70980 R15:
ffff88020e7f9068
8=E6=9C=88 01 10:55:52 kobato kernel: FS:  00007f7ee903d700(0000)
GS:ffff88031ed40000(0000) knlGS:0000000000000000
8=E6=9C=88 01 10:55:52 kobato kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000=
000080050033
8=E6=9C=88 01 10:55:52 kobato kernel: CR2: 00000000000000b8 CR3: 0000000297=
b41000 CR4:
00000000001406a0
8=E6=9C=88 01 10:55:52 kobato kernel: Call Trace:
8=E6=9C=88 01 10:55:52 kobato kernel:  ? ttm_bo_man_put_node+0x26/0x50
8=E6=9C=88 01 10:55:52 kobato kernel:  ? ttm_bo_evict+0x156/0x2a0
8=E6=9C=88 01 10:55:52 kobato kernel:  ? ttm_mem_evict_first+0x137/0x190
8=E6=9C=88 01 10:55:52 kobato kernel:  ? ttm_bo_mem_space+0x327/0x4a0
8=E6=9C=88 01 10:55:52 kobato kernel:  ? ttm_bo_validate+0xa5/0x120
8=E6=9C=88 01 10:55:52 kobato kernel:  ? ttm_eu_reserve_buffers+0x28a/0x300
8=E6=9C=88 01 10:55:52 kobato kernel:  ? radeon_bo_list_validate+0xbf/0x200
8=E6=9C=88 01 10:55:52 kobato kernel:  ? radeon_cs_parser_relocs+0x2c0/0x3d0
8=E6=9C=88 01 10:55:52 kobato kernel:  ? radeon_cs_ioctl+0xc0/0x750
8=E6=9C=88 01 10:55:52 kobato kernel:  ? drm_ioctl+0x1c8/0x3e0
8=E6=9C=88 01 10:55:52 kobato kernel:  ? radeon_cs_parser_init+0x20/0x20
8=E6=9C=88 01 10:55:52 kobato kernel:  ? do_futex+0x26d/0xb20
8=E6=9C=88 01 10:55:52 kobato kernel:  ? shmem_truncate_range+0x19/0x30
8=E6=9C=88 01 10:55:52 kobato kernel:  ? radeon_drm_ioctl+0x44/0x80
8=E6=9C=88 01 10:55:52 kobato kernel:  ? do_vfs_ioctl+0x8a/0x5d0
8=E6=9C=88 01 10:55:52 kobato kernel:  ? __fget+0x62/0xa0
8=E6=9C=88 01 10:55:52 kobato kernel:  ? SyS_ioctl+0x36/0x70
8=E6=9C=88 01 10:55:52 kobato kernel:  ? entry_SYSCALL_64_fastpath+0x17/0x98
8=E6=9C=88 01 10:55:52 kobato kernel: Code: 00 00 00 e9 b2 fe ff ff 48 8b 8=
5 88 00 00
00 4c 8b 41 08 49 89 ca 48 89 41 48 48 89 c8 e9 65 fe ff ff 4c 89 51 10 e9 =
8f
fe ff ff <49> 89 8d b8 00 00 0
8=E6=9C=88 01 10:55:52 kobato kernel: RIP: drm_mm_remove_node+0x280/0x2c0 R=
SP:
ffffc9000ee1f600
8=E6=9C=88 01 10:55:52 kobato kernel: CR2: 00000000000000b8


The same code has been tested in windows in same hardware, and other PC with
nvidia proprietary driver, and it's working fine.

Did I do something wrong with opengl code, or do you think it's a problem in
mesa somewhere?

Thanks


You are receiving this mail because:
  • You are the assignee for the bug.
= --15015614270.eDe2B6Af9.20458-- --===============1079254646== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1079254646==--