gallium: Add optional pipe_context to flush_frontbuffer

It's hooked up in all the pipe wrapper drivers, and all the
frontends except a couple places in glx/xlib.

This enables a more efficient path for drivers which use
swrast's Present, but hardware rendering (e.g. d3d12, zink).

Reviewed-by: Dave Airlie <airlied@redhat.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8045>
This commit is contained in:
Jesse Natalie 2020-12-10 10:50:54 -08:00 committed by Marge Bot
parent 23488c3515
commit 9ac8f8f490
39 changed files with 78 additions and 35 deletions

View File

@ -167,14 +167,16 @@ dd_screen_can_create_resource(struct pipe_screen *_screen,
static void static void
dd_screen_flush_frontbuffer(struct pipe_screen *_screen, dd_screen_flush_frontbuffer(struct pipe_screen *_screen,
struct pipe_context *_pipe,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *context_private, void *context_private,
struct pipe_box *sub_box) struct pipe_box *sub_box)
{ {
struct pipe_screen *screen = dd_screen(_screen)->screen; struct pipe_screen *screen = dd_screen(_screen)->screen;
struct pipe_context *pipe = _pipe ? dd_context(_pipe)->pipe : NULL;
screen->flush_frontbuffer(screen, resource, level, layer, context_private, screen->flush_frontbuffer(screen, pipe, resource, level, layer, context_private,
sub_box); sub_box);
} }

View File

@ -399,6 +399,7 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen,
* pipe_screen * pipe_screen
*/ */
static void noop_flush_frontbuffer(struct pipe_screen *_screen, static void noop_flush_frontbuffer(struct pipe_screen *_screen,
struct pipe_context *ctx,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *context_private, struct pipe_box *box) void *context_private, struct pipe_box *box)

View File

@ -356,6 +356,7 @@ rbug_screen_resource_destroy(struct pipe_screen *screen,
static void static void
rbug_screen_flush_frontbuffer(struct pipe_screen *_screen, rbug_screen_flush_frontbuffer(struct pipe_screen *_screen,
struct pipe_context *_ctx,
struct pipe_resource *_resource, struct pipe_resource *_resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *context_private, struct pipe_box *sub_box) void *context_private, struct pipe_box *sub_box)
@ -364,8 +365,10 @@ rbug_screen_flush_frontbuffer(struct pipe_screen *_screen,
struct rbug_resource *rb_resource = rbug_resource(_resource); struct rbug_resource *rb_resource = rbug_resource(_resource);
struct pipe_screen *screen = rb_screen->screen; struct pipe_screen *screen = rb_screen->screen;
struct pipe_resource *resource = rb_resource->resource; struct pipe_resource *resource = rb_resource->resource;
struct pipe_context *ctx = _ctx ? rbug_context(_ctx)->pipe : NULL;
screen->flush_frontbuffer(screen, screen->flush_frontbuffer(screen,
ctx,
resource, resource,
level, layer, level, layer,
context_private, sub_box); context_private, sub_box);

View File

@ -279,6 +279,7 @@ trace_screen_context_create(struct pipe_screen *_screen, void *priv,
static void static void
trace_screen_flush_frontbuffer(struct pipe_screen *_screen, trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
struct pipe_context *_pipe,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *context_private, void *context_private,
@ -286,6 +287,7 @@ trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
{ {
struct trace_screen *tr_scr = trace_screen(_screen); struct trace_screen *tr_scr = trace_screen(_screen);
struct pipe_screen *screen = tr_scr->screen; struct pipe_screen *screen = tr_scr->screen;
struct pipe_context *pipe = _pipe ? trace_context(_pipe)->pipe : NULL;
trace_dump_call_begin("pipe_screen", "flush_frontbuffer"); trace_dump_call_begin("pipe_screen", "flush_frontbuffer");
@ -297,7 +299,7 @@ trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
trace_dump_arg(ptr, context_private); trace_dump_arg(ptr, context_private);
*/ */
screen->flush_frontbuffer(screen, resource, level, layer, context_private, sub_box); screen->flush_frontbuffer(screen, pipe, resource, level, layer, context_private, sub_box);
trace_dump_call_end(); trace_dump_call_end();
} }

View File

@ -120,6 +120,7 @@ vl_dri2_get_flush_reply(struct vl_dri_screen *scrn)
static void static void
vl_dri2_flush_frontbuffer(struct pipe_screen *screen, vl_dri2_flush_frontbuffer(struct pipe_screen *screen,
struct pipe_context *pipe,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *context_private, struct pipe_box *sub_box) void *context_private, struct pipe_box *sub_box)

View File

@ -555,6 +555,7 @@ dri3_get_screen_for_root(xcb_connection_t *conn, xcb_window_t root)
static void static void
vl_dri3_flush_frontbuffer(struct pipe_screen *screen, vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
struct pipe_context *pipe,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *context_private, struct pipe_box *sub_box) void *context_private, struct pipe_box *sub_box)

View File

@ -627,6 +627,7 @@ d3d12_destroy_screen(struct pipe_screen *pscreen)
static void static void
d3d12_flush_frontbuffer(struct pipe_screen * pscreen, d3d12_flush_frontbuffer(struct pipe_screen * pscreen,
struct pipe_context *pctx,
struct pipe_resource *pres, struct pipe_resource *pres,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *winsys_drawable_handle, void *winsys_drawable_handle,

View File

@ -449,6 +449,7 @@ i915_fence_finish(struct pipe_screen *screen,
static void static void
i915_flush_frontbuffer(struct pipe_screen *screen, i915_flush_frontbuffer(struct pipe_screen *screen,
struct pipe_context *pipe,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *winsys_drawable_handle, void *winsys_drawable_handle,
@ -456,6 +457,7 @@ i915_flush_frontbuffer(struct pipe_screen *screen,
{ {
/* XXX: Dummy right now. */ /* XXX: Dummy right now. */
(void)screen; (void)screen;
(void)pipe;
(void)resource; (void)resource;
(void)level; (void)level;
(void)layer; (void)layer;

View File

@ -82,6 +82,7 @@
static void static void
iris_flush_frontbuffer(struct pipe_screen *_screen, iris_flush_frontbuffer(struct pipe_screen *_screen,
struct pipe_context *_pipe,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *context_private, struct pipe_box *box) void *context_private, struct pipe_box *box)

View File

@ -714,6 +714,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
static void static void
llvmpipe_flush_frontbuffer(struct pipe_screen *_screen, llvmpipe_flush_frontbuffer(struct pipe_screen *_screen,
struct pipe_context *_pipe,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *context_private, void *context_private,

View File

@ -481,6 +481,7 @@ softpipe_destroy_screen( struct pipe_screen *screen )
*/ */
static void static void
softpipe_flush_frontbuffer(struct pipe_screen *_screen, softpipe_flush_frontbuffer(struct pipe_screen *_screen,
struct pipe_context *pipe,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *context_private, void *context_private,

View File

@ -145,10 +145,12 @@ swr_create_screen(struct sw_winsys *winsys)
void void
swr_gdi_swap(struct pipe_screen *screen, swr_gdi_swap(struct pipe_screen *screen,
struct pipe_context *ctx,
struct pipe_resource *res, struct pipe_resource *res,
void *hDC) void *hDC)
{ {
screen->flush_frontbuffer(screen, screen->flush_frontbuffer(screen,
ctx,
res, res,
0, 0, 0, 0,
hDC, hDC,

View File

@ -25,6 +25,7 @@
#define SWR_PUBLIC_H #define SWR_PUBLIC_H
struct pipe_screen; struct pipe_screen;
struct pipe_context;
struct sw_displaytarget; struct sw_displaytarget;
struct sw_winsys; struct sw_winsys;
struct swr_screen; struct swr_screen;
@ -44,6 +45,7 @@ void swr_destroy_screen_internal(struct swr_screen **screen);
#ifdef _WIN32 #ifdef _WIN32
void swr_gdi_swap(struct pipe_screen *screen, void swr_gdi_swap(struct pipe_screen *screen,
struct pipe_conext *ctx,
struct pipe_resource *res, struct pipe_resource *res,
void *hDC); void *hDC);
#endif /* _WIN32 */ #endif /* _WIN32 */

View File

@ -988,6 +988,7 @@ swr_resource_destroy(struct pipe_screen *p_screen, struct pipe_resource *pt)
static void static void
swr_flush_frontbuffer(struct pipe_screen *p_screen, swr_flush_frontbuffer(struct pipe_screen *p_screen,
struct pipe_context *pipe,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned level,
unsigned layer, unsigned layer,
@ -997,7 +998,6 @@ swr_flush_frontbuffer(struct pipe_screen *p_screen,
struct swr_screen *screen = swr_screen(p_screen); struct swr_screen *screen = swr_screen(p_screen);
struct sw_winsys *winsys = screen->winsys; struct sw_winsys *winsys = screen->winsys;
struct swr_resource *spr = swr_resource(resource); struct swr_resource *spr = swr_resource(resource);
struct pipe_context *pipe = screen->pipe;
struct swr_context *ctx = swr_context(pipe); struct swr_context *ctx = swr_context(pipe);
if (pipe) { if (pipe) {

View File

@ -358,6 +358,7 @@ tegra_screen_resource_destroy(struct pipe_screen *pscreen,
static void static void
tegra_screen_flush_frontbuffer(struct pipe_screen *pscreen, tegra_screen_flush_frontbuffer(struct pipe_screen *pscreen,
struct pipe_context *pcontext,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned int level, unsigned int level,
unsigned int layer, unsigned int layer,
@ -365,8 +366,11 @@ tegra_screen_flush_frontbuffer(struct pipe_screen *pscreen,
struct pipe_box *box) struct pipe_box *box)
{ {
struct tegra_screen *screen = to_tegra_screen(pscreen); struct tegra_screen *screen = to_tegra_screen(pscreen);
struct tegra_context *context = to_tegra_context(pcontext);
screen->gpu->flush_frontbuffer(screen->gpu, resource, level, layer, screen->gpu->flush_frontbuffer(screen->gpu,
context ? context->gpu : NULL,
resource, level, layer,
winsys_drawable_handle, box); winsys_drawable_handle, box);
} }

View File

@ -745,6 +745,7 @@ virgl_is_format_supported( struct pipe_screen *screen,
} }
static void virgl_flush_frontbuffer(struct pipe_screen *screen, static void virgl_flush_frontbuffer(struct pipe_screen *screen,
struct pipe_context *ctx,
struct pipe_resource *res, struct pipe_resource *res,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *winsys_drawable_handle, struct pipe_box *sub_box) void *winsys_drawable_handle, struct pipe_box *sub_box)

View File

@ -692,6 +692,7 @@ update_queue_props(struct zink_screen *screen)
static void static void
zink_flush_frontbuffer(struct pipe_screen *pscreen, zink_flush_frontbuffer(struct pipe_screen *pscreen,
struct pipe_context *pcontext,
struct pipe_resource *pres, struct pipe_resource *pres,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *winsys_drawable_handle, void *winsys_drawable_handle,

View File

@ -198,7 +198,7 @@ drisw_put_image_shm(struct dri_drawable *drawable,
} }
static inline void static inline void
drisw_present_texture(__DRIdrawable *dPriv, drisw_present_texture(struct pipe_context *pipe, __DRIdrawable *dPriv,
struct pipe_resource *ptex, struct pipe_box *sub_box) struct pipe_resource *ptex, struct pipe_box *sub_box)
{ {
struct dri_drawable *drawable = dri_drawable(dPriv); struct dri_drawable *drawable = dri_drawable(dPriv);
@ -207,7 +207,7 @@ drisw_present_texture(__DRIdrawable *dPriv,
if (screen->swrast_no_present) if (screen->swrast_no_present)
return; return;
screen->base.screen->flush_frontbuffer(screen->base.screen, ptex, 0, 0, drawable, sub_box); screen->base.screen->flush_frontbuffer(screen->base.screen, pipe, ptex, 0, 0, drawable, sub_box);
} }
static inline void static inline void
@ -221,10 +221,11 @@ drisw_invalidate_drawable(__DRIdrawable *dPriv)
} }
static inline void static inline void
drisw_copy_to_front(__DRIdrawable * dPriv, drisw_copy_to_front(struct pipe_context *pipe,
__DRIdrawable * dPriv,
struct pipe_resource *ptex) struct pipe_resource *ptex)
{ {
drisw_present_texture(dPriv, ptex, NULL); drisw_present_texture(pipe, dPriv, ptex, NULL);
drisw_invalidate_drawable(dPriv); drisw_invalidate_drawable(dPriv);
} }
@ -261,7 +262,7 @@ drisw_swap_buffers(__DRIdrawable *dPriv)
drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]); drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]);
} }
drisw_copy_to_front(dPriv, ptex); drisw_copy_to_front(ctx->st->pipe, dPriv, ptex);
} }
} }
@ -285,7 +286,7 @@ drisw_copy_sub_buffer(__DRIdrawable *dPriv, int x, int y,
ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL, NULL, NULL); ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL, NULL, NULL);
u_box_2d(x, dPriv->h - y - h, w, h, &box); u_box_2d(x, dPriv->h - y - h, w, h, &box);
drisw_present_texture(dPriv, ptex, &box); drisw_present_texture(ctx->st->pipe, dPriv, ptex, &box);
} }
} }
@ -308,7 +309,7 @@ drisw_flush_frontbuffer(struct dri_context *ctx,
ptex = drawable->textures[statt]; ptex = drawable->textures[statt];
if (ptex) { if (ptex) {
drisw_copy_to_front(ctx->dPriv, ptex); drisw_copy_to_front(ctx->st->pipe, ctx->dPriv, ptex);
} }
} }

View File

@ -59,11 +59,13 @@ xmesa_st_framebuffer(struct st_framebuffer_iface *stfbi)
*/ */
static bool static bool
xmesa_st_framebuffer_display(struct st_framebuffer_iface *stfbi, xmesa_st_framebuffer_display(struct st_framebuffer_iface *stfbi,
struct st_context_iface *stctx,
enum st_attachment_type statt) enum st_attachment_type statt)
{ {
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi); struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
struct pipe_resource *ptex = xstfb->textures[statt]; struct pipe_resource *ptex = xstfb->textures[statt];
struct pipe_resource *pres; struct pipe_resource *pres;
struct pipe_context *pctx = stctx ? stctx->pipe : NULL;
if (!ptex) if (!ptex)
return true; return true;
@ -75,7 +77,7 @@ xmesa_st_framebuffer_display(struct st_framebuffer_iface *stfbi,
pres = xstfb->display_resource; pres = xstfb->display_resource;
} }
xstfb->screen->flush_frontbuffer(xstfb->screen, pres, 0, 0, &xstfb->buffer->ws, NULL); xstfb->screen->flush_frontbuffer(xstfb->screen, pctx, pres, 0, 0, &xstfb->buffer->ws, NULL);
return true; return true;
} }
@ -265,7 +267,7 @@ xmesa_st_framebuffer_flush_front(struct st_context_iface *stctx,
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi); struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
bool ret; bool ret;
ret = xmesa_st_framebuffer_display(stfbi, statt); ret = xmesa_st_framebuffer_display(stfbi, stctx, statt);
if (ret && xmesa_strict_invalidate) if (ret && xmesa_strict_invalidate)
xmesa_check_buffer_size(xstfb->buffer); xmesa_check_buffer_size(xstfb->buffer);
@ -347,7 +349,7 @@ xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi)
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi); struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
bool ret; bool ret;
ret = xmesa_st_framebuffer_display(stfbi, ST_ATTACHMENT_BACK_LEFT); ret = xmesa_st_framebuffer_display(stfbi, NULL, ST_ATTACHMENT_BACK_LEFT);
if (ret) { if (ret) {
struct pipe_resource **front, **back, *tmp; struct pipe_resource **front, **back, *tmp;
@ -378,7 +380,7 @@ xmesa_copy_st_framebuffer(struct st_framebuffer_iface *stfbi,
{ {
xmesa_st_framebuffer_copy_textures(stfbi, src, dst, x, y, w, h); xmesa_st_framebuffer_copy_textures(stfbi, src, dst, x, y, w, h);
if (dst == ST_ATTACHMENT_FRONT_LEFT) if (dst == ST_ATTACHMENT_FRONT_LEFT)
xmesa_st_framebuffer_display(stfbi, dst); xmesa_st_framebuffer_display(stfbi, NULL, dst);
} }

View File

@ -381,7 +381,7 @@ vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface_id, void* draw, short s
*/ */
drv->pipe->flush(drv->pipe, NULL, 0); drv->pipe->flush(drv->pipe, NULL, 0);
screen->flush_frontbuffer(screen, tex, 0, 0, screen->flush_frontbuffer(screen, drv->pipe, tex, 0, 0,
vscreen->get_private(vscreen), NULL); vscreen->get_private(vscreen), NULL);

View File

@ -268,7 +268,7 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
// to back buffer so the texture can be copied in flush_frontbuffer // to back buffer so the texture can be copied in flush_frontbuffer
pipe->screen->fence_reference(pipe->screen, &surf->fence, NULL); pipe->screen->fence_reference(pipe->screen, &surf->fence, NULL);
pipe->flush(pipe, &surf->fence, 0); pipe->flush(pipe, &surf->fence, 0);
pipe->screen->flush_frontbuffer(pipe->screen, tex, 0, 0, pipe->screen->flush_frontbuffer(pipe->screen, pipe, tex, 0, 0,
vscreen->get_private(vscreen), NULL); vscreen->get_private(vscreen), NULL);
pq->last_surf = surf; pq->last_surf = surf;

View File

@ -497,7 +497,9 @@ BOOL APIENTRY
DrvPresentBuffers(HDC hdc, LPPRESENTBUFFERS data) DrvPresentBuffers(HDC hdc, LPPRESENTBUFFERS data)
{ {
struct stw_framebuffer *fb; struct stw_framebuffer *fb;
struct stw_context *ctx;
struct pipe_screen *screen; struct pipe_screen *screen;
struct pipe_context *pipe;
struct pipe_resource *res; struct pipe_resource *res;
if (!stw_dev) if (!stw_dev)
@ -508,6 +510,8 @@ DrvPresentBuffers(HDC hdc, LPPRESENTBUFFERS data)
return FALSE; return FALSE;
screen = stw_dev->screen; screen = stw_dev->screen;
ctx = stw_current_context();
pipe = ctx ? ctx->st->pipe : NULL;
res = (struct pipe_resource *)data->pPrivData; res = (struct pipe_resource *)data->pPrivData;
@ -536,7 +540,7 @@ DrvPresentBuffers(HDC hdc, LPPRESENTBUFFERS data)
data->ullPresentToken); data->ullPresentToken);
} }
else { else {
stw_dev->stw_winsys->present( screen, res, hdc ); stw_dev->stw_winsys->present( screen, pipe, res, hdc );
} }
} }
@ -587,8 +591,10 @@ stw_framebuffer_present_locked(HDC hdc,
} }
else { else {
struct pipe_screen *screen = stw_dev->screen; struct pipe_screen *screen = stw_dev->screen;
struct stw_context *ctx = stw_current_context();
struct pipe_context *pipe = ctx ? ctx->st->pipe : NULL;
stw_dev->stw_winsys->present( screen, res, hdc ); stw_dev->stw_winsys->present( screen, pipe, res, hdc );
stw_framebuffer_update(fb); stw_framebuffer_update(fb);
stw_notify_current_locked(fb); stw_notify_current_locked(fb);

View File

@ -74,6 +74,7 @@ struct stw_winsys
*/ */
void void
(*present)( struct pipe_screen *screen, (*present)( struct pipe_screen *screen,
struct pipe_context *context,
struct pipe_resource *res, struct pipe_resource *res,
HDC hDC ); HDC hDC );

View File

@ -447,7 +447,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display. Pushing to front buffer.\n", surface); XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display. Pushing to front buffer.\n", surface);
pipe->screen->flush_frontbuffer(pipe->screen, tex, 0, 0, pipe->screen->flush_frontbuffer(pipe->screen, pipe, tex, 0, 0,
vscreen->get_private(vscreen), NULL); vscreen->get_private(vscreen), NULL);
if(dump_window == -1) { if(dump_window == -1) {

View File

@ -318,6 +318,7 @@ struct pipe_screen {
* \param subbox an optional sub region to flush * \param subbox an optional sub region to flush
*/ */
void (*flush_frontbuffer)( struct pipe_screen *screen, void (*flush_frontbuffer)( struct pipe_screen *screen,
struct pipe_context *ctx,
struct pipe_resource *resource, struct pipe_resource *resource,
unsigned level, unsigned layer, unsigned level, unsigned layer,
void *winsys_drawable_handle, void *winsys_drawable_handle,

View File

@ -342,7 +342,7 @@ GalliumContext::SwapBuffers(context_id contextID)
return B_ERROR; return B_ERROR;
} }
fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 0, fScreen->flush_frontbuffer(fScreen, context->st->pipe, surface->texture, 0, 0,
context->bitmap, NULL); context->bitmap, NULL);
return B_OK; return B_OK;

View File

@ -64,10 +64,11 @@ no_winsys:
static void static void
gdi_present(struct pipe_screen *screen, gdi_present(struct pipe_screen *screen,
struct pipe_context *context,
struct pipe_resource *res, struct pipe_resource *res,
HDC hDC) HDC hDC)
{ {
d3d12_wgl_present(screen, res, hDC); d3d12_wgl_present(screen, context, res, hDC);
} }

View File

@ -40,6 +40,7 @@
#include "stw_winsys.h" #include "stw_winsys.h"
#include "stw_device.h" #include "stw_device.h"
#include "gdi/gdi_sw_winsys.h" #include "gdi/gdi_sw_winsys.h"
#include "pipe/p_context.h"
#ifdef GALLIUM_SOFTPIPE #ifdef GALLIUM_SOFTPIPE
#include "softpipe/sp_texture.h" #include "softpipe/sp_texture.h"
@ -151,6 +152,7 @@ no_winsys:
static void static void
gdi_present(struct pipe_screen *screen, gdi_present(struct pipe_screen *screen,
struct pipe_context *ctx,
struct pipe_resource *res, struct pipe_resource *res,
HDC hDC) HDC hDC)
{ {
@ -178,21 +180,21 @@ gdi_present(struct pipe_screen *screen,
#ifdef GALLIUM_SWR #ifdef GALLIUM_SWR
if (use_swr) { if (use_swr) {
swr_gdi_swap(screen, res, hDC); swr_gdi_swap(screen, ctx, res, hDC);
return; return;
} }
#endif #endif
#ifdef GALLIUM_D3D12 #ifdef GALLIUM_D3D12
if (use_d3d12) { if (use_d3d12) {
d3d12_wgl_present(screen, res, hDC); d3d12_wgl_present(screen, ctx, res, hDC);
return; return;
} }
#endif #endif
#ifdef GALLIUM_ZINK #ifdef GALLIUM_ZINK
if (use_zink) { if (use_zink) {
screen->flush_frontbuffer(screen, res, 0, 0, hDC, NULL); screen->flush_frontbuffer(screen, ctx, res, 0, 0, hDC, NULL);
return; return;
} }
#endif #endif

View File

@ -33,7 +33,7 @@ static void draw( void )
graw_save_surface_to_file(ctx, surf, NULL); graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, tex, 0, 0, window, NULL); screen->flush_frontbuffer(screen, ctx, tex, 0, 0, window, NULL);
} }
static void init( void ) static void init( void )

View File

@ -238,7 +238,7 @@ static void draw( void )
graw_save_surface_to_file(ctx, surf, NULL); graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, rttex, 0, 0, window, NULL); screen->flush_frontbuffer(screen, ctx, rttex, 0, 0, window, NULL);
} }
#define SIZE 16 #define SIZE 16

View File

@ -208,7 +208,7 @@ graw_util_viewport(struct graw_info *info,
static inline void static inline void
graw_util_flush_front(const struct graw_info *info) graw_util_flush_front(const struct graw_info *info)
{ {
info->screen->flush_frontbuffer(info->screen, info->color_buf[0], info->screen->flush_frontbuffer(info->screen, info->ctx, info->color_buf[0],
0, 0, info->window, NULL); 0, 0, info->window, NULL);
} }

View File

@ -328,7 +328,7 @@ static void draw( void )
graw_save_surface_to_file(ctx, surf, NULL); graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, rttex, 0, 0, window, NULL); screen->flush_frontbuffer(screen, ctx, rttex, 0, 0, window, NULL);
} }
#define SIZE 16 #define SIZE 16

View File

@ -154,7 +154,7 @@ static void draw( void )
graw_save_surface_to_file(ctx, surf, NULL); graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, rttex, 0, 0, window, NULL); screen->flush_frontbuffer(screen, ctx, rttex, 0, 0, window, NULL);
} }
#define SIZE 16 #define SIZE 16

View File

@ -156,7 +156,7 @@ static void draw( void )
ctx->delete_fs_state(ctx, fs); ctx->delete_fs_state(ctx, fs);
} }
screen->flush_frontbuffer(screen, tex, 0, 0, window, NULL); screen->flush_frontbuffer(screen, ctx, tex, 0, 0, window, NULL);
ctx->destroy(ctx); ctx->destroy(ctx);
exit(0); exit(0);

View File

@ -166,7 +166,7 @@ static void draw( void )
util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3); util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
ctx->flush(ctx, NULL, 0); ctx->flush(ctx, NULL, 0);
screen->flush_frontbuffer(screen, tex, 0, 0, window, NULL); screen->flush_frontbuffer(screen, ctx, tex, 0, 0, window, NULL);
} }

View File

@ -218,7 +218,7 @@ static void draw( void )
graw_save_surface_to_file(ctx, surf, NULL); graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, tex, 0, 0, window, NULL); screen->flush_frontbuffer(screen, ctx, tex, 0, 0, window, NULL);
} }

View File

@ -226,7 +226,7 @@ static void draw( void )
graw_save_surface_to_file(ctx, surf, NULL); graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, rttex, 0, 0, window, NULL); screen->flush_frontbuffer(screen, ctx, rttex, 0, 0, window, NULL);
} }
#define SIZE 16 #define SIZE 16

View File

@ -32,6 +32,7 @@ extern "C" {
struct pipe_resource; struct pipe_resource;
struct pipe_screen; struct pipe_screen;
struct pipe_context;
struct stw_winsys; struct stw_winsys;
struct pipe_screen * struct pipe_screen *
@ -40,6 +41,7 @@ d3d12_wgl_create_screen(struct sw_winsys *winsys,
void void
d3d12_wgl_present(struct pipe_screen *screen, d3d12_wgl_present(struct pipe_screen *screen,
struct pipe_context *context,
struct pipe_resource *res, struct pipe_resource *res,
HDC hDC); HDC hDC);

View File

@ -43,10 +43,11 @@ d3d12_wgl_create_screen(struct sw_winsys *winsys, HDC hDC)
void void
d3d12_wgl_present(struct pipe_screen *screen, d3d12_wgl_present(struct pipe_screen *screen,
struct pipe_context *ctx,
struct pipe_resource *res, struct pipe_resource *res,
HDC hDC) HDC hDC)
{ {
screen->flush_frontbuffer(screen, res, 0, 0, hDC, NULL); screen->flush_frontbuffer(screen, ctx, res, 0, 0, hDC, NULL);
} }
unsigned unsigned