Re: Can GTK+ make use of XSHM extension from MIT



Hello;

ext Bin Chen wrote:
On Jan 10, 2008 4:26 PM, Tapani Pälli <tapani palli nokia com> wrote:
  
Hello;

ext Bin Chen wrote:
    
Hello,

I am running GTK+ in a singal machine, the machine is slow so I want
make GTK+ use XSHM extension to accelerate the drawing speed.

By taking a look at both GTK+ source code and the MIT-SHM paper, my
conclusion is :

1) The XSHM can only support XImage and Pixmap.

      
It is supporting the creation of XImage structure in shared memory and
'transferring' it to X-server to be used as a pixmap.

    
2) The GTK+ engine update the image using XCopyArea, so its impossible
to accelerate the entire process.

I am thinking a case, we do all the rendering process in GTK+
side(such as use pango to render text, use other library to render
image), the transfer the rendered image to XServer using XSHM, then
draw this Image to the window.


      
SHM extension is made to 'accelerate' data transfer between X client and
server when they reside on same machine. When data is on server end, it
can be used and manipulated via Xlib commands such as XCopyArea and the
operation is done on server side. Operation performance depends on the
X-server driver implementation.

    
Will this work?

      
Your usecase is valid, but are you facing some performance issues with
current implementation? Have you profiled where the time is actually
spent? You might want to create these buffers (images) beforehand and
then transfer them to server. See also XRender API for rendering and
manipulating buffers on server-side.

    
I am not doing very detailed profiling against this, but by comparing
the frame rate in my player against using pure framebuffer
implementation. The performance difference is large. If not using
shared memory to transfer the decoded image data, obviously the
performance can't be good in slow machine.
  

You did not mention a 'player' before. Video playback is very much of a
special case. Are you drawing/compositing other elements on top of
video? If so, you are entering very experimental areas here. You might
want to check out Xv extension which is available for video. I don't
know much about video so I'll stop here, good luck :-)

The GTK+ can draw pixbuf and image to the drawable, is there any
existing method for me to choose to force the low level gdk to use SHM
extension?

Thanks.
Bin

  


// Tapani Pälli

-- 
Software Engineer
Open Source Software Operations 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]