[PATCH weston] gl-renderer: Use EGL_KHR_no_config_context

Armin Krezović krezovic.armin at gmail.com
Wed Sep 28 19:54:40 UTC 2016


On 27.09.2016 15:18, Emmanuel Gil Peyrot wrote:
> On Tue, Sep 27, 2016 at 12:29:51PM +0200, Armin Krezović wrote:
>> This patch makes use of recently implemented
>> EGL_KHR_no_config_context extension in Mesa,
>> which superseeds EGL_MESA_configless_context.
>>
>> See also (and the follow-up patch):
>>
>> https://lists.freedesktop.org/archives/mesa-dev/2016-September/128510.html
>>
>> Signed-off-by: Armin Krezović <krezovic.armin at gmail.com>
>> ---
>>  libweston/gl-renderer.c    | 14 +++++++++++---
>>  libweston/weston-egl-ext.h |  3 +++
>>  2 files changed, 14 insertions(+), 3 deletions(-)
>>
>> diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
>> index 031576b..7ef7b89 100644
>> --- a/libweston/gl-renderer.c
>> +++ b/libweston/gl-renderer.c
>> @@ -199,6 +199,8 @@ struct gl_renderer {
>>  
>>  	int has_egl_buffer_age;
>>  
>> +	int has_no_config_context;
>> +
>>  	int has_configless_context;
> 
> You don’t need to keep two different booleans for that, both extensions
> are implemented and exposed the same way, only the wording changes a
> bit.
> 
>>  
>>  	int has_surfaceless_context;
>> @@ -2564,10 +2566,11 @@ gl_renderer_output_create(struct weston_output *output,
>>  	}
>>  
>>  	if (egl_config != gr->egl_config &&
>> +	    !gr->has_no_config_context &&
>>  	    !gr->has_configless_context) {
>>  		weston_log("attempted to use a different EGL config for an "
>> -			   "output but EGL_MESA_configless_context is not "
>> -			   "supported\n");
>> +			   "output but EGL_KHR_no_config_context or "
>> +			   "EGL_MESA_configless_context is not supported\n");
>>  		return -1;
>>  	}
>>  
>> @@ -2726,6 +2729,9 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
>>  		weston_log("warning: EGL_EXT_swap_buffers_with_damage not "
>>  			   "supported. Performance could be affected.\n");
>>  
>> +	if (weston_check_egl_extension(extensions, "EGL_KHR_no_config_context"))
>> +		gr->has_no_config_context = 1;
>> +
>>  	if (weston_check_egl_extension(extensions, "EGL_MESA_configless_context"))
>>  		gr->has_configless_context = 1;
> 
> Same here, you can safely set gr->has_no_config_context instead.
> 
>>  
>> @@ -3101,7 +3107,9 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
>>  
>>  	context_config = gr->egl_config;
>>  
>> -	if (gr->has_configless_context)
>> +	if (gr->has_no_config_context)
>> +		context_config = EGL_NO_CONFIG_KHR;
>> +	else if (gr->has_configless_context)
>>  		context_config = EGL_NO_CONFIG_MESA;
> 
> And same here, the EGL_NO_CONFIG_KHR and EGL_NO_CONFIG_MESA values are
> the same, so as long as you have both in the header (you do), it will
> not be an issue.
> 
>>  
>>  	gr->egl_context = eglCreateContext(gr->egl_display, context_config,
>> diff --git a/libweston/weston-egl-ext.h b/libweston/weston-egl-ext.h
>> index 6e36996..50964a8 100644
>> --- a/libweston/weston-egl-ext.h
>> +++ b/libweston/weston-egl-ext.h
>> @@ -152,5 +152,8 @@ typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLD
>>  #define EGL_PLATFORM_X11_KHR 0x31D5
>>  #endif
>>  
>> +#ifndef EGL_NO_CONFIG_KHR
>> +#define EGL_NO_CONFIG_KHR ((EGLConfig)0)
>> +#endif
>>  
>>  #endif
>> -- 
>> 2.10.0
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 

Hi Emmanuel,

Thanks for the review. I was going to implement it that way, but I wanted to keep
up the tradition.

If nobody complains about the way you suggested, I'll implement it that way.

Cheers, Armin.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 837 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160928/a57c057b/attachment-0001.sig>


More information about the wayland-devel mailing list