mesa: update to the latest p_config.h

PIPE_ARCH_*_ENDIAN is replaced by UTIL_ARCH_*_ENDIAN.  We also differ
from Mesa in how arch and endianness are detected.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Chia-I Wu 3 years ago
parent 90ab7ae537
commit 49403c1dfd
  1. 4
      config.h.meson
  2. 6
      meson.build
  3. 2
      src/gallium/auxiliary/util/u_format_table.py
  4. 2
      src/gallium/auxiliary/util/u_math.h
  5. 4
      src/gallium/include/pipe/p_defines.h
  6. 4
      src/gallium/include/pipe/p_format.h
  7. 1
      src/gallium/meson.build
  8. 2
      src/mesa/meson.build
  9. 92
      src/mesa/pipe/p_config.h
  10. 131
      src/mesa/util/detect_os.h
  11. 38
      src/mesa/util/u_endian.h
  12. 4
      src/vrend_renderer.c
  13. 2
      tests/test_virgl_cmd.c

@ -14,8 +14,8 @@
#mesondefine HAVE_EVENTFD_H
#mesondefine HAVE_DLFCN_H
#mesondefine ENABLE_TRACING
#mesondefine PIPE_ARCH_LITTLE_ENDIAN
#mesondefine PIPE_ARCH_BIG_ENDIAN
#mesondefine UTIL_ARCH_LITTLE_ENDIAN
#mesondefine UTIL_ARCH_BIG_ENDIAN
#mesondefine PIPE_ARCH_X86
#mesondefine PIPE_ARCH_X86_64
#mesondefine PIPE_ARCH_PPC

@ -140,9 +140,11 @@ foreach f : ['timespec_get']
endforeach
if host_machine.endian() == 'little'
conf_data.set('PIPE_ARCH_LITTLE_ENDIAN', true)
conf_data.set('UTIL_ARCH_LITTLE_ENDIAN', 1)
conf_data.set('UTIL_ARCH_BIG_ENDIAN', 0)
elif host_machine.endian() == 'big'
conf_data.set('PIPE_ARCH_BIG_ENDIAN', true)
conf_data.set('UTIL_ARCH_LITTLE_ENDIAN', 0)
conf_data.set('UTIL_ARCH_BIG_ENDIAN', 1)
else
error('It wasn\'t possible to figure out the endianess of the machine')
endif

@ -124,7 +124,7 @@ def write_format_table(formats):
if format.nr_channels() <= 1:
func(format.le_channels, format.le_swizzles)
else:
print('#ifdef PIPE_ARCH_BIG_ENDIAN')
print('#if UTIL_ARCH_BIG_ENDIAN')
func(format.be_channels, format.be_swizzles)
print('#else')
func(format.le_channels, format.le_swizzles)

@ -761,7 +761,7 @@ util_bitreverse(unsigned n)
* Convert from little endian to CPU byte order.
*/
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
#define util_le64_to_cpu(x) util_bswap64(x)
#define util_le32_to_cpu(x) util_bswap32(x)
#define util_le16_to_cpu(x) util_bswap16(x)

