summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorMarc-AndrĂ© Lureau <[email protected]>2015-06-10 17:34:15 +0200
committerDave Airlie <[email protected]>2018-05-30 09:11:53 +1000
commit63c427fa71a07649d5c033a5c6184ef701348590 (patch)
treec5ae7dd8c42064f2f9ed2d30f06608c5a05a6e5e /src/gallium/state_trackers
parentde8085e649235cd120e9eb06b82cc1dbabeb8652 (diff)
drisw: use putImageShm if available
If the DRIswrastLoaderExtension implements putImageShm, bind it to drisw_loader_funcs. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/dri/drisw.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c
index eb5752386dc..40cbca54940 100644
--- a/src/gallium/state_trackers/dri/drisw.c
+++ b/src/gallium/state_trackers/dri/drisw.c
@@ -26,14 +26,6 @@
*
**************************************************************************/
-/* TODO:
- *
- * xshm / EGLImage:
- *
- * Allow the loaders to use the XSHM extension. It probably requires callbacks
- * for createImage/destroyImage similar to DRI2 getBuffers.
- */
-
#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
@@ -87,6 +79,19 @@ put_image2(__DRIdrawable *dPriv, void *data, int x, int y,
}
static inline void
+put_image_shm(__DRIdrawable *dPriv, int shmid, char *shmaddr,
+ unsigned offset, int x, int y,
+ unsigned width, unsigned height, unsigned stride)
+{
+ __DRIscreen *sPriv = dPriv->driScreenPriv;
+ const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
+
+ loader->putImageShm(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
+ x, y, width, height, stride,
+ shmid, shmaddr, offset, dPriv->loaderPrivate);
+}
+
+static inline void
get_image(__DRIdrawable *dPriv, int x, int y, int width, int height, void *data)
{
__DRIscreen *sPriv = dPriv->driScreenPriv;
@@ -153,6 +158,17 @@ drisw_put_image2(struct dri_drawable *drawable,
}
static inline void
+drisw_put_image_shm(struct dri_drawable *drawable,
+ int shmid, char *shmaddr, unsigned offset,
+ int x, int y, unsigned width, unsigned height,
+ unsigned stride)
+{
+ __DRIdrawable *dPriv = drawable->dPriv;
+
+ put_image_shm(dPriv, shmid, shmaddr, offset, x, y, width, height, stride);
+}
+
+static inline void
drisw_present_texture(__DRIdrawable *dPriv,
struct pipe_resource *ptex, struct pipe_box *sub_box)
{
@@ -394,6 +410,7 @@ static struct drisw_loader_funcs drisw_lf = {
static const __DRIconfig **
drisw_init_screen(__DRIscreen * sPriv)
{
+ const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
const __DRIconfig **configs;
struct dri_screen *screen;
struct pipe_screen *pscreen = NULL;
@@ -409,6 +426,10 @@ drisw_init_screen(__DRIscreen * sPriv)
sPriv->driverPrivate = (void *)screen;
sPriv->extensions = drisw_screen_extensions;
+ if (loader->base.version >= 4) {
+ if (loader->putImageShm)
+ drisw_lf.put_image_shm = drisw_put_image_shm;
+ }
if (pipe_loader_sw_probe_dri(&screen->dev, &drisw_lf)) {
dri_init_options(screen);