On 17 September 2017 at 19:01, Gwan-gyeong Mun <elong...@gmail.com> wrote: > It adds support of dri_image_loader to egl dri2 tizen backend. > - referenced a basic buffer flow and management implementation from > android's. > > It adds dri_image_back/dri_image_back member variables to dri_egl_surface for > a management of back/front buffers. > I fear you've heard this before:
Some of the code is fairly generic and can be moved and shared with others. > + if (dri2_surf->dri_image_back) { > + _eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_back", __func__, > __LINE__); > + dri2_dpy->image->destroyImage(dri2_surf->dri_image_back); > + dri2_surf->dri_image_back = NULL; > + } > + > + if (dri2_surf->dri_image_front) { > + _eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_front", __func__, > __LINE__); > + dri2_dpy->image->destroyImage(dri2_surf->dri_image_front); > + dri2_surf->dri_image_front = NULL; > + } > + ... this > dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable); > > tpl_object_unreference((tpl_object_t *)dri2_surf->tpl_surface); > @@ -416,6 +436,157 @@ update_buffers(struct dri2_egl_surface *dri2_surf) > return 0; > } > > +static int > +get_front_bo(struct dri2_egl_surface *dri2_surf, unsigned int format) > +{ > + struct dri2_egl_display *dri2_dpy = > + dri2_egl_display(dri2_surf->base.Resource.Display); > + > + if (dri2_surf->dri_image_front) > + return 0; > + > + if (dri2_surf->base.Type == EGL_WINDOW_BIT) { > + /* According current EGL spec, front buffer rendering > + * for window surface is not supported now. > + * and mesa doesn't have the implementation of this case. > + * Add warning message, but not treat it as error. > + */ > + _eglLog(_EGL_DEBUG, "DRI driver requested unsupported front buffer for > window surface"); > + } else if (dri2_surf->base.Type == EGL_PBUFFER_BIT) { > + dri2_surf->dri_image_front = > + dri2_dpy->image->createImage(dri2_dpy->dri_screen, > + dri2_surf->base.Width, > + dri2_surf->base.Height, > + format, > + 0, > + dri2_surf); > + if (!dri2_surf->dri_image_front) { > + _eglLog(_EGL_WARNING, "dri2_image_front allocation failed"); > + return -1; > + } > + } > + > + return 0; > +} ... this whole function Thanks Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev