modesetting: Do not use function local static variables
The modesetting driver may be driving 2 screens (slave and master gpu), which may have different behavior wrt hardware cursor support. So stop using static variables and instead store the hw-cursor support related data in a per screen struct. While at it actually make it per crtc data as in theory different crtc's could have different hw-cursor support. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
d8c288ec37
commit
6c984ac9a7
|
@ -756,10 +756,9 @@ drmmode_set_cursor(xf86CrtcPtr crtc)
|
||||||
drmmode_ptr drmmode = drmmode_crtc->drmmode;
|
drmmode_ptr drmmode = drmmode_crtc->drmmode;
|
||||||
uint32_t handle = drmmode_crtc->cursor_bo->handle;
|
uint32_t handle = drmmode_crtc->cursor_bo->handle;
|
||||||
modesettingPtr ms = modesettingPTR(crtc->scrn);
|
modesettingPtr ms = modesettingPTR(crtc->scrn);
|
||||||
static Bool use_set_cursor2 = TRUE;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (use_set_cursor2) {
|
if (!drmmode_crtc->set_cursor2_failed) {
|
||||||
CursorPtr cursor = xf86CurrentCursor(crtc->scrn->pScreen);
|
CursorPtr cursor = xf86CurrentCursor(crtc->scrn->pScreen);
|
||||||
|
|
||||||
ret =
|
ret =
|
||||||
|
@ -769,7 +768,7 @@ drmmode_set_cursor(xf86CrtcPtr crtc)
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
use_set_cursor2 = FALSE;
|
drmmode_crtc->set_cursor2_failed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
|
ret = drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
|
||||||
|
@ -803,7 +802,6 @@ drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 *image)
|
||||||
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
|
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
|
||||||
int i;
|
int i;
|
||||||
uint32_t *ptr;
|
uint32_t *ptr;
|
||||||
static Bool first_time = TRUE;
|
|
||||||
|
|
||||||
/* cursor should be mapped already */
|
/* cursor should be mapped already */
|
||||||
ptr = (uint32_t *) (drmmode_crtc->cursor_bo->ptr);
|
ptr = (uint32_t *) (drmmode_crtc->cursor_bo->ptr);
|
||||||
|
@ -811,11 +809,11 @@ drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 *image)
|
||||||
for (i = 0; i < ms->cursor_width * ms->cursor_height; i++)
|
for (i = 0; i < ms->cursor_width * ms->cursor_height; i++)
|
||||||
ptr[i] = image[i]; // cpu_to_le32(image[i]);
|
ptr[i] = image[i]; // cpu_to_le32(image[i]);
|
||||||
|
|
||||||
if (drmmode_crtc->cursor_up || first_time) {
|
if (drmmode_crtc->cursor_up || !drmmode_crtc->first_cursor_load_done) {
|
||||||
Bool ret = drmmode_set_cursor(crtc);
|
Bool ret = drmmode_set_cursor(crtc);
|
||||||
if (!drmmode_crtc->cursor_up)
|
if (!drmmode_crtc->cursor_up)
|
||||||
drmmode_hide_cursor(crtc);
|
drmmode_hide_cursor(crtc);
|
||||||
first_time = FALSE;
|
drmmode_crtc->first_cursor_load_done = TRUE;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -89,6 +89,8 @@ typedef struct {
|
||||||
int dpms_mode;
|
int dpms_mode;
|
||||||
struct dumb_bo *cursor_bo;
|
struct dumb_bo *cursor_bo;
|
||||||
Bool cursor_up;
|
Bool cursor_up;
|
||||||
|
Bool set_cursor2_failed;
|
||||||
|
Bool first_cursor_load_done;
|
||||||
uint16_t lut_r[256], lut_g[256], lut_b[256];
|
uint16_t lut_r[256], lut_g[256], lut_b[256];
|
||||||
|
|
||||||
drmmode_bo rotate_bo;
|
drmmode_bo rotate_bo;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user