@ -624,9 +624,9 @@ enum pipe_cap {
enum pipe_endian {
PIPE_ENDIAN_LITTLE = 0,
PIPE_ENDIAN_BIG = 1,
#if defined(PIPE_ARCH_LITTLE_ENDIAN)
#if UTIL_ARCH_LITTLE_ENDIAN
PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_LITTLE
#elif defined(PIPE_ARCH_BIG_ENDIAN)
#elif UTIL_ARCH_BIG_ENDIAN
PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_BIG
#endif
};

@ -402,7 +402,7 @@ extern "C" {
#define PIPE_FORMAT_COUNT VIRGL_FORMAT_MAX
#if defined(PIPE_ARCH_LITTLE_ENDIAN)
#if UTIL_ARCH_LITTLE_ENDIAN
#define PIPE_FORMAT_RGBA8888_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
#define PIPE_FORMAT_RGBX8888_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
#define PIPE_FORMAT_BGRA8888_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
@ -439,7 +439,7 @@ extern "C" {
#define PIPE_FORMAT_GR1616_UNORM PIPE_FORMAT_G16R16_UNORM
#define PIPE_FORMAT_RG1616_SNORM PIPE_FORMAT_R16G16_SNORM
#define PIPE_FORMAT_GR1616_SNORM PIPE_FORMAT_G16R16_SNORM
#elif defined(PIPE_ARCH_BIG_ENDIAN)
#elif UTIL_ARCH_BIG_ENDIAN
#define PIPE_FORMAT_ABGR8888_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
#define PIPE_FORMAT_XBGR8888_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
#define PIPE_FORMAT_ARGB8888_UNORM PIPE_FORMAT_B8G8R8A8_UNORM

@ -22,7 +22,6 @@
#
sources_libgallium = [
'include/pipe/p_config.h',
'include/pipe/p_defines.h',
'include/pipe/p_context.h',
'include/pipe/p_state.h',

@ -1,7 +1,7 @@
# Copyright 2021 Google LLC
# SPDX-License-Identifier: MIT
inc_mesa = include_directories('.', 'compat')
inc_mesa = include_directories('.', 'compat', 'pipe', 'util')
files_mesa = files(
)

@ -47,14 +47,6 @@
#define P_CONFIG_H_
#include <limits.h>
/*
* This has PIPE_ARCH_<ENDIANESS>_ENDIAN defines acquired
* via meson and in the future might have other defines
* if they are found to be easier done on meson than in
* preprocessor macros
*/
#include "config.h"
/*
* Compiler
*/
@ -85,13 +77,11 @@
#define PIPE_CC_ICL
#endif
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#define PIPE_CC_SUNPRO
#endif
/*
* Processor architecture
*
* (virglrenderer) This is detected by meson.
*/
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
@ -100,96 +90,78 @@
#else
#define PIPE_ARCH_SSE
#endif
#if defined(PIPE_CC_GCC) && !defined(__SSSE3__)
/* #warning SSE3 support requires -msse3 compiler options */
#if defined(PIPE_CC_GCC) && (__GNUC__ * 100 + __GNUC_MINOR__) < 409 && !defined(__SSSE3__)
/* #warning SSE3 support requires -msse3 compiler options before GCC 4.9 */
#else
#define PIPE_ARCH_SSSE3
#endif
#endif
/*
* Endian detection.
*/
#include "util/u_endian.h"
/*
* Auto-detect the operating system family.
*
* See subsystem below for a more fine-grained distinction.
*/
#include "util/detect_os.h"
#if defined(__linux__)
#if DETECT_OS_LINUX
#define PIPE_OS_LINUX
#endif
#if DETECT_OS_UNIX
#define PIPE_OS_UNIX
#endif
/*
* Android defines __linux__ so PIPE_OS_LINUX and PIPE_OS_UNIX will also be
* defined.
*/
#if defined(ANDROID)
#if DETECT_OS_ANDROID
#define PIPE_OS_ANDROID
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#if DETECT_OS_FREEBSD
#define PIPE_OS_FREEBSD
#endif
#if DETECT_OS_BSD
#define PIPE_OS_BSD
#define PIPE_OS_UNIX
#endif
#if defined(__OpenBSD__)
#if DETECT_OS_OPENBSD
#define PIPE_OS_OPENBSD
#define PIPE_OS_BSD
#define PIPE_OS_UNIX
#endif
#if defined(__NetBSD__)
#if DETECT_OS_NETBSD
#define PIPE_OS_NETBSD
#define PIPE_OS_BSD
#define PIPE_OS_UNIX
#endif
#if defined(__GNU__)
#if DETECT_OS_DRAGONFLY
#define PIPE_OS_DRAGONFLY
#endif
#if DETECT_OS_HURD
#define PIPE_OS_HURD
#define PIPE_OS_UNIX
#endif
#if defined(__sun)
#if DETECT_OS_SOLARIS
#define PIPE_OS_SOLARIS
#define PIPE_OS_UNIX
#endif
#if defined(__APPLE__)
#if DETECT_OS_APPLE
#define PIPE_OS_APPLE
#define PIPE_OS_UNIX
#endif
#if defined(_WIN32) || defined(WIN32)
#if DETECT_OS_WINDOWS
#define PIPE_OS_WINDOWS
#endif
#if defined(__HAIKU__)
#if DETECT_OS_HAIKU
#define PIPE_OS_HAIKU
#define PIPE_OS_UNIX
#endif
#if defined(__CYGWIN__)
#if DETECT_OS_CYGWIN
#define PIPE_OS_CYGWIN
#define PIPE_OS_UNIX
#endif
/*
* Try to auto-detect the subsystem.
*
* NOTE: There is no way to auto-detect most of these.
*/
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#define PIPE_SUBSYSTEM_DRI
#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
#if defined(PIPE_OS_WINDOWS)
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
/* Windows User-space Library */
#else
#define PIPE_SUBSYSTEM_WINDOWS_USER
#endif
#endif /* PIPE_OS_WINDOWS */
#endif /* P_CONFIG_H_ */

@ -0,0 +1,131 @@
/* SPDX-License-Identifier: MIT */
/* Copyright 2008 VMware, Inc. */
/**
* Auto-detect the operating system family.
*
* See also:
* - http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
* - echo | gcc -dM -E - | sort
* - http://msdn.microsoft.com/en-us/library/b0084kay.aspx
*
* @author José Fonseca <jfonseca@vmware.com>
*/
#ifndef DETECT_OS_H
#define DETECT_OS_H
#if defined(__linux__)
#define DETECT_OS_LINUX 1
#define DETECT_OS_UNIX 1
#endif
/*
* Android defines __linux__, so DETECT_OS_LINUX and DETECT_OS_UNIX will
* also be defined.
*/
#if defined(ANDROID)
#define DETECT_OS_ANDROID 1
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#define DETECT_OS_FREEBSD 1
#define DETECT_OS_BSD 1
#define DETECT_OS_UNIX 1
#endif
#if defined(__OpenBSD__)
#define DETECT_OS_OPENBSD 1
#define DETECT_OS_BSD 1
#define DETECT_OS_UNIX 1
#endif
#if defined(__NetBSD__)
#define DETECT_OS_NETBSD 1
#define DETECT_OS_BSD 1
#define DETECT_OS_UNIX 1
#endif
#if defined(__DragonFly__)
#define DETECT_OS_DRAGONFLY 1
#define DETECT_OS_BSD 1
#define DETECT_OS_UNIX 1
#endif
#if defined(__GNU__)
#define DETECT_OS_HURD 1
#define DETECT_OS_UNIX 1
#endif
#if defined(__sun)
#define DETECT_OS_SOLARIS 1
#define DETECT_OS_UNIX 1
#endif
#if defined(__APPLE__)
#define DETECT_OS_APPLE 1
#define DETECT_OS_UNIX 1
#endif
#if defined(_WIN32) || defined(WIN32)
#define DETECT_OS_WINDOWS 1
#endif
#if defined(__HAIKU__)
#define DETECT_OS_HAIKU 1
#define DETECT_OS_UNIX 1
#endif
#if defined(__CYGWIN__)
#define DETECT_OS_CYGWIN 1
#define DETECT_OS_UNIX 1
#endif
/*
* Make sure DETECT_OS_* are always defined, so that they can be used with #if
*/
#ifndef DETECT_OS_ANDROID
#define DETECT_OS_ANDROID 0
#endif
#ifndef DETECT_OS_APPLE
#define DETECT_OS_APPLE 0
#endif
#ifndef DETECT_OS_BSD
#define DETECT_OS_BSD 0
#endif
#ifndef DETECT_OS_CYGWIN
#define DETECT_OS_CYGWIN 0
#endif
#ifndef DETECT_OS_DRAGONFLY
#define DETECT_OS_DRAGONFLY 0
#endif
#ifndef DETECT_OS_FREEBSD
#define DETECT_OS_FREEBSD 0
#endif
#ifndef DETECT_OS_HAIKU
#define DETECT_OS_HAIKU 0
#endif
#ifndef DETECT_OS_HURD
#define DETECT_OS_HURD 0
#endif
#ifndef DETECT_OS_LINUX
#define DETECT_OS_LINUX 0
#endif
#ifndef DETECT_OS_NETBSD
#define DETECT_OS_NETBSD 0
#endif
#ifndef DETECT_OS_OPENBSD
#define DETECT_OS_OPENBSD 0
#endif
#ifndef DETECT_OS_SOLARIS
#define DETECT_OS_SOLARIS 0
#endif
#ifndef DETECT_OS_UNIX
#define DETECT_OS_UNIX 0
#endif
#ifndef DETECT_OS_WINDOWS
#define DETECT_OS_WINDOWS 0
#endif
#endif /* DETECT_OS_H */

@ -0,0 +1,38 @@
/**************************************************************************
*
* Copyright 2007-2008 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
*
**************************************************************************/
#ifndef U_ENDIAN_H
#define U_ENDIAN_H
/* (virglrenderer) Detected by meson */
#if !defined(UTIL_ARCH_LITTLE_ENDIAN) || !defined(UTIL_ARCH_BIG_ENDIAN)
# error "UTIL_ARCH_LITTLE_ENDIAN and/or UTIL_ARCH_BIG_ENDIAN were unset."
#elif UTIL_ARCH_LITTLE_ENDIAN == UTIL_ARCH_BIG_ENDIAN
# error "UTIL_ARCH_LITTLE_ENDIAN and UTIL_ARCH_BIG_ENDIAN must not both be 1 or 0."
#endif
#endif

@ -8123,7 +8123,7 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
if (actually_invert && !has_feature(feat_mesa_invert))
separate_invert = true;
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
glPixelStorei(GL_PACK_SWAP_BYTES, 1);
#endif
@ -8213,7 +8213,7 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glPixelStorei(GL_PACK_ALIGNMENT, 4);
#ifdef PIPE_ARCH_BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
glPixelStorei(GL_PACK_SWAP_BYTES, 0);
#endif

@ -67,7 +67,7 @@ START_TEST(virgl_test_overlap_obj_id)
}
END_TEST
#ifdef PIPE_ARCH_LITTLE_ENDIAN
#if UTIL_ARCH_LITTLE_ENDIAN
static const uint32_t test_green = 0xff00ff00;
#else
static const uint32_t test_green = 0x00ff00ff;

Loading…
Cancel
Save