mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
modesetting: get more values from the fallback cursor probe
The space needed to store these extra values is at worst a few dozen bytes. In exchange for these, larger cursors glyphs can use a more optimal cursor size. Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
committed by
Enrico Weigelt
parent
d0b6510b64
commit
3f821b291e
@@ -4794,7 +4794,7 @@ static void drmmode_probe_cursor_size(xf86CrtcPtr crtc)
|
||||
* this doesn't happen, there shouldn't be any issues.
|
||||
*/
|
||||
|
||||
int num_dimensions = 1;
|
||||
int num_dimensions = !(max_width == max_height);
|
||||
if (min_width > min_height) {
|
||||
for(int j = min_height; j <= min_width; j *= 2) {
|
||||
num_dimensions++;
|
||||
@@ -4806,6 +4806,10 @@ static void drmmode_probe_cursor_size(xf86CrtcPtr crtc)
|
||||
|
||||
}
|
||||
|
||||
for (int j = MAX(min_width, min_height) * 2; j <= MIN(max_width, max_height); j *= 2) {
|
||||
num_dimensions++;
|
||||
}
|
||||
|
||||
void *tmp = realloc(drmmode_cursor->dimensions, num_dimensions * sizeof(drmmode_cursor_dim_rec));
|
||||
if (!tmp) {
|
||||
xf86DrvMsgVerb(crtc->scrn->scrnIndex, X_INFO, MS_LOGLEVEL_DEBUG,
|
||||
@@ -4817,15 +4821,15 @@ static void drmmode_probe_cursor_size(xf86CrtcPtr crtc)
|
||||
drmmode_cursor->dimensions = tmp;
|
||||
drmmode_cursor->num_dimensions = num_dimensions;
|
||||
|
||||
int idx = 0;
|
||||
|
||||
if (min_width > min_height) {
|
||||
int idx = 0;
|
||||
for(int j = min_height; j <= min_width; j *= 2) {
|
||||
drmmode_cursor->dimensions[idx].width = min_width;
|
||||
drmmode_cursor->dimensions[idx].height = j;
|
||||
idx++;
|
||||
}
|
||||
} else {
|
||||
int idx = 0;
|
||||
for(int j = min_width; j <= min_height; j *= 2) {
|
||||
drmmode_cursor->dimensions[idx].width = j;
|
||||
drmmode_cursor->dimensions[idx].height = min_height;
|
||||
@@ -4833,6 +4837,12 @@ static void drmmode_probe_cursor_size(xf86CrtcPtr crtc)
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = MAX(min_width, min_height) * 2; j <= MIN(max_width, max_height); j *= 2) {
|
||||
drmmode_cursor->dimensions[idx].width = j;
|
||||
drmmode_cursor->dimensions[idx].height = j;
|
||||
idx++;
|
||||
}
|
||||
|
||||
/* maximum size */
|
||||
drmmode_cursor->dimensions[num_dimensions - 1].width = max_width;
|
||||
drmmode_cursor->dimensions[num_dimensions - 1].height = max_height;
|
||||
|
||||
Reference in New Issue
Block a user