From: Roland Scheidegger Date: Mon, 17 May 2010 19:33:27 +0000 (+0200) Subject: st/xorg: adapt to interface changes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=48780ec9f99d7af4e98614be597adc3534d6918c;p=mesa.git st/xorg: adapt to interface changes --- diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index b90f9c908d2..35741f86842 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -437,10 +437,12 @@ xorg_dri2_init(ScreenPtr pScreen) ms->d_depth_bits_last = ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24X8_UNORM, PIPE_TEXTURE_2D, + 0, PIPE_BIND_DEPTH_STENCIL, 0); ms->ds_depth_bits_last = ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_TEXTURE_2D, + 0, PIPE_BIND_DEPTH_STENCIL, 0); return DRI2ScreenInit(pScreen, &dri2info); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 65be8c332a5..6657f7391b2 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -347,7 +347,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) XORG_FALLBACK("not GXcopy"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, - priv->tex->target, + priv->tex->target, 0, PIPE_BIND_RENDER_TARGET, 0)) { XORG_FALLBACK("format %s", util_format_name(priv->tex->format)); } @@ -428,39 +428,26 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, XORG_FALLBACK("alu not GXcopy"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, - priv->tex->target, + priv->tex->target, 0, PIPE_BIND_RENDER_TARGET, 0)) XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format)); if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format, - src_priv->tex->target, + src_priv->tex->target, 0, PIPE_BIND_SAMPLER_VIEW, 0)) XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format)); exa->copy.src = src_priv; exa->copy.dst = priv; - /* For same-surface copies, the pipe->surface_copy path is clearly - * superior, providing it is implemented. In other cases it's not - * clear what the better path would be, and eventually we'd - * probably want to gather timings and choose dynamically. + /* XXX this used to use resource_copy_region for same-surface copies, + * but they were redefined to not allow overlaps (some of the util code + * always assumed this anyway). + * Drivers should implement accelerated resource_copy_region or it will + * be slow - disable for now. */ - if (exa->pipe->surface_copy && - exa->copy.src == exa->copy.dst) { - + if (0 && exa->copy.src != exa->copy.dst) { exa->copy.use_surface_copy = TRUE; - - exa->copy.src_surface = - exa->scrn->get_tex_surface( exa->scrn, - exa->copy.src->tex, - 0, 0, 0, - PIPE_BIND_BLIT_SOURCE); - - exa->copy.dst_surface = - exa->scrn->get_tex_surface( exa->scrn, - exa->copy.dst->tex, - 0, 0, 0, - PIPE_BIND_BLIT_DESTINATION ); } else { exa->copy.use_surface_copy = FALSE; @@ -476,7 +463,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->scrn->get_tex_surface(exa->scrn, exa->copy.dst->tex, 0, 0, 0, - PIPE_BIND_BLIT_DESTINATION); + PIPE_BIND_RENDER_TARGET); renderer_copy_prepare(exa->renderer, @@ -506,14 +493,19 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, (void) priv; if (exa->copy.use_surface_copy) { - /* XXX: consider exposing >1 box in surface_copy interface. - */ - exa->pipe->surface_copy( exa->pipe, - exa->copy.dst_surface, - dstX, dstY, - exa->copy.src_surface, - srcX, srcY, - width, height ); + struct pipe_subresource subdst, subsrc; + subdst.face = 0; + subdst.level = 0; + subsrc.face = 0; + subsrc.level = 0; + exa->pipe->resource_copy_region( exa->pipe, + exa->copy.dst->tex, + subdst, + dstX, dstY, 0, + exa->copy.src->tex, + subsrc, + srcX, srcY, 0, + width, height ); } else { renderer_copy_pixmap(exa->renderer, @@ -540,7 +532,6 @@ ExaDoneCopy(PixmapPtr pPixmap) exa->copy.src = NULL; exa->copy.dst = NULL; - pipe_surface_reference(&exa->copy.src_surface, NULL); pipe_surface_reference(&exa->copy.dst_surface, NULL); pipe_resource_reference(&exa->copy.src_texture, NULL); } @@ -639,7 +630,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, - priv->tex->target, + priv->tex->target, 0, PIPE_BIND_RENDER_TARGET, 0)) XORG_FALLBACK("pDst format: %s", util_format_name(priv->tex->format)); @@ -654,7 +645,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, XORG_FALLBACK("pSrc %s", !priv ? "!priv" : "!priv->tex"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, - priv->tex->target, + priv->tex->target, 0, PIPE_BIND_SAMPLER_VIEW, 0)) XORG_FALLBACK("pSrc format: %s", util_format_name(priv->tex->format)); @@ -671,7 +662,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, XORG_FALLBACK("pMask %s", !priv ? "!priv" : "!priv->tex"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, - priv->tex->target, + priv->tex->target, 0, PIPE_BIND_SAMPLER_VIEW, 0)) XORG_FALLBACK("pMask format: %s", util_format_name(priv->tex->format)); @@ -890,23 +881,19 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, texture = exa->scrn->resource_create(exa->scrn, &template); if (priv->tex) { - struct pipe_surface *dst_surf; + struct pipe_subresource subdst, subsrc; struct pipe_surface *src_surf; - dst_surf = exa->scrn->get_tex_surface( - exa->scrn, texture, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION); - src_surf = xorg_gpu_surface(exa->pipe->screen, priv); - if (exa->pipe->surface_copy) { - exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width0), - min(height, texture->height0)); - } else { - util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width0), - min(height, texture->height0)); - } - exa->scrn->tex_surface_destroy(dst_surf); - exa->scrn->tex_surface_destroy(src_surf); + subdst.face = 0; + subdst.level = 0; + subsrc.face = 0; + subsrc.level = 0; + exa->pipe->resource_copy_region(exa->pipe, texture, + subdst, 0, 0, 0, + priv->tex, + subsrc, 0, 0, 0, + min(width, texture->width0), + min(height, texture->height0)); } pipe_resource_reference(&priv->tex, texture); @@ -1074,11 +1061,7 @@ out_err: struct pipe_surface * xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv) { - - /* seems to get called both for blits and render target usage */ return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0, - PIPE_BIND_BLIT_SOURCE | - PIPE_BIND_BLIT_DESTINATION | PIPE_BIND_RENDER_TARGET); } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index a35e9a5c901..86a1afc06e6 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -40,7 +40,6 @@ struct exa_context struct exa_pixmap_priv *src; struct exa_pixmap_priv *dst; - struct pipe_surface *src_surface; struct pipe_surface *dst_surface; struct pipe_resource *src_texture; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 583493116d5..1576e5ea01b 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -449,7 +449,7 @@ void renderer_copy_prepare(struct xorg_renderer *r, struct xorg_shader shader; assert(screen->is_format_supported(screen, dst_surface->format, - PIPE_TEXTURE_2D, + PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET, 0)); (void) screen; @@ -525,7 +525,7 @@ renderer_clone_texture(struct xorg_renderer *r, /* the coming in texture should already have that invariance */ debug_assert(screen->is_format_supported(screen, src->format, - PIPE_TEXTURE_2D, + PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW, 0)); format = src->format; @@ -548,25 +548,19 @@ renderer_clone_texture(struct xorg_renderer *r, { /* copy source framebuffer surface into texture */ - struct pipe_surface *ps_read = screen->get_tex_surface( - screen, src, 0, 0, 0, PIPE_BIND_BLIT_SOURCE); - struct pipe_surface *ps_tex = screen->get_tex_surface( - screen, pt, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION ); - if (pipe->surface_copy) { - pipe->surface_copy(pipe, - ps_tex, /* dest */ - 0, 0, /* destx/y */ - ps_read, - 0, 0, src->width0, src->height0); - } else { - util_surface_copy(pipe, FALSE, - ps_tex, /* dest */ - 0, 0, /* destx/y */ - ps_read, - 0, 0, src->width0, src->height0); - } - pipe_surface_reference(&ps_read, NULL); - pipe_surface_reference(&ps_tex, NULL); + struct pipe_subresource subsrc, subdst; + subsrc.face = 0; + subsrc.level = 0; + subdst.face = 0; + subdst.level = 0; + pipe->resource_copy_region(pipe, + pt, /* dest */ + subdst, + 0, 0, 0, /* destx/y/z */ + src, + subsrc, + 0, 0, 0, + src->width0, src->height0); } return pt;