<div class="gmail_quote">On Mon, Mar 28, 2011 at 9:35 AM, Chia-I Wu <span dir="ltr"><<a href="mailto:olvaffe@gmail.com">olvaffe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi list,<br>
<br>
I have a simple scenario that there are clients rendering to buffer<br>
objects using the CPU, and the display server compositing the buffers<br>
using OpenGL and doing page flips to present the final contents. It<br>
is like doing the following steps repeatedly<br>
<br>
1) process A (the server) allocates a bo<br>
<br>
bo = radeon_bo_open(info->bufmgr, 0, size, align, RADEON_GEM_DOMAIN_GTT, 0);<br>
<br>
2) process B (the client) maps the bo for CPU rendering and unmaps<br>
<br>
radeon_bo_map(bo, 1);<br>
/* ...render with CPU... */<br>
radeon_bo_unmap(bo);<br>
<br>
3) process A renders to the back buffer using the bo as the texture<br>
<br>
/* renders with OpenGL followed by a glFinish() */<br>
<br>
4) process A flips its front and back buffers<br>
<br>
drmModePageFlip(fd, crtc_id, fb_id_of_the_bo, 0x0, NULL);<br>
drmWaitVBlank(fd, &vbl); /* HACK! wait until the next vblank */<br>
<br>
With this setup, I am seeing glitches frequently. My hardware is a<br>
CEDAR. The kernel is 2.6.38-rc7 and both mesa and drm are from<br>
master. I originally ran them on a i965-based machine using<br>
libdrm_i915, and it is fine there.<br>
<br>
I think there are sync issues in how I use libdrm_radeon, but I could<br>
not identify them. Here are my findings/questions<br>
<br>
In 1), The bo is initially in the GTT domain because CPU rendering is<br>
expected. Using VRAM domain reduces the glitches greatly, but there<br>
are still glitches and the framerate is much lower.<br>
<br>
In 3), glFinish() is called after rendering to make sure the frame is<br>
complete before page flipping. Does glFlush() suffice here? I think<br>
that would require page flipping to be pipelined, but I am not sure if<br>
that is the case with radeon.<br></blockquote></div><br>glFinish uses fences, which are not implemented in r600g (and there is no wait-for-a-fence ioctl), so glFinish=glFlush. Could that be the cause of your problems? The other radeon drivers use bo_wait for glFinish (including r300g). <br>
<br>Marek<br>