Mesa (master): tegra: Fix scanout resources without modifiers
Module: Mesa Branch: master Commit: 9603d81df05105857b676f20dff964ef3ab0ecff URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9603d81df05105857b676f20dff964ef3ab0ecff Author: Thierry Reding Date: Thu Mar 15 21:59:02 2018 +0100 tegra: Fix scanout resources without modifiers Resources created for scanout but without modifiers need to be treated as pitch-linear. This is because applications that don't use modifiers to create resources must be assumed to not understand modifiers and in turn won't be able to create a DRM framebuffer and passing along which modifiers were picked by the implementation. Tested-by: Daniel Kolesa Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Thierry Reding --- src/gallium/drivers/tegra/tegra_screen.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/tegra/tegra_screen.c b/src/gallium/drivers/tegra/tegra_screen.c index 41bf2052f9..8b61c09016 100644 --- a/src/gallium/drivers/tegra/tegra_screen.c +++ b/src/gallium/drivers/tegra/tegra_screen.c @@ -260,6 +260,7 @@ tegra_screen_resource_create(struct pipe_screen *pscreen, const struct pipe_resource *template) { struct tegra_screen *screen = to_tegra_screen(pscreen); + uint64_t modifier = DRM_FORMAT_MOD_INVALID; struct tegra_resource *resource; int err; @@ -267,7 +268,23 @@ tegra_screen_resource_create(struct pipe_screen *pscreen, if (!resource) return NULL; - resource->gpu = screen->gpu->resource_create(screen->gpu, template); + /* +* Applications that create scanout resources without modifiers are very +* unlikely to support modifiers at all. In that case the resources need +* to be created with a pitch-linear layout so that they can be properly +* shared with scanout hardware. +* +* Technically it is possible for applications to create resources without +* specifying a modifier but still query the modifier associated with the +* resource (e.g. using gbm_bo_get_modifier()) before handing it to the +* framebuffer creation API (such as the DRM_IOCTL_MODE_ADDFB2 IOCTL). +*/ + if (template->bind & PIPE_BIND_SCANOUT) + modifier = DRM_FORMAT_MOD_LINEAR; + + resource->gpu = screen->gpu->resource_create_with_modifiers(screen->gpu, + template, + &modifier, 1); if (!resource->gpu) goto free; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): tegra: Remove usage of non-stable UAPI
Module: Mesa Branch: master Commit: bd3e97e5aad7800b8e17ed10d34a070926691945 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd3e97e5aad7800b8e17ed10d34a070926691945 Author: Thierry Reding Date: Mon Mar 12 17:53:51 2018 +0100 tegra: Remove usage of non-stable UAPI This code path is no longer required with framebuffer modifier support. Tested-by: Daniel Kolesa Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Thierry Reding --- src/gallium/drivers/tegra/tegra_screen.c | 69 ++-- 1 file changed, 3 insertions(+), 66 deletions(-) diff --git a/src/gallium/drivers/tegra/tegra_screen.c b/src/gallium/drivers/tegra/tegra_screen.c index 669f22a194..41bf2052f9 100644 --- a/src/gallium/drivers/tegra/tegra_screen.c +++ b/src/gallium/drivers/tegra/tegra_screen.c @@ -219,11 +219,9 @@ free: } static int tegra_screen_import_resource(struct tegra_screen *screen, -struct tegra_resource *resource, -bool has_modifiers) +struct tegra_resource *resource) { unsigned usage = PIPE_HANDLE_USAGE_READ; - struct drm_tegra_gem_set_tiling args; struct winsys_handle handle; boolean status; int fd, err; @@ -254,67 +252,6 @@ static int tegra_screen_import_resource(struct tegra_screen *screen, close(fd); - if (!has_modifiers) { - memset(&args, 0, sizeof(args)); - args.handle = resource->handle; - - switch (handle.modifier) { - case DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED: -args.mode = DRM_TEGRA_GEM_TILING_MODE_TILED; -break; - - case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB: -args.mode = DRM_TEGRA_GEM_TILING_MODE_BLOCK; -args.value = 0; -break; - - case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB: -args.mode = DRM_TEGRA_GEM_TILING_MODE_BLOCK; -args.value = 1; -break; - - case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB: -args.mode = DRM_TEGRA_GEM_TILING_MODE_BLOCK; -args.value = 2; -break; - - case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB: -args.mode = DRM_TEGRA_GEM_TILING_MODE_BLOCK; -args.value = 3; -break; - - case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB: -args.mode = DRM_TEGRA_GEM_TILING_MODE_BLOCK; -args.value = 4; -break; - - case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB: -args.mode = DRM_TEGRA_GEM_TILING_MODE_BLOCK; -args.value = 5; -break; - - default: -debug_printf("unsupported modifier %" PRIx64 ", assuming linear\n", - handle.modifier); -/* fall-through */ - - case DRM_FORMAT_MOD_LINEAR: -args.mode = DRM_TEGRA_GEM_TILING_MODE_PITCH; -break; - } - - err = drmIoctl(screen->fd, DRM_IOCTL_TEGRA_GEM_SET_TILING, &args); - if (err < 0) { - fprintf(stderr, "failed to set tiling parameters: %s\n", - strerror(errno)); - err = -errno; - goto out; - } - } - - return 0; - -out: return err; } @@ -336,7 +273,7 @@ tegra_screen_resource_create(struct pipe_screen *pscreen, /* import scanout buffers for display */ if (template->bind & PIPE_BIND_SCANOUT) { - err = tegra_screen_import_resource(screen, resource, false); + err = tegra_screen_import_resource(screen, resource); if (err < 0) goto destroy; } @@ -575,7 +512,7 @@ tegra_screen_resource_create_with_modifiers(struct pipe_screen *pscreen, if (!resource->gpu) goto free; - err = tegra_screen_import_resource(screen, resource, true); + err = tegra_screen_import_resource(screen, resource); if (err < 0) goto destroy; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): tegra: Treat resources with modifiers as scanout
Module: Mesa Branch: master Commit: 9e539012dfaa848fc4cfde83c3f3a83fee274ca4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e539012dfaa848fc4cfde83c3f3a83fee274ca4 Author: Thierry Reding Date: Wed Apr 4 16:04:25 2018 +0200 tegra: Treat resources with modifiers as scanout Resources created with modifiers are treated as scanout because there is no way for applications to specify the usage (though that capability may be useful to have in the future). Currently all the resources created by applications with modifiers are for scanout, so make sure they have bind flags set accordingly. This is necessary in order to properly export buffers for such resources so that they can be shared with scanout hardware. Tested-by: Daniel Kolesa Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Thierry Reding --- src/gallium/drivers/tegra/tegra_screen.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/tegra/tegra_screen.c b/src/gallium/drivers/tegra/tegra_screen.c index 8b61c09016..e03e71f81a 100644 --- a/src/gallium/drivers/tegra/tegra_screen.c +++ b/src/gallium/drivers/tegra/tegra_screen.c @@ -515,6 +515,7 @@ tegra_screen_resource_create_with_modifiers(struct pipe_screen *pscreen, int count) { struct tegra_screen *screen = to_tegra_screen(pscreen); + struct pipe_resource tmpl = *template; struct tegra_resource *resource; int err; @@ -522,8 +523,18 @@ tegra_screen_resource_create_with_modifiers(struct pipe_screen *pscreen, if (!resource) return NULL; + /* +* Assume that resources created with modifiers will always be used for +* scanout. This is necessary because some of the APIs that are used to +* create resources with modifiers (e.g. gbm_bo_create_with_modifiers()) +* can't pass along usage information. Adding that capability might be +* worth adding to remove this ambiguity. Not all future use-cases that +* involve modifiers may always be targetting scanout hardware. +*/ + tmpl.bind |= PIPE_BIND_SCANOUT; + resource->gpu = screen->gpu->resource_create_with_modifiers(screen->gpu, - template, + &tmpl, modifiers, count); if (!resource->gpu) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): drm/tegra: Sanitize format modifiers
Module: Mesa Branch: master Commit: 75bf4896282b89cb06e3638941479d306b63b163 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=75bf4896282b89cb06e3638941479d306b63b163 Author: Thierry Reding Date: Tue Feb 20 15:48:37 2018 +0100 drm/tegra: Sanitize format modifiers The existing format modifier definitions were merged prematurely, and recent work has unveiled that the definitions are suboptimal in several ways: - The format specifiers, except for one, are not Tegra specific, but the names don't reflect that. - The number space is split into two, reserving 32 bits for some "parameter" which most of the modifiers are not going to have. - Symbolic names for the modifiers are not using the standard DRM_FORMAT_MOD_* prefix, which makes them awkward to use. - The vendor prefix NV is somewhat ambiguous. Fortunately, nobody's started using these modifiers, so we can still fix the above issues. Do so by using the standard prefix. Also, remove TEGRA from the name of those modifiers that exist on NVIDIA GPUs as well. In case of the block linear modifiers, make the "parameter" smaller (4 bits, though only 6 values are valid) and don't let that leak into any of the other modifiers. Finally, also use the more canonical NVIDIA instead of the ambiguous NV prefix. This is based on commit 268892cb63a822315921a8dab48ac3e4abf7dd03 from Linux v4.16-rc1. Acked-by: Emil Velikov Tested-by: Andre Heider Signed-off-by: Thierry Reding --- include/drm-uapi/drm_fourcc.h | 36 +++- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/include/drm-uapi/drm_fourcc.h b/include/drm-uapi/drm_fourcc.h index a76ed8f9e3..e04613d30a 100644 --- a/include/drm-uapi/drm_fourcc.h +++ b/include/drm-uapi/drm_fourcc.h @@ -178,7 +178,7 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_NONE0 #define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 #define DRM_FORMAT_MOD_VENDOR_AMD 0x02 -#define DRM_FORMAT_MOD_VENDOR_NV 0x03 +#define DRM_FORMAT_MOD_VENDOR_NVIDIA 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM0x05 #define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06 @@ -338,29 +338,17 @@ extern "C" { */ #define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4) -/* NVIDIA Tegra frame buffer modifiers */ - -/* - * Some modifiers take parameters, for example the number of vertical GOBs in - * a block. Reserve the lower 32 bits for parameters - */ -#define __fourcc_mod_tegra_mode_shift 32 -#define fourcc_mod_tegra_code(val, params) \ - fourcc_mod_code(NV, __u64)val) << __fourcc_mod_tegra_mode_shift) | params)) -#define fourcc_mod_tegra_mod(m) \ - (m & ~((1ULL << __fourcc_mod_tegra_mode_shift) - 1)) -#define fourcc_mod_tegra_param(m) \ - (m & ((1ULL << __fourcc_mod_tegra_mode_shift) - 1)) +/* NVIDIA frame buffer modifiers */ /* * Tegra Tiled Layout, used by Tegra 2, 3 and 4. * * Pixels are arranged in simple tiles of 16 x 16 bytes. */ -#define NV_FORMAT_MOD_TEGRA_TILED fourcc_mod_tegra_code(1, 0) +#define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1) /* - * Tegra 16Bx2 Block Linear layout, used by TK1/TX1 + * 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1 and later * * Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked * vertically by a power of 2 (1 to 32 GOBs) to form a block. @@ -380,7 +368,21 @@ extern "C" { * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format * in full detail. */ -#define NV_FORMAT_MOD_TEGRA_16BX2_BLOCK(v) fourcc_mod_tegra_code(2, v) +#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) \ + fourcc_mod_code(NVIDIA, 0x10 | ((v) & 0xf)) + +#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB \ + fourcc_mod_code(NVIDIA, 0x10) +#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB \ + fourcc_mod_code(NVIDIA, 0x11) +#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB \ + fourcc_mod_code(NVIDIA, 0x12) +#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB \ + fourcc_mod_code(NVIDIA, 0x13) +#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB \ + fourcc_mod_code(NVIDIA, 0x14) +#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB \ + fourcc_mod_code(NVIDIA, 0x15) /* * Broadcom VC4 "T" format ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): autotools: Add tegra to AM_DISTCHECK_CONFIGURE_FLAGS
Module: Mesa Branch: master Commit: 6d4d46bca9c58c81c1af98a5bd4909d91558fef4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d4d46bca9c58c81c1af98a5bd4909d91558fef4 Author: Thierry Reding Date: Thu Feb 22 18:21:45 2018 +0100 autotools: Add tegra to AM_DISTCHECK_CONFIGURE_FLAGS This allows the driver to be built on a make distcheck and makes sure that it properly builds when a distribution tarball is made. Suggested-by: Emil Velikov Signed-off-by: Thierry Reding --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 5c3a6717d3..de6921bf1f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,7 +45,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \ --enable-libunwind \ --with-platforms=x11,wayland,drm,surfaceless \ --with-dri-drivers=i915,i965,nouveau,radeon,r200,swrast \ - --with-gallium-drivers=i915,nouveau,r300,pl111,r600,radeonsi,freedreno,svga,swrast,vc4,virgl,swr,etnaviv,imx \ + --with-gallium-drivers=i915,nouveau,r300,pl111,r600,radeonsi,freedreno,svga,swrast,vc4,tegra,virgl,swr,etnaviv,imx \ --with-vulkan-drivers=intel,radeon ACLOCAL_AMFLAGS = -I m4 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nouveau: Add framebuffer modifier support
Module: Mesa Branch: master Commit: 2052dbdae363f4fd184842733ff9c96bd6e7f08c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2052dbdae363f4fd184842733ff9c96bd6e7f08c Author: Thierry Reding Date: Wed Oct 11 14:38:56 2017 +0200 nouveau: Add framebuffer modifier support This adds support for framebuffer modifiers to Nouveau. This will be used by the Tegra driver to share metadata about the format of buffers (such as the tiling mode or compression). Changes in v2: - remove unused parameters to nouveau_buffer_create() - move format modifier query code to nvc0 backend - restrict format modifiers to 2D textures - implement ->query_dmabuf_modifiers() Changes in v4: - add UAPI include path on meson builds Changes in v5: - remove unnecessary includes Acked-by: Emil Velikov Tested-by: Andre Heider Reviewed-by: Ilia Mirkin Signed-off-by: Thierry Reding --- src/gallium/drivers/nouveau/Android.mk | 3 + src/gallium/drivers/nouveau/Makefile.am | 1 + src/gallium/drivers/nouveau/meson.build | 4 +- src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c | 81 +++- src/gallium/drivers/nouveau/nvc0/nvc0_resource.c | 59 - src/gallium/drivers/nouveau/nvc0/nvc0_resource.h | 3 +- 6 files changed, 146 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/nouveau/Android.mk b/src/gallium/drivers/nouveau/Android.mk index 2de22e73ec..a446774a86 100644 --- a/src/gallium/drivers/nouveau/Android.mk +++ b/src/gallium/drivers/nouveau/Android.mk @@ -36,6 +36,9 @@ LOCAL_SRC_FILES := \ $(NVC0_CODEGEN_SOURCES) \ $(NVC0_C_SOURCES) +LOCAL_C_INCLUDES := \ + $(MESA_TOP)/include/drm-uapi + LOCAL_SHARED_LIBRARIES := libdrm_nouveau LOCAL_MODULE := libmesa_pipe_nouveau diff --git a/src/gallium/drivers/nouveau/Makefile.am b/src/gallium/drivers/nouveau/Makefile.am index 91547178e3..f6126b5448 100644 --- a/src/gallium/drivers/nouveau/Makefile.am +++ b/src/gallium/drivers/nouveau/Makefile.am @@ -24,6 +24,7 @@ include Makefile.sources include $(top_srcdir)/src/gallium/Automake.inc AM_CPPFLAGS = \ + -I$(top_srcdir)/include/drm-uapi \ $(GALLIUM_DRIVER_CFLAGS) \ $(LIBDRM_CFLAGS) \ $(NOUVEAU_CFLAGS) diff --git a/src/gallium/drivers/nouveau/meson.build b/src/gallium/drivers/nouveau/meson.build index e44be2616e..242ee0e000 100644 --- a/src/gallium/drivers/nouveau/meson.build +++ b/src/gallium/drivers/nouveau/meson.build @@ -207,7 +207,9 @@ files_libnouveau = files( libnouveau = static_library( 'nouveau', [files_libnouveau], - include_directories : [inc_src, inc_include, inc_gallium, inc_gallium_aux], + include_directories : [ +inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_drm_uapi + ], c_args : [c_vis_args], cpp_args : [cpp_vis_args], dependencies : [dep_libdrm, dep_libdrm_nouveau], diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c index 27674f72a7..7983c40308 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c @@ -20,8 +20,11 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include + #include "pipe/p_state.h" #include "pipe/p_defines.h" +#include "state_tracker/drm_driver.h" #include "util/u_inlines.h" #include "util/u_format.h" @@ -233,9 +236,79 @@ nvc0_miptree_init_layout_tiled(struct nv50_miptree *mt) } } +static uint64_t nvc0_miptree_get_modifier(struct nv50_miptree *mt) +{ + union nouveau_bo_config *config = &mt->base.bo->config; + uint64_t modifier; + + if (mt->layout_3d) + return DRM_FORMAT_MOD_INVALID; + + switch (config->nvc0.memtype) { + case 0x00: + modifier = DRM_FORMAT_MOD_LINEAR; + break; + + case 0xfe: + switch (NVC0_TILE_MODE_Y(config->nvc0.tile_mode)) { + case 0: + modifier = DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB; + break; + + case 1: + modifier = DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB; + break; + + case 2: + modifier = DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB; + break; + + case 3: + modifier = DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB; + break; + + case 4: + modifier = DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB; + break; + + case 5: + modifier = DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB; + break; + + default: + modifier = DRM_FORMAT_MOD_INVALID; + break; + } + break; + + default: + modifier = DRM_FORMAT_MOD_INVALID; + break; + } + + return modifier; +} + +static boolean +nvc0_miptree_get_handle(struct pipe_screen *pscreen, +struct pipe_resource *pt, +struct winsys_handle *whandle) +{ + struct nv50_miptree *mt = nv50_miptree(pt); + boolean ret; + + re
Mesa (master): drm/fourcc: Fix fourcc_mod_code() definition
Module: Mesa Branch: master Commit: ffc85cfac0d96396390aa8414f24567231902087 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ffc85cfac0d96396390aa8414f24567231902087 Author: Thierry Reding Date: Tue Feb 20 15:47:25 2018 +0100 drm/fourcc: Fix fourcc_mod_code() definition Avoid a compiler warnings when the val parameter is an expression. This is based on commit 5843f4e02fbe86a59981e35adc6cabebee46fdc0 from Linux v4.16-rc1. Acked-by: Emil Velikov Tested-by: Andre Heider Signed-off-by: Thierry Reding --- include/drm-uapi/drm_fourcc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/drm-uapi/drm_fourcc.h b/include/drm-uapi/drm_fourcc.h index 3ad838d3f9..a76ed8f9e3 100644 --- a/include/drm-uapi/drm_fourcc.h +++ b/include/drm-uapi/drm_fourcc.h @@ -188,7 +188,7 @@ extern "C" { #define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) #define fourcc_mod_code(vendor, val) \ - __u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffULL)) + __u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffULL)) /* * Format Modifier tokens: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nouveau/nvc0: Extract common tile mode macro
Module: Mesa Branch: master Commit: b964cab80a094207cbdc33c56d0904533670c8a9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b964cab80a094207cbdc33c56d0904533670c8a9 Author: Thierry Reding Date: Wed Oct 11 14:41:26 2017 +0200 nouveau/nvc0: Extract common tile mode macro Add a new macro that can be used to extract the tiling mode from a tile_mode value. This is will be used to determine the number of GOBs used in block linear mode. Acked-by: Emil Velikov Tested-by: Andre Heider Reviewed-by: Ilia Mirkin Signed-off-by: Thierry Reding --- src/gallium/drivers/nouveau/nvc0/nvc0_resource.h | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h index 0d5f026d6e..c68a509483 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h @@ -6,14 +6,17 @@ #define NVC0_RESOURCE_FLAG_VIDEO (NOUVEAU_RESOURCE_FLAG_DRV_PRIV << 0) +#define NVC0_TILE_MODE_X(m) (((m) >> 0) & 0xf) +#define NVC0_TILE_MODE_Y(m) (((m) >> 4) & 0xf) +#define NVC0_TILE_MODE_Z(m) (((m) >> 8) & 0xf) -#define NVC0_TILE_SHIFT_X(m) m) >> 0) & 0xf) + 6) -#define NVC0_TILE_SHIFT_Y(m) m) >> 4) & 0xf) + 3) -#define NVC0_TILE_SHIFT_Z(m) m) >> 8) & 0xf) + 0) +#define NVC0_TILE_SHIFT_X(m) (NVC0_TILE_MODE_X(m) + 6) +#define NVC0_TILE_SHIFT_Y(m) (NVC0_TILE_MODE_Y(m) + 3) +#define NVC0_TILE_SHIFT_Z(m) (NVC0_TILE_MODE_Z(m) + 0) -#define NVC0_TILE_SIZE_X(m) (64 << (((m) >> 0) & 0xf)) -#define NVC0_TILE_SIZE_Y(m) ( 8 << (((m) >> 4) & 0xf)) -#define NVC0_TILE_SIZE_Z(m) ( 1 << (((m) >> 8) & 0xf)) +#define NVC0_TILE_SIZE_X(m) (64 << NVC0_TILE_MODE_X(m)) +#define NVC0_TILE_SIZE_Y(m) ( 8 << NVC0_TILE_MODE_Y(m)) +#define NVC0_TILE_SIZE_Z(m) ( 1 << NVC0_TILE_MODE_Z(m)) /* it's ok to mask only in the end because max value is 3 * 5 */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): tegra: Initial support
Module: Mesa Branch: master Commit: 1755f608f5201e0a23f00cc3ea1b01edd07eb6ef URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1755f608f5201e0a23f00cc3ea1b01edd07eb6ef Author: Thierry Reding Date: Wed May 28 00:36:48 2014 +0200 tegra: Initial support Tegra K1 and later use a GPU that can be driven by the Nouveau driver. But the GPU is a pure render node and has no display engine, hence the scanout needs to happen on the Tegra display hardware. The GPU and the display engine each have a separate DRM device node exposed by the kernel. To make the setup appear as a single device, this driver instantiates a Nouveau screen with each instance of a Tegra screen and forwards GPU requests to the Nouveau screen. For purposes of scanout it will import buffers created on the GPU into the display driver. Handles that userspace requests are those of the display driver so that they can be used to create framebuffers. This has been tested with some GBM test programs, as well as kmscube and weston. All of those run without modifications, but I'm sure there is a lot that can be improved. Some fixes contributed by Hector Martin . Changes in v2: - duplicate file descriptor in winsys to avoid potential issues - require nouveau when building the tegra driver - check for nouveau driver name on render node - remove unneeded dependency on libdrm_tegra - remove zombie references to libudev - add missing headers to C_SOURCES variable - drop unneeded tegra/ prefix for includes - open device files with O_CLOEXEC - update copyrights Changes in v3: - properly unwrap resources in ->resource_copy_region() - support vertex buffers passed by user pointer - allocate custom stream and const uploader - silence error message on pre-Tegra124 - support X without explicit PRIME Changes in v4: - ship Meson build files in distribution tarball - drop duplicate driver_tegra dependency Reviewed-by: Emil Velikov Acked-by: Emil Velikov Tested-by: Andre Heider Reviewed-by: Dmitry Osipenko Reviewed-by: Dylan Baker Signed-off-by: Thierry Reding --- configure.ac | 12 +- include/drm-uapi/tegra_drm.h | 225 meson.build|7 +- src/gallium/Makefile.am|5 + .../auxiliary/pipe-loader/pipe_loader_drm.c|7 +- src/gallium/auxiliary/target-helpers/drm_helper.h | 23 + .../auxiliary/target-helpers/drm_helper_public.h |3 + src/gallium/drivers/tegra/Automake.inc | 11 + src/gallium/drivers/tegra/Makefile.am | 14 + src/gallium/drivers/tegra/Makefile.sources |6 + src/gallium/drivers/tegra/meson.build | 41 + src/gallium/drivers/tegra/tegra_context.c | 1384 src/gallium/drivers/tegra/tegra_context.h | 81 ++ src/gallium/drivers/tegra/tegra_resource.h | 76 ++ src/gallium/drivers/tegra/tegra_screen.c | 688 ++ src/gallium/drivers/tegra/tegra_screen.h | 45 + src/gallium/meson.build|6 + src/gallium/targets/dri/Makefile.am|2 + src/gallium/targets/dri/meson.build|4 +- src/gallium/targets/dri/target.c |4 + src/gallium/targets/vdpau/Makefile.am |2 + src/gallium/winsys/tegra/drm/Makefile.am | 13 + src/gallium/winsys/tegra/drm/Makefile.sources |2 + src/gallium/winsys/tegra/drm/meson.build | 33 + src/gallium/winsys/tegra/drm/tegra_drm_public.h| 31 + src/gallium/winsys/tegra/drm/tegra_drm_winsys.c| 49 + 26 files changed, 2770 insertions(+), 4 deletions(-) Diff: http://cgit.freedesktop.org/mesa/mesa/diff/?id=1755f608f5201e0a23f00cc3ea1b01edd07eb6ef ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glx/apple: Ship meson build file in tarball
Module: Mesa Branch: master Commit: d41ee9ba5d0f085b517bc6ce192f912fc1490e3a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d41ee9ba5d0f085b517bc6ce192f912fc1490e3a Author: Thierry Reding Date: Tue Mar 6 10:44:08 2018 +0100 glx/apple: Ship meson build file in tarball The meson build file for Apple GLX is not listed in the EXTRA_DIST make variable and therefore isn't shipped as part of the release tarball, so meson builds from the tarball will fail. Add the file to EXTRA_DIST to ensure it is included in the tarball. Reviewed-by: Dylan Baker Signed-off-by: Thierry Reding --- src/glx/apple/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/glx/apple/Makefile.am b/src/glx/apple/Makefile.am index bfa18b1c2f..8f93268635 100644 --- a/src/glx/apple/Makefile.am +++ b/src/glx/apple/Makefile.am @@ -1,4 +1,6 @@ -EXTRA_DIST = RELEASE_NOTES +EXTRA_DIST = \ + RELEASE_NOTES \ + meson.build noinst_LTLIBRARIES = libappleglx.la ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): loader: Add support for platform and host1x busses
Module: Mesa Branch: master Commit: f9bc48d41d99f2cd4d603561b35fa5c6aedaf169 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9bc48d41d99f2cd4d603561b35fa5c6aedaf169 Author: Thierry Reding Date: Wed Dec 21 14:15:06 2016 +0100 loader: Add support for platform and host1x busses ARM SoCs usually have their DRM/KMS devices on the platform bus, so add support for this bus in order to allow use of the DRI_PRIME environment variable with those devices. While at it, also support the host1x bus, which is effectively the same but uses an additional layer in the bus hierarchy. Note that it isn't enough to support the bus that has the rendering GPU because the loader code will also try to construct an ID path tag for a scanout-only device if it is the default that is being opened. The ID path tag for a device can be obtained by running udevadm info on the device node, as shown in this example on NVIDIA Tegra: $ udevadm info /dev/dri/card0 | grep ID_PATH_TAG E: ID_PATH_TAG=platform-5000_host1x The corresponding OF_FULLNAME property, from which the ID_PATH_TAG is constructed, can be found in the sysfs "uevent" attribute for the card0 device's parent: $ grep OF_FULLNAME /sys/devices/platform/5000.host1x/drm/uevent OF_FULLNAME=/host1x@5000 Similarily, /dev/dri/card1 corresponds to the GPU: $ udevadm info /dev/dri/card1 | grep ID_PATH_TAG E: ID_PATH_TAG=platform-5700_gpu and: $ grep OF_FULLNAME /sys/devices/platform/5700.gpu/uevent OF_FULLNAME=/gpu@5700 Changes in v2: - avoid confusing pre-increment in strdup() - add examples of tags to commit message Reviewed-by: Eric Engestrom Reviewed-by: Emil Velikov Signed-off-by: Thierry Reding --- src/loader/loader.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/src/loader/loader.c b/src/loader/loader.c index 92b4c5204b..43275484cc 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -120,6 +120,33 @@ static char *drm_construct_id_path_tag(drmDevicePtr device) device->businfo.pci->func) < 0) { return NULL; } + } else if (device->bustype == DRM_BUS_PLATFORM || + device->bustype == DRM_BUS_HOST1X) { + char *fullname, *name, *address; + + if (device->bustype == DRM_BUS_PLATFORM) + fullname = device->businfo.platform->fullname; + else + fullname = device->businfo.host1x->fullname; + + name = strrchr(fullname, '/'); + if (!name) + name = strdup(fullname); + else + name = strdup(name + 1); + + address = strchr(name, '@'); + if (address) { + *address++ = '\0'; + + if (asprintf(&tag, "platform-%s_%s", address, name) < 0) +tag = NULL; + } else { + if (asprintf(&tag, "platform-%s", name) < 0) +tag = NULL; + } + + free(name); } return tag; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): disk cache: Link with -latomic if necessary
Module: Mesa Branch: master Commit: 498faea103aa7966b435f21d8ff5e36172389b1e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=498faea103aa7966b435f21d8ff5e36172389b1e Author: Thierry Reding Date: Fri Feb 23 14:13:27 2018 +0100 disk cache: Link with -latomic if necessary The disk cache implementation uses 64-bit atomic operations. For some architectures, such as 32-bit ARM, GCC will not be able to translate these operations into atomic, lock-free instructions and will instead rely on the external atomics library to provide these operations. Check at configuration time whether or not linking against libatomic is necessary and if so, create a dependency that can be used while linking the mesautil library. This is the meson equivalent of 2ef7f23820a6 ("configure: check if -latomic is needed for __atomic_*"). For some background information on this, see: https://gcc.gnu.org/wiki/Atomic/GCCMM Changes in v2: - clarify meaning of lock-free in commit message - fix build if -latomic is not necessary Acked-by: Matt Turner Reviewed-by: Dylan Baker Signed-off-by: Thierry Reding --- meson.build | 17 + src/util/meson.build | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index e9928a3793..bb6a835084 100644 --- a/meson.build +++ b/meson.build @@ -790,9 +790,26 @@ else endif # Check for GCC style atomics +dep_atomic = declare_dependency() + if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }', name : 'GCC atomic builtins') pre_args += '-DUSE_GCC_ATOMIC_BUILTINS' + + # Not all atomic calls can be turned into lock-free instructions, in which + # GCC will make calls into the libatomic library. Check whether we need to + # link with -latomic. + # + # This can happen for 64-bit atomic operations on 32-bit architectures such + # as ARM. + if not cc.links('''#include + int main() { + uint64_t n; + return (int)__atomic_load_n(&n, __ATOMIC_ACQUIRE); + }''', + name : 'GCC atomic builtins required -latomic') +dep_atomic = cc.find_library('atomic') + endif endif if not cc.links('''#include uint64_t v; diff --git a/src/util/meson.build b/src/util/meson.build index b23dba3a98..eece1cefef 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -102,7 +102,7 @@ libmesa_util = static_library( 'mesa_util', [files_mesa_util, format_srgb], include_directories : inc_common, - dependencies : [dep_zlib, dep_clock, dep_thread], + dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic], c_args : [c_msvc_compat_args, c_vis_args], build_by_default : false ) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit