Original explanatory text:

    Fix for throwing BadDrawable (invalid Pixmap or Window parameter)
    by Xserver when calling XCreatePixmap or fill_bitmap from
    DRI_glXUseXFont.

    currentDrawable which came from __glXGetCurrentContext was not correct in
    this case, we use DefaultRootWindow(dpy) instead.

To reproduce this error you just have to call this:

dpy = (machine.display)->handle();
fontStruct = XLoadQueryFont(dpy, "fixed");
int firstGlyph = fontStruct->min_char_or_byte2;
int dispListBase = 1;
glXUseXFont(fontStruct->fid, firstGlyph, 1, dispListBase);

And you will get this:

X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)
Major opcode of failed request: 53 (X_CreatePixmap)

Feedback from CC reporters would be really helpful.

-----Original Message-----
From: Ian Romanick [mailto:i...@freedesktop.org] 
Sent: Wednesday, September 04, 2013 7:09 PM
To: Maniak, Lukasz
Cc: mesa-dev@lists.freedesktop.org; Alexander Monakov; djee...@gmail.com
Subject: Re: [Mesa-dev] [PATCH] Fix for throwing BadDrawable (invalid Pixmap or 
Window parameter) by Xserver

The explanatory text from the mangled version of the patch should be included 
here as well.

Can you give some more explanation of how this can occur?  I'd like to have a 
piglit test.  Looking at the documentation for glXUseXFont, there needs to be a 
valid context bound, and there is some commentary about invalid windows:

    "GLXBadCurrentWindow is generated if the drawable associated
    with the current context of the calling thread is a window,
    and that window is no longer valid."

Also, this seems related to

https://bugs.freedesktop.org/show_bug.cgi?id=56922

and possibly

https://bugs.freedesktop.org/show_bug.cgi?id=54080

Perhaps the reporters of those bugs (added to CC) can comment on whether this 
change fixes their bugs.

On 09/04/2013 09:40 AM, Lukasz Maniak wrote:
> Signed-off-by: Lukasz Maniak <lukasz.man...@intel.com>
> ---
>  src/glx/xfont.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/glx/xfont.c b/src/glx/xfont.c index 316c585..60e28ab 
> 100644
> --- a/src/glx/xfont.c
> +++ b/src/glx/xfont.c
> @@ -215,7 +215,6 @@ _X_HIDDEN void
>  DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int 
> count, int listbase)  {
>     Display *dpy;
> -   Window win;
>     Pixmap pixmap;
>     GC gc;
>     XGCValues values;
> @@ -231,7 +230,6 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int 
> first, int count, int lis
>     int i;
>  
>     dpy = CC->currentDpy;
> -   win = CC->currentDrawable;
>  
>     fs = XQueryFont(dpy, font);
>     if (!fs) {
> @@ -279,7 +277,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int 
> first, int count, int lis
>     glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
>     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
>  
> -   pixmap = XCreatePixmap(dpy, win, 10, 10, 1);
> +   pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), 10, 10, 1);
>     values.foreground = BlackPixel(dpy, DefaultScreen(dpy));
>     values.background = WhitePixel(dpy, DefaultScreen(dpy));
>     values.font = fs->fid;
> @@ -342,7 +340,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int 
> first, int count, int lis
>        if (valid && (bm_width > 0) && (bm_height > 0)) {
>  
>           memset(bm, '\0', bm_width * bm_height);
> -         fill_bitmap(dpy, win, gc, bm_width, bm_height, x, y, c, bm);
> +         fill_bitmap(dpy, DefaultRootWindow(dpy), gc, bm_width, 
> + bm_height, x, y, c, bm);
>  
>           glBitmap(width, height, x0, y0, dx, dy, bm);  #ifdef DEBUG
> 

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by others 
is strictly prohibited.

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to