Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int
- get_back_bo(struct dri2_egl_surface *dri2_surf)
- {
- struct dri2_egl_display *dri2_dpy =
- dri2_egl_display(dri2_surf->base.Resource.Display);
- struct gbm_dri_surface *surf = dri2_surf->gbm_surf;
- int age = 0;
- if (dri2_surf->back == NULL) {
- printf("--panfrost: look for new backbuffer... %i to pick from\n", (int)ARRAY_SIZE(dri2_surf->color_buffers));
- for (unsigned i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
- printf("--panfrost: buf [%p] %i locked=%i, age=%i\n", dri2_surf->color_buffers[i].bo, i, dri2_surf->color_buffers[i].locked, dri2_surf->color_buffers[i].age);
- if (!dri2_surf->color_buffers[i].locked &&
- dri2_surf->color_buffers[i].age >= age) {
- dri2_surf->back = &dri2_surf->color_buffers[i];
- age = dri2_surf->color_buffers[i].age;
- printf("--panfrost: chosen [%p] age=%i\n", dri2_surf->back->bo, age);
- }
- }
- }
- if (dri2_surf->back == NULL)
- return -1;
- if (dri2_surf->back->bo == NULL) {
- if (surf->base.modifiers)
- dri2_surf->back->bo = gbm_bo_create_with_modifiers(&dri2_dpy->gbm_dri->base,
- surf->base.width,
- surf->base.height,
- surf->base.format,
- surf->base.modifiers,
- surf->base.count);
- else
- dri2_surf->back->bo = gbm_bo_create(&dri2_dpy->gbm_dri->base,
- surf->base.width,
- surf->base.height,
- surf->base.format,
- surf->base.flags);
- printf("--panfrost: had to create new buffer %p\n", dri2_surf->back->bo);
- }
- if (dri2_surf->back->bo == NULL)
- return -1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement