mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 04:10:10 +01:00
gallium: add a nboxes param to flush_frontbuffer
this allows conveying damage regions through the sw presentation interface Acked-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27703>
This commit is contained in:
parent
74f6392545
commit
3cca761934
22 changed files with 35 additions and 24 deletions
|
|
@ -220,7 +220,7 @@ haiku_swap_buffers(_EGLDisplay *disp, _EGLSurface *surf)
|
|||
// flush back buffer and swap buffers if double buffering is used
|
||||
if (backBuffer != NULL) {
|
||||
screen->flush_frontbuffer(screen, st->pipe, backBuffer, 0, 0,
|
||||
buffer->winsysContext, NULL);
|
||||
buffer->winsysContext, 1, NULL);
|
||||
std::swap(frontBuffer, backBuffer);
|
||||
p_atomic_inc(&buffer->base.stamp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,13 +171,14 @@ dd_screen_flush_frontbuffer(struct pipe_screen *_screen,
|
|||
struct pipe_resource *resource,
|
||||
unsigned level, unsigned layer,
|
||||
void *context_private,
|
||||
unsigned nboxes,
|
||||
struct pipe_box *sub_box)
|
||||
{
|
||||
struct pipe_screen *screen = dd_screen(_screen)->screen;
|
||||
struct pipe_context *pipe = _pipe ? dd_context(_pipe)->pipe : NULL;
|
||||
|
||||
screen->flush_frontbuffer(screen, pipe, resource, level, layer, context_private,
|
||||
sub_box);
|
||||
nboxes, sub_box);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ static void noop_flush_frontbuffer(struct pipe_screen *_screen,
|
|||
struct pipe_context *ctx,
|
||||
struct pipe_resource *resource,
|
||||
unsigned level, unsigned layer,
|
||||
void *context_private, struct pipe_box *box)
|
||||
void *context_private, unsigned nboxes, struct pipe_box *box)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -483,6 +483,7 @@ trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
|
|||
struct pipe_resource *resource,
|
||||
unsigned level, unsigned layer,
|
||||
void *context_private,
|
||||
unsigned nboxes,
|
||||
struct pipe_box *sub_box)
|
||||
{
|
||||
struct trace_screen *tr_scr = trace_screen(_screen);
|
||||
|
|
@ -501,7 +502,7 @@ trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
|
|||
|
||||
trace_dump_call_end();
|
||||
|
||||
screen->flush_frontbuffer(screen, pipe, resource, level, layer, context_private, sub_box);
|
||||
screen->flush_frontbuffer(screen, pipe, resource, level, layer, context_private, nboxes, sub_box);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ vl_dri2_flush_frontbuffer(struct pipe_screen *screen,
|
|||
struct pipe_context *pipe,
|
||||
struct pipe_resource *resource,
|
||||
unsigned level, unsigned layer,
|
||||
void *context_private, struct pipe_box *sub_box)
|
||||
void *context_private, unsigned nboxes, struct pipe_box *sub_box)
|
||||
{
|
||||
struct vl_dri_screen *scrn = (struct vl_dri_screen *)context_private;
|
||||
uint32_t msc_hi, msc_lo;
|
||||
|
|
|
|||
|
|
@ -571,7 +571,7 @@ vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
|
|||
struct pipe_context *pipe,
|
||||
struct pipe_resource *resource,
|
||||
unsigned level, unsigned layer,
|
||||
void *context_private, struct pipe_box *sub_box)
|
||||
void *context_private, unsigned nboxes, struct pipe_box *sub_box)
|
||||
{
|
||||
struct vl_dri3_screen *scrn = (struct vl_dri3_screen *)context_private;
|
||||
uint32_t options = XCB_PRESENT_OPTION_NONE;
|
||||
|
|
|
|||
|
|
@ -790,6 +790,7 @@ d3d12_flush_frontbuffer(struct pipe_screen * pscreen,
|
|||
struct pipe_resource *pres,
|
||||
unsigned level, unsigned layer,
|
||||
void *winsys_drawable_handle,
|
||||
unsigned nboxes,
|
||||
struct pipe_box *sub_box)
|
||||
{
|
||||
struct d3d12_screen *screen = d3d12_screen(pscreen);
|
||||
|
|
|
|||
|
|
@ -852,6 +852,7 @@ llvmpipe_flush_frontbuffer(struct pipe_screen *_screen,
|
|||
struct pipe_resource *resource,
|
||||
unsigned level, unsigned layer,
|
||||
void *context_private,
|
||||
unsigned nboxes,
|
||||
struct pipe_box *sub_box)
|
||||
{
|
||||
struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
|
||||
|
|
|
|||
|
|
@ -495,6 +495,7 @@ softpipe_flush_frontbuffer(struct pipe_screen *_screen,
|
|||
struct pipe_resource *resource,
|
||||
unsigned level, unsigned layer,
|
||||
void *context_private,
|
||||
unsigned nboxes,
|
||||
struct pipe_box *sub_box)
|
||||
{
|
||||
struct softpipe_screen *screen = softpipe_screen(_screen);
|
||||
|
|
|
|||
|
|
@ -369,15 +369,17 @@ tegra_screen_flush_frontbuffer(struct pipe_screen *pscreen,
|
|||
unsigned int level,
|
||||
unsigned int layer,
|
||||
void *winsys_drawable_handle,
|
||||
unsigned nboxes,
|
||||
struct pipe_box *box)
|
||||
{
|
||||
struct tegra_screen *screen = to_tegra_screen(pscreen);
|
||||
struct tegra_context *context = to_tegra_context(pcontext);
|
||||
|
||||
/* TODO: maybe rejigger for damage regions */
|
||||
screen->gpu->flush_frontbuffer(screen->gpu,
|
||||
context ? context->gpu : NULL,
|
||||
resource, level, layer,
|
||||
winsys_drawable_handle, box);
|
||||
winsys_drawable_handle, nboxes, box);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -927,7 +927,7 @@ static void virgl_flush_frontbuffer(struct pipe_screen *screen,
|
|||
struct pipe_context *ctx,
|
||||
struct pipe_resource *res,
|
||||
unsigned level, unsigned layer,
|
||||
void *winsys_drawable_handle, struct pipe_box *sub_box)
|
||||
void *winsys_drawable_handle, unsigned nboxes, struct pipe_box *sub_box)
|
||||
{
|
||||
struct virgl_screen *vscreen = virgl_screen(screen);
|
||||
struct virgl_winsys *vws = vscreen->vws;
|
||||
|
|
@ -937,7 +937,7 @@ static void virgl_flush_frontbuffer(struct pipe_screen *screen,
|
|||
if (vws->flush_frontbuffer) {
|
||||
virgl_flush_eq(vctx, vctx, NULL);
|
||||
vws->flush_frontbuffer(vws, vctx->cbuf, vres->hw_res, level, layer, winsys_drawable_handle,
|
||||
sub_box);
|
||||
nboxes == 1 ? sub_box : NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1792,6 +1792,7 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen,
|
|||
struct pipe_resource *pres,
|
||||
unsigned level, unsigned layer,
|
||||
void *winsys_drawable_handle,
|
||||
unsigned nboxes,
|
||||
struct pipe_box *sub_box)
|
||||
{
|
||||
struct zink_screen *screen = zink_screen(pscreen);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ _Present(DXGI_DDI_ARG_PRESENT *pPresentData)
|
|||
Resource *pSrcResource = CastResource(pPresentData->hSurfaceToPresent);
|
||||
|
||||
device->pipe->screen->flush_frontbuffer(device->pipe->screen, device->pipe,
|
||||
pSrcResource->resource, 0, 0, pPresentData->pDXGIContext, NULL);
|
||||
pSrcResource->resource, 0, 0, pPresentData->pDXGIContext, 0, NULL);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ drisw_present_texture(struct pipe_context *pipe, struct dri_drawable *drawable,
|
|||
if (screen->swrast_no_present)
|
||||
return;
|
||||
|
||||
screen->base.screen->flush_frontbuffer(screen->base.screen, pipe, ptex, 0, 0, drawable, sub_box);
|
||||
screen->base.screen->flush_frontbuffer(screen->base.screen, pipe, ptex, 0, 0, drawable, !!sub_box, sub_box);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
|||
|
|
@ -603,11 +603,11 @@ kopper_update_drawable_info(struct dri_drawable *drawable)
|
|||
|
||||
static inline void
|
||||
kopper_present_texture(struct pipe_context *pipe, struct dri_drawable *drawable,
|
||||
struct pipe_resource *ptex, struct pipe_box *sub_box)
|
||||
struct pipe_resource *ptex, unsigned nboxes, struct pipe_box *sub_box)
|
||||
{
|
||||
struct dri_screen *screen = drawable->screen;
|
||||
|
||||
screen->base.screen->flush_frontbuffer(screen->base.screen, pipe, ptex, 0, 0, drawable, sub_box);
|
||||
screen->base.screen->flush_frontbuffer(screen->base.screen, pipe, ptex, 0, 0, drawable, nboxes, sub_box);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -615,7 +615,7 @@ kopper_copy_to_front(struct pipe_context *pipe,
|
|||
struct dri_drawable *drawable,
|
||||
struct pipe_resource *ptex)
|
||||
{
|
||||
kopper_present_texture(pipe, drawable, ptex, NULL);
|
||||
kopper_present_texture(pipe, drawable, ptex, 0, NULL);
|
||||
|
||||
kopper_invalidate_drawable(opaque_dri_drawable(drawable));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ static bool
|
|||
xmesa_st_framebuffer_display(struct pipe_frontend_drawable *drawable,
|
||||
struct st_context *st,
|
||||
enum st_attachment_type statt,
|
||||
unsigned nboxes,
|
||||
struct pipe_box *box)
|
||||
{
|
||||
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(drawable);
|
||||
|
|
@ -82,7 +83,7 @@ xmesa_st_framebuffer_display(struct pipe_frontend_drawable *drawable,
|
|||
pres = xstfb->display_resource;
|
||||
}
|
||||
|
||||
xstfb->screen->flush_frontbuffer(xstfb->screen, pctx, pres, 0, 0, &xstfb->buffer->ws, box);
|
||||
xstfb->screen->flush_frontbuffer(xstfb->screen, pctx, pres, 0, 0, &xstfb->buffer->ws, nboxes, box);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +283,7 @@ xmesa_st_framebuffer_flush_front(struct st_context *st,
|
|||
if (statt != ST_ATTACHMENT_FRONT_LEFT)
|
||||
return false;
|
||||
|
||||
ret = xmesa_st_framebuffer_display(drawable, st, statt, NULL);
|
||||
ret = xmesa_st_framebuffer_display(drawable, st, statt, 0, NULL);
|
||||
|
||||
if (ret && xmesa_strict_invalidate())
|
||||
xmesa_check_buffer_size(xstfb->buffer);
|
||||
|
|
@ -359,7 +360,7 @@ xmesa_swap_st_framebuffer(struct pipe_frontend_drawable *drawable)
|
|||
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(drawable);
|
||||
bool ret;
|
||||
|
||||
ret = xmesa_st_framebuffer_display(drawable, NULL, ST_ATTACHMENT_BACK_LEFT, NULL);
|
||||
ret = xmesa_st_framebuffer_display(drawable, NULL, ST_ATTACHMENT_BACK_LEFT, 0, NULL);
|
||||
if (ret) {
|
||||
struct pipe_resource **front, **back, *tmp;
|
||||
|
||||
|
|
@ -396,7 +397,7 @@ xmesa_copy_st_framebuffer(struct pipe_frontend_drawable *drawable,
|
|||
box.y = y;
|
||||
box.width = w;
|
||||
box.height = h;
|
||||
xmesa_st_framebuffer_display(drawable, NULL, src, &box);
|
||||
xmesa_st_framebuffer_display(drawable, NULL, src, 1, &box);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ hgl_st_framebuffer_flush_front(struct st_context *st,
|
|||
|
||||
// TODO: pipe_context here??? Might be needed for hw renderers
|
||||
buffer->screen->flush_frontbuffer(buffer->screen, NULL, ptex, 0, 0,
|
||||
buffer->winsysContext, NULL);
|
||||
buffer->winsysContext, 0, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface_id, void* draw, short s
|
|||
drv->pipe->flush(drv->pipe, NULL, 0);
|
||||
|
||||
screen->flush_frontbuffer(screen, drv->pipe, tex, 0, 0,
|
||||
vscreen->get_private(vscreen), NULL);
|
||||
vscreen->get_private(vscreen), 0, NULL);
|
||||
|
||||
|
||||
pipe_resource_reference(&tex, NULL);
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
|
|||
pipe->screen->fence_reference(pipe->screen, &surf->fence, NULL);
|
||||
pipe->flush(pipe, &surf->fence, 0);
|
||||
pipe->screen->flush_frontbuffer(pipe->screen, pipe, tex, 0, 0,
|
||||
vscreen->get_private(vscreen), NULL);
|
||||
vscreen->get_private(vscreen), 0, NULL);
|
||||
|
||||
pq->last_surf = surf;
|
||||
|
||||
|
|
|
|||
|
|
@ -384,13 +384,15 @@ struct pipe_screen {
|
|||
* displayed, eg copy fake frontbuffer.
|
||||
* \param winsys_drawable_handle an opaque handle that the calling context
|
||||
* gets out-of-band
|
||||
* \param subbox an optional sub region to flush
|
||||
* \param nboxes the number of sub regions to flush
|
||||
* \param subbox an array of optional sub regions to flush
|
||||
*/
|
||||
void (*flush_frontbuffer)(struct pipe_screen *screen,
|
||||
struct pipe_context *ctx,
|
||||
struct pipe_resource *resource,
|
||||
unsigned level, unsigned layer,
|
||||
void *winsys_drawable_handle,
|
||||
unsigned nboxes,
|
||||
struct pipe_box *subbox);
|
||||
|
||||
/** Set ptr = fence, with reference counting */
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ wgl_present(struct pipe_screen *screen,
|
|||
|
||||
#ifdef GALLIUM_ZINK
|
||||
if (use_zink) {
|
||||
screen->flush_frontbuffer(screen, ctx, res, 0, 0, hDC, NULL);
|
||||
screen->flush_frontbuffer(screen, ctx, res, 0, 0, hDC, 0, NULL);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ d3d12_wgl_present(struct pipe_screen *screen,
|
|||
struct pipe_resource *res,
|
||||
HDC hDC)
|
||||
{
|
||||
screen->flush_frontbuffer(screen, ctx, res, 0, 0, hDC, NULL);
|
||||
screen->flush_frontbuffer(screen, ctx, res, 0, 0, hDC, 0, NULL);
|
||||
}
|
||||
|
||||
unsigned
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue