[Mesa-dev] [PATCH] Partially revert "st/xa: Fix advertized version number and try to avoid future discrepancies"

Thomas Hellstrom thellstrom at vmware.com
Mon Apr 7 22:40:14 PDT 2014


Hi!

Thanks, This looks good to me.

Reviewed-by: Thomas Hellstrom <thellstrom at vmware.com>

/Thomas


On 04/07/2014 03:45 PM, Emil Velikov wrote:
> This reverts commit 61bedc3d6b08943f015f9d590c07a6af36c2a92c.
>
> As the header is the one defining the API/ABI and is distributed
> during installation, we should be using it rather than re-defining
> the XA version in configure.ac.
>
> Bump the version in the header to 2.2.0, to reflect what was the
> original intent of commit 42158926c6d7d3ddbe61b9a04d60544ff1b50a96.
>
> Cc: Thomas Hellstrom <thellstrom at vmware.com>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>
> Yikes, thanks for the reminder Thomas.
>
> I've completely missed the "xa_tracker is installed header" part.
>
> Considering that we already have a cannonical place where the
> version is defined, one can simply use it (be that a build system
> or not).
>
> IMHO this approach looks alot better. Hopefully I did not miss
> something this time.
>
> Emil
>
>  configure.ac                                  |  12 +-
>  src/gallium/state_trackers/xa/xa_tracker.h    | 200 ++++++++++++++++++++++++++
>  src/gallium/state_trackers/xa/xa_tracker.h.in | 200 --------------------------
>  3 files changed, 208 insertions(+), 204 deletions(-)
>  create mode 100644 src/gallium/state_trackers/xa/xa_tracker.h
>  delete mode 100644 src/gallium/state_trackers/xa/xa_tracker.h.in
>
> diff --git a/configure.ac b/configure.ac
> index ee5c2d1..1a3ef87 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2000,9 +2000,14 @@ AC_SUBST([VDPAU_MINOR], 0)
>  AC_SUBST([XVMC_MAJOR], 1)
>  AC_SUBST([XVMC_MINOR], 0)
>  
> -AC_SUBST([XA_MAJOR], 2)
> -AC_SUBST([XA_MINOR], 2)
> -AC_SUBST([XA_TINY], 0)
> +XA_HEADER="$srcdir/src/gallium/state_trackers/xa/xa_tracker.h"
> +XA_MAJOR=`grep "#define XA_TRACKER_VERSION_MAJOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MAJOR //'`
> +XA_MINOR=`grep "#define XA_TRACKER_VERSION_MINOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MINOR //'`
> +XA_TINY=`grep "#define XA_TRACKER_VERSION_PATCH" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_PATCH //'`
> +
> +AC_SUBST([XA_MAJOR], $XA_MAJOR)
> +AC_SUBST([XA_MINOR], $XA_MINOR)
> +AC_SUBST([XA_TINY], $XA_TINY)
>  AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
>  
>  dnl Restore LDFLAGS and CPPFLAGS
> @@ -2063,7 +2068,6 @@ AC_CONFIG_FILES([Makefile
>  		src/gallium/state_trackers/vdpau/Makefile
>  		src/gallium/state_trackers/vega/Makefile
>  		src/gallium/state_trackers/xa/Makefile
> -                src/gallium/state_trackers/xa/xa_tracker.h
>  		src/gallium/state_trackers/xvmc/Makefile
>  		src/gallium/targets/Makefile
>  		src/gallium/targets/dri-freedreno/Makefile
> diff --git a/src/gallium/state_trackers/xa/xa_tracker.h b/src/gallium/state_trackers/xa/xa_tracker.h
> new file mode 100644
> index 0000000..5c6435e
> --- /dev/null
> +++ b/src/gallium/state_trackers/xa/xa_tracker.h
> @@ -0,0 +1,200 @@
> +/**********************************************************
> + * Copyright 2009-2011 VMware, Inc. All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person
> + * obtaining a copy of this software and associated documentation
> + * files (the "Software"), to deal in the Software without
> + * restriction, including without limitation the rights to use, copy,
> + * modify, merge, publish, distribute, sublicense, and/or sell copies
> + * of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be
> + * included in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + *
> + * The format encoding idea is partially borrowed from libpixman, but it is not
> + * considered a "substantial part of the software", so the pixman copyright
> + * is left out for simplicity, and acknowledgment is instead given in this way.
> + *
> + *********************************************************
> + * Authors:
> + * Zack Rusin <zackr-at-vmware-dot-com>
> + * Thomas Hellstrom <thellstrom-at-vmware-dot-com>
> + */
> +
> +#ifndef _XA_TRACKER_H_
> +#define _XA_TRACKER_H_
> +
> +#include <stdint.h>
> +
> +#define XA_TRACKER_VERSION_MAJOR 2
> +#define XA_TRACKER_VERSION_MINOR 2
> +#define XA_TRACKER_VERSION_PATCH 0
> +
> +#define XA_FLAG_SHARED         (1 << 0)
> +#define XA_FLAG_RENDER_TARGET  (1 << 1)
> +#define XA_FLAG_SCANOUT        (1 << 2)
> +
> +#define XA_MAP_READ                     (1 << 0)
> +#define XA_MAP_WRITE                    (1 << 1)
> +#define XA_MAP_MAP_DIRECTLY             (1 << 2)
> +#define XA_MAP_UNSYNCHRONIZED           (1 << 3)
> +#define XA_MAP_DONTBLOCK                (1 << 4)
> +#define XA_MAP_DISCARD_WHOLE_RESOURCE   (1 << 5)
> +
> +#define XA_ERR_NONE            0
> +#define XA_ERR_NORES           1
> +#define XA_ERR_INVAL           2
> +#define XA_ERR_BUSY            3
> +
> +enum xa_surface_type {
> +    xa_type_other,
> +    xa_type_a,
> +    xa_type_argb,
> +    xa_type_abgr,
> +    xa_type_bgra,
> +    xa_type_z,
> +    xa_type_zs,
> +    xa_type_sz,
> +    xa_type_yuv_component
> +};
> +
> +/*
> + * Note that these formats should not be assumed to be binary compatible with
> + * pixman formats, but with the below macros and a format type map,
> + * conversion should be simple. Macros for now. We might replace with
> + * inline functions.
> + */
> +
> +#define xa_format(bpp,type,a,r,g,b)	(((bpp) << 24) |  \
> +					 ((type) << 16) | \
> +					 ((a) << 12) |	  \
> +					 ((r) << 8) |	  \
> +					 ((g) << 4) |	  \
> +					 ((b)))
> +/*
> + *  Non-RGBA one- and two component formats.
> + */
> +
> +#define xa_format_c(bpp,type,c1,c2) (((bpp) << 24) |	  \
> +				     ((type) << 16) |	  \
> +				     ((c1) << 8) |	  \
> +				     ((c2)))
> +#define xa_format_bpp(f)	(((f) >> 24)       )
> +#define xa_format_type(f)	(((f) >> 16) & 0xff)
> +#define xa_format_a(f)	(((f) >> 12) & 0x0f)
> +#define xa_format_r(f)	(((f) >>  8) & 0x0f)
> +#define xa_format_g(f)	(((f) >>  4) & 0x0f)
> +#define xa_format_b(f)	(((f)      ) & 0x0f)
> +#define xa_format_rgb(f)	(((f)      ) & 0xfff)
> +#define xa_format_c1(f)          (((f) >> 8 ) & 0xff)
> +#define xa_format_c2(f)          (((f)      ) & 0xff)
> +#define xa_format_argb_depth(f)	(xa_format_a(f) +	\
> +				 xa_format_r(f) +	\
> +				 xa_format_g(f) +	\
> +				 xa_format_b(f))
> +#define xa_format_c_depth(f)    (xa_format_c1(f) + \
> +				 xa_format_c2(f))
> +
> +static inline int
> +xa_format_type_is_color(uint32_t xa_format)
> +{
> +    return (xa_format_type(xa_format) < xa_type_z);
> +}
> +
> +static inline unsigned int
> +xa_format_depth(uint32_t xa_format)
> +{
> +    return ((xa_format_type_is_color(xa_format)) ?
> +	    xa_format_argb_depth(xa_format) : xa_format_c_depth(xa_format));
> +}
> +
> +enum xa_formats {
> +    xa_format_unknown = 0,
> +    xa_format_a8 = xa_format(8, xa_type_a, 8, 0, 0, 0),
> +
> +    xa_format_a8r8g8b8 = xa_format(32, xa_type_argb, 8, 8, 8, 8),
> +    xa_format_x8r8g8b8 = xa_format(32, xa_type_argb, 0, 8, 8, 8),
> +    xa_format_r5g6b5 = xa_format(16, xa_type_argb, 0, 5, 6, 5),
> +    xa_format_x1r5g5b5 = xa_format(16, xa_type_argb, 0, 5, 5, 5),
> +
> +    xa_format_z16 = xa_format_c(16, xa_type_z, 16, 0),
> +    xa_format_z32 = xa_format_c(32, xa_type_z, 32, 0),
> +    xa_format_z24 = xa_format_c(32, xa_type_z, 24, 0),
> +
> +    xa_format_x8z24 = xa_format_c(32, xa_type_sz, 24, 0),
> +    xa_format_s8z24 = xa_format_c(32, xa_type_sz, 24, 8),
> +    xa_format_z24x8 = xa_format_c(32, xa_type_zs, 24, 0),
> +    xa_format_z24s8 = xa_format_c(32, xa_type_zs, 24, 8),
> +
> +    xa_format_yuv8 = xa_format_c(8, xa_type_yuv_component, 8, 0)
> +};
> +
> +struct xa_tracker;
> +struct xa_surface;
> +
> +struct xa_box {
> +    uint16_t x1, y1, x2, y2;
> +};
> +
> +enum xa_handle_type {
> +    xa_handle_type_shared,
> +    xa_handle_type_kms,
> +};
> +
> +extern void xa_tracker_version(int *major, int *minor, int *patch);
> +
> +extern struct xa_tracker *xa_tracker_create(int drm_fd);
> +
> +extern void xa_tracker_destroy(struct xa_tracker *xa);
> +
> +extern int xa_format_check_supported(struct xa_tracker *xa,
> +				     enum xa_formats xa_format,
> +				     unsigned int flags);
> +
> +extern struct xa_surface *xa_surface_create(struct xa_tracker *xa,
> +					    int width,
> +					    int height,
> +					    int depth,
> +					    enum xa_surface_type stype,
> +					    enum xa_formats pform,
> +					    unsigned int flags);
> +
> +extern struct xa_surface * xa_surface_from_handle(struct xa_tracker *xa,
> +					    int width,
> +					    int height,
> +					    int depth,
> +					    enum xa_surface_type stype,
> +					    enum xa_formats pform,
> +					    unsigned int flags,
> +					    uint32_t handle, uint32_t stride);
> +
> +enum xa_formats xa_surface_format(const struct xa_surface *srf);
> +
> +extern struct xa_surface *xa_surface_ref(struct xa_surface *srf);
> +extern void xa_surface_unref(struct xa_surface *srf);
> +
> +extern int xa_surface_redefine(struct xa_surface *srf,
> +			       int width,
> +			       int height,
> +			       int depth,
> +			       enum xa_surface_type stype,
> +			       enum xa_formats rgb_format,
> +			       unsigned int new_flags,
> +			       int copy_contents);
> +
> +extern int xa_surface_handle(struct xa_surface *srf,
> +			     enum xa_handle_type type,
> +			     uint32_t * handle,
> +			     unsigned int *byte_stride);
> +
> +#endif
> diff --git a/src/gallium/state_trackers/xa/xa_tracker.h.in b/src/gallium/state_trackers/xa/xa_tracker.h.in
> deleted file mode 100644
> index 25344f5..0000000
> --- a/src/gallium/state_trackers/xa/xa_tracker.h.in
> +++ /dev/null
> @@ -1,200 +0,0 @@
> -/**********************************************************
> - * Copyright 2009-2011 VMware, Inc. All rights reserved.
> - *
> - * Permission is hereby granted, free of charge, to any person
> - * obtaining a copy of this software and associated documentation
> - * files (the "Software"), to deal in the Software without
> - * restriction, including without limitation the rights to use, copy,
> - * modify, merge, publish, distribute, sublicense, and/or sell copies
> - * of the Software, and to permit persons to whom the Software is
> - * furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice shall be
> - * included in all copies or substantial portions of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> - * SOFTWARE.
> - *
> - * The format encoding idea is partially borrowed from libpixman, but it is not
> - * considered a "substantial part of the software", so the pixman copyright
> - * is left out for simplicity, and acknowledgment is instead given in this way.
> - *
> - *********************************************************
> - * Authors:
> - * Zack Rusin <zackr-at-vmware-dot-com>
> - * Thomas Hellstrom <thellstrom-at-vmware-dot-com>
> - */
> -
> -#ifndef _XA_TRACKER_H_
> -#define _XA_TRACKER_H_
> -
> -#include <stdint.h>
> -
> -#define XA_TRACKER_VERSION_MAJOR @XA_MAJOR@
> -#define XA_TRACKER_VERSION_MINOR @XA_MINOR@
> -#define XA_TRACKER_VERSION_PATCH @XA_TINY@
> -
> -#define XA_FLAG_SHARED         (1 << 0)
> -#define XA_FLAG_RENDER_TARGET  (1 << 1)
> -#define XA_FLAG_SCANOUT        (1 << 2)
> -
> -#define XA_MAP_READ                     (1 << 0)
> -#define XA_MAP_WRITE                    (1 << 1)
> -#define XA_MAP_MAP_DIRECTLY             (1 << 2)
> -#define XA_MAP_UNSYNCHRONIZED           (1 << 3)
> -#define XA_MAP_DONTBLOCK                (1 << 4)
> -#define XA_MAP_DISCARD_WHOLE_RESOURCE   (1 << 5)
> -
> -#define XA_ERR_NONE            0
> -#define XA_ERR_NORES           1
> -#define XA_ERR_INVAL           2
> -#define XA_ERR_BUSY            3
> -
> -enum xa_surface_type {
> -    xa_type_other,
> -    xa_type_a,
> -    xa_type_argb,
> -    xa_type_abgr,
> -    xa_type_bgra,
> -    xa_type_z,
> -    xa_type_zs,
> -    xa_type_sz,
> -    xa_type_yuv_component
> -};
> -
> -/*
> - * Note that these formats should not be assumed to be binary compatible with
> - * pixman formats, but with the below macros and a format type map,
> - * conversion should be simple. Macros for now. We might replace with
> - * inline functions.
> - */
> -
> -#define xa_format(bpp,type,a,r,g,b)	(((bpp) << 24) |  \
> -					 ((type) << 16) | \
> -					 ((a) << 12) |	  \
> -					 ((r) << 8) |	  \
> -					 ((g) << 4) |	  \
> -					 ((b)))
> -/*
> - *  Non-RGBA one- and two component formats.
> - */
> -
> -#define xa_format_c(bpp,type,c1,c2) (((bpp) << 24) |	  \
> -				     ((type) << 16) |	  \
> -				     ((c1) << 8) |	  \
> -				     ((c2)))
> -#define xa_format_bpp(f)	(((f) >> 24)       )
> -#define xa_format_type(f)	(((f) >> 16) & 0xff)
> -#define xa_format_a(f)	(((f) >> 12) & 0x0f)
> -#define xa_format_r(f)	(((f) >>  8) & 0x0f)
> -#define xa_format_g(f)	(((f) >>  4) & 0x0f)
> -#define xa_format_b(f)	(((f)      ) & 0x0f)
> -#define xa_format_rgb(f)	(((f)      ) & 0xfff)
> -#define xa_format_c1(f)          (((f) >> 8 ) & 0xff)
> -#define xa_format_c2(f)          (((f)      ) & 0xff)
> -#define xa_format_argb_depth(f)	(xa_format_a(f) +	\
> -				 xa_format_r(f) +	\
> -				 xa_format_g(f) +	\
> -				 xa_format_b(f))
> -#define xa_format_c_depth(f)    (xa_format_c1(f) + \
> -				 xa_format_c2(f))
> -
> -static inline int
> -xa_format_type_is_color(uint32_t xa_format)
> -{
> -    return (xa_format_type(xa_format) < xa_type_z);
> -}
> -
> -static inline unsigned int
> -xa_format_depth(uint32_t xa_format)
> -{
> -    return ((xa_format_type_is_color(xa_format)) ?
> -	    xa_format_argb_depth(xa_format) : xa_format_c_depth(xa_format));
> -}
> -
> -enum xa_formats {
> -    xa_format_unknown = 0,
> -    xa_format_a8 = xa_format(8, xa_type_a, 8, 0, 0, 0),
> -
> -    xa_format_a8r8g8b8 = xa_format(32, xa_type_argb, 8, 8, 8, 8),
> -    xa_format_x8r8g8b8 = xa_format(32, xa_type_argb, 0, 8, 8, 8),
> -    xa_format_r5g6b5 = xa_format(16, xa_type_argb, 0, 5, 6, 5),
> -    xa_format_x1r5g5b5 = xa_format(16, xa_type_argb, 0, 5, 5, 5),
> -
> -    xa_format_z16 = xa_format_c(16, xa_type_z, 16, 0),
> -    xa_format_z32 = xa_format_c(32, xa_type_z, 32, 0),
> -    xa_format_z24 = xa_format_c(32, xa_type_z, 24, 0),
> -
> -    xa_format_x8z24 = xa_format_c(32, xa_type_sz, 24, 0),
> -    xa_format_s8z24 = xa_format_c(32, xa_type_sz, 24, 8),
> -    xa_format_z24x8 = xa_format_c(32, xa_type_zs, 24, 0),
> -    xa_format_z24s8 = xa_format_c(32, xa_type_zs, 24, 8),
> -
> -    xa_format_yuv8 = xa_format_c(8, xa_type_yuv_component, 8, 0)
> -};
> -
> -struct xa_tracker;
> -struct xa_surface;
> -
> -struct xa_box {
> -    uint16_t x1, y1, x2, y2;
> -};
> -
> -enum xa_handle_type {
> -    xa_handle_type_shared,
> -    xa_handle_type_kms,
> -};
> -
> -extern void xa_tracker_version(int *major, int *minor, int *patch);
> -
> -extern struct xa_tracker *xa_tracker_create(int drm_fd);
> -
> -extern void xa_tracker_destroy(struct xa_tracker *xa);
> -
> -extern int xa_format_check_supported(struct xa_tracker *xa,
> -				     enum xa_formats xa_format,
> -				     unsigned int flags);
> -
> -extern struct xa_surface *xa_surface_create(struct xa_tracker *xa,
> -					    int width,
> -					    int height,
> -					    int depth,
> -					    enum xa_surface_type stype,
> -					    enum xa_formats pform,
> -					    unsigned int flags);
> -
> -extern struct xa_surface * xa_surface_from_handle(struct xa_tracker *xa,
> -					    int width,
> -					    int height,
> -					    int depth,
> -					    enum xa_surface_type stype,
> -					    enum xa_formats pform,
> -					    unsigned int flags,
> -					    uint32_t handle, uint32_t stride);
> -
> -enum xa_formats xa_surface_format(const struct xa_surface *srf);
> -
> -extern struct xa_surface *xa_surface_ref(struct xa_surface *srf);
> -extern void xa_surface_unref(struct xa_surface *srf);
> -
> -extern int xa_surface_redefine(struct xa_surface *srf,
> -			       int width,
> -			       int height,
> -			       int depth,
> -			       enum xa_surface_type stype,
> -			       enum xa_formats rgb_format,
> -			       unsigned int new_flags,
> -			       int copy_contents);
> -
> -extern int xa_surface_handle(struct xa_surface *srf,
> -			     enum xa_handle_type type,
> -			     uint32_t * handle,
> -			     unsigned int *byte_stride);
> -
> -#endif


More information about the mesa-dev mailing list