st/xorg: adapt to interface changes

This commit is contained in:
Roland Scheidegger
2010-05-17 21:33:27 +02:00
parent 8bd87b662f
commit 48780ec9f9
4 changed files with 54 additions and 76 deletions

View File

@@ -437,10 +437,12 @@ xorg_dri2_init(ScreenPtr pScreen)
ms->d_depth_bits_last = ms->d_depth_bits_last =
ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24X8_UNORM, ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24X8_UNORM,
PIPE_TEXTURE_2D, PIPE_TEXTURE_2D,
0,
PIPE_BIND_DEPTH_STENCIL, 0); PIPE_BIND_DEPTH_STENCIL, 0);
ms->ds_depth_bits_last = ms->ds_depth_bits_last =
ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_TEXTURE_2D, PIPE_TEXTURE_2D,
0,
PIPE_BIND_DEPTH_STENCIL, 0); PIPE_BIND_DEPTH_STENCIL, 0);
return DRI2ScreenInit(pScreen, &dri2info); return DRI2ScreenInit(pScreen, &dri2info);

View File

@@ -347,7 +347,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
XORG_FALLBACK("not GXcopy"); XORG_FALLBACK("not GXcopy");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
priv->tex->target, priv->tex->target, 0,
PIPE_BIND_RENDER_TARGET, 0)) { PIPE_BIND_RENDER_TARGET, 0)) {
XORG_FALLBACK("format %s", util_format_name(priv->tex->format)); 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"); XORG_FALLBACK("alu not GXcopy");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
priv->tex->target, priv->tex->target, 0,
PIPE_BIND_RENDER_TARGET, 0)) PIPE_BIND_RENDER_TARGET, 0))
XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format)); XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format));
if (!exa->scrn->is_format_supported(exa->scrn, src_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)) PIPE_BIND_SAMPLER_VIEW, 0))
XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format)); XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format));
exa->copy.src = src_priv; exa->copy.src = src_priv;
exa->copy.dst = priv; exa->copy.dst = priv;
/* For same-surface copies, the pipe->surface_copy path is clearly /* XXX this used to use resource_copy_region for same-surface copies,
* superior, providing it is implemented. In other cases it's not * but they were redefined to not allow overlaps (some of the util code
* clear what the better path would be, and eventually we'd * always assumed this anyway).
* probably want to gather timings and choose dynamically. * Drivers should implement accelerated resource_copy_region or it will
* be slow - disable for now.
*/ */
if (exa->pipe->surface_copy && if (0 && exa->copy.src != exa->copy.dst) {
exa->copy.src == exa->copy.dst) {
exa->copy.use_surface_copy = TRUE; 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 { else {
exa->copy.use_surface_copy = FALSE; 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->scrn->get_tex_surface(exa->scrn,
exa->copy.dst->tex, exa->copy.dst->tex,
0, 0, 0, 0, 0, 0,
PIPE_BIND_BLIT_DESTINATION); PIPE_BIND_RENDER_TARGET);
renderer_copy_prepare(exa->renderer, renderer_copy_prepare(exa->renderer,
@@ -506,14 +493,19 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
(void) priv; (void) priv;
if (exa->copy.use_surface_copy) { if (exa->copy.use_surface_copy) {
/* XXX: consider exposing >1 box in surface_copy interface. struct pipe_subresource subdst, subsrc;
*/ subdst.face = 0;
exa->pipe->surface_copy( exa->pipe, subdst.level = 0;
exa->copy.dst_surface, subsrc.face = 0;
dstX, dstY, subsrc.level = 0;
exa->copy.src_surface, exa->pipe->resource_copy_region( exa->pipe,
srcX, srcY, exa->copy.dst->tex,
width, height ); subdst,
dstX, dstY, 0,
exa->copy.src->tex,
subsrc,
srcX, srcY, 0,
width, height );
} }
else { else {
renderer_copy_pixmap(exa->renderer, renderer_copy_pixmap(exa->renderer,
@@ -540,7 +532,6 @@ ExaDoneCopy(PixmapPtr pPixmap)
exa->copy.src = NULL; exa->copy.src = NULL;
exa->copy.dst = NULL; exa->copy.dst = NULL;
pipe_surface_reference(&exa->copy.src_surface, NULL);
pipe_surface_reference(&exa->copy.dst_surface, NULL); pipe_surface_reference(&exa->copy.dst_surface, NULL);
pipe_resource_reference(&exa->copy.src_texture, 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"); XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
priv->tex->target, priv->tex->target, 0,
PIPE_BIND_RENDER_TARGET, 0)) PIPE_BIND_RENDER_TARGET, 0))
XORG_FALLBACK("pDst format: %s", util_format_name(priv->tex->format)); 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"); XORG_FALLBACK("pSrc %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
priv->tex->target, priv->tex->target, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) PIPE_BIND_SAMPLER_VIEW, 0))
XORG_FALLBACK("pSrc format: %s", util_format_name(priv->tex->format)); 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"); XORG_FALLBACK("pMask %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
priv->tex->target, priv->tex->target, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) PIPE_BIND_SAMPLER_VIEW, 0))
XORG_FALLBACK("pMask format: %s", util_format_name(priv->tex->format)); 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); texture = exa->scrn->resource_create(exa->scrn, &template);
if (priv->tex) { if (priv->tex) {
struct pipe_surface *dst_surf; struct pipe_subresource subdst, subsrc;
struct pipe_surface *src_surf; struct pipe_surface *src_surf;
dst_surf = exa->scrn->get_tex_surface( subdst.face = 0;
exa->scrn, texture, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION); subdst.level = 0;
src_surf = xorg_gpu_surface(exa->pipe->screen, priv); subsrc.face = 0;
if (exa->pipe->surface_copy) { subsrc.level = 0;
exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, exa->pipe->resource_copy_region(exa->pipe, texture,
0, 0, min(width, texture->width0), subdst, 0, 0, 0,
min(height, texture->height0)); priv->tex,
} else { subsrc, 0, 0, 0,
util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf, min(width, texture->width0),
0, 0, min(width, texture->width0), min(height, texture->height0));
min(height, texture->height0));
}
exa->scrn->tex_surface_destroy(dst_surf);
exa->scrn->tex_surface_destroy(src_surf);
} }
pipe_resource_reference(&priv->tex, texture); pipe_resource_reference(&priv->tex, texture);
@@ -1074,11 +1061,7 @@ out_err:
struct pipe_surface * struct pipe_surface *
xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv) 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, return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0,
PIPE_BIND_BLIT_SOURCE |
PIPE_BIND_BLIT_DESTINATION |
PIPE_BIND_RENDER_TARGET); PIPE_BIND_RENDER_TARGET);
} }

