mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-02 12:20:09 +01:00
glamor: use glBlit where possible
When we're simply doing a blit, using glBlitFramebuffer gives more information to the GL driver about what our intent is and can optionally enable optimizations (eg: do a copy instead of a draw). The main use case I have for this is 'present_copy_region' (which calls into glamor_copy_area and utltimately this function). For now glBlit usage is stricter than required (eg: single src/dst box), and could be extended later if it proves useful. Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
This commit is contained in:
parent
7203626173
commit
e8b9a955c0
1 changed files with 24 additions and 0 deletions
|
|
@ -384,6 +384,30 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
|
|||
if (bitplane && !glamor_priv->can_copyplane)
|
||||
goto bail_ctx;
|
||||
|
||||
/* Try blit directly. */
|
||||
if (!bitplane && (!gc || gc->alu == GXcopy) && nbox == 1 && src_pixmap != dst_pixmap &&
|
||||
glamor_pixmap_hcnt(src_priv) == 1 && glamor_pixmap_hcnt(dst_priv) == 1) {
|
||||
int dst_samples, src_samples;
|
||||
|
||||
/* Assume DSA is available for simplicity. */
|
||||
glGetNamedFramebufferParameteriv(src_priv->fbo->fb, GL_SAMPLES, &src_samples);
|
||||
glGetNamedFramebufferParameteriv(dst_priv->fbo->fb, GL_SAMPLES, &dst_samples);
|
||||
|
||||
if (src_samples == dst_samples) {
|
||||
glamor_get_drawable_deltas(src, src_pixmap, &src_off_x, &src_off_y);
|
||||
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_off_x, &dst_off_y);
|
||||
|
||||
glBlitNamedFramebuffer(
|
||||
src_priv->fbo->fb, dst_priv->fbo->fb,
|
||||
box[0].x1 + dx + src_off_x, box[0].y1 + dy + src_off_y,
|
||||
box[0].x2 + dx + src_off_x, box[0].y2 + dy + src_off_y,
|
||||
box[0].x1 + dst_off_x, box[0].y1 + dst_off_y,
|
||||
box[0].x2 + dst_off_x, box[0].y2 + dst_off_y,
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (bitplane) {
|
||||
prog = &glamor_priv->copy_plane_prog;
|
||||
copy_facet = &glamor_facet_copyplane;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue