summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-10-09 01:38:08 +0100
committerDave Airlie <airlied@gmail.com>2015-10-31 16:04:36 +1000
commit2b676570960277d47477822ffeccc672613f9142 (patch)
tree84194de9b3e72ac548512b07c57e6a938d5efa19 /src/glx
parent103de0225b1e22aabc3e132ff30393765061ff03 (diff)
downloadexternal_mesa3d-2b676570960277d47477822ffeccc672613f9142.zip
external_mesa3d-2b676570960277d47477822ffeccc672613f9142.tar.gz
external_mesa3d-2b676570960277d47477822ffeccc672613f9142.tar.bz2
gallium/swrast: fix front buffer blitting. (v2)
So I've known this was broken before, cogl has a workaround for it from what I know, but with the gallium based swrast drivers BlitFramebuffer from back to front or vice-versa was pretty broken. The legacy swrast driver tracks when a front buffer is used and does the get/put images when it is mapped/unmapped, so this patch attempts to add the same functionality to the gallium drivers. It creates a new context interface to denote when a front buffer is being created, and passes a private pointer to it, this pointer is then used to decide on map/unmap if the contents should be updated from the real frontbuffer using get/put image. This is primarily to make gtk's gl code work, the only thing I've tested so far is the glarea test from https://github.com/ebassi/glarea-example.git v2: bump extension version, check extension version before calling get image. (Ian) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91930 Cc: <mesa-stable@lists.freedesktop.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/drisw_glx.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 749ceb0..76cc321 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -177,9 +177,9 @@ swrastPutImage(__DRIdrawable * draw, int op,
}
static void
-swrastGetImage(__DRIdrawable * read,
- int x, int y, int w, int h,
- char *data, void *loaderPrivate)
+swrastGetImage2(__DRIdrawable * read,
+ int x, int y, int w, int h, int stride,
+ char *data, void *loaderPrivate)
{
struct drisw_drawable *prp = loaderPrivate;
__GLXDRIdrawable *pread = &(prp->base);
@@ -193,20 +193,29 @@ swrastGetImage(__DRIdrawable * read,
ximage->data = data;
ximage->width = w;
ximage->height = h;
- ximage->bytes_per_line = bytes_per_line(w * ximage->bits_per_pixel, 32);
+ ximage->bytes_per_line = stride ? stride : bytes_per_line(w * ximage->bits_per_pixel, 32);
XGetSubImage(dpy, readable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0);
ximage->data = NULL;
}
+static void
+swrastGetImage(__DRIdrawable * read,
+ int x, int y, int w, int h,
+ char *data, void *loaderPrivate)
+{
+ swrastGetImage2(read, x, y, w, h, 0, data, loaderPrivate);
+}
+
static const __DRIswrastLoaderExtension swrastLoaderExtension = {
- .base = {__DRI_SWRAST_LOADER, 2 },
+ .base = {__DRI_SWRAST_LOADER, 3 },
.getDrawableInfo = swrastGetDrawableInfo,
.putImage = swrastPutImage,
.getImage = swrastGetImage,
.putImage2 = swrastPutImage2,
+ .getImage2 = swrastGetImage2,
};
static const __DRIextension *loader_extensions[] = {