Package: libgl1-mesa-dri
Version: 24.0.8-1
Severity: important
Tags: patch

Dear Maintainer,

OpenGL ES 1 contexts cannot be created when using Mesa on Debian Testing
(trixie). However it works on Debian 12 (bookworm). It can be fixed in
Testing by building Mesa with "-Dgles1=enabled" in the mesa source package
"debian/rules" file.


OpenGL ES 1 contexts can be tested by installing mesa-utils package and running
es2_info under the executable name es1_info:

$ ln -s /usr/bin/es2_info es1_info
$ ./es1_info


On Debian Testing es1_info fails to create an OpenGL ES 1 context:

$ ./es1_info
Error: eglCreateContext failed


On Debian Testing with libgl1-mesa-dri patched to use -Dgles1=enabled it prints
the OpenGL ES 1 context information (GL_VERSION: OpenGL ES-CM 1.1):

$ ./es1_info
EGL_VERSION: 1.5
EGL_VENDOR: Mesa Project
EGL_EXTENSIONS:
    EGL_ANDROID_blob_cache, EGL_ANDROID_native_fence_sync,
    EGL_CHROMIUM_sync_control, EGL_ANGLE_sync_control_rate,
    EGL_EXT_buffer_age, EGL_EXT_create_context_robustness,
    EGL_EXT_image_dma_buf_import, EGL_EXT_image_dma_buf_import_modifiers,
    EGL_EXT_query_reset_notification_strategy,
    EGL_EXT_swap_buffers_with_damage, EGL_IMG_context_priority,
    EGL_KHR_cl_event2, EGL_KHR_config_attribs, EGL_KHR_context_flush_control,
    EGL_KHR_create_context, EGL_KHR_create_context_no_error,
    EGL_KHR_fence_sync, EGL_KHR_get_all_proc_addresses, EGL_KHR_gl_colorspace,
    EGL_KHR_gl_renderbuffer_image, EGL_KHR_gl_texture_2D_image,
    EGL_KHR_gl_texture_3D_image, EGL_KHR_gl_texture_cubemap_image,
    EGL_KHR_image, EGL_KHR_image_base, EGL_KHR_image_pixmap,
    EGL_KHR_no_config_context, EGL_KHR_reusable_sync,
    EGL_KHR_surfaceless_context, EGL_KHR_swap_buffers_with_damage,
    EGL_EXT_pixel_format_float, EGL_KHR_wait_sync,
    EGL_MESA_configless_context, EGL_MESA_drm_image, EGL_MESA_gl_interop,
    EGL_MESA_image_dma_buf_export, EGL_MESA_query_driver,
    EGL_NOK_texture_from_pixmap, EGL_WL_bind_wayland_display
EGL_CLIENT_APIS: OpenGL OpenGL_ES
GL_VENDOR: AMD
GL_VERSION: OpenGL ES-CM 1.1 Mesa 24.0.8-1
GL_SHADING_LANGUAGE_VERSION: (null)
GL_RENDERER: AMD Radeon RX 6600 (radeonsi, navi23, LLVM 17.0.6, DRM 3.57, 
6.7.12-amd64)
GL_EXTENSIONS:
    GL_EXT_blend_minmax, GL_EXT_multi_draw_arrays,
    GL_EXT_texture_filter_anisotropic, GL_EXT_texture_lod_bias,
    GL_OES_byte_coordinates, GL_OES_fixed_point, GL_OES_stencil_wrap,
    GL_OES_compressed_paletted_texture, GL_OES_query_matrix,
    GL_OES_read_format, GL_OES_single_precision,
    GL_EXT_texture_compression_dxt1, GL_OES_draw_texture,
    GL_OES_point_size_array, GL_OES_point_sprite,
    GL_EXT_texture_format_BGRA8888, GL_OES_compressed_ETC1_RGB8_texture,
    GL_OES_depth24, GL_OES_element_index_uint, GL_OES_fbo_render_mipmap,
    GL_OES_framebuffer_object, GL_OES_mapbuffer, GL_OES_rgb8_rgba8,
    GL_OES_stencil8, GL_OES_texture_env_crossbar,
    GL_OES_texture_mirrored_repeat, GL_OES_texture_npot, GL_OES_EGL_image,
    GL_OES_packed_depth_stencil, GL_OES_texture_cube_map,
    GL_APPLE_texture_max_level, GL_EXT_discard_framebuffer,
    GL_EXT_read_format_bgra, GL_OES_blend_equation_separate,
    GL_OES_blend_func_separate, GL_OES_blend_subtract,
    GL_OES_EGL_image_external, GL_OES_EGL_sync, GL_OES_vertex_array_object,
    GL_ANGLE_texture_compression_dxt3, GL_ANGLE_texture_compression_dxt5,
    GL_APPLE_sync, GL_EXT_map_buffer_range, GL_KHR_debug,
    GL_NV_generate_mipmap_sRGB, GL_OES_required_internalformat,
    GL_OES_surfaceless_context, GL_EXT_debug_label,
    GL_EXT_compressed_ETC1_RGB8_sub_texture, GL_EXT_polygon_offset_clamp,
    GL_KHR_no_error, GL_EXT_demote_to_helper_invocation


