[Mesa-dev] [RFC 00/21] Extensions Rework

Nanley Chery nanleychery at gmail.com
Mon Oct 19 15:36:18 PDT 2015


From: Nanley Chery <nanley.g.chery at intel.com>

Summary:
This series fixes 26 dEQP tests with prefix:
   dEQP-GLES2.functional.negative_api.texture.compressedteximage2d*
and prevents similar bugs from occuring in the future.

The bug fix that originated from using the helper functions (mentioned below)
is split out for easy backporting to stable.


Intro:
Mesa tries to advertise an extension to a client application if the environment
satifies the following 3 requirements: the driver capability flag is enabled in
struct gl_extensions, the provided context's API matches the extension's spec
requirement, and the provided context's version is within the range specified by
the extension's spec. If an extension is advertised externally, Mesa's internal
behavior is changed as a result.


Problem:
Although most extension advertisement requirements are statically defined in
extensions.c (struct extension extension_table[]), checks for each of these
requirements are open-coded throughout Mesa. Sometimes, only 1-2 of the
requirements are checked. This can introduce bugs by leaking extension
functionality into improper contexts.

The version requirement for extensions exists in the extension table, but only
with a coarse granularity (Compat, Core, ES{1,2,3,31}). If an extension requires
Compat 3.3, but a Compat 3.0 context is provided, Mesa advertises the extension
anyways. One extension this exact problem occurs with is ARB_ES3_compatibility.


Solution:
This series uses the extension table to generate query functions which check all
3 requirements to determine if an extension should be advertised. Using these
helper functions eliminates the extension functionality leaks that arise from
coding error and makes fixing leaks that arise from a misunderstanding of the
extension spec as simple as changing entries in the extension table (see patches
for examples).

This series also modifies the extension table so that extensions can be
advertised or hidden with the same granularity used to advertise our GL[ES]
version (e.g., 21, 33, etc.).

This series can be divided into four logical parts:
  1  : Fix dEQP bugs.
 2-8 : Enable specifying the required GL version needed to advertise an
       extension.
 9-17: Create auto-generated query functions and use them to fix bugs.
18-21: Minor cleanups.

This series is an RFC because this new way of advertising extensions is based on
a more restrictive interpretation of extension specs than Mesa currently has
(see paragraph two in the problem section). Since this would set a precedence
for future patches to come, I'd like to make sure others believe this is the
right way to go about this.

Note: This series is rebased onto the following bug-fix patch:
   http://lists.freedesktop.org/archives/mesa-stable/2015-October/003248.html

Nanley Chery (21):
  mesa/texcompress: Restrict FXT1 format to desktop GL subset
  mesa/extensions: Remove array sentinel
  mesa/extensions: Wrap array entries in macros
  mesa/extensions: Move entries entries to seperate file
  mesa/extensions: Add extension::version
  mesa/extensions: Create _mesa_extension_supported()
  mesa/extensions: Use _mesa_extension_supported()
  mesa/extensions: Replace extension::api_set with ::version
  mesa: Generate a helper function for each extension
  mesa: Remove equality check in helper functions
  mesa: In helpers, only check driver capability for meta
  mesa: Fix 3DFX_texture_compression_FXT1 funtionality leaks
  mesa: Fix EXT_texture_compression_s3tc functionality leaks
  mesa: Fix ASTC extension functionality leak into GLES 1
  mesa: Fix EXT_texture_sRGB functionality leaks
  mesa: Fix ARB_texture_compression_bptc functionality leaks
  mesa: Fix ARB_ES3_compatibility functionality leaks
  mesa/extensions: Remove extra memsets on gl_extensions
  mesa: Replace gl_extensions::EXT_texture3D with ::dummy_true
  mesa: Remove gl_extensions::dummy
  mesa/extensions: Declare _mesa_init_extensions() static inline

 src/glsl/glsl_parser_extras.cpp     |   2 +-
 src/glsl/standalone_scaffolding.cpp |   1 -
 src/mesa/drivers/common/meta.c      |  11 +
 src/mesa/drivers/common/meta.h      |   1 +
 src/mesa/main/context.h             |   1 +
 src/mesa/main/enable.c              |   4 +-
 src/mesa/main/extensions.c          | 493 +++++-------------------------------
 src/mesa/main/extensions.h          |  55 +++-
 src/mesa/main/extensions_table.h    | 330 ++++++++++++++++++++++++
 src/mesa/main/glformats.c           |  30 ++-
 src/mesa/main/mtypes.h              |  10 +-
 src/mesa/main/queryobj.c            |   2 +-
 src/mesa/main/texcompress.c         |   4 +-
 src/mesa/main/teximage.c            |   8 +-
 src/mesa/main/textureview.c         |   4 +-
 src/mesa/main/version.c             |   1 +
 16 files changed, 493 insertions(+), 464 deletions(-)
 create mode 100644 src/mesa/main/extensions_table.h

-- 
2.6.1



More information about the mesa-dev mailing list