Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it so certain requests can be split into smaller parts #702

Open
notgull opened this issue May 10, 2022 · 2 comments
Open

Make it so certain requests can be split into smaller parts #702

notgull opened this issue May 10, 2022 · 2 comments
Labels
enhancement New feature or request P5 Priority Nice-to-have

Comments

@notgull
Copy link
Collaborator

notgull commented May 10, 2022

Certain requests in the XCB-XML file are labeled as combine-adjacent. This is an indicator that it contains some list of items that can be taken apart and put back together without any logical errors. While it's intended to be used by the X server as a way to buffer certain requests, we could take advantage of it here to ensure that we can send very large requests without going over the size limit and leading to an error.

What I envision is a new method for the Request trait like this:

pub trait Request {
    fn split(self, limit: usize) -> (Self, Option<Self>) {
        (self, None)
    }
}

Where limit is the maximum request size for the connection. Then, during code generation, we could override split for combine-adjacent types so that it's able to "split" these requests into many parts.

I'm aware that, for modern BigRequests X11, a request would need to be several billion bytes in length in order to violate the size limit, meaning that this wouldn't come up often. This is just to ensure correctness.

@notgull notgull added the enhancement New feature or request label May 10, 2022
@psychon
Copy link
Owner

psychon commented May 10, 2022

Uhm...

$ git grep combine-adjacent                                                                                                                          master
doc/xml-xcb.txt:<request name="identifier" opcode="integer" [combine-adjacent="true"]>
doc/xml-xcb.txt:  If the optional combine-adjacent attribute is true, multiple adjacent
src/glx.xml:    <request name="Render" opcode="1" combine-adjacent="true">
src/xcb.xsd:          <xsd:attribute name="combine-adjacent" type="xsd:boolean"
src/xproto.xml:  <!-- combine-adjacent doesn't work for mode==Relative -->
src/xproto.xml:  <request name="PolyLine" opcode="65" combine-adjacent="true">
src/xproto.xml:  <request name="PolySegment" opcode="66" combine-adjacent="true">
src/xproto.xml:  <request name="PolyRectangle" opcode="67" combine-adjacent="true">
src/xproto.xml:    So using combine-adjacent here is bad.
src/xproto.xml:  <request name="PolyFillRectangle" opcode="70" combine-adjacent="true">
src/xproto.xml:  <request name="PolyFillArc" opcode="71" combine-adjacent="true">
src/xproto.xml:  <request name="StoreColors" opcode="89" combine-adjacent="true">

No one / nothing uses the GLX extension and nothing (modern) uses core rendering, so my first impression would be "nothing can make use of this".

@notgull
Copy link
Collaborator Author

notgull commented May 10, 2022

It's certainly a cold path, but I still think it's something that should be on our radar. Definitely not a high priority for now.

@psychon psychon added the P5 Priority Nice-to-have label May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P5 Priority Nice-to-have
Projects
None yet
Development

No branches or pull requests

2 participants