On Debian 12 es1_info prints the OpenGL ES 1 context information (even though
the mesa source package disables gles1):

$ ./es1_info
EGL_VERSION: 1.5
EGL_VENDOR: Mesa Project
EGL_EXTENSIONS:
    EGL_ANDROID_blob_cache, EGL_ANDROID_native_fence_sync,
    EGL_CHROMIUM_sync_control, EGL_ANGLE_sync_control_rate,
    EGL_EXT_buffer_age, EGL_EXT_create_context_robustness,
    EGL_EXT_image_dma_buf_import, EGL_EXT_image_dma_buf_import_modifiers,
    EGL_EXT_swap_buffers_with_damage, EGL_IMG_context_priority,
    EGL_KHR_cl_event2, EGL_KHR_config_attribs, EGL_KHR_context_flush_control,
    EGL_KHR_create_context, EGL_KHR_create_context_no_error,
    EGL_KHR_fence_sync, EGL_KHR_get_all_proc_addresses, EGL_KHR_gl_colorspace,
    EGL_KHR_gl_renderbuffer_image, EGL_KHR_gl_texture_2D_image,
    EGL_KHR_gl_texture_3D_image, EGL_KHR_gl_texture_cubemap_image,
    EGL_KHR_image, EGL_KHR_image_base, EGL_KHR_image_pixmap,
    EGL_KHR_no_config_context, EGL_KHR_reusable_sync,
    EGL_KHR_surfaceless_context, EGL_KHR_swap_buffers_with_damage,
    EGL_EXT_pixel_format_float, EGL_KHR_wait_sync,
    EGL_MESA_configless_context, EGL_MESA_drm_image,
    EGL_MESA_image_dma_buf_export, EGL_MESA_query_driver,
    EGL_NOK_texture_from_pixmap, EGL_WL_bind_wayland_display
