[Intel-gfx] xf86-video-intel: src/xvmc/intel_xvmc.c

Xiang, Haihao haihao.xiang at intel.com
Fri Feb 20 02:37:04 CET 2009



>-----Original Message-----
>From: intel-gfx-bounces at lists.freedesktop.org
>[mailto:intel-gfx-bounces at lists.freedesktop.org] On Behalf Of Zou, Nanhai
>Sent: 2008年12月19日 9:29
>To: Barry Scott
>Cc: intel-gfx
>Subject: Re: [Intel-gfx] xf86-video-intel: src/xvmc/intel_xvmc.c
>
>>-----Original Message-----
>>From: Barry Scott [mailto:barry.scott at onelan.co.uk]
>>Sent: 2008年12月18日 23:07
>>To: Zou, Nanhai
>>Cc: Wang, Zhenyu Z; intel-gfx
>>Subject: Re: [Intel-gfx] xf86-video-intel: src/xvmc/intel_xvmc.c
>>
>>Zou, Nanhai wrote:
>>>> -----Original Message-----
>>>> From: Wang, Zhenyu Z
>>>> Sent: 2008年12月18日 16:07
>>>> To: Zou, Nanhai
>>>> Cc: intel-gfx
>>>> Subject: Re: xf86-video-intel: src/xvmc/intel_xvmc.c
>>>>
>>>> On 2008.12.17 13:55:41 +0800, Nan hai Zou wrote:
>>>>
>>>>>  src/xvmc/intel_xvmc.c |    2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> New commits:
>>>>> commit 555eea5411cf8c725df5f1b4cb80198fa6a1225b
>>>>> Author: Zou Nan hai <nanhai.zou at intel.com>
>>>>> Date:   Wed Dec 17 13:55:07 2008 +0800
>>>>>
>>>>>      wait vblank before render to fix tearing
>>>>>
>>>>> diff --git a/src/xvmc/intel_xvmc.c b/src/xvmc/intel_xvmc.c
>>>>> index dbde22f..c197e35 100644
>>>>> --- a/src/xvmc/intel_xvmc.c
>>>>> +++ b/src/xvmc/intel_xvmc.c
>>>>> @@ -757,7 +757,7 @@ _X_EXPORT Status XvMCPutSurface(Display
>>>>>
>>>> *display,XvMCSurface *surface,
>>>>
>>>>>      }
>>>>>      intel_surf->last_draw = draw;
>>>>>      /* fill intel_surf->data */
>>>>> -    if (0)
>>>>> +    if (1)
>>>>>      {
>>>>>  	drmVBlank vbl;
>>>>>  	vbl.request.type = DRM_VBLANK_RELATIVE;
>>>>>
>>>> This is broken as no care is taken for vblank pipes (e.g I have to
>>>> add DRM_VBLANK_SECONDARY for my GM965 LVDS on pipe B).
>>>> As XvMC uses Xv port for video playback, we should just fix
>>>> Xv port for vblank sync. My suggest is to add a Xv port attribute
>>>> for texture video, that can flip vblank wait on or off. Or we
>>>> might steal some idea from radeon driver. But doing this in XvMC
>>>> lib is wrong to me anyway.
>>>>
>>>>
>>> Wait in server context is not a good idea, either busy wait or sleep, user
>>experience will not be good when server stall for vblank.
>>> So let's do it in client context.
>>>
>>
>>I agree in principle. But we found that only one app on a host can wait
>>for VBLANK. If, for example OpenGL has the vblank
>>when you try for it in XvMC VBLANK will be delivered late and cause tearing.
>>
>>In our application we had to ensure only one process waited for VBLANK
>>and then use futext to send a pulse to all our
>>other apps that need to be in sync with VBLANK.
>>
>>We believe that you will need to fix DRM for intel to allow multiple
>>clients to wait for VBLANK if you wish to make this work.
>>There is code in DRM that changes notification delivery based on the
>>number of clients waiting. When there is 1 it works
>>great, 2 or more it delivers about ~10ms late. (We see a tear between
>>1/3 and 2/3 down the screen).
>>
>
I test Nanhai's patch on GM965 with one output, and it works fine for me, even if multiple clients are waiting for VBLANK. But it fails to get the right vblank pipe with multiple outputs due to lack of DRAWABLE info.


Here are 3 patches, please test it.
0001-xvmc-wait-vblank-before-rendering.patch: Nanhai's vblank patch
0002-xvmc-fix-for-pipe-enable-sanity-check.patch: Use drawable info to get the right vblank pipe.
0001-drm-wake-up-all-clients-waited-for-VBLANK.patch: Wake up all clients. I am not sure whether it works for you.

Thanks 
Haihao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-xvmc-wait-vblank-before-rendering.patch
Type: application/octet-stream
Size: 3508 bytes
Desc: 0001-xvmc-wait-vblank-before-rendering.patch
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090220/7678ffcc/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-xvmc-fix-for-pipe-enable-sanity-check.patch
Type: application/octet-stream
Size: 16193 bytes
Desc: 0002-xvmc-fix-for-pipe-enable-sanity-check.patch
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090220/7678ffcc/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-drm-wake-up-all-clients-waited-for-VBLANK.patch
Type: application/octet-stream
Size: 1267 bytes
Desc: 0001-drm-wake-up-all-clients-waited-for-VBLANK.patch
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090220/7678ffcc/attachment-0002.obj>


More information about the Intel-gfx mailing list