diff options
author | Jakob Bornecrantz <jakob@vmware.com> | 2009-08-05 19:26:21 +0100 |
---|---|---|
committer | Jakob Bornecrantz <jakob@vmware.com> | 2009-08-05 19:29:31 +0100 |
commit | 3905119b4743eb5d284236cc237ee2c19ae3c5c8 (patch) | |
tree | 36b56d4307416ced9c2b5284114c39703c21ebff /src/gallium/state_trackers/xorg/xorg_exa.c | |
parent | 8ccec83e63932d78bb67638e013b9645e609da42 (diff) |
st/xorg: Make it work again
Diffstat (limited to 'src/gallium/state_trackers/xorg/xorg_exa.c')
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_exa.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 2c4291aa4e..f2dac73e90 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -359,8 +359,48 @@ ExaPixmapIsOffscreen(PixmapPtr pPixmap) return FALSE; } +int +xorg_exa_set_displayed_usage(PixmapPtr pPixmap) +{ + struct exa_pixmap_priv *priv; + priv = exaGetPixmapDriverPrivate(pPixmap); + + if (!priv) { + FatalError("NO PIXMAP PRIVATE\n"); + return 0; + } + + if (priv->flags & ~PIPE_TEXTURE_USAGE_PRIMARY) { + FatalError("BAD FLAGS\n"); + return 0; + } + priv->flags = PIPE_TEXTURE_USAGE_PRIMARY; + + return 0; +} + +int +xorg_exa_set_shared_usage(PixmapPtr pPixmap) +{ + struct exa_pixmap_priv *priv; + priv = exaGetPixmapDriverPrivate(pPixmap); + + if (!priv) { + FatalError("NO PIXMAP PRIVATE\n"); + return 0; + } + + if (priv->flags & ~PIPE_TEXTURE_USAGE_DISPLAY_TARGET) { + FatalError("BAD FLAGS\n"); + return 0; + } + priv->flags = PIPE_TEXTURE_USAGE_DISPLAY_TARGET; + + return 0; +} + unsigned -xorg_exa_get_pixmap_handle(PixmapPtr pPixmap) +xorg_exa_get_pixmap_handle(PixmapPtr pPixmap, unsigned *stride_out) { ScreenPtr pScreen = pPixmap->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -385,6 +425,9 @@ xorg_exa_get_pixmap_handle(PixmapPtr pPixmap) ms->api->buffer_from_texture(ms->api, priv->tex, &buffer, &stride); ms->api->handle_from_buffer(ms->api, ms->screen, buffer, &handle); pipe_buffer_reference(&buffer, NULL); + if (stride_out) + *stride_out = stride; + return handle; } @@ -421,7 +464,9 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, bitsPerPixel, devKind, NULL); /* Deal with screen resize */ - if (priv->tex && (priv->tex->width[0] != width || priv->tex->height[0] != height)) { + if (priv->tex && (priv->tex->width[0] != width || + priv->tex->height[0] != height || + priv->tex_flags != priv->flags)) { pipe_texture_reference(&priv->tex, NULL); } @@ -436,7 +481,8 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, template.height[0] = height; template.depth[0] = 1; template.last_level = 0; - template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET; + template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags; + priv->tex_flags = priv->flags; priv->tex = exa->scrn->texture_create(exa->scrn, &template); } |