xlib: Getting xmesa_strict_invalidate to be function

So that doesn't be called in global constructor

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19258>
This commit is contained in:
Yonggang Luo 2022-10-23 22:45:59 +08:00 committed by Marge Bot
parent adcdfe66fc
commit 4117710ec1
3 changed files with 13 additions and 10 deletions

View file

@ -103,14 +103,17 @@ static struct xm_driver driver;
* invalidation. Xcb almost looks as if it could provide this, but
* the API doesn't seem to quite be there.
*/
boolean xmesa_strict_invalidate = FALSE;
DEBUG_GET_ONCE_BOOL_OPTION(xmesa_strict_invalidate, "XMESA_STRICT_INVALIDATE", false)
bool
xmesa_strict_invalidate(void)
{
return debug_get_option_xmesa_strict_invalidate();
}
void xmesa_set_driver( const struct xm_driver *templ )
{
driver = *templ;
xmesa_strict_invalidate =
debug_get_bool_option("XMESA_STRICT_INVALIDATE", FALSE);
}
@ -120,7 +123,7 @@ xmesa_get_param(struct st_manager *smapi,
{
switch(param) {
case ST_MANAGER_BROKEN_INVALIDATE:
return !xmesa_strict_invalidate;
return !xmesa_strict_invalidate();
default:
return 0;
}

View file

@ -394,6 +394,6 @@ xmesa_buffer_height(XMesaBuffer b)
return b->height;
}
extern boolean xmesa_strict_invalidate;
bool xmesa_strict_invalidate(void);
#endif

View file

@ -222,7 +222,7 @@ xmesa_st_framebuffer_validate(struct st_context_iface *stctx,
/* If xmesa_strict_invalidate is not set, we will not yet have
* called XGetGeometry(). Do so here:
*/
if (!xmesa_strict_invalidate)
if (!xmesa_strict_invalidate())
xmesa_check_buffer_size(xstfb->buffer);
resized = (xstfb->buffer->width != xstfb->texture_width ||
@ -273,7 +273,7 @@ xmesa_st_framebuffer_flush_front(struct st_context_iface *stctx,
ret = xmesa_st_framebuffer_display(stfbi, stctx, statt, NULL);
if (ret && xmesa_strict_invalidate)
if (ret && xmesa_strict_invalidate())
xmesa_check_buffer_size(xstfb->buffer);
return ret;
@ -366,11 +366,11 @@ xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi)
*back = tmp;
/* the current context should validate the buffer after swapping */
if (!xmesa_strict_invalidate)
if (!xmesa_strict_invalidate())
xmesa_notify_invalid_buffer(xstfb->buffer);
}
if (xmesa_strict_invalidate)
if (xmesa_strict_invalidate())
xmesa_check_buffer_size(xstfb->buffer);
}
}