EGL_CLIENT_APIS: OpenGL OpenGL_ES
GL_VENDOR: AMD
GL_VERSION: OpenGL ES-CM 1.1 Mesa 22.3.6
GL_SHADING_LANGUAGE_VERSION: (null)
GL_RENDERER: AMD Radeon RX 6600 (navi23, LLVM 15.0.6, DRM 3.49, 6.1.0-20-amd64)
GL_EXTENSIONS:
    GL_EXT_blend_minmax, GL_EXT_multi_draw_arrays,
    GL_EXT_texture_filter_anisotropic, GL_EXT_texture_lod_bias,
    GL_OES_byte_coordinates, GL_OES_fixed_point, GL_OES_stencil_wrap,
    GL_OES_compressed_paletted_texture, GL_OES_query_matrix,
    GL_OES_read_format, GL_OES_single_precision,
    GL_EXT_texture_compression_dxt1, GL_OES_draw_texture,
    GL_OES_point_size_array, GL_OES_point_sprite,
    GL_EXT_texture_format_BGRA8888, GL_OES_compressed_ETC1_RGB8_texture,
    GL_OES_depth24, GL_OES_element_index_uint, GL_OES_fbo_render_mipmap,
    GL_OES_framebuffer_object, GL_OES_mapbuffer, GL_OES_rgb8_rgba8,
    GL_OES_stencil8, GL_OES_texture_env_crossbar,
    GL_OES_texture_mirrored_repeat, GL_OES_texture_npot, GL_OES_EGL_image,
    GL_OES_packed_depth_stencil, GL_OES_texture_cube_map,
    GL_APPLE_texture_max_level, GL_EXT_discard_framebuffer,
    GL_EXT_read_format_bgra, GL_OES_blend_equation_separate,
    GL_OES_blend_func_separate, GL_OES_blend_subtract,
    GL_OES_EGL_image_external, GL_OES_EGL_sync, GL_OES_vertex_array_object,
    GL_ANGLE_texture_compression_dxt3, GL_ANGLE_texture_compression_dxt5,
    GL_EXT_map_buffer_range, GL_KHR_debug, GL_OES_required_internalformat,
    GL_OES_surfaceless_context, GL_EXT_debug_label,
    GL_EXT_compressed_ETC1_RGB8_sub_texture, GL_EXT_polygon_offset_clamp,
    GL_KHR_no_error, GL_EXT_demote_to_helper_invocation


Debian 12 (Mesa 22.3) and Testing (Mesa 24.0) packages both specify disabling
gles1. Before Mesa 23.1, this disabled the Mesa specific libGLESv1_CM library
but not the OpenGL ES 1 context support.

The glvnd system provides the libGLESv1_CM shim library that passes calls to
Mesa or Nvidia's driver. This made OpenGL ES 1 usable with Mesa in Debian 12.
The contexts have stopped working in Debian Testing due to Mesa 23.1 changing
the implementation of the gles1 option to cause it to disable OpenGL ES 1
context support.

Using "-Dgles1=enabled" would restore support to the level of Debian 12.
Building Mesa with glvnd enabled (as Debian does) no longer builds the Mesa
specific libGLESv1_CM library when gles1 is enabled. I don't think applying
this change would require other packaging changes.

I tested this by fetching the Debian Testing mesa source package, building, and
installing libgl1-mesa-dri with gles1 enabled. It allows OpenGL ES 1 contexts
to be created and used on Debian Testing.

--- debian/rules    2024-06-18 22:28:08.426053432 +0000
+++ debian/rules    2024-06-18 22:45:19.826044739 +0000
@@ -158,7 +158,7 @@
 VULKAN_LAYERS := $(patsubst %,'%',$(VULKAN_LAYERS))
 VULKAN_LAYERS_LIST := $(subst $(space),$(comma),$(VULKAN_LAYERS))
-confflags_GLES = -Dgles1=disabled -Dgles2=enabled
+confflags_GLES = -Dgles1=enabled -Dgles2=enabled
 confflags_GALLIUM += -Dgallium-drivers="[$(GALLIUM_DRIVERS_LIST)]"
 confflags += \

For reference:

es2_info uses the source code of es1_info and the ES version is based on the
executable name at run-time:
https://gitlab.freedesktop.org/mesa/demos/-/blob/main/src/egl/opengles1/es1_info.c
https://gitlab.freedesktop.org/mesa/demos/-/blob/main/src/egl/opengles2/es2_info.c

This Mesa 23.1 change made disabling the gles1 option disable the context 
support:
("mesa: optimize out _mesa_is_desktop_gl*() and _mesa_is_gles*() calls when not 
built")
https://gitlab.freedesktop.org/mesa/mesa/-/commit/adbe8b6c17a76bb5ee0b924d927473f81c593eba

This Mesa 23.2 change properly rejects OpenGL ES 1 context when it's disabled
instead of crashing:
("mesa/main: Exit early when trying to create an unsupported context API")
https://gitlab.freedesktop.org/mesa/mesa/-/commit/8bb1ecaa02177720758255bdd7ec34a5d15feca4

Reply via email to