mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 11:00:11 +01: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>
(cherry picked from commit 7100ef4566)
This commit is contained in:
parent
4171bb1239
commit
0c84f8d915
2 changed files with 12 additions and 6 deletions
|
|
@ -22984,7 +22984,7 @@
|
|||
"description": "glxsw: check geometry of drawables on creation",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -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