0051-egl-wayland-a-linear-buffer-is-not-needed-with-DRM-f.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From 1777578c96aba9bac85508d2fc6d6b38407cf9b9 Mon Sep 17 00:00:00 2001
  2. From: Brendan King <Brendan.King@imgtec.com>
  3. Date: Wed, 28 Apr 2021 10:57:15 +0100
  4. Subject: [PATCH] egl/wayland: a linear buffer is not needed with DRM format
  5. modifiers
  6. If the compositor supports DRM format modifiers, there is no
  7. need for an additional linear buffer, as the client can allocate
  8. buffers with attributes known to the compositor.
  9. ---
  10. src/egl/drivers/dri2/platform_wayland.c | 8 ++++----
  11. 1 file changed, 4 insertions(+), 4 deletions(-)
  12. diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
  13. index b393e05..60683fa 100644
  14. --- a/src/egl/drivers/dri2/platform_wayland.c
  15. +++ b/src/egl/drivers/dri2/platform_wayland.c
  16. @@ -695,7 +695,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
  17. use_flags |= __DRI_IMAGE_USE_PROTECTED;
  18. }
  19. - if (dri2_dpy->is_different_gpu &&
  20. + if (dri2_dpy->is_different_gpu && !num_modifiers &&
  21. dri2_surf->back->linear_copy == NULL) {
  22. /* The LINEAR modifier should be a perfect alias of the LINEAR use
  23. * flag; try the new interface first before the old, then fall back. */
  24. @@ -811,7 +811,7 @@ update_buffers(struct dri2_egl_display *dri2_dpy,
  25. dri2_surf->color_buffers[i].wl_buffer) {
  26. wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer);
  27. dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image);
  28. - if (dri2_dpy->is_different_gpu)
  29. + if (dri2_surf->color_buffers[i].linear_copy)
  30. dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].linear_copy);
  31. dri2_surf->color_buffers[i].wl_buffer = NULL;
  32. dri2_surf->color_buffers[i].dri_image = NULL;
  33. @@ -1247,7 +1247,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
  34. if (!dri2_surf->current->wl_buffer) {
  35. __DRIimage *image;
  36. - if (dri2_dpy->is_different_gpu)
  37. + if (dri2_surf->current->linear_copy)
  38. image = dri2_surf->current->linear_copy;
  39. else
  40. image = dri2_surf->current->dri_image;
  41. @@ -1281,7 +1281,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp,
  42. dri2_flush_drawable_for_swapbuffers(disp, draw);
  43. - if (dri2_dpy->is_different_gpu) {
  44. + if (dri2_surf->current->linear_copy) {
  45. _EGLContext *ctx = _eglGetCurrentContext();
  46. struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
  47. dri2_dpy->image->blitImage(dri2_ctx->dri_context,