summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-07-13 02:22:04 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-08-23 17:32:56 -0400
commit0f633bc3d14f8fe7d1b87a19ee1c7c2bc883e03f (patch)
tree162460cad9ce704e04cc32e4a8feefa5b90be845
parentdf7d307981ac94a1096be1974dcfb8b8beaaa3eb (diff)
More stubs
-rw-r--r--src/qxl.h16
-rw-r--r--src/qxl_driver.c81
-rw-r--r--src/qxl_surface.c23
3 files changed, 108 insertions, 12 deletions
diff --git a/src/qxl.h b/src/qxl.h
index 1d9ca75..90ac44e 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -392,7 +392,21 @@ Bool qxl_surface_put_image (qxl_surface_t *dest,
const char *src, int src_pitch);
void qxl_surface_unref (surface_cache_t *cache,
uint32_t surface_id);
-
+
+/* composite */
+Bool qxl_surface_prepare_composite (int op,
+ PicturePtr src_picture,
+ PicturePtr mask_picture,
+ PicturePtr dst_picture,
+ qxl_surface_t *src,
+ qxl_surface_t *mask,
+ qxl_surface_t *dest);
+void qxl_surface_composite (qxl_surface_t *dest,
+ int src_x, int src_y,
+ int mask_x, int mask_y,
+ int dst_x, int dst_y,
+ int width, int height);
+
#if HAS_DEVPRIVATEKEYREC
extern DevPrivateKeyRec uxa_pixmap_index;
#else
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 8f5735e..7e25b3f 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -1200,12 +1200,6 @@ int uxa_pixmap_index;
#endif
static Bool
-unaccel (void)
-{
- return FALSE;
-}
-
-static Bool
qxl_prepare_access (PixmapPtr pixmap, RegionPtr region, uxa_access_t access)
{
return qxl_surface_prepare_access (get_surface (pixmap),
@@ -1318,26 +1312,83 @@ qxl_done_copy (PixmapPtr dest)
* Composite
*/
static Bool
+can_accelerate_picture (PicturePtr pict)
+{
+ if (pict->format != PICT_a8r8g8b8 &&
+ pict->format != PICT_x8r8g8b8 &&
+ pict->format != PICT_a8)
+ {
+ return FALSE;
+ }
+
+ if (pict->transform)
+ {
+ if (pict->transform->matrix[2][0] != 0 ||
+ pict->transform->matrix[2][1] != 0 ||
+ pict->transform->matrix[2][2] != pixman_int_to_fixed (1))
+ {
+ return FALSE;
+ }
+ }
+
+ if (pict->filter != PictFilterBilinear &&
+ pict->filter != PictFilterNearest)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static Bool
qxl_check_composite (int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture,
PicturePtr pDstPicture,
int width, int height)
{
+ int i;
+
+ static const int accelerated_ops[] =
+ {
+ PictOpClear, PictOpDst, PictOpOver, PictOpOverReverse,
+ PictOpIn, PictOpInReverse, PictOpOut, PictOpOutReverse,
+ PictOpAtop, PictOpAtopReverse, PictOpXor, PictOpAdd,
+ PictOpSaturate, PictOpMultiply, PictOpScreen, PictOpOverlay,
+ PictOpDarken, PictOpLighten, PictOpColorDodge, PictOpColorBurn,
+ PictOpHardLight, PictOpSoftLight, PictOpDifference, PictOpExclusion,
+ PictOpHSLHue, PictOpHSLSaturation, PictOpHSLColor, PictOpHSLLuminosity,
+ };
+
+ if (!can_accelerate_picture (pSrcPicture) ||
+ !can_accelerate_picture (pMaskPicture) ||
+ !can_accelerate_picture (pDstPicture))
+ {
+ return FALSE;
+ }
+
+ for (i = 0; i < sizeof (accelerated_ops) / sizeof (accelerated_ops[0]); ++i)
+ {
+ if (accelerated_ops[i] == op)
+ goto found;
+ }
return FALSE;
+
+found:
+ return TRUE;
}
static Bool
qxl_check_composite_target (PixmapPtr pixmap)
{
- return FALSE;
+ return TRUE;
}
static Bool
qxl_check_composite_texture (ScreenPtr screen,
PicturePtr pPicture)
{
- return FALSE;
+ return TRUE;
}
static Bool
@@ -1349,7 +1400,11 @@ qxl_prepare_composite (int op,
PixmapPtr pMask,
PixmapPtr pDst)
{
- return FALSE;
+ return qxl_surface_prepare_composite (
+ op, pSrcPicture, pMaskPicture, pDstPicture,
+ get_surface (pSrc),
+ get_surface (pMask),
+ get_surface (pDst));
}
static void
@@ -1359,13 +1414,17 @@ qxl_composite (PixmapPtr pDst,
int dst_x, int dst_y,
int width, int height)
{
-
+ qxl_surface_composite (
+ get_surface (pDst),
+ src_x, src_y,
+ mask_x, mask_x,
+ dst_x, dst_y, width, height);
}
static void
qxl_done_composite (PixmapPtr pDst)
{
-
+ ;
}
static Bool
diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index 6ac3f13..927f892 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -1367,6 +1367,29 @@ qxl_surface_copy (qxl_surface_t *dest,
push_drawable (qxl, drawable);
}
+/* composite */
+Bool
+qxl_surface_prepare_composite (int op,
+ PicturePtr src_picture,
+ PicturePtr mask_picture,
+ PicturePtr dst_picture,
+ qxl_surface_t *src,
+ qxl_surface_t *mask,
+ qxl_surface_t *dest)
+{
+ return FALSE;
+}
+
+void
+qxl_surface_composite (qxl_surface_t *dest,
+ int src_x, int src_y,
+ int mask_x, int mask_y,
+ int dst_x, int dst_y,
+ int width, int height)
+{
+ ;
+}
+
Bool
qxl_surface_put_image (qxl_surface_t *dest,
int x, int y, int width, int height,