egl,glx,kopper: Switch back to DRIkopperLoaderExtension::GetDrawableInfo
This decouples Kopper and swrast. With this change, dri/kopper.c no longer references DRIswrastLoaderEsxtension at all. Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36014>
This commit is contained in:
committed by
Marge Bot
parent
1f263aaef9
commit
4e88f02ab4
@@ -2718,14 +2718,12 @@ dri2_wl_swrast_commit_backbuffer(struct dri2_egl_surface *dri2_surf)
|
||||
}
|
||||
|
||||
static void
|
||||
dri2_wl_kopper_get_drawable_info(struct dri_drawable *draw, int *x, int *y, int *w,
|
||||
dri2_wl_kopper_get_drawable_info(struct dri_drawable *draw, 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;
|
||||
}
|
||||
@@ -3058,15 +3056,6 @@ 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),
|
||||
"");
|
||||
@@ -3126,16 +3115,16 @@ static const __DRIkopperLoaderExtension kopper_loader_extension = {
|
||||
.base = {__DRI_KOPPER_LOADER, 1},
|
||||
|
||||
.SetSurfaceCreateInfo = kopperSetSurfaceCreateInfo,
|
||||
.GetDrawableInfo = dri2_wl_kopper_get_drawable_info,
|
||||
};
|
||||
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,
|
||||
static const __DRIextension *kopper_loader_extensions[] = {
|
||||
&kopper_loader_extension.base,
|
||||
&image_lookup_extension.base,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -3216,7 +3205,7 @@ dri2_initialize_wayland_swrast(_EGLDisplay *disp)
|
||||
dri2_dpy->driver_name = strdup(disp->Options.Zink ? "zink" : "swrast");
|
||||
dri2_detect_swrast(disp);
|
||||
|
||||
dri2_dpy->loader_extensions = disp->Options.Zink ? kopper_swrast_loader_extensions : swrast_loader_extensions;
|
||||
dri2_dpy->loader_extensions = disp->Options.Zink ? kopper_loader_extensions : swrast_loader_extensions;
|
||||
|
||||
if (!dri2_create_screen(disp))
|
||||
goto cleanup;
|
||||
|
||||
@@ -1056,10 +1056,20 @@ kopperSetSurfaceCreateInfo(void *_draw, struct kopper_loader_info *ci)
|
||||
ci->present_opaque = dri2_surf->base.PresentOpaque;
|
||||
}
|
||||
|
||||
static void
|
||||
kopperGetDrawableInfo(struct dri_drawable *draw, int *w, int *h,
|
||||
void *loaderPrivate)
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
*w = *h = 0;
|
||||
x11_get_drawable_info(draw, &x, &y, w, h, loaderPrivate);
|
||||
}
|
||||
|
||||
static const __DRIkopperLoaderExtension kopper_loader_extension = {
|
||||
.base = {__DRI_KOPPER_LOADER, 1},
|
||||
|
||||
.SetSurfaceCreateInfo = kopperSetSurfaceCreateInfo,
|
||||
.GetDrawableInfo = kopperGetDrawableInfo,
|
||||
};
|
||||
|
||||
static const __DRIextension *kopper_loader_extensions[] = {
|
||||
|
||||
@@ -347,13 +347,12 @@ XXX do this once swapinterval is hooked up
|
||||
}
|
||||
|
||||
static inline void
|
||||
get_drawable_info(struct dri_drawable *drawable, int *x, int *y, int *w, int *h)
|
||||
get_drawable_info(struct dri_drawable *drawable, int *w, int *h)
|
||||
{
|
||||
const __DRIswrastLoaderExtension *loader = drawable->screen->swrast_loader;
|
||||
const __DRIkopperLoaderExtension *loader = drawable->screen->kopper_loader;
|
||||
|
||||
if (loader)
|
||||
loader->getDrawableInfo(drawable, x, y, w, h,
|
||||
drawable->loaderPrivate);
|
||||
loader->GetDrawableInfo(drawable, w, h, drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -361,7 +360,6 @@ kopper_update_drawable_info(struct dri_drawable *drawable)
|
||||
{
|
||||
struct dri_screen *screen = drawable->screen;
|
||||
bool is_window = drawable->info.bos.sType != 0;
|
||||
int x, y;
|
||||
struct pipe_resource *ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT] ?
|
||||
drawable->textures[ST_ATTACHMENT_BACK_LEFT] :
|
||||
drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
|
||||
@@ -370,7 +368,7 @@ kopper_update_drawable_info(struct dri_drawable *drawable)
|
||||
if (drawable->info.bos.sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR && do_kopper_update)
|
||||
zink_kopper_update(kopper_get_zink_screen(screen->base.screen), ptex, &drawable->w, &drawable->h);
|
||||
else
|
||||
get_drawable_info(drawable, &x, &y, &drawable->w, &drawable->h);
|
||||
get_drawable_info(drawable, &drawable->w, &drawable->h);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
||||
@@ -194,6 +194,18 @@ swrast_get_image(struct dri_drawable *driDrawable,
|
||||
data, surf->dri_private);
|
||||
}
|
||||
|
||||
static void
|
||||
kopper_get_drawable_info(struct dri_drawable *driDrawable,
|
||||
int *width,
|
||||
int *height,
|
||||
void *loaderPrivate)
|
||||
{
|
||||
struct gbm_dri_surface *surf = loaderPrivate;
|
||||
|
||||
*width = surf->base.v0.width;
|
||||
*height = surf->base.v0.height;
|
||||
}
|
||||
|
||||
static const __DRIimageLookupExtension image_lookup_extension = {
|
||||
.base = { __DRI_IMAGE_LOOKUP, 2 },
|
||||
|
||||
@@ -222,6 +234,7 @@ static const __DRIkopperLoaderExtension kopper_loader_extension = {
|
||||
.base = { __DRI_KOPPER_LOADER, 1 },
|
||||
|
||||
.SetSurfaceCreateInfo = NULL,
|
||||
.GetDrawableInfo = kopper_get_drawable_info,
|
||||
};
|
||||
|
||||
static const __DRIextension *gbm_dri_screen_extensions[] = {
|
||||
|
||||
+19
-1
@@ -144,7 +144,7 @@ XDestroyDrawable(struct drisw_drawable * pdp, Display * dpy, XID drawable)
|
||||
*/
|
||||
|
||||
static void
|
||||
swrastGetDrawableInfo(struct dri_drawable * draw,
|
||||
get_drawable_geometry(struct dri_drawable * draw,
|
||||
int *x, int *y, int *w, int *h,
|
||||
void *loaderPrivate)
|
||||
{
|
||||
@@ -163,6 +163,14 @@ swrastGetDrawableInfo(struct dri_drawable * draw,
|
||||
*h = uh;
|
||||
}
|
||||
|
||||
static void
|
||||
swrastGetDrawableInfo(struct dri_drawable * draw,
|
||||
int *x, int *y, int *w, int *h,
|
||||
void *loaderPrivate)
|
||||
{
|
||||
get_drawable_geometry(draw, x, y, w, h, loaderPrivate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Align renderbuffer pitch.
|
||||
*
|
||||
@@ -391,10 +399,20 @@ kopperSetSurfaceCreateInfo(void *_draw, struct kopper_loader_info *out)
|
||||
xcb->window = draw->xDrawable;
|
||||
}
|
||||
|
||||
static void
|
||||
kopperGetDrawableInfo(struct dri_drawable * draw,
|
||||
int *w, int *h,
|
||||
void *loaderPrivate)
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
get_drawable_geometry(draw, &x, &y, w, h, loaderPrivate);
|
||||
}
|
||||
|
||||
static const __DRIkopperLoaderExtension kopperLoaderExtension = {
|
||||
.base = { __DRI_KOPPER_LOADER, 1 },
|
||||
|
||||
.SetSurfaceCreateInfo = kopperSetSurfaceCreateInfo,
|
||||
.GetDrawableInfo = kopperGetDrawableInfo,
|
||||
};
|
||||
|
||||
static const __DRIextension *loader_extensions_shm[] = {
|
||||
|
||||
Reference in New Issue
Block a user