[Spice-devel] [PATCH 1/2] Implement copy with fbFill.

Jeremy White jwhite at codeweavers.com
Thu Sep 20 15:03:44 PDT 2012


This fixes issues with 1 bit images; some pixman implementations
did not support 1 bit images - the general fbFill implementation
takes care of it for us.
---

This depends on the previous series that implement a Deferred FPS mode.

 src/dfps.c |   27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/dfps.c b/src/dfps.c
index 2eec3fe..2b96586 100644
--- a/src/dfps.c
+++ b/src/dfps.c
@@ -50,6 +50,7 @@ struct dfps_info_t
      PixmapPtr   copy_src;
     Pixel       solid_pixel;
+    GCPtr       pgc;
 };
  void dfps_ticker(void *opaque)
@@ -92,16 +93,22 @@ static Bool dfps_prepare_solid (PixmapPtr pixmap,
int alu, Pixel planemask, Pixe
         return FALSE;
      info->solid_pixel = fg;
+    info->pgc = GetScratchGC(pixmap->drawable.depth,
pixmap->drawable.pScreen);
+    if (! info->pgc)
+        return FALSE;
+
+    info->pgc->alu = alu;
+    info->pgc->planemask = planemask;
+    info->pgc->fgPixel = fg;
+    info->pgc->fillStyle = FillSolid;
+
+    fbValidateGC(info->pgc, GCForeground | GCPlaneMask, &pixmap->drawable);
      return TRUE;
 }
  static void dfps_solid (PixmapPtr pixmap, int x_1, int y_1, int x_2,
int y_2)
 {
-    FbBits *bits;
-    int stride;
-    int bpp;
-    int xoff, yoff;
     struct pixman_box16 box;
     RegionPtr region;
     Bool throwaway_bool;
@@ -111,10 +118,7 @@ static void dfps_solid (PixmapPtr pixmap, int x_1,
int y_1, int x_2, int y_2)
         return;
      /* Draw to the frame buffer */
-    fbGetDrawable((DrawablePtr)pixmap, bits, stride, bpp, xoff, yoff);
-    pixman_fill((uint32_t *) bits, stride, bpp, x_1 + xoff, y_1 + yoff,
x_2 - x_1, y_2 - y_1, info->solid_pixel);
-    fbValidateDrawable(pixmap);
-    fbFinishAccess(pixmap);
+    fbFill(&pixmap->drawable, info->pgc, x_1, y_1, x_2 - x_1, y_2 - y_1);
      /* Track the updated region */
     box.x1 = x_1; box.x2 = x_2; box.y1 = y_1; box.y2 = y_2;
@@ -127,6 +131,13 @@ static void dfps_solid (PixmapPtr pixmap, int x_1,
int y_1, int x_2, int y_2)
  static void dfps_done_solid (PixmapPtr pixmap)
 {
+    dfps_info_t *info;
+
+    if ((info = dfps_get_info (pixmap)))
+    {
+        FreeScratchGC(info->pgc);
+        info->pgc = NULL;
+    }
 }
  static Bool dfps_check_copy (PixmapPtr source, PixmapPtr dest,
-- 
1.7.10.4





More information about the Spice-devel mailing list