modesetting: Move cursor_up into the cursor struct.#1855
modesetting: Move cursor_up into the cursor struct.#1855notbabaisyou wants to merge 1 commit intoX11Libre:masterfrom
Conversation
Currently the drmmode_cursor_rec has a 6-byte hole in the middle of it like this: ``` num_dimensions (2 bytes) ------ unused 6 bytes on 64-bit platforms drmmode_cursor_dim_rec* (pointer) struct dumb_bo *bo (pointer) ``` Mitigate this by moving the cursor_up boolean into the struct itself. While we're at it use drmmode_cursor more in drmmode_load_cursor_argb_check. Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
|
|
||
| typedef struct { | ||
| uint16_t num_dimensions; | ||
| Bool up; |
There was a problem hiding this comment.
I'm not much familiar with C, but watching xlibre for some time to notice that @metux replaced some Bool occurrences with standard bool. Maybe it's good idea to follow this guideline for new code.
There was a problem hiding this comment.
Bool is just an integer, but using aligned sizes tends to be faster than doing byte or bit operations, especially on older platforms, plus we have some guarantees about atomicity.
Using a true boolean would still leave a large gap within the struct.
There was a problem hiding this comment.
Got your point, thanks for explanation. So far I was coding mostly in Python, seeing C++ only few months on university almost two decades ago. Trying to watch your work and learn a bit, but so far I don't dare to write any code like you do. Thanks for your patience with my silly question and all the best for whole Xlibre team.
There was a problem hiding this comment.
For new code I'd really prefer stdbool. In the future I'd like to get rid of Xorg's Bool type (different from BOOL protocol type) as much as possible.
|
Merge Conflict found |
3 similar comments
|
Merge Conflict found |
|
Merge Conflict found |
|
Merge Conflict found |
|
@notbabaisyou needs rebase |
Currently the
drmmode_cursor_rechas a 6-byte hole in the middle of it like this:Mitigate this by moving the
cursor_upboolean into the struct itself.While we're at it use
drmmode_cursormore indrmmode_load_cursor_argb_check.