diff --git a/glamor_font.h b/glamor_font.h new file mode 100644 index 0000000..36d2062 --- /dev/null +++ b/glamor_font.h @@ -0,0 +1,49 @@ +/* + * 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_FONT_H_ +#define _GLAMOR_FONT_H_ + +typedef struct { + Bool realized; + CharInfoPtr default_char; + CARD8 default_row; + CARD8 default_col; + + GLuint texture_id; + + CARD16 glyph_width_bytes; + CARD16 glyph_width_pixels; + CARD16 glyph_height; + +} glamor_font_t; + +glamor_font_t * +glamor_font_get(ScreenPtr screen, FontPtr font); + +Bool +glamor_font_init(ScreenPtr screen); + +void +glamor_fini_glyph_shader(ScreenPtr screen); + +#endif /* _GLAMOR_FONT_H_ */ diff --git a/glamor_program.h b/glamor_program.h new file mode 100644 index 0000000..88efc35 --- /dev/null +++ b/glamor_program.h @@ -0,0 +1,94 @@ +/* + * 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_PROGRAM_H_ +#define _GLAMOR_PROGRAM_H_ + +typedef enum { + glamor_program_location_none = 0, + glamor_program_location_fg = 1, + glamor_program_location_bg = 2, + glamor_program_location_fill = 4, + glamor_program_location_font = 8, +} glamor_program_location; + +typedef enum { + glamor_program_flag_none = 0, +} glamor_program_flag; + +typedef struct _glamor_program glamor_program; + +typedef Bool (*glamor_use) (PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg); + +typedef struct { + const char *name; + const int version; + const char *vs_vars; + const char *vs_exec; + const char *fs_vars; + const char *fs_exec; + const glamor_program_location locations; + const glamor_program_flag flags; + const char *source_name; + glamor_use use; +} glamor_facet; + +struct _glamor_program { + GLint prog; + GLint failed; + GLint matrix_uniform; + GLint fg_uniform; + GLint bg_uniform; + GLint fill_size_uniform; + GLint fill_offset_uniform; + GLint font_uniform; + glamor_program_location locations; + glamor_program_flag flags; + glamor_use prim_use; + glamor_use fill_use; +}; + +typedef struct { + glamor_program progs[4]; +} glamor_program_fill; + +extern const glamor_facet glamor_fill_solid; + +Bool +glamor_build_program(ScreenPtr screen, + glamor_program *prog, + const glamor_facet *prim, + const glamor_facet *fill); + +Bool +glamor_use_program(PixmapPtr pixmap, + GCPtr gc, + glamor_program *prog, + void *arg); + +glamor_program * +glamor_use_program_fill(PixmapPtr pixmap, + GCPtr gc, + glamor_program_fill *program_fill, + const glamor_facet *prim); + +#endif /* _GLAMOR_PROGRAM_H_ */ diff --git a/glamor_transform.h b/glamor_transform.h new file mode 100644 index 0000000..36b789a --- /dev/null +++ b/glamor_transform.h @@ -0,0 +1,87 @@ +/* + * 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_TRANSFORM_H_ +#define _GLAMOR_TRANSFORM_H_ + +void +glamor_set_destination_drawable(DrawablePtr drawable, + int box_x, + int box_y, + Bool do_drawable_translate, + Bool center_offset, + GLint matrix_uniform_location, + int *p_off_x, + int *p_off_y); + +void +glamor_set_color(PixmapPtr pixmap, + CARD32 pixel, + GLint uniform); + +Bool +glamor_set_texture(PixmapPtr pixmap, + PixmapPtr texture, + int off_x, + int off_y, + GLint offset_uniform, + GLint size_uniform); + +Bool +glamor_set_solid(PixmapPtr pixmap, + GCPtr gc, + Bool use_alu, + GLint uniform); + +Bool +glamor_set_tiled(PixmapPtr pixmap, + GCPtr gc, + GLint offset_uniform, + GLint size_uniform); + +Bool +glamor_set_stippled(PixmapPtr pixmap, + GCPtr gc, + GLint fg_uniform, + GLint offset_uniform, + GLint size_uniform); + +/* + * Vertex shader bits that transform X coordinates to pixmap + * coordinates using the matrix computed above + */ + +#define GLAMOR_DECLARE_MATRIX "uniform vec4 v_matrix;\n" +#define GLAMOR_X_POS(x) #x " *v_matrix.x + v_matrix.y" +#define GLAMOR_Y_POS(y) #y " *v_matrix.z + v_matrix.w" +#if 0 +#define GLAMOR_POS(dst,src) \ + " " #dst ".x = " #src ".x * v_matrix.x + v_matrix.y;\n" \ + " " #dst ".y = " #src ".y * v_matrix.z + v_matrix.w;\n" \ + " " #dst ".z = 0.0;\n" \ + " " #dst ".w = 1.0;\n" +#endif +#define GLAMOR_POS(dst,src) \ + " " #dst ".xy = " #src ".xy * v_matrix.xz + v_matrix.yw;\n" \ + " " #dst ".zw = vec2(0.0,1.0);\n" + +#endif /* _GLAMOR_TRANSFORM_H_ */ diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 5e3bc3e..0c261ed 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -42,7 +42,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.15.99.902 -Release: 1%{?gitdate:.%{gitdate}}%{dist} +Release: 2%{?gitdate:.%{gitdate}}%{dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -77,6 +77,9 @@ Source40: driver-abi-rebuild.sh # workaround for make dist bug in 1.15.99.902, remove once fixed Source50: Xorg.wrap.man Source51: Xwrapper.config.man +Source52: glamor_font.h +Source53: glamor_program.h +Source54: glamor_transform.h # Trivial things to never merge upstream ever: # This really could be done prettier. @@ -204,6 +207,8 @@ Provides: xserver-abi(videodrv-%{git_videodrv_major}) = %{git_videodrv_minor} Provides: xserver-abi(xinput-%{git_xinput_major}) = %{git_xinput_minor} Provides: xserver-abi(extension-%{git_extension_major}) = %{git_extension_minor} %endif +Obsoletes: xorg-x11-glamor < %{version}-%{release} +Provides: xorg-x11-glamor = %{version}-%{release} %if 0%{?fedora} > 17 # Dropped from F18, use a video card instead @@ -310,6 +315,8 @@ Requires: xorg-x11-util-macros Requires: xorg-x11-proto-devel Requires: pkgconfig pixman-devel libpciaccess-devel Provides: xorg-x11-server-static +Obsoletes: xorg-x11-glamor-devel < %{version}-%{release} +Provides: xorg-x11-glamor-devel = %{version}-%{release} %description devel The SDK package provides the developmental files which are necessary for @@ -353,6 +360,7 @@ git commit -a -q -m "%{version} baseline." # workaround for make dist bug in 1.15.99.902, remove once fixed cp %{SOURCE50} %{SOURCE51} hw/xfree86/man +cp %{SOURCE52} %{SOURCE53} %{SOURCE54} glamor # Apply all the patches. git am -p1 %{patches} < /dev/null @@ -385,7 +393,7 @@ test `getminor extension` == %{extension_minor} %global default_font_path "catalogue:/etc/X11/fontpath.d,built-ins" %if %{with_hw_servers} -%global dri_flags --with-dri-driver-path=%{drimoduledir} --enable-dri2 %{?!rhel:--enable-dri3} --enable-suid-wrapper +%global dri_flags --with-dri-driver-path=%{drimoduledir} --enable-dri2 %{?!rhel:--enable-dri3} --enable-suid-wrapper --enable-glamor %else %global dri_flags --disable-dri %endif @@ -529,6 +537,7 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %{_libdir}/xorg/modules/libfbdevhw.so %{_libdir}/xorg/modules/libexa.so %{_libdir}/xorg/modules/libfb.so +%{_libdir}/xorg/modules/libglamoregl.so %{_libdir}/xorg/modules/libshadow.so %{_libdir}/xorg/modules/libshadowfb.so %{_libdir}/xorg/modules/libvgahw.so @@ -603,6 +612,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %changelog +* Wed Apr 23 2014 Hans de Goede - 1.15.99.902-2 +- Add --enable-glamor to configure flags + * Thu Apr 17 2014 Hans de Goede - 1.15.99.902-1 - Update to 1.15.99.902 - Drop the Xwayland as extension patch-set