mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 02:58:05 +02:00
glxsw: check geometry of drawables on creation
this mimics the dri codepath and allows early rejection of invalid drawables to avoid subsequent breakage cc: mesa-stable Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24075>
This commit is contained in:
parent
2b71e645bc
commit
7100ef4566
1 changed files with 11 additions and 5 deletions
|
|
@ -675,11 +675,22 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable,
|
|||
{
|
||||
struct drisw_drawable *pdp;
|
||||
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
|
||||
unsigned depth;
|
||||
struct drisw_screen *psc = (struct drisw_screen *) base;
|
||||
const __DRIswrastExtension *swrast = psc->swrast;
|
||||
const __DRIkopperExtension *kopper = psc->kopper;
|
||||
Display *dpy = psc->base.dpy;
|
||||
|
||||
xcb_connection_t *conn = XGetXCBConnection(dpy);
|
||||
xcb_generic_error_t *error;
|
||||
xcb_get_geometry_cookie_t cookie = xcb_get_geometry(conn, xDrawable);
|
||||
xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(conn, cookie, &error);
|
||||
if (reply)
|
||||
depth = reply->depth;
|
||||
free(reply);
|
||||
if (!reply || error)
|
||||
return NULL;
|
||||
|
||||
pdp = calloc(1, sizeof(*pdp));
|
||||
if (!pdp)
|
||||
return NULL;
|
||||
|
|
@ -709,11 +720,6 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable,
|
|||
|
||||
/* Otherwise, or if XGetVisualInfo failed, ask the server */
|
||||
if (pdp->xDepth == 0) {
|
||||
Window root;
|
||||
int x, y;
|
||||
unsigned uw, uh, bw, depth;
|
||||
|
||||
XGetGeometry(dpy, xDrawable, &root, &x, &y, &uw, &uh, &bw, &depth);
|
||||
pdp->xDepth = depth;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue