1. 23 Apr, 2014 19 commits
  2. 22 Apr, 2014 12 commits
    • Eric Anholt's avatar
      glamor: Fix accelerated rendering of GTK's ARGB vs xBGR composites. · e9240342
      Eric Anholt authored
      There is some complicated code to support tweaking the format as we
      upload from a SHM pixmap (aka the GTK icon cache), but if we weren't
      sourcing from a SHM pixmap we just forgot to check that the formats
      matched at all.
      
      We could potentially be a little more discerning here (xRGB source and
      ARGB mask would be fine, for example), but this will all change with
      texture views anyway, so just get the rendering working for 1.16
      release.
      
      Fixes the new rendercheck gtk_argb_xbgr test.
      
      v2: Squash in keithp's fix for checking that we have a non-NULL
          pixmap, and reword the comment even more.
      Signed-off-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
      Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      e9240342
    • Jamey Sharp's avatar
      Make glamor build with --enable-debug. · 4bbee676
      Jamey Sharp authored
      Bad anholt, no biscuit. Broken in commit
      4c9a2007.
      Signed-off-by: Jamey Sharp's avatarJamey Sharp <jamey@minilop.net>
      Cc: Eric Anholt <eric@anholt.net>
      Signed-off-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
      Reviewed-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
      4bbee676
    • Adam Jackson's avatar
      xfixes: Forbid manipulating clip for source-only pictures (#28968) · ba2432a0
      Adam Jackson authored
      Just throw BadPicture instead of crashing.  It's not currently a
      meaningful thing to do anyway, RenderSetPictureRectangles would error if
      you tried (which this patch changes to BadPicture as well for
      consistency).  The problem with trying to do it is if the clip is
      specified as a pixmap then we try to convert it to a region, and
      ->BitmapToRegion requires a ScreenPtr, and source-only pictures don't
      have one.
      
      I can imagine a use for client clip on source-only pictures, so if we
      really wanted to allow this, probably the way forward is to always store
      the clip as a region internally, and when setting the clip _from_ a
      pixmap, look up BitmapToRegion relative to the pixmap not the picture.
      But since clearly nobody can be relying on it working...
      Signed-off-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      ba2432a0
    • Dominik Behr's avatar
      xf86RandR12: use correct gamma size when allocating gamma table · 70e56410
      Dominik Behr authored
      When setting crtc->gamma_size to randr_crtc->gammaSize we should
      use randr_crtc->gammaSize to allocate new gamma table in crtc.
      Currently, if randr_crtc->gammaSize > crtc->gammaSize the subsequent
      memcpy will overwrite memory beyond the end of gamma table.
      Signed-off-by: Dominik Behr's avatarDominik Behr <dbehr@chromium.org>
      Reviewed-by: default avatarStéphane Marchesin <marcheu@chromium.org>
      Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      70e56410
    • Eric Anholt's avatar
      os: Initialize the set of signals to be suppressed during our handler. · 35d275c7
      Eric Anholt authored
      Fixes a valgrind complaint:
      
      ==8805== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
      ==8805==    at 0x5EB8315: __libc_sigaction (sigaction.c:66)
      ==8805==    by 0x5B13DA: busfault_init (busfault.c:145)
      ==8805==    by 0x5A60A2: OsInit (osinit.c:191)
      ==8805==    by 0x46EBA2: dix_main (main.c:163)
      Signed-off-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
      Reviewed-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
      Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
      Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      35d275c7
    • Yunqiang Su's avatar
      Fix hw/xfree86/common/compiler.h for mips64 · 19e5a139
      Yunqiang Su authored
      Mark mips64 as 64bit
      Use long as PORT_SIZE
      Signed-off-by: Yunqiang Su's avatarYunQiang Su <wzssyqa@gmail.com>
      Reviewed-by: Matt Turner's avatarMatt Turner <mattst88@gmail.com>
      Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      19e5a139
    • Adam Jackson's avatar
      xres: Fix size estimation for <8bpp pixmaps (#69057) · f466fb24
      Adam Jackson authored
      Just use floats, it's not like this is a performance path.
      Signed-off-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
      Reviewed-by: Julien Cristau's avatarJulien Cristau <jcristau@debian.org>
      Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      f466fb24
    • Keith Packard's avatar
      shadowfb: Fix compilation errors · 5df66822
      Keith Packard authored
      Ok, that's embarassing -- I didn't even make sure Adam's patch
      compiled. These are minimal fixes to make it build.
      Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      5df66822
    • Adam Jackson's avatar
      shadowfb: Port to miext/damage (#31303, #65547) · 2dcb1672
      Adam Jackson authored
      Somewhat shocking how much simpler this is, isn't it?  We no longer need
      to wrap the screen or GC or Picture, because damage does it for us,
      which is doubly great since the old shadowfb code didn't wrap _enough_
      things (border updates and Render glyphs, at least).  The only real
      difference now between this and shadow is a) shadow will let you track
      arbitrary pixmaps, and b) shadow's update hook runs off the BlockHandler
      whereas shadowfb is immediate.
      
      Tested on nouveau.
      Signed-off-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
      Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      2dcb1672
    • Peter Harris's avatar
      8edeac20
    • Alan Coopersmith's avatar
      dmxConfigCanvasUpdate: Delay dereference until after checking for NULL · 935ea0d7
      Alan Coopersmith authored
      Flagged by cppcheck 1.64:
      [hw/dmx/config/xdmxconfig.c:306] -> [hw/dmx/config/xdmxconfig.c:323]:
       (warning) Possible null pointer dereference: fs - otherwise
                 it is redundant to check it against null.
      Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
      Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      935ea0d7
    • 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: Peter Harris's avatarPeter Harris <pharris@opentext.com>
      Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
      Signed-off-by: Keith Packard's 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
  3. 21 Apr, 2014 9 commits