[PATCH 10/13] glamor: Provide render fallbacks for debugging

walter harms wharms at bfs.de
Tue May 6 04:13:31 PDT 2014



Am 06.05.2014 00:02, schrieb Keith Packard:
> These provide a complete set of fallbacks to isolate the glamor render
> code from the rest of the implementation.
> 
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  glamor/Makefile.am              |   4 +-
>  glamor/glamor.c                 |   4 ++
>  glamor/glamor_render_fallback.c | 127 ++++++++++++++++++++++++++++++++++++++++
>  glamor/glamor_render_fallback.h |  92 +++++++++++++++++++++++++++++
>  4 files changed, 226 insertions(+), 1 deletion(-)
>  create mode 100644 glamor/glamor_render_fallback.c
>  create mode 100644 glamor/glamor_render_fallback.h
> 
> diff --git a/glamor/Makefile.am b/glamor/Makefile.am
> index b248638..422ea32 100644
> --- a/glamor/Makefile.am
> +++ b/glamor/Makefile.am
> @@ -46,7 +46,9 @@ libglamor_la_SOURCES = \
>  	glamor_compositerects.c\
>  	glamor_utils.c\
>  	glamor_utils.h\
> -	glamor.h
> +	glamor.h \
> +	glamor_render_fallback.c \
> +	glamor_render_fallback.h
>  
>  libglamor_egl_stubs_la_SOURCES = glamor_egl_stubs.c
>  
> diff --git a/glamor/glamor.c b/glamor/glamor.c
> index 9fb9c67..6a77538 100644
> --- a/glamor/glamor.c
> +++ b/glamor/glamor.c
> @@ -309,6 +309,10 @@ glamor_create_screen_resources(ScreenPtr screen)
>      return ret;
>  }
>  
> +#if 0
> +#include "glamor_render_fallback.h"
> +#endif
> +

and this is needed why ?

re
 wh

