summaryrefslogtreecommitdiff
path: root/src/uxa
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-09-12 13:44:49 -0700
committerKeith Packard <keithp@keithp.com>2014-09-12 13:50:33 -0700
commit9ca7b8771c7f5253fdcafafed751af31f1ad3828 (patch)
tree8f071f14c4d0fabb73bac6c392d09cb742b09106 /src/uxa
parentfa6f6839dc7e23cdbeef4379ded31ead3ea3968c (diff)
glamor: Add DRI3 support to glamor code paths
This creates wrappers to invoke glamor functions for pixmap_from_fd and fd_from_pixmap when the driver is using glamor. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/uxa')
-rw-r--r--src/uxa/intel_dri3.c9
-rw-r--r--src/uxa/intel_glamor.c31
-rw-r--r--src/uxa/intel_glamor.h25
3 files changed, 65 insertions, 0 deletions
diff --git a/src/uxa/intel_dri3.c b/src/uxa/intel_dri3.c
index dc8d7621..a81ebe58 100644
--- a/src/uxa/intel_dri3.c
+++ b/src/uxa/intel_dri3.c
@@ -30,6 +30,7 @@
#include "intel.h"
#include "dri3.h"
+#include "intel_glamor.h"
static int
intel_dri3_open(ScreenPtr screen,
@@ -60,6 +61,10 @@ static PixmapPtr intel_dri3_pixmap_from_fd(ScreenPtr screen,
PixmapPtr pixmap;
dri_bo *bo;
+ pixmap = intel_glamor_pixmap_from_fd(screen, fd, width, height, stride, depth, bpp);
+ if (pixmap)
+ return pixmap;
+
if (depth < 8)
return NULL;
@@ -108,6 +113,10 @@ static int intel_dri3_fd_from_pixmap(ScreenPtr screen,
struct intel_pixmap *priv;
int fd;
+ fd = intel_glamor_fd_from_pixmap(screen, pixmap, stride, size);
+ if (fd >= 0)
+ return fd;
+
priv = intel_get_pixmap_private(pixmap);
if (!priv)
return -1;
diff --git a/src/uxa/intel_glamor.c b/src/uxa/intel_glamor.c
index 9d2792f9..c8b41033 100644
--- a/src/uxa/intel_glamor.c
+++ b/src/uxa/intel_glamor.c
@@ -138,6 +138,37 @@ intel_glamor_pre_init(ScrnInfoPtr scrn)
}
PixmapPtr
+intel_glamor_pixmap_from_fd(ScreenPtr screen,
+ int fd,
+ CARD16 width,
+ CARD16 height,
+ CARD16 stride,
+ CARD8 depth,
+ CARD8 bpp)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ intel_screen_private *intel = intel_get_screen_private(scrn);
+
+ if (intel->uxa_flags & UXA_USE_GLAMOR)
+ return glamor_pixmap_from_fd(screen, fd, width, height, stride, depth, bpp);
+ else
+ return NULL;
+}
+
+int
+intel_glamor_fd_from_pixmap(ScreenPtr screen,
+ PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ intel_screen_private *intel = intel_get_screen_private(scrn);
+
+ if (intel->uxa_flags & UXA_USE_GLAMOR)
+ return glamor_fd_from_pixmap(screen, pixmap, stride, size);
+ else
+ return -1;
+}
+
+PixmapPtr
intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
int depth, unsigned int usage)
{
diff --git a/src/uxa/intel_glamor.h b/src/uxa/intel_glamor.h
index 2e305fc9..94a06171 100644
--- a/src/uxa/intel_glamor.h
+++ b/src/uxa/intel_glamor.h
@@ -48,6 +48,20 @@ PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
int depth, unsigned int usage);
void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst);
XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports);
+
+int
+intel_glamor_fd_from_pixmap(ScreenPtr screen,
+ PixmapPtr pixmap, CARD16 *stride, CARD32 *size);
+
+PixmapPtr
+intel_glamor_pixmap_from_fd(ScreenPtr screen,
+ int fd,
+ CARD16 width,
+ CARD16 height,
+ CARD16 stride,
+ CARD8 depth,
+ CARD8 bpp);
+
#else
static inline Bool intel_glamor_pre_init(ScrnInfoPtr scrn) { return TRUE; }
@@ -66,6 +80,17 @@ static inline PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int
static inline void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst) {}
static inline XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports) { return NULL; }
+static inline PixmapPtr intel_glamor_pixmap_from_fd(ScreenPtr screen,
+ int fd,
+ CARD16 width,
+ CARD16 height,
+ CARD16 stride,
+ CARD8 depth,
+ CARD8 bpp) { return NULL; }
+
+static int
+intel_glamor_fd_from_pixmap(ScreenPtr screen,
+ PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { return -1; }
#endif
#endif /* INTEL_GLAMOR_H */