Bug 31832

Summary: [i915] Bad renderbuffer format: 21
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Drivers/DRI/i915Assignee: Ian Romanick <idr>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: medium CC: eric
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2010-11-22 01:19:35 UTC
mesa: 1b6ed809729dd3adee4adfa87c227bbd98d9f23a (master)

chipset: 945GM (Intel GMA 950)
system architecture: i686
xserver-xorg-video-intel: 2:2.12.0-1ubuntu5.1
libdrm-intel1: 2.4.21-1ubuntu2.1
kernel version: 2.6.35-22-generic
Linux distribution: Ubuntu 10.10 i386


Run piglit test fbo-generatemipmap-formats.

$ ./bin/fbo-generatemipmap-formats -auto
Using test set: Core formats
Testing 3
Testing 4
Testing GL_RGB
Testing GL_RGBA
Testing GL_ALPHA
Mesa 7.10-devel implementation error: Bad renderbuffer format: 21

Please report at bugzilla.freedesktop.org
Testing GL_LUMINANCE
Testing GL_LUMINANCE_ALPHA
Testing GL_INTENSITY
Testing GL_ALPHA4
Testing GL_ALPHA8
Testing GL_ALPHA12
Testing GL_ALPHA16
Testing GL_LUMINANCE4
Testing GL_LUMINANCE8
Testing GL_LUMINANCE12
Testing GL_LUMINANCE16
Testing GL_LUMINANCE4_ALPHA4
Testing GL_LUMINANCE8_ALPHA8
Testing GL_LUMINANCE12_ALPHA12
Testing GL_LUMINANCE16_ALPHA16
Testing GL_INTENSITY4
Testing GL_INTENSITY8
Testing GL_INTENSITY12
Testing GL_INTENSITY16
Testing GL_R3_G3_B2
Testing GL_RGB4
Testing GL_RGB5
Testing GL_RGB8
Testing GL_RGB10
Testing GL_RGB12
Testing GL_RGB16
Testing GL_RGBA2
Testing GL_RGBA4
Testing GL_RGB5_A1
Testing GL_RGBA8
Testing GL_RGB10_A2
Testing GL_RGBA12
Testing GL_RGBA16
PIGLIT: {'result': 'pass' }


21 == MESA_FORMAT_A8.


mesa/src/mesa/main/formats.h
    43  typedef enum
    44  {
    45     MESA_FORMAT_NONE = 0,
    46  
    47     /** 
    48      * \name Basic hardware formats
    49      */
    50     /*@{*/
    51                                  /* msb <------ TEXEL BITS -----------> lsb */
    52                                  /* ---- ---- ---- ---- ---- ---- ---- ---- */
    53     MESA_FORMAT_RGBA8888,        /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
    54     MESA_FORMAT_RGBA8888_REV,    /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
    55     MESA_FORMAT_ARGB8888,        /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
    56     MESA_FORMAT_ARGB8888_REV,    /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
    57     MESA_FORMAT_XRGB8888,        /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
    58     MESA_FORMAT_XRGB8888_REV,    /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
    59     MESA_FORMAT_RGB888,          /*           RRRR RRRR GGGG GGGG BBBB BBBB */
    60     MESA_FORMAT_BGR888,          /*           BBBB BBBB GGGG GGGG RRRR RRRR */
    61     MESA_FORMAT_RGB565,          /*                     RRRR RGGG GGGB BBBB */
    62     MESA_FORMAT_RGB565_REV,      /*                     GGGB BBBB RRRR RGGG */
    63     MESA_FORMAT_ARGB4444,        /*                     AAAA RRRR GGGG BBBB */
    64     MESA_FORMAT_ARGB4444_REV,    /*                     GGGG BBBB AAAA RRRR */
    65     MESA_FORMAT_RGBA5551,        /*                     RRRR RGGG GGBB BBBA */
    66     MESA_FORMAT_ARGB1555,        /*                     ARRR RRGG GGGB BBBB */
    67     MESA_FORMAT_ARGB1555_REV,    /*                     GGGB BBBB ARRR RRGG */
    68     MESA_FORMAT_AL88,            /*                     AAAA AAAA LLLL LLLL */
    69     MESA_FORMAT_AL88_REV,        /*                     LLLL LLLL AAAA AAAA */
    70     MESA_FORMAT_AL1616,          /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
    71     MESA_FORMAT_AL1616_REV,      /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
    72     MESA_FORMAT_RGB332,          /*                               RRRG GGBB */
    73     MESA_FORMAT_A8,              /*                               AAAA AAAA */



mesa/src/mesa/drivers/dri/i915/i915_vtbl.c
   564     if (irb != NULL) {
   565        switch (irb->Base.Format) {
   566        case MESA_FORMAT_ARGB8888:
   567        case MESA_FORMAT_XRGB8888:
   568           value |= DV_PF_8888;
   569           break;
   570        case MESA_FORMAT_RGB565:
   571           value |= DV_PF_565 | DITHER_FULL_ALWAYS;
   572           break;
   573        case MESA_FORMAT_ARGB1555:
   574           value |= DV_PF_1555 | DITHER_FULL_ALWAYS;
   575           break;
   576        case MESA_FORMAT_ARGB4444:
   577           value |= DV_PF_4444 | DITHER_FULL_ALWAYS;
   578           break;
   579        default:
   580           _mesa_problem(ctx, "Bad renderbuffer format: %d\n",
   581                         irb->Base.Format);
   582        }
Comment 1 Ian Romanick 2010-11-23 13:54:35 UTC
The assertion is triggered because i915-class hardware cannot render to A8 surfaces.  The part that's odd is that the same error is not triggered for the other alpha formats.  Looking in intel_tex_format.c, MESA_FORMAT_A8 is used for all of the alpha-only texture formats.

I'll poke at this a bit.
Comment 2 Ian Romanick 2010-11-23 18:45:46 UTC
This should be fixed by:

commit 78a340fd487c56468ace7347a53f95a0c751c419
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Tue Nov 23 16:17:21 2010 -0800

    i915: Disallow alpha, red, RG, and sRGB as render targets
    
    Fixes bugzilla #31832
    
    NOTE: This is a candidate for the 7.9 branch.
Comment 3 Vinson Lee 2010-11-23 19:40:45 UTC
mesa: 78a340fd487c56468ace7347a53f95a0c751c419 (master)

Verified fixed.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.