[PATCH 2/3] renderer: introduce destroy callback

Vasily Khoruzhick anarsoul at gmail.com
Tue Jan 8 12:14:34 PST 2013


On Tue, Jan 8, 2013 at 10:50 PM, John Kåre Alsaker
<john.kare.alsaker at gmail.com> wrote:

Hi John,

> I'd like for output_create, output_destroy, renderer_destroy,
> set_border and repaint_output to be virtual functions as part of a new
> abstraction which is responsible for handling buffers and renderers
> for the backends. These may simply be new fields in weston_renderer
> that the backends override as necessary, or a new structure private to
> the backends which the renderers may partially initialize.
>
> This way we can replace this nice peace of code

We still need to initialize x11 shm part (and it's x11 specific,
fbdev backend will initialize something else), it'll just replace
output create part.
But again it's very renderer-specific (gl renderer needs
EGLNativeWindowType, pixman
renderer currently needs nothing, same for no-op renderer). Also
pixman renderer does not manage
buffers at all, backend is responsible in providing buffer(s) for
pixman renderer (see pixman_renderer_output_set_buffer)

>         if (c->use_pixman) {
>                 if (x11_output_init_shm(c, output, width, height) < 0)
>                         return NULL;
>                 if (pixman_renderer_output_create(&output->base) < 0) {
>                         x11_output_deinit_shm(c, output);
>                         return NULL;
>                 }
>         } else {
>                 if (gl_renderer_output_create(&output->base, output->window) < 0)
>                         return NULL;
>         }
> with this
>         if (buff_manager->output_create(&output->base, output->window) < 0)
>                 return NULL;
> and generally reduce the number of branches. Which will help making
> EGL/gl_renderer switchable.

Regards
Vasily


More information about the wayland-devel mailing list