[PATCH weston 4/7] compositor-drm: Delay egl initialization until all outputs are created

Ander Conselvan de Oliveira conselvan2 at gmail.com
Wed Jan 23 01:12:24 PST 2013


On 01/22/2013 06:52 PM, John Kåre Alsaker wrote:
> What's the reason for this change and where is EGL initialized for
> outputs created on the fly?

Right, that is missing. This patch is not actually necessary. I already 
had part of the rework needed for the pixman renderer done for another 
reason. I implemented support for showing a splash screen as soon as the 
output is initialized, delaying the load of the gl-renderer because it 
takes up to 300ms to initialize. (This is in 
git at github.com:anderco/weston.git splash-screen).

I discussed that with Kristian and we're trying to find a more flexible 
solution. Right now I'm looking into doing a runtime switch from the 
pixman renderer to the gl one, so that we could have a splash client 
display the splash screen, and once the gl initialization is done, 
resume normal operation.

Anyway, even though this patch would be helpful goinging down that line, 
it is not necessary now and I can move that to a different series.

Thanks for reviewing.

Cheers,
Ander

> On Tue, Jan 22, 2013 at 5:07 PM, Ander Conselvan de Oliveira
> <ander.conselvan.de.oliveira at intel.com> wrote:
>> ---
>>   src/compositor-drm.c |   30 ++++++++++++++++++------------
>>   1 file changed, 18 insertions(+), 12 deletions(-)
>>
>> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
>> index 449106e..0f455ba 100644
>> --- a/src/compositor-drm.c
>> +++ b/src/compositor-drm.c
>> @@ -1047,8 +1047,13 @@ init_drm(struct drm_compositor *ec, struct udev_device *device)
>>   }
>>
>>   static int
>> +drm_output_init_egl(struct drm_output *output, struct drm_compositor *ec);
>> +
>> +static int
>>   init_egl(struct drm_compositor *ec)
>>   {
>> +       struct drm_output *output;
>> +
>>          ec->gbm = gbm_create_device(ec->drm.fd);
>>
>>          if (gl_renderer_create(&ec->base, ec->gbm, gl_renderer_opaque_attribs,
>> @@ -1057,6 +1062,14 @@ init_egl(struct drm_compositor *ec)
>>                  return -1;
>>          }
>>
>> +       wl_list_for_each(output, &ec->base.output_list, base.link)
>> +               if (drm_output_init_egl(output, ec) < 0) {
>> +                       weston_log("Failed to init egl state for output %s\n",
>> +                                  output->name);
>> +                       weston_output_destroy(&output->base);
>> +                       wl_list_remove(&output->base.link);
>> +               }
>> +
>>          return 0;
>>   }
>>
>> @@ -1421,11 +1434,6 @@ create_output_for_connector(struct drm_compositor *ec,
>>                             connector->mmWidth, connector->mmHeight,
>>                             o ? o->transform : WL_OUTPUT_TRANSFORM_NORMAL);
>>
>> -       if (drm_output_init_egl(output, ec) < 0) {
>> -               weston_log("Failed to init output gl state\n");
>> -               goto err_output;
>> -       }
>> -
>>          output->backlight = backlight_init(drm_device,
>>                                             connector->connector_type);
>>          if (output->backlight) {
>> @@ -1459,8 +1467,6 @@ create_output_for_connector(struct drm_compositor *ec,
>>
>>          return 0;
>>
>> -err_output:
>> -       weston_output_destroy(&output->base);
>>   err_free:
>>          wl_list_for_each_safe(drm_mode, next, &output->base.mode_list,
>>                                                          base.link) {
>> @@ -2249,11 +2255,6 @@ drm_compositor_create(struct wl_display *display,
>>                  goto err_udev_dev;
>>          }
>>
>> -       if (init_egl(ec) < 0) {
>> -               weston_log("failed to initialize egl\n");
>> -               goto err_udev_dev;
>> -       }
>> -
>>          ec->base.destroy = drm_destroy;
>>          ec->base.restore = drm_restore;
>>
>> @@ -2274,6 +2275,11 @@ drm_compositor_create(struct wl_display *display,
>>                  goto err_sprite;
>>          }
>>
>> +       if (init_egl(ec) < 0) {
>> +               weston_log("failed to initialize egl\n");
>> +               goto err_udev_dev;
>> +       }
>> +
>>          path = NULL;
>>
>>          evdev_input_create(&ec->base, ec->udev, seat);
>> --
>> 1.7.10.4
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>



More information about the wayland-devel mailing list