Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions hw/xfree86/drivers/video/modesetting/drmmode_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -2001,16 +2001,16 @@ drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 *image)
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
modesettingPtr ms = modesettingPTR(crtc->scrn);
CursorPtr cursor = xf86CurrentCursor(crtc->scrn->pScreen);
drmmode_cursor_rec drmmode_cursor = drmmode_crtc->cursor;
int i;

if (drmmode_crtc->cursor_up) {
if (drmmode_cursor.up) {
/* we probe the cursor so late, because we want to make sure that
the screen is fully initialized and something is already drawn on it.
Otherwise, we can't get reliable results with the probe. */
drmmode_probe_cursor_size(crtc);
}

drmmode_cursor_rec drmmode_cursor = drmmode_crtc->cursor;

/* Find the most compatiable size. */
for (i = 0; i < drmmode_cursor.num_dimensions; i++)
Expand Down Expand Up @@ -2042,7 +2042,7 @@ drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 *image)
drmmode_crtc->cursor_width = cursor_width;
drmmode_crtc->cursor_height = cursor_height;

return drmmode_crtc->cursor_up ? drmmode_set_cursor(crtc, cursor_width, cursor_height) : TRUE;
return drmmode_cursor.up ? drmmode_set_cursor(crtc, cursor_width, cursor_height) : TRUE;
}

static void
Expand All @@ -2051,7 +2051,7 @@ drmmode_hide_cursor(xf86CrtcPtr crtc)
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_ptr drmmode = drmmode_crtc->drmmode;

drmmode_crtc->cursor_up = FALSE;
drmmode_crtc->cursor.up = FALSE;
drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, 0,
drmmode_crtc->cursor_width, drmmode_crtc->cursor_height);
}
Expand All @@ -2060,7 +2060,7 @@ static Bool
drmmode_show_cursor(xf86CrtcPtr crtc)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_crtc->cursor_up = TRUE;
drmmode_crtc->cursor.up = TRUE;
return drmmode_set_cursor(crtc, drmmode_crtc->cursor_width, drmmode_crtc->cursor_height);
}

Expand Down
2 changes: 1 addition & 1 deletion hw/xfree86/drivers/video/modesetting/drmmode_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ typedef struct {

typedef struct {
uint16_t num_dimensions;
Bool up;
Copy link

@Petricak-1982 Petricak-1982 Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


/* Sorted from smallest to largest. */
drmmode_cursor_dim_rec* dimensions;
Expand All @@ -205,7 +206,6 @@ typedef struct {
uint32_t vblank_pipe;
int dpms_mode;
drmmode_cursor_rec cursor;
Bool cursor_up;
uint16_t lut_r[256], lut_g[256], lut_b[256];

drmmode_prop_info_rec props[DRMMODE_CRTC__COUNT];
Expand Down