Re: Is there any way to intercept or generate protocol to an in-memory buffer?

Clemens Eisserer <[email protected]>
Newsgroups gmane.comp.freedesktop.xcb
Message-ID <CAFvQSYR4t9Fxy2R7kKSrXC+hJg4KTZ9=Ey6=x9Fdgx-JGYMhWQ@mail.gmail.com>
Hi Bart,

> The overhead of doing separate XShmPutImages should be minimal.

Xcb is performing fine, what is causing performance issues is how the
drivers implement those tiny XPutImage requests (especially when
operating on top of OpenGL like all glamor based setups).
I've found a way to implement the deferred protocol submission using
the socket handoff mechanism and it seems to work really well.

However, currently the socket owner changes quite frequently, so I am
struggling with the requirement to issue a XGetInputFocus-Request
*every* time I call xcb_take_socket.
For cases where there are only 4 requests to submit, an additional
XGetInputFocus hurts.

What I tried instead was:

uint64_t lastManualSyncSeq; //Remember sequence-number, when the last
manual sync was issued
uint64_t socketTakenSeq; //Sequence number when the socket was taken
uint32_t self_generated_count; //Number of self-generated X requests

while(1) {
xcb_take_socket(xcbCon, &returnSocketCB, &flags, 0, &socketTakenSeq);

   while(1) {
     if((socketTakenSeq + self_generated_count) - lastManualSyncSeq > 65000) {
        //will cause socket to be revoked, callback will take care of
flushing out generated protocol
        lastManualSyncSeq = xcb_get_input_focus(xcbCon).sequence;
        xcb_discard_reply(xcbCon, lastManualSyncSeq);
        self_generated_count = 0;
        break;
   }

    self_generated_count++;
    GenerateXrenderFillRectanglesRequest(); //appends reply-less
request to request data buffer
}



The idea is I can't be sure when xcb automatically generated the last
XGetInputFocus request, but I know when I last called
xcb_get_input_focus myself.
As long as the last call to xcb_get_input_focus is less than 65k
requests away, everything is fine (regardless of whether xcb issued
some xcb_get_input_focus requests in between).

However, this doesn't seem to work out as expected - I still get hangs
from time to time.

Any idea what is wrong with the above snippit?

Thank you in advance, Clemens
_______________________________________________
Xcb mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/xcb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.