egl/wayland: split out kopper update_buffers
no functional changes Acked-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27703>
This commit is contained in:
committed by
Marge Bot
parent
1959691033
commit
17355e737d
@@ -2252,6 +2252,25 @@ dri2_wl_swrast_allocate_buffer(struct dri2_egl_surface *dri2_surf, int format,
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
kopper_update_buffers(struct dri2_egl_surface *dri2_surf)
|
||||
{
|
||||
/* we need to do the following operations only once per frame */
|
||||
if (dri2_surf->back)
|
||||
return;
|
||||
|
||||
if (dri2_surf->wl_win &&
|
||||
(dri2_surf->base.Width != dri2_surf->wl_win->width ||
|
||||
dri2_surf->base.Height != dri2_surf->wl_win->height)) {
|
||||
|
||||
dri2_surf->base.Width = dri2_surf->wl_win->width;
|
||||
dri2_surf->base.Height = dri2_surf->wl_win->height;
|
||||
dri2_surf->dx = dri2_surf->wl_win->dx;
|
||||
dri2_surf->dy = dri2_surf->wl_win->dy;
|
||||
dri2_surf->current = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
swrast_update_buffers(struct dri2_egl_surface *dri2_surf)
|
||||
{
|
||||
@@ -2406,6 +2425,19 @@ dri2_wl_swrast_commit_backbuffer(struct dri2_egl_surface *dri2_surf)
|
||||
wl_display_flush(dri2_dpy->wl_dpy);
|
||||
}
|
||||
|
||||
static void
|
||||
dri2_wl_kopper_get_drawable_info(__DRIdrawable *draw, int *x, int *y, int *w,
|
||||
int *h, void *loaderPrivate)
|
||||
{
|
||||
struct dri2_egl_surface *dri2_surf = loaderPrivate;
|
||||
|
||||
kopper_update_buffers(dri2_surf);
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
*w = dri2_surf->base.Width;
|
||||
*h = dri2_surf->base.Height;
|
||||
}
|
||||
|
||||
static void
|
||||
dri2_wl_swrast_get_drawable_info(__DRIdrawable *draw, int *x, int *y, int *w,
|
||||
int *h, void *loaderPrivate)
|
||||
@@ -2696,6 +2728,15 @@ static const __DRIswrastLoaderExtension swrast_loader_extension = {
|
||||
.putImage2 = dri2_wl_swrast_put_image2,
|
||||
};
|
||||
|
||||
static const __DRIswrastLoaderExtension kopper_swrast_loader_extension = {
|
||||
.base = {__DRI_SWRAST_LOADER, 2},
|
||||
|
||||
.getDrawableInfo = dri2_wl_kopper_get_drawable_info,
|
||||
.putImage = dri2_wl_swrast_put_image,
|
||||
.getImage = dri2_wl_swrast_get_image,
|
||||
.putImage2 = dri2_wl_swrast_put_image2,
|
||||
};
|
||||
|
||||
static_assert(sizeof(struct kopper_vk_surface_create_storage) >=
|
||||
sizeof(VkWaylandSurfaceCreateInfoKHR),
|
||||
"");
|
||||
@@ -2724,6 +2765,11 @@ static const __DRIkopperLoaderExtension kopper_loader_extension = {
|
||||
static const __DRIextension *swrast_loader_extensions[] = {
|
||||
&swrast_loader_extension.base,
|
||||
&image_lookup_extension.base,
|
||||
NULL,
|
||||
};
|
||||
static const __DRIextension *kopper_swrast_loader_extensions[] = {
|
||||
&kopper_swrast_loader_extension.base,
|
||||
&image_lookup_extension.base,
|
||||
&kopper_loader_extension.base,
|
||||
NULL,
|
||||
};
|
||||
@@ -2781,7 +2827,7 @@ dri2_initialize_wayland_swrast(_EGLDisplay *disp)
|
||||
if (!dri2_load_driver_swrast(disp))
|
||||
goto cleanup;
|
||||
|
||||
dri2_dpy->loader_extensions = swrast_loader_extensions;
|
||||
dri2_dpy->loader_extensions = disp->Options.Zink ? kopper_swrast_loader_extensions : swrast_loader_extensions;
|
||||
|
||||
if (!dri2_create_screen(disp))
|
||||
goto cleanup;
|
||||
|
||||
Reference in New Issue
Block a user