summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/drisw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/dri/drisw.c')
-rw-r--r--src/gallium/state_trackers/dri/drisw.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c
index 4ec6992643a..753c59d696a 100644
--- a/src/gallium/state_trackers/dri/drisw.c
+++ b/src/gallium/state_trackers/dri/drisw.c
@@ -95,6 +95,21 @@ get_image(__DRIdrawable *dPriv, int x, int y, int width, int height, void *data)
data, dPriv->loaderPrivate);
}
+static inline void
+get_image2(__DRIdrawable *dPriv, int x, int y, int width, int height, int stride, void *data)
+{
+ __DRIscreen *sPriv = dPriv->driScreenPriv;
+ const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
+
+ /* getImage2 support is only in version 3 or newer */
+ if (loader->base.version < 3)
+ return;
+
+ loader->getImage2(dPriv,
+ x, y, width, height, stride,
+ data, dPriv->loaderPrivate);
+}
+
static void
drisw_update_drawable_info(struct dri_drawable *drawable)
{
@@ -105,6 +120,18 @@ drisw_update_drawable_info(struct dri_drawable *drawable)
}
static void
+drisw_get_image(struct dri_drawable *drawable,
+ int x, int y, unsigned width, unsigned height, unsigned stride,
+ void *data)
+{
+ __DRIdrawable *dPriv = drawable->dPriv;
+ int draw_x, draw_y, draw_w, draw_h;
+
+ get_drawable_info(dPriv, &draw_x, &draw_y, &draw_w, &draw_h);
+ get_image2(dPriv, x, y, draw_w, draw_h, stride, data);
+}
+
+static void
drisw_put_image(struct dri_drawable *drawable,
void *data, unsigned width, unsigned height)
{
@@ -236,6 +263,7 @@ drisw_allocate_textures(struct dri_context *stctx,
unsigned count)
{
struct dri_screen *screen = dri_screen(drawable->sPriv);
+ const __DRIswrastLoaderExtension *loader = drawable->dPriv->driScreenPriv->swrast_loader;
struct pipe_resource templ;
unsigned width, height;
boolean resized;
@@ -281,8 +309,14 @@ drisw_allocate_textures(struct dri_context *stctx,
templ.format = format;
templ.bind = bind;
- drawable->textures[statts[i]] =
- screen->base.screen->resource_create(screen->base.screen, &templ);
+ if (statts[i] == ST_ATTACHMENT_FRONT_LEFT &&
+ screen->base.screen->resource_create_front &&
+ loader->base.version >= 3) {
+ drawable->textures[statts[i]] =
+ screen->base.screen->resource_create_front(screen->base.screen, &templ, (const void *)drawable);
+ } else
+ drawable->textures[statts[i]] =
+ screen->base.screen->resource_create(screen->base.screen, &templ);
}
drawable->old_w = width;
@@ -338,6 +372,7 @@ static const __DRIextension *drisw_screen_extensions[] = {
};
static struct drisw_loader_funcs drisw_lf = {
+ .get_image = drisw_get_image,
.put_image = drisw_put_image,
.put_image2 = drisw_put_image2
};