[PATCH weston v2 07/12] gl-renderer: Always setup gl-renderer

Armin Krezović krezovic.armin at gmail.com
Thu Jun 30 04:26:11 UTC 2016


On 27.06.2016 15:08, Pekka Paalanen wrote:
>> diff --git a/src/gl-renderer.c b/src/gl-renderer.c
>> index 23c0cd7..28c0b50 100644
>> --- a/src/gl-renderer.c
>> +++ b/src/gl-renderer.c
>> @@ -2873,6 +2878,43 @@ platform_to_extension(EGLenum platform)
>>  }
>>  
>>  static int
>> +gl_renderer_create_pbuffer_surface(struct gl_renderer *gr) {
> 
> Style-wise, this function could just take a EGLDisplay as an argument,
> and return the EGLSurface. That way the setting of dummy_surface would
> be in the caller, which would make it easier to read.
> 
>> +	EGLConfig pbuffer_config;
>> +
>> +	static const EGLint pbuffer_config_attribs[] = {
>> +		EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
>> +		EGL_RED_SIZE, 1,
>> +		EGL_GREEN_SIZE, 1,
>> +		EGL_BLUE_SIZE, 1,
>> +		EGL_ALPHA_SIZE, 0,
>> +		EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
>> +		EGL_NONE
>> +	};
>> +
>> +	static const EGLint pbuffer_attribs[] = {
>> +		EGL_WIDTH, 10,
>> +		EGL_HEIGHT, 10,
>> +		EGL_NONE
>> +	};
>> +
>> +	if (egl_choose_config(gr, pbuffer_config_attribs, NULL, 0, &pbuffer_config) < 0) {
>> +		weston_log("failed to choose EGL config for PbufferSurface");
>> +		return -1;
>> +	}
>> +
>> +	gr->dummy_surface = eglCreatePbufferSurface(gr->egl_display,
>> +						    pbuffer_config,
>> +						    pbuffer_attribs);
>> +
>> +	if (gr->dummy_surface == EGL_NO_SURFACE) {
>> +		weston_log("failed to create PbufferSurface\n");
>> +		return -1;
>> +	}
>> +
>> +	return 0;
>> +}
>> +

I've been looking at this. If I choose to pass EGLDisplay and return an
EGLSurface from this function, I can't use egl_choose_config. Instead,
I'd have to manually call eglGetConfigs and eglChooseConfig. So, I'd
rather not do this, unless you really, really want it.

> 
> 
> Thanks,
> pq
> 

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


More information about the wayland-devel mailing list