1. 29 Sep, 2015 1 commit
  2. 08 Jul, 2015 1 commit
  3. 21 Apr, 2015 1 commit
  4. 12 Nov, 2014 1 commit
  5. 27 Oct, 2014 12 commits
  6. 23 Oct, 2014 1 commit
  7. 09 Oct, 2014 3 commits
  8. 22 Aug, 2014 1 commit
    • Takashi Iwai's avatar
      fb: Fix invalid bpp for 24bit depth window · fe5018e0
      Takashi Iwai authored
      We have a hack in fb layer for a 24bpp screen to use 32bpp images, and
      fbCreateWindow() replaces its drawable.bitsPerPixel field
      appropriately.  But, the problem is that it always replaces when 32bpp
      is passed.  If the depth is 32, this results in bpp < depth, which is
      actually invalid.
      
      Meanwhile, fbCreatePixmap() has a more check and it creates with 24bpp
      only when the passed depth <= 24 for avoiding such a problem.
      
      This oneliner patch just adds the similar check in fbCreateWindow().
      This (hopefully) fixes the long-standing broken graphics mess of
      cirrus KMS with 24bpp.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
      fe5018e0
  9. 03 Jul, 2014 1 commit
  10. 05 Jun, 2014 1 commit
  11. 22 Apr, 2014 1 commit
    • Peter Harris's avatar
      fb: Fix origin of source picture in fbGlyphs · 983e3036
      Peter Harris authored
      If a source picture doesn't repeat and a mask format is specified, the
      incorrect calulation of the origin of the glyphs caused the glyphs to
      not be drawn at all.
      
      Noticed when running gtk-demo from RHEL 6.5 and selecting "Rotated
      Text".
      Signed-off-by: default avatarPeter Harris <pharris@opentext.com>
      Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
      Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
      
      /* Test for this bug
      
      cc -std=c99 -o glyph glyph.c `pkg-config --cflags --libs xcb-render`
      
      */
      
      // 16 x 16 pictfmt_a8 "glyph"
      static const char glyph[] = {
          0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff,
          0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0,
          0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0,
          0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0,
          0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0,
          0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0,
          0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0xff, 0, 0, 0, 0, 0, 0,
          0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0,
          0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0,
          0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0xff, 0, 0, 0, 0, 0, 0,
          0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0,
          0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0,
          0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0,
          0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0,
          0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0,
          0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff,
      };
      
      static struct {
          uint8_t len;
          uint8_t pad[3];
          uint16_t deltax, deltay;
          uint8_t glyph;
          uint8_t pad2[3];
      } elt = { len:1, glyph:1, deltax:WIN_SIZE/2 - GLYPH_SIZE/2, deltay:WIN_SIZE/2 - GLYPH_SIZE/2 };
      
      int main(int argc, char *argv[])
      {
          int screen;
          xcb_connection_t *c = xcb_connect(NULL, &screen);
          if (!c || xcb_connection_has_error(c)) {
      	fprintf(stderr, "Cannot open default display \"%s\"\n", getenv("DISPLAY"));
      	return EXIT_FAILURE;
          }
      
          // Find root window and depth
          const xcb_setup_t *setup = xcb_get_setup(c);
          if (screen >= setup->roots_len)
      	screen = 0;
          xcb_screen_iterator_t si = xcb_setup_roots_iterator(setup);
          for (int i=0; i < screen; i++)
      	xcb_screen_next(&si);
          xcb_window_t root = si.data->root;
          uint8_t depth = si.data->root_depth;
          xcb_visualid_t visual = si.data->root_visual;
      
          // Find picture formats
          xcb_render_query_pict_formats_reply_t *qpf;
          qpf = xcb_render_query_pict_formats_reply(c, xcb_render_query_pict_formats(c), NULL);
          if (!qpf) {
      	fprintf(stderr, "Cannot query RENDER picture formats\n");
      	return EXIT_FAILURE;
          }
          xcb_render_pictformat_t fmt_a8 = 0;
          xcb_render_pictforminfo_iterator_t pfi =
              xcb_render_query_pict_formats_formats_iterator(qpf);
          for (int i = 0; i < xcb_render_query_pict_formats_formats_length(qpf); i++) {
      
              if (pfi.data->depth == 8 &&
                      pfi.data->type == XCB_RENDER_PICT_TYPE_DIRECT &&
                      pfi.data->direct.alpha_mask == 0xFF) {
                  fmt_a8 = pfi.data->id;
                  break;
              }
              xcb_render_pictforminfo_next(&pfi);
          }
          if (!fmt_a8) {
      	fprintf(stderr, "Cannot find a8 RENDER picture format\n");
      	return EXIT_FAILURE;
          }
      
          xcb_render_pictformat_t fmt_visual = 0;
          xcb_render_pictscreen_iterator_t psi =
              xcb_render_query_pict_formats_screens_iterator(qpf);
          for (int i = 0; i < xcb_render_query_pict_formats_screens_length(qpf); i++) {
              xcb_render_pictdepth_iterator_t pdi =
                  xcb_render_pictscreen_depths_iterator(psi.data);
              for (int j = 0; i < xcb_render_pictscreen_depths_length(psi.data); i++) {
                  xcb_render_pictvisual_iterator_t pvi =
                      xcb_render_pictdepth_visuals_iterator(pdi.data);
                  for (int k = 0; k < xcb_render_pictdepth_visuals_length(pdi.data); i++) {
                      if (pvi.data->visual == visual) {
                          fmt_visual = pvi.data->format;
                          goto found_visual;
                      }
                      xcb_render_pictvisual_next(&pvi);
                  }
                  xcb_render_pictdepth_next(&pdi);
              }
              xcb_render_pictscreen_next(&psi);
          }
      found_visual:
          if (!fmt_visual) {
      	fprintf(stderr, "Cannot find visual RENDER picture format\n");
      	return EXIT_FAILURE;
          }
      
          xcb_render_glyphset_t glyphset = xcb_generate_id(c);
          xcb_render_create_glyph_set(c, glyphset, fmt_a8);
          uint32_t glyph_ids[] = {1};
          xcb_render_add_glyphs(c, glyphset, 1, glyph_ids,
                  &(xcb_render_glyphinfo_t){width:GLYPH_SIZE, height:GLYPH_SIZE}, sizeof(glyph), glyph);
      
          // Create window, pixmap, and gc
          xcb_window_t window = xcb_generate_id(c);
          uint32_t list[] = { si.data->black_pixel, XCB_EVENT_MASK_EXPOSURE };
          xcb_create_window(c, XCB_COPY_FROM_PARENT, window, root, 0, 0, WIN_SIZE, WIN_SIZE,
      	    0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT,
      	    XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK, list);
          xcb_map_window(c, window);
          xcb_render_picture_t winpic = xcb_generate_id(c);
          xcb_render_create_picture(c, winpic, window, fmt_visual, 0, NULL);
      
          xcb_pixmap_t pixmap = xcb_generate_id(c);
          xcb_create_pixmap(c, depth, pixmap, window, GLYPH_SIZE, GLYPH_SIZE);
          xcb_render_picture_t pixpic = xcb_generate_id(c);
          xcb_render_create_picture(c, pixpic, pixmap, fmt_visual, 0, NULL);
          xcb_render_fill_rectangles(c, XCB_RENDER_PICT_OP_SRC, pixpic,
                  (xcb_render_color_t){green:0xFFFF, alpha:0xFFFF}, 1,
                  &(xcb_rectangle_t){width:GLYPH_SIZE, height:GLYPH_SIZE} );
      
          xcb_flush(c);
          for (xcb_generic_event_t *ev = xcb_wait_for_event(c); ev; ev = xcb_wait_for_event(c)) {
      	int type = ev->response_type;
      	free(ev);
      	if (type == XCB_EXPOSE) {
                  xcb_clear_area(c, 0, window, 0, 0, 0, 0);
                  xcb_render_composite_glyphs_8(c, XCB_RENDER_PICT_OP_SRC, pixpic, winpic, fmt_a8,
                          glyphset, 0, 0, sizeof(elt), (uint8_t *)&elt);
                  xcb_flush(c);
              }
          }
      
          return EXIT_SUCCESS;
      }
      983e3036
  12. 03 Apr, 2014 1 commit
  13. 28 Mar, 2014 1 commit
    • Keith Packard's avatar
      fb: fix fast-path blt detection · a2880699
      Keith Packard authored
      The width parameter is used to disable the blit fast-path (memcpy) when
      source and destination rows overlap in memory. This check was added in [0].
      
      Unfortunately, the calculation to determine if source and destination
      lines overlapped was incorrect:
        (1) it converts width from pixels to bytes, but width is actually in
            bits, not pixels.
        (2) it adds this byte offset to dst/srcLine, which implicitly converts
            the offset from bytes to sizeof(FbBits).
      
      Fix both of these by converting addresses to byte pointers and width
      to bytes and doing comparisons on the resulting byte address.
      
      For example:
      A 32-bpp 1366 pixel-wide row will have
        width = 1366 * 32 = 43712 bits
        bpp = 32
        (bpp >> 3) = 4
        width * (bpp >> 3) = 174848 FbBits
        (FbBits *)width => 699392 bytes
      
      So, "careful" was true if the destination line was within 699392 bytes,
      instead of just within its 1366 * 4 = 5464 byte row.
      
      This bug causes us to take the slow path for large non-overlapping rows
      that are "close" in memory.  As a data point, XGetImage(1366x768) on my
      ARM chromebook was taking ~140 ms, but with this fixed, it now takes
      about 60 ms.
        XGetImage() -> exaGetImage() -> fbGetImage -> fbBlt()
      
      [0] commit e32cc0b4
      Author: Adam Jackson <ajax@redhat.com>
      Date:   Thu Apr 21 16:37:11 2011 -0400
      
          fb: Fix memcpy abuse
      
          The memcpy fast path implicitly assumes that the copy walks
          left-to-right.  That's not something memcpy guarantees, and newer glibc
          on some processors will indeed break that assumption.  Since we walk a
          line at a time, check the source and destination against the width of
          the blit to determine whether we can be sloppy enough to allow memcpy.
          (Having done this, we can remove the check for !reverse as well.)
      
      v3: Convert to byte units
      
      This first checks to make sure the blt is byte aligned, converts all
      of the data to byte units and then compares for byte address range
      overlap between source and dest.
      Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
      Reviewed-by: default avatarDaniel Kurtz <djkurtz@chromium.org>
      a2880699
  14. 27 Mar, 2014 1 commit
  15. 12 Jan, 2014 1 commit
  16. 10 Sep, 2013 1 commit
  17. 30 Apr, 2013 1 commit
  18. 08 Mar, 2013 1 commit
  19. 15 Feb, 2013 1 commit
  20. 06 Dec, 2012 1 commit
  21. 05 Nov, 2012 1 commit
    • Yaakov Selkowitz's avatar
      fb: fix shadow warnings · 1fe30c00
      Yaakov Selkowitz authored
      fbblt.c: In function 'fbBlt':
      fbblt.c:76:16: warning: declaration of 'src' shadows a previous local
      fbblt.c:52:13: warning: shadowed declaration is here
      fbblt.c:77:16: warning: declaration of 'dst' shadows a previous local
      fbblt.c:52:19: warning: shadowed declaration is here
      fbbltone.c: In function 'fbBltPlane':
      fbbltone.c:742:13: warning: declaration of 'w' shadows a previous local
      fbbltone.c:725:9: warning: shadowed declaration is here
      Signed-off-by: default avatarYaakov Selkowitz <yselkowitz@users.sourceforge.net>
      Reviewed-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      1fe30c00
  22. 25 Oct, 2012 1 commit
    • Søren Sandmann Pedersen's avatar
      Use new pixman_glyph_cache_t API that will be in pixman 0.28.0 · 9cbcb5bd
      Søren Sandmann Pedersen authored
      This new API allows glyphs to be cached in a data structure in pixman,
      and entire glyph strings to be composited in one go.
      
      Also bump pixman dependency to 0.27.2.
      
      Results from the cairo peformance test suite running against Xvfb with
      a screen size of 1680x1050@32bpp:
      
      Speedups
      ========
       xlib          firefox-talos-gfx  12416.63 -> 3603.93   3.45x speedup
      ██▌
       xlib          xfce4-terminal-a1   1727.57 -> 1048.85:  1.65x speedup
      ▋
       xlib                  evolution   1370.49 -> 869.34:   1.58x speedup
      ▋
       xlib         gnome-terminal-vim   1832.83 -> 1251.94:  1.46x speedup
      ▌
       xlib                    poppler   1519.70 -> 1204.05:  1.26x speedup
      ▎
       xlib       firefox-planet-gnome   6982.55 -> 5598.16:  1.25x speedup
      ▎
       xlib                  ocitysmap   1142.77 -> 1071.53:  1.07x speedup
      ▏
      
      No slowdowns were reported.
      
      Results of x11perf -aa10text:
      
      Before:
      
            8000000 reps @   0.0007 msec (1450000.0/sec)
            8000000 reps @   0.0007 msec (1460000.0/sec)
            8000000 reps @   0.0007 msec (1460000.0/sec)
            8000000 reps @   0.0007 msec (1470000.0/sec)
            8000000 reps @   0.0007 msec (1480000.0/sec)
           40000000 trep @   0.0007 msec (1460000.0/sec)
      
      After:
      
           32000000 reps @   0.0002 msec (4910000.0/sec)
           32000000 reps @   0.0002 msec (4830000.0/sec)
           32000000 reps @   0.0002 msec (4890000.0/sec)
           32000000 reps @   0.0002 msec (4830000.0/sec)
           32000000 reps @   0.0002 msec (4900000.0/sec)
          160000000 trep @   0.0002 msec (4870000.0/sec)
      
      Version 2: Destroy the glyph cache at server regen time
      Acked-by: default avatarAaron Plattner <aplattner@nvidia.com>
      Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
      Signed-off-by: default avatarSoren Sandmann <ssp@redhat.com>
      9cbcb5bd
  23. 23 Sep, 2012 1 commit
  24. 14 Aug, 2012 1 commit
  25. 05 Jul, 2012 1 commit
  26. 05 Jun, 2012 1 commit
  27. 21 Mar, 2012 1 commit
    • Keith Packard's avatar
      Introduce a consistent coding style · 9838b703
      Keith Packard authored
      This is strictly the application of the script 'x-indent-all.sh'
      from util/modular. Compared to the patch that Daniel posted in
      January, I've added a few indent flags:
      
      	-bap
      	-psl
      	-T PrivatePtr
      	-T pmWait
      	-T _XFUNCPROTOBEGIN
      	-T _XFUNCPROTOEND
      	-T _X_EXPORT
      
      The typedefs were needed to make the output of sdksyms.sh match the
      previous output, otherwise, the code is formatted badly enough that
      sdksyms.sh generates incorrect output.
      
      The generated code was compared with the previous version and found to
      be essentially identical -- "assert" line numbers and BUILD_TIME were
      the only differences found.
      
      The comparison was done with this script:
      
      dir1=$1
      dir2=$2
      
      for dir in $dir1 $dir2; do
      	(cd $dir && find . -name '*.o' | while read file; do
      		dir=`dirname $file`
      		base=`basename $file .o`
      		dump=$dir/$base.dump
      		objdump -d $file > $dump
      	done)
      done
      
      find $dir1 -name '*.dump' | while read dump; do
      	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
      	diff -u $dump $otherdump
      done
      Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
      Acked-by: default avatarDaniel Stone <daniel@fooishbar.org>
      Acked-by: default avatarAlan Coopersmith <alan.coopersmith@oracle.com>
      9838b703