>  /** Set up glamor for an already-configured GL context. */
>  Bool
>  glamor_init(ScreenPtr screen, unsigned int flags)
> diff --git a/glamor/glamor_render_fallback.c b/glamor/glamor_render_fallback.c
> new file mode 100644
> index 0000000..ae55930
> --- /dev/null
> +++ b/glamor/glamor_render_fallback.c
> @@ -0,0 +1,127 @@
> +/*
> + * Copyright © 2014 Keith Packard
> + *
> + * Permission to use, copy, modify, distribute, and sell this software and its
> + * documentation for any purpose is hereby granted without fee, provided that
> + * the above copyright notice appear in all copies and that both that copyright
> + * notice and this permission notice appear in supporting documentation, and
> + * that the name of the copyright holders not be used in advertising or
> + * publicity pertaining to distribution of the software without specific,
> + * written prior permission.  The copyright holders make no representations
> + * about the suitability of this software for any purpose.  It is provided "as
> + * is" without express or implied warranty.
> + *
> + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
> + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
> + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
> + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
> + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
> + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
> + * OF THIS SOFTWARE.
> + */
> +
> +#include "glamor_priv.h"
> +#include "glamor_render_fallback.h"
> +
> +void
> +glamor_composite_fallback(CARD8 op,
> +                          PicturePtr source,
> +                          PicturePtr mask,
> +                          PicturePtr dest,
> +                          INT16 x_source, INT16 y_source,
> +                          INT16 x_mask, INT16 y_mask,
> +                          INT16 x_dest, INT16 y_dest,
> +                          CARD16 width, CARD16 height)
> +{
> +    miCompositeSourceValidate(source);
> +    if (mask)
> +        miCompositeSourceValidate(mask);
> +
> +    if (glamor_prepare_access_picture(dest, GLAMOR_ACCESS_RW) &&
> +        glamor_prepare_access_picture(source, GLAMOR_ACCESS_RO) &&
> +        glamor_prepare_access_picture(mask, GLAMOR_ACCESS_RO))
> +    {
> +        fbComposite(op,
> +                    source, mask, dest,
> +                    x_source, y_source,
> +                    x_mask, y_mask, x_dest, y_dest, width, height);
> +    }
> +    glamor_finish_access_picture(mask);
> +    glamor_finish_access_picture(source);
> +    glamor_finish_access_picture(dest);
> +}
> +
> +void
> +glamor_trapezoids_fallback(CARD8 op,
> +                           PicturePtr src,
> +                           PicturePtr dst,
> +                           PictFormatPtr mask_format,
> +                           INT16 x_src, INT16 y_src,
> +                           int ntrap, xTrapezoid * traps)
> +{
> +    if (glamor_prepare_access_picture(dst, GLAMOR_ACCESS_RW) &&
> +        glamor_prepare_access_picture(src, GLAMOR_ACCESS_RO))
> +    {
> +        fbTrapezoids(op,
> +                     src, dst, mask_format,
> +                     x_src, y_src, ntrap, traps);
> +    }
> +    glamor_finish_access_picture(src);
> +    glamor_finish_access_picture(dst);
> +}
> +
> +void
> +glamor_triangles_fallback(CARD8 op,
> +                          PicturePtr src,
> +                          PicturePtr dst,
> +                          PictFormatPtr mask_format,
> +                          INT16 x_src, INT16 y_src,
> +                          int ntri, xTriangle * tris)
> +{
> +    if (glamor_prepare_access_picture(dst, GLAMOR_ACCESS_RW) &&
> +        glamor_prepare_access_picture(src, GLAMOR_ACCESS_RO))
> +    {
> +        fbTriangles(op,
> +                    src, dst, mask_format,
> +                    x_src, y_src, ntri, tris);
> +    }
> +    glamor_finish_access_picture(src);
> +    glamor_finish_access_picture(dst);
> +}
> +
> +void
> +glamor_add_traps_fallback(PicturePtr picture,
> +                          INT16 x_off, INT16 y_off,
> +                          int ntrap, xTrap * traps)
> +{
> +    if (glamor_prepare_access_picture(picture, GLAMOR_ACCESS_RW))
> +        fbAddTraps(picture, x_off, y_off, ntrap, traps);
> +    glamor_finish_access_picture(picture);
> +}
> +
> +void
> +glamor_glyphs_fallback(CARD8 op,
> +                       PicturePtr src,
> +                       PicturePtr dst,
> +                       PictFormatPtr mask_format,
> +                       INT16 x_src, INT16 y_src,
> +                       int nlist, GlyphListPtr list,
> +                       GlyphPtr * glyphs)
> +{
> +    if (glamor_prepare_access_picture(dst, GLAMOR_ACCESS_RW) &&
> +        glamor_prepare_access_picture(src, GLAMOR_ACCESS_RO))
> +    {
> +        fbGlyphs(op, src, dst, mask_format,
> +                 x_src, y_src,
> +                 nlist, list, glyphs);
> +    }
> +    glamor_finish_access_picture(src);
> +    glamor_finish_access_picture(dst);
> +}
> +
> +void
> +glamor_glyph_unrealize_fallback(ScreenPtr screen,
> +                                GlyphPtr glyph)
> +{
> +    fbUnrealizeGlyph(screen, glyph);
> +}
> diff --git a/glamor/glamor_render_fallback.h b/glamor/glamor_render_fallback.h
> new file mode 100644
> index 0000000..71ccf81
> --- /dev/null
> +++ b/glamor/glamor_render_fallback.h
> @@ -0,0 +1,92 @@
> +/*
> + * Copyright © 2014 Keith Packard
> + *
> + * Permission to use, copy, modify, distribute, and sell this software and its
> + * documentation for any purpose is hereby granted without fee, provided that
> + * the above copyright notice appear in all copies and that both that copyright
> + * notice and this permission notice appear in supporting documentation, and
> + * that the name of the copyright holders not be used in advertising or
> + * publicity pertaining to distribution of the software without specific,
> + * written prior permission.  The copyright holders make no representations
> + * about the suitability of this software for any purpose.  It is provided "as
> + * is" without express or implied warranty.
> + *
> + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
> + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
> + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
> + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
> + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
> + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
> + * OF THIS SOFTWARE.
> + */
> +
> +#ifndef _GLAMOR_RENDER_FALLBACK_H_
> +#define _GLAMOR_RENDER_FALLBACK_H_
> +
> +#include "mipict.h"
> +#include "fbpict.h"
> +
> +void
> +glamor_composite_fallback(CARD8 op,
> +                          PicturePtr source,
> +                          PicturePtr mask,
> +                          PicturePtr dest,
> +                          INT16 x_source, INT16 y_source,
> +                          INT16 x_mask, INT16 y_mask,
> +                          INT16 x_dest, INT16 y_dest,
> +                          CARD16 width, CARD16 height);
> +
> +#define glamor_composite glamor_composite_fallback
> +
> +void
> +glamor_trapezoids_fallback(CARD8 op,
> +                           PicturePtr pSrc,
> +                           PicturePtr pDst,
> +                           PictFormatPtr maskFormat,
> +                           INT16 xSrc, INT16 ySrc,
> +                           int ntrap, xTrapezoid * traps);
> +
> +#define glamor_trapezoids glamor_trapezoids_fallback
> +
> +void
> +glamor_triangles_fallback(CARD8 op,
> +                          PicturePtr src,
> +                          PicturePtr dst,
> +                          PictFormatPtr mask_format,
> +                          INT16 x_src, INT16 y_src,
> +                          int ntri, xTriangle * tris);
> +
> +#define glamor_triangles glamor_triangles_fallback
> +
> +void
> +glamor_add_traps_fallback(PicturePtr picture,
> +                          INT16 x_off, INT16 y_off,
> +                          int ntrap, xTrap * traps);
> +
> +#define glamor_add_traps glamor_add_traps_fallback
> +
> +#define glamor_composite_rectangles miCompositeRects
> +
> +void
> +glamor_glyphs_fallback(CARD8 op,
> +                       PicturePtr src,
> +                       PicturePtr dst,
> +                       PictFormatPtr mask_format,
> +                       INT16 x_src, INT16 y_src,
> +                       int nlist, GlyphListPtr list,
> +                       GlyphPtr * glyphs);
> +
> +
> +#define glamor_glyphs glamor_glyphs_fallback
> +
> +void
> +glamor_glyph_unrealize_fallback(ScreenPtr screen,
> +                                GlyphPtr glyph);
> +
> +#define glamor_glyph_unrealize glamor_glyph_unrealize_fallback
> +
> +#define glamor_create_picture miCreatePicture
> +
> +#define glamor_destroy_picture miDestroyPicture
> +
> +#endif /* _GLAMOR_RENDER_FALLBACK_H_ */


More information about the xorg-devel mailing list