View File

@@ -40,7 +40,6 @@ struct exa_context
struct exa_pixmap_priv *src; struct exa_pixmap_priv *src;
struct exa_pixmap_priv *dst; struct exa_pixmap_priv *dst;
struct pipe_surface *src_surface;
struct pipe_surface *dst_surface; struct pipe_surface *dst_surface;
struct pipe_resource *src_texture; struct pipe_resource *src_texture;

View File

@@ -449,7 +449,7 @@ void renderer_copy_prepare(struct xorg_renderer *r,
struct xorg_shader shader; struct xorg_shader shader;
assert(screen->is_format_supported(screen, dst_surface->format, assert(screen->is_format_supported(screen, dst_surface->format,
PIPE_TEXTURE_2D, PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET, PIPE_BIND_RENDER_TARGET,
0)); 0));
(void) screen; (void) screen;
@@ -525,7 +525,7 @@ renderer_clone_texture(struct xorg_renderer *r,
/* the coming in texture should already have that invariance */ /* the coming in texture should already have that invariance */
debug_assert(screen->is_format_supported(screen, src->format, debug_assert(screen->is_format_supported(screen, src->format,
PIPE_TEXTURE_2D, PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)); PIPE_BIND_SAMPLER_VIEW, 0));
format = src->format; format = src->format;
@@ -548,25 +548,19 @@ renderer_clone_texture(struct xorg_renderer *r,
{ {
/* copy source framebuffer surface into texture */ /* copy source framebuffer surface into texture */
struct pipe_surface *ps_read = screen->get_tex_surface( struct pipe_subresource subsrc, subdst;
screen, src, 0, 0, 0, PIPE_BIND_BLIT_SOURCE); subsrc.face = 0;
struct pipe_surface *ps_tex = screen->get_tex_surface( subsrc.level = 0;
screen, pt, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION ); subdst.face = 0;
if (pipe->surface_copy) { subdst.level = 0;
pipe->surface_copy(pipe, pipe->resource_copy_region(pipe,
ps_tex, /* dest */ pt, /* dest */
0, 0, /* destx/y */ subdst,
ps_read, 0, 0, 0, /* destx/y/z */
0, 0, src->width0, src->height0); src,
} else { subsrc,
util_surface_copy(pipe, FALSE, 0, 0, 0,
ps_tex, /* dest */ src->width0, src->height0);
0, 0, /* destx/y */
ps_read,
0, 0, src->width0, src->height0);
}
pipe_surface_reference(&ps_read, NULL);
pipe_surface_reference(&ps_tex, NULL);
} }
return pt; return pt;