Android.common.mk | 4 +- Android.mk | 2 + amdgpu/amdgpu-symbol-check | 1 amdgpu/amdgpu.h | 28 ++++++++++++++ amdgpu/amdgpu_bo.c | 28 +++++++++++--- configure.ac | 22 ++++++++--- debian/changelog | 7 +++ debian/libdrm-amdgpu1.symbols | 1 debian/rules | 2 - etnaviv/etnaviv_gpu.c | 72 ++++++++++++++------------------------ etnaviv/etnaviv_priv.h | 22 +---------- exynos/exynos_drm.c | 2 - exynos/exynos_fimg2d.c | 14 ------- include/drm/README | 4 -- include/drm/amdgpu_drm.h | 56 +++++++++++++++++++++++++++++ tegra/tegra-symbol-check | 7 ++- tests/etnaviv/Makefile.am | 1 tests/exynos/exynos_fimg2d_test.c | 43 ++++++++++++---------- tests/util/Android.mk | 2 + xf86drm.c | 18 ++++++--- 20 files changed, 212 insertions(+), 124 deletions(-)
New commits: commit 677169e627f6fffe0518d6f6f6a056b01c1d50c2 Author: Jordan Justen <jordan.l.jus...@intel.com> Date: Tue Apr 4 23:30:06 2017 -0700 Bump libdrm-amdgpu1 symbols Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com> diff --git a/debian/changelog b/debian/changelog index 50ca4a7..27ecdda 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ libdrm (2.4.77-1) UNRELEASED; urgency=medium * New upstream release. + * Bump libdrm-amdgpu1 symbols. -- Jordan Justen <jordan.l.jus...@intel.com> Tue, 04 Apr 2017 23:14:32 -0700 diff --git a/debian/libdrm-amdgpu1.symbols b/debian/libdrm-amdgpu1.symbols index b4e4d68..f9e2702 100644 --- a/debian/libdrm-amdgpu1.symbols +++ b/debian/libdrm-amdgpu1.symbols @@ -11,6 +11,7 @@ libdrm_amdgpu.so.1 libdrm-amdgpu1 #MINVER# amdgpu_bo_query_info@Base 2.4.63 amdgpu_bo_set_metadata@Base 2.4.63 amdgpu_bo_va_op@Base 2.4.63 + amdgpu_bo_va_op_raw@Base 2.4.77 amdgpu_bo_wait_for_idle@Base 2.4.63 amdgpu_create_bo_from_user_mem@Base 2.4.63 amdgpu_cs_create_semaphore@Base 2.4.67 diff --git a/debian/rules b/debian/rules index eb92a40..a86efea 100755 --- a/debian/rules +++ b/debian/rules @@ -108,7 +108,7 @@ ifeq ($(NOUVEAU), yes) dh_makeshlibs -plibdrm-nouveau2 -V'libdrm-nouveau2 (>= 2.4.66)' -- -c4 endif dh_makeshlibs -plibdrm-radeon1 -V'libdrm-radeon1 (>= 2.4.39)' -- -c4 - dh_makeshlibs -plibdrm-amdgpu1 -V'libdrm-amdgpu1 (>= 2.4.73)' -- -c4 + dh_makeshlibs -plibdrm-amdgpu1 -V'libdrm-amdgpu1 (>= 2.4.77)' -- -c4 ifeq ($(ARM), yes) dh_makeshlibs -plibdrm-omap1 -V'libdrm-omap1 (>= 2.4.38)' -- -c4 dh_makeshlibs -plibdrm-exynos1 -V'libdrm-exynos1 (>= 2.4.66)' -- -c4 commit 9116ff106b759d87053ad8a188068354282970d7 Author: Jordan Justen <jordan.l.jus...@intel.com> Date: Tue Apr 4 23:15:22 2017 -0700 Start 2.4.77-1 changelog entry Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com> diff --git a/debian/changelog b/debian/changelog index 7608577..50ca4a7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libdrm (2.4.77-1) UNRELEASED; urgency=medium + + * New upstream release. + + -- Jordan Justen <jordan.l.jus...@intel.com> Tue, 04 Apr 2017 23:14:32 -0700 + libdrm (2.4.76-1) experimental; urgency=medium * New upstream release. commit e61e999838faa65f1c5cbddfbda06125be19e353 Author: Marek Olšák <marek.ol...@amd.com> Date: Tue Apr 4 11:36:00 2017 +0200 configure.ac: bump the version to 2.4.77 diff --git a/configure.ac b/configure.ac index f1a1309..036f65a 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ AC_PREREQ([2.63]) AC_INIT([libdrm], - [2.4.76], + [2.4.77], [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI], [libdrm]) commit 63120172668610cebfd01e89f67e73037037dfd9 Author: Emil Velikov <emil.l.veli...@gmail.com> Date: Thu Mar 30 18:01:12 2017 +0100 configure.ac: bring back pthread-stubs check Accidentally removed with earlier commit. Although rather than simply adding the check for all platforms, use the same heuristics as we do in mesa. Namely: pthread-stubs is a thing only for BSD platforms. Everyone else should have lightweight pthread API in their C runtime library. Fixes: 4ecd1ef010b ("xf86drm: fix null termination of string buffer") Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com> Reviewed-by: Eric Engestrom <e...@engestrom.ch> diff --git a/configure.ac b/configure.ac index 6a60ffc..f1a1309 100644 --- a/configure.ac +++ b/configure.ac @@ -61,10 +61,22 @@ AC_CHECK_HEADERS([sys/sysctl.h sys/select.h]) LT_PREREQ([2.2]) LT_INIT([disable-static]) - - -AC_SUBST(PTHREADSTUBS_CFLAGS) -AC_SUBST(PTHREADSTUBS_LIBS) +dnl pthread-stubs is mandatory on BSD platforms, due to the nature of the +dnl project. Even then there's a notable issue as described in the project README +case "$host_os" in +linux* | cygwin* | darwin* | solaris* | gnu*) + pthread_stubs_possible="no" + ;; +* ) + pthread_stubs_possible="yes" + ;; +esac + +if test "x$pthread_stubs_possible" = xyes; then + PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs >= 0.4) + AC_SUBST(PTHREADSTUBS_CFLAGS) + AC_SUBST(PTHREADSTUBS_LIBS) +fi pkgconfigdir=${libdir}/pkgconfig AC_SUBST(pkgconfigdir) commit 6796859fcce7b9d7157f066a8b0dac3ede6438dd Author: Bernd Kuhls <bernd.ku...@t-online.de> Date: Mon Apr 3 17:57:22 2017 +0100 tests/etnaviv: link against libdrm Fixes link errors detected by buildroot autobuilders: http://autobuild.buildroot.net/results/68a/68af62f4ab6944d326468818562c05fd5cc55b03/build-end.log Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100530 Signed-off-by: Bernd Kuhls <bernd.ku...@t-online.de> Reviewed-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/tests/etnaviv/Makefile.am b/tests/etnaviv/Makefile.am index 0631864..226baee 100644 --- a/tests/etnaviv/Makefile.am +++ b/tests/etnaviv/Makefile.am @@ -28,6 +28,7 @@ etnaviv_2d_test_SOURCES = \ write_bmp.h etnaviv_cmd_stream_test_LDADD = \ + $(top_builddir)/libdrm.la \ $(top_builddir)/etnaviv/libdrm_etnaviv.la etnaviv_cmd_stream_test_SOURCES = \ commit e5053343de6f910882a43214ce5c7b69a9b07927 Author: Erik Faye-Lund <kusmab...@gmail.com> Date: Wed Mar 29 22:24:24 2017 +0000 tegra: update symbol-check I get a few more symbols in my build tegra-libraries, so let's include these in the whitelist as well. While we're at it, update the comment at the top. Signed-off-by: Erik Faye-Lund <kusmab...@gmail.com> Reviewed-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/tegra/tegra-symbol-check b/tegra/tegra-symbol-check index 4020831..420469f 100755 --- a/tegra/tegra-symbol-check +++ b/tegra/tegra-symbol-check @@ -1,11 +1,14 @@ #!/bin/bash -# The following symbols (past the first five) are taken from the public headers. -# A list of the latter should be available Makefile.sources/LIBDRM_FREEDRENO_H_FILES +# The following symbols (past the first nine) are taken from tegra.h. FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_tegra.so} | awk '{print $3}'| while read func; do ( grep -q "^$func$" || echo $func ) <<EOF +__bss_end__ +__bss_start__ __bss_start +__end__ +_bss_end__ _edata _end _fini commit 51a514c43f607c7f3c1231d1fcac15d450f98e5c Author: Rob Herring <r...@kernel.org> Date: Wed Mar 22 14:05:25 2017 -0500 Android: disable pointer-arith and enum-conversion Disable some more warnings from clang. These don't appear to be warnings worth fixing. Signed-off-by: Rob Herring <r...@kernel.org> Reviewed-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/Android.common.mk b/Android.common.mk index f57b8d3..35c0f02 100644 --- a/Android.common.mk +++ b/Android.common.mk @@ -5,7 +5,9 @@ LOCAL_CFLAGS += \ LOCAL_CFLAGS += \ -Wno-unused-parameter \ - -Wno-missing-field-initializers + -Wno-missing-field-initializers \ + -Wno-pointer-arith \ + -Wno-enum-conversion # Quiet down the build system and remove any .h files from the sources LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES)) commit c4d673acdcf1add753aa53d359f29bb44bc057db Author: Rob Herring <r...@kernel.org> Date: Wed Mar 22 14:05:24 2017 -0500 Android: fix building of modetest and proptest These tests depend on tests/util/ headers, but expect the include path to be tests/. Signed-off-by: Rob Herring <r...@kernel.org> Reviewed-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/Android.mk b/Android.mk index 5209059..292be23 100644 --- a/Android.mk +++ b/Android.mk @@ -24,6 +24,8 @@ LIBDRM_COMMON_MK := $(call my-dir)/Android.common.mk LOCAL_PATH := $(call my-dir) +LIBDRM_TOP := $(LOCAL_PATH) + include $(CLEAR_VARS) # Import variables LIBDRM_{,H_,INCLUDE_H_,INCLUDE_VMWGFX_H_}FILES diff --git a/tests/util/Android.mk b/tests/util/Android.mk index 7656c4c..12eccb4 100644 --- a/tests/util/Android.mk +++ b/tests/util/Android.mk @@ -32,5 +32,7 @@ LOCAL_SHARED_LIBRARIES := libdrm LOCAL_SRC_FILES := $(UTIL_FILES) +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LIBDRM_TOP)/tests + include $(LIBDRM_COMMON_MK) include $(BUILD_STATIC_LIBRARY) commit 7b806e87890182ac1b6181a848e03cd5c7db97ec Author: Seung-Woo Kim <sw0312....@samsung.com> Date: Mon Mar 27 11:09:29 2017 +0900 xf86drm: remove memory leaks in drmGetBusid/drmGetReservedContextList In error path of drmGetBusid() and drmGetReservedContextList(), there are memory leaks for error path. So this removes them. Signed-off-by: Seung-Woo Kim <sw0312....@samsung.com> Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com> Reviewed-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/xf86drm.c b/xf86drm.c index 88f86ed..685cf69 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -994,8 +994,10 @@ char *drmGetBusid(int fd) if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) return NULL; u.unique = drmMalloc(u.unique_len + 1); - if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) + if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) { + drmFree(u.unique); return NULL; + } u.unique[u.unique_len] = '\0'; return u.unique; @@ -1523,14 +1525,12 @@ drm_context_t *drmGetReservedContextList(int fd, int *count) if (!(list = drmMalloc(res.count * sizeof(*list)))) return NULL; - if (!(retval = drmMalloc(res.count * sizeof(*retval)))) { - drmFree(list); - return NULL; - } + if (!(retval = drmMalloc(res.count * sizeof(*retval)))) + goto err_free_list; res.contexts = list; if (drmIoctl(fd, DRM_IOCTL_RES_CTX, &res)) - return NULL; + goto err_free_context; for (i = 0; i < res.count; i++) retval[i] = list[i].handle; @@ -1538,6 +1538,12 @@ drm_context_t *drmGetReservedContextList(int fd, int *count) *count = res.count; return retval; + +err_free_list: + drmFree(list); +err_free_context: + drmFree(retval); + return NULL; } void drmFreeReservedContextList(drm_context_t *pt) commit 2dc30dd5279fea1838f181724fb699a3689f582b Author: Seung-Woo Kim <sw0312....@samsung.com> Date: Mon Mar 20 09:52:49 2017 +0900 tests/exynos: fix invalid code of error path in g2d test This patch fixes invalid code of error path including NULL deference and leak in g2d test. Signed-off-by: Seung-Woo Kim <sw0312....@samsung.com> Reviewed-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c index 3495c62..ab1028e 100644 --- a/tests/exynos/exynos_fimg2d_test.c +++ b/tests/exynos/exynos_fimg2d_test.c @@ -59,7 +59,6 @@ static void connector_find_mode(int fd, struct connector *c, if (!connector) { fprintf(stderr, "could not get connector %i: %s\n", resources->connectors[i], strerror(errno)); - drmModeFreeConnector(connector); continue; } @@ -98,7 +97,6 @@ static void connector_find_mode(int fd, struct connector *c, if (!c->encoder) { fprintf(stderr, "could not get encoder %i: %s\n", resources->encoders[i], strerror(errno)); - drmModeFreeEncoder(c->encoder); continue; } @@ -264,7 +262,8 @@ static int g2d_copy_test(struct exynos_device *dev, struct exynos_bo *src, userptr = (unsigned long)malloc(size); if (!userptr) { fprintf(stderr, "failed to allocate userptr.\n"); - return -EFAULT; + ret = -EFAULT; + goto fail; } src_img.user_ptr[0].userptr = userptr; @@ -469,7 +468,8 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev, userptr = (unsigned long)malloc(size); if (!userptr) { fprintf(stderr, "failed to allocate userptr.\n"); - return -EFAULT; + ret = -EFAULT; + goto fail; } src_img.user_ptr[0].userptr = userptr; @@ -520,7 +520,7 @@ err_free_userptr: fail: g2d_fini(ctx); - return 0; + return ret;; } #if EXYNOS_G2D_USERPTR_TEST @@ -558,7 +558,8 @@ static int g2d_blend_test(struct exynos_device *dev, userptr = (unsigned long)malloc(size); if (!userptr) { fprintf(stderr, "failed to allocate userptr.\n"); - return -EFAULT; + ret = -EFAULT; + goto fail; } src_img.user_ptr[0].userptr = userptr; @@ -620,7 +621,7 @@ err_free_userptr: fail: g2d_fini(ctx); - return 0; + return ret; } #endif @@ -647,8 +648,8 @@ static int g2d_checkerboard_test(struct exynos_device *dev, dst_y = 0; checkerboard = create_checkerboard_pattern(screen_width / 32, screen_height / 32, 32); - if (checkerboard == NULL) { - ret = -1; + if (!checkerboard) { + ret = -EFAULT; goto fail; } @@ -757,8 +758,8 @@ int main(int argc, char **argv) dev = exynos_device_create(fd); if (!dev) { - drmClose(dev->fd); - return -EFAULT; + ret = -EFAULT; + goto err_drm_close; } resources = drmModeGetResources(dev->fd); @@ -766,7 +767,7 @@ int main(int argc, char **argv) fprintf(stderr, "drmModeGetResources failed: %s\n", strerror(errno)); ret = -EFAULT; - goto err_drm_close; + goto err_dev_destory; } connector_find_mode(dev->fd, &con, resources); @@ -775,7 +776,7 @@ int main(int argc, char **argv) if (!con.mode) { fprintf(stderr, "failed to find usable connector\n"); ret = -EFAULT; - goto err_drm_close; + goto err_dev_destory; } screen_width = con.mode->hdisplay; @@ -784,7 +785,7 @@ int main(int argc, char **argv) if (screen_width == 0 || screen_height == 0) { fprintf(stderr, "failed to find sane resolution on connector\n"); ret = -EFAULT; - goto err_drm_close; + goto err_dev_destory; } printf("screen width = %d, screen height = %d\n", screen_width, @@ -793,7 +794,7 @@ int main(int argc, char **argv) bo = exynos_create_buffer(dev, screen_width * screen_height * 4, 0); if (!bo) { ret = -EFAULT; - goto err_drm_close; + goto err_dev_destory; } handles[0] = bo->handle; @@ -884,9 +885,11 @@ err_rm_fb: err_destroy_buffer: exynos_destroy_buffer(bo); -err_drm_close: - drmClose(dev->fd); +err_dev_destory: exynos_device_destroy(dev); - return 0; +err_drm_close: + drmClose(fd); + + return ret; } commit a398adba7c845fe248ab1e5c338789ca2882644b Author: Seung-Woo Kim <sw0312....@samsung.com> Date: Fri Mar 31 12:30:57 2017 +0900 tests/exynos: remove unused-function build warning The function g2d_blend_test() is blocked to call because of feature unsafety. This patch blocks with proper feature name and also blocks the function itself to remove build warning. Signed-off-by: Seung-Woo Kim <sw0312....@samsung.com> Reviewed-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c index 797fb6e..3495c62 100644 --- a/tests/exynos/exynos_fimg2d_test.c +++ b/tests/exynos/exynos_fimg2d_test.c @@ -523,6 +523,7 @@ fail: return 0; } +#if EXYNOS_G2D_USERPTR_TEST static int g2d_blend_test(struct exynos_device *dev, struct exynos_bo *src, struct exynos_bo *dst, @@ -621,6 +622,7 @@ fail: return 0; } +#endif static int g2d_checkerboard_test(struct exynos_device *dev, struct exynos_bo *src, @@ -864,7 +866,7 @@ int main(int argc, char **argv) * * Disable the test for now, until the kernel code has been sanitized. */ -#if 0 +#if EXYNOS_G2D_USERPTR_TEST ret = g2d_blend_test(dev, src, bo, G2D_IMGBUF_USERPTR); if (ret < 0) fprintf(stderr, "failed to test blend operation.\n"); commit 762be6c2102de0ec99659838a1423c4a131432ff Author: Seung-Woo Kim <sw0312....@samsung.com> Date: Fri Mar 31 12:30:56 2017 +0900 exynos/fimg2d: remove unused-function build warning The function g2d_reset() is not anymore used after the commit e3c97d1a2473 ("exynos/fimg2d: add g2d_validate_xyz() functions"), so it should be removed. Signed-off-by: Seung-Woo Kim <sw0312....@samsung.com> Reviewed-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de> Reviewed-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index 7f1d105..61340c3 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -293,20 +293,6 @@ static void g2d_set_direction(struct g2d_context *ctx, } /* - * g2d_reset - reset fimg2d hardware. - * - * @ctx: a pointer to g2d_context structure. - * - */ -static void g2d_reset(struct g2d_context *ctx) -{ - ctx->cmd_nr = 0; - ctx->cmd_buf_nr = 0; - - g2d_add_cmd(ctx, SOFT_RESET_REG, 0x01); -} - -/* * g2d_flush - submit all commands and values in user side command buffer * to command queue aware of fimg2d dma. * commit c9ef5c4a1c691ebcdfa4261b406b8b81f7b5a18f Author: Seung-Woo Kim <sw0312....@samsung.com> Date: Fri Mar 31 12:30:55 2017 +0900 exynos: fix type-punned pointer build warning As like the commit ecc2a097294d ("xf86drm: Fix type-punned pointer build warning"), this fixes following build warning. exynos_drm.c: In function 'exynos_handle_event': exynos_drm.c:420:15: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] e = (struct drm_event *) &buffer[i]; ^ Signed-off-by: Seung-Woo Kim <sw0312....@samsung.com> Reviewed-by: Tobias Jakobi <tjak...@math.uni-bielefeld.de> Reviewed-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c index b961e52..f6204f1 100644 --- a/exynos/exynos_drm.c +++ b/exynos/exynos_drm.c @@ -417,7 +417,7 @@ exynos_handle_event(struct exynos_device *dev, struct exynos_event_context *ctx) i = 0; while (i < len) { - e = (struct drm_event *) &buffer[i]; + e = (struct drm_event *)(buffer + i); switch (e->type) { case DRM_EVENT_VBLANK: if (evctx->version < 1 || commit f5995751b0722bdd3789b1afb48b86d8f075b1e7 Author: Emil Velikov <emil.veli...@collabora.com> Date: Mon Apr 3 17:40:59 2017 +0100 amdgpu: add amdgpu_bo_va_op_raw to the symbol check Otherwise the make check will rightfully fail. Fixes: 4e369f25a94 ("amdgpu: add amdgpu_bo_va_op_raw") Signed-off-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check index 87f4fd2..8e06474 100755 --- a/amdgpu/amdgpu-symbol-check +++ b/amdgpu/amdgpu-symbol-check @@ -22,6 +22,7 @@ amdgpu_bo_list_update amdgpu_bo_query_info amdgpu_bo_set_metadata amdgpu_bo_va_op +amdgpu_bo_va_op_raw amdgpu_bo_wait_for_idle amdgpu_create_bo_from_user_mem amdgpu_cs_create_semaphore commit eead59110771e617096d554ffd92360e023174e1 Author: Junwei Zhang <jerry.zh...@amd.com> Date: Wed Mar 22 11:14:00 2017 +0800 amdgpu: add REPLACE and CLEAR checking for VA op (v2) v2: fix indent Signed-off-by: Junwei Zhang <jerry.zh...@amd.com> Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com> Reviewed-by: Christian König <christian.koe...@amd.com> Reviewed-by: Marek Olšák <marek.ol...@amd.com> Acked-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c index f725bfd..9adfffa 100644 --- a/amdgpu/amdgpu_bo.c +++ b/amdgpu/amdgpu_bo.c @@ -703,7 +703,8 @@ int amdgpu_bo_va_op_raw(amdgpu_device_handle dev, struct drm_amdgpu_gem_va va; int r; - if (ops != AMDGPU_VA_OP_MAP && ops != AMDGPU_VA_OP_UNMAP) + if (ops != AMDGPU_VA_OP_MAP && ops != AMDGPU_VA_OP_UNMAP && + ops != AMDGPU_VA_OP_REPLACE && ops != AMDGPU_VA_OP_CLEAR) return -EINVAL; memset(&va, 0, sizeof(va)); commit 0a4626fead67f228bd7fad3c8b00812ab2613ec8 Author: Nicolai Hähnle <nicolai.haeh...@amd.com> Date: Mon Apr 3 10:23:03 2017 +0200 headers: the uint*_t vs. __u* discrepancy in amdgpu_drm is fixed This was already done in commit 3dc002df3e5 ("amdgpu: sync amdgpu_drm.h with kernel 4.11-rc2"), now update the README accordingly. Signed-off-by: Nicolai Hähnle <nicolai.haeh...@amd.com> Reviewed-by: Marek Olšák <marek.ol...@amd.com> Acked-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/include/drm/README b/include/drm/README index f3cdf5d..870b0b5 100644 --- a/include/drm/README +++ b/include/drm/README @@ -96,10 +96,6 @@ Status: ? Promote to fixed size ints, which match the current (32bit) ones. -amdgpu_drm.h - - Using the stdint.h uint*_t over the respective __u* ones -Status: Trivial. - drm_mode.h - Missing DPI encode/connector pair. Status: Trivial. commit f104148e40d6285a04698f0fa5f4ef76383bee6f Author: Nicolai Hähnle <nicolai.haeh...@amd.com> Date: Mon Apr 3 10:22:59 2017 +0200 headers: sync amdgpu_drm.h from airlied/drm-next Changes include: PRT and preemption flags, sensor info, and some more changes for Vega10. Generated using make headers_install from airlied/drm-next commit 320d8c3d38739fa8e31a076b86cbdafcf8897d5e. Signed-off-by: Nicolai Hähnle <nicolai.haeh...@amd.com> Reviewed-by: Marek Olšák <marek.ol...@amd.com> Acked-by: Emil Velikov <emil.veli...@collabora.com> diff --git a/include/drm/amdgpu_drm.h b/include/drm/amdgpu_drm.h index fa56499..516a9f2 100644 --- a/include/drm/amdgpu_drm.h +++ b/include/drm/amdgpu_drm.h @@ -232,6 +232,7 @@ struct drm_amdgpu_gem_userptr { #define AMDGPU_TILING_SWIZZLE_MODE_SHIFT 0 #define AMDGPU_TILING_SWIZZLE_MODE_MASK 0x1f +/* Set/Get helpers for tiling flags. */ #define AMDGPU_TILING_SET(field, value) \ (((__u64)(value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT) #define AMDGPU_TILING_GET(value, field) \ @@ -355,6 +356,8 @@ struct drm_amdgpu_gem_op { #define AMDGPU_VA_OP_MAP 1 #define AMDGPU_VA_OP_UNMAP 2 +#define AMDGPU_VA_OP_CLEAR 3 +#define AMDGPU_VA_OP_REPLACE 4 /* Delay the page table update till the next CS */ #define AMDGPU_VM_DELAY_UPDATE (1 << 0) @@ -366,6 +369,20 @@ struct drm_amdgpu_gem_op { #define AMDGPU_VM_PAGE_WRITEABLE (1 << 2) /* executable mapping, new for VI */ #define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3) +/* partially resident texture */ +#define AMDGPU_VM_PAGE_PRT (1 << 4) +/* MTYPE flags use bit 5 to 8 */ +#define AMDGPU_VM_MTYPE_MASK (0xf << 5) +/* Default MTYPE. Pre-AI must use this. Recommended for newer ASICs. */ +#define AMDGPU_VM_MTYPE_DEFAULT (0 << 5) +/* Use NC MTYPE instead of default MTYPE */ +#define AMDGPU_VM_MTYPE_NC (1 << 5) +/* Use WC MTYPE instead of default MTYPE */ +#define AMDGPU_VM_MTYPE_WC (2 << 5) +/* Use CC MTYPE instead of default MTYPE */ +#define AMDGPU_VM_MTYPE_CC (3 << 5) +/* Use UC MTYPE instead of default MTYPE */ +#define AMDGPU_VM_MTYPE_UC (4 << 5) struct drm_amdgpu_gem_va { /** GEM object handle */ @@ -428,9 +445,12 @@ union drm_amdgpu_cs { /* This IB should be submitted to CE */ #define AMDGPU_IB_FLAG_CE (1<<0) -/* CE Preamble */ +/* Preamble flag, which means the IB could be dropped if no context switch */ #define AMDGPU_IB_FLAG_PREAMBLE (1<<1) +/* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */ +#define AMDGPU_IB_FLAG_PREEMPT (1<<2) + struct drm_amdgpu_cs_chunk_ib { __u32 _pad; /** AMDGPU_IB_FLAG_* */ @@ -506,6 +526,10 @@ struct drm_amdgpu_cs_chunk_data { #define AMDGPU_INFO_FW_SMC 0x0a /* Subquery id: Query SDMA firmware version */ #define AMDGPU_INFO_FW_SDMA 0x0b + /* Subquery id: Query PSP SOS firmware version */ + #define AMDGPU_INFO_FW_SOS 0x0c + /* Subquery id: Query PSP ASD firmware version */ + #define AMDGPU_INFO_FW_ASD 0x0d /* number of bytes moved for TTM migration */ #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f /* the used VRAM size */ @@ -536,6 +560,22 @@ struct drm_amdgpu_cs_chunk_data { #define AMDGPU_INFO_VBIOS_IMAGE 0x2 /* Query UVD handles */ #define AMDGPU_INFO_NUM_HANDLES 0x1C +/* Query sensor related information */ +#define AMDGPU_INFO_SENSOR 0x1D + /* Subquery id: Query GPU shader clock */ + #define AMDGPU_INFO_SENSOR_GFX_SCLK 0x1 + /* Subquery id: Query GPU memory clock */ + #define AMDGPU_INFO_SENSOR_GFX_MCLK 0x2 + /* Subquery id: Query GPU temperature */ + #define AMDGPU_INFO_SENSOR_GPU_TEMP 0x3 + /* Subquery id: Query GPU load */ + #define AMDGPU_INFO_SENSOR_GPU_LOAD 0x4 + /* Subquery id: Query average GPU power */ + #define AMDGPU_INFO_SENSOR_GPU_AVG_POWER 0x5 + /* Subquery id: Query northbridge voltage */ + #define AMDGPU_INFO_SENSOR_VDDNB 0x6 + /* Subquery id: Query graphics voltage */ + #define AMDGPU_INFO_SENSOR_VDDGFX 0x7 #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0 #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff @@ -599,6 +639,10 @@ struct drm_amdgpu_info { __u32 type; __u32 offset; } vbios_info; + + struct { + __u32 type; + } sensor_info; }; }; @@ -710,6 +754,16 @@ struct drm_amdgpu_info_device { __u32 vram_bit_width; /* vce harvesting instance */ __u32 vce_harvest_config; + /* gfx double offchip LDS buffers */ + __u32 gc_double_offchip_lds_buf; + /* NGG Primitive Buffer */ + __u64 prim_buf_gpu_addr; + /* NGG Position Buffer */ + __u64 pos_buf_gpu_addr; + /* NGG Control Sideband */ + __u64 cntl_sb_buf_gpu_addr; + /* NGG Parameter Cache */ + __u64 param_buf_gpu_addr; }; struct drm_amdgpu_info_hw_ip { commit 4e369f25a942837454f1c127a7a440571af4f486 Author: Nicolai Hähnle <nicolai.haeh...@amd.com> Date: Wed Feb 8 13:02:56 2017 +0100 amdgpu: add amdgpu_bo_va_op_raw This variant allows the caller full control over flags and size, and allows passing a NULL bo (for PRT support). Cc: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl> Cc: Jerry Zhang <jerry.zh...@amd.com> Signed-off-by: Nicolai Hähnle <nicolai.haeh...@amd.com> Reviewed-by: Christian König <christian.koe...@amd.com> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h index 7b26a04..6b2ded8 100644 --- a/amdgpu/amdgpu.h +++ b/amdgpu/amdgpu.h @@ -1186,6 +1186,34 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops); /** + * VA mapping/unmapping for a buffer object or PRT region. + * + * This is not a simple drop-in extension for amdgpu_bo_va_op; instead, all + * parameters are treated "raw", i.e. size is not automatically aligned, and + * all flags must be specified explicitly. + * + * \param dev - \c [in] device handle + * \param bo - \c [in] BO handle (may be NULL) + * \param offset - \c [in] Start offset to map + * \param size - \c [in] Size to map + * \param addr - \c [in] Start virtual address. + * \param flags - \c [in] Supported flags for mapping/unmapping + * \param ops - \c [in] AMDGPU_VA_OP_MAP or AMDGPU_VA_OP_UNMAP + * + * \return 0 on success\n + * <0 - Negative POSIX Error code + * +*/ + +int amdgpu_bo_va_op_raw(amdgpu_device_handle dev, + amdgpu_bo_handle bo, + uint64_t offset, + uint64_t size, + uint64_t addr, + uint64_t flags, + uint32_t ops); + +/** * create semaphore * * \param sem - \c [out] semaphore handle diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c index d30fd1e..f725bfd 100644 --- a/amdgpu/amdgpu_bo.c +++ b/amdgpu/amdgpu_bo.c @@ -683,6 +683,23 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, uint32_t ops) { amdgpu_device_handle dev = bo->dev; + + size = ALIGN(size, getpagesize()); + + return amdgpu_bo_va_op_raw(dev, bo, offset, size, addr, + AMDGPU_VM_PAGE_READABLE | + AMDGPU_VM_PAGE_WRITEABLE | + AMDGPU_VM_PAGE_EXECUTABLE, ops); +} + +int amdgpu_bo_va_op_raw(amdgpu_device_handle dev, + amdgpu_bo_handle bo, + uint64_t offset, + uint64_t size, + uint64_t addr, + uint64_t flags, + uint32_t ops) +{ struct drm_amdgpu_gem_va va; int r; @@ -690,14 +707,12 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo, return -EINVAL; memset(&va, 0, sizeof(va)); - va.handle = bo->handle; + va.handle = bo ? bo->handle : 0; va.operation = ops; - va.flags = AMDGPU_VM_PAGE_READABLE | - AMDGPU_VM_PAGE_WRITEABLE | - AMDGPU_VM_PAGE_EXECUTABLE; + va.flags = flags; va.va_address = addr; va.offset_in_bo = offset; - va.map_size = ALIGN(size, getpagesize()); + va.map_size = size; r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_VA, &va, sizeof(va)); commit 18fbd7f0899d4e67a6902813a46be2983986c21c Author: Christian Gmeiner <christian.gmei...@gmail.com> Date: Sun Mar 26 15:57:28 2017 +0200 etnaviv: remove struct etna_specs There is no need to cache spec values directly as library users will cache them anyway. Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com> diff --git a/etnaviv/etnaviv_gpu.c b/etnaviv/etnaviv_gpu.c index 35dec6c..bc355e8 100644 --- a/etnaviv/etnaviv_gpu.c +++ b/etnaviv/etnaviv_gpu.c @@ -61,32 +61,13 @@ struct etna_gpu *etna_gpu_new(struct etna_device *dev, unsigned int core) gpu->dev = dev; gpu->core = core; - /* get specs from kernel space */ - gpu->specs.model = get_param(dev, core, ETNAVIV_PARAM_GPU_MODEL); - gpu->specs.revision = get_param(dev, core, ETNAVIV_PARAM_GPU_REVISION); - gpu->specs.features[0] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_0); - gpu->specs.features[1] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_1); - gpu->specs.features[2] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_2); - gpu->specs.features[3] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_3); - gpu->specs.features[4] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_4); - gpu->specs.features[5] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_5); - gpu->specs.features[6] = get_param(dev, core, ETNAVIV_PARAM_GPU_FEATURES_6); - gpu->specs.stream_count = get_param(dev, core, ETNA_GPU_STREAM_COUNT); - gpu->specs.register_max = get_param(dev, core, ETNA_GPU_REGISTER_MAX); - gpu->specs.thread_count = get_param(dev, core, ETNA_GPU_THREAD_COUNT); - gpu->specs.vertex_cache_size = get_param(dev, core, ETNA_GPU_VERTEX_CACHE_SIZE); - gpu->specs.shader_core_count = get_param(dev, core, ETNA_GPU_SHADER_CORE_COUNT); - gpu->specs.pixel_pipes = get_param(dev, core, ETNA_GPU_PIXEL_PIPES); - gpu->specs.vertex_output_buffer_size = get_param(dev, core, ETNA_GPU_VERTEX_OUTPUT_BUFFER_SIZE); - gpu->specs.buffer_size = get_param(dev, core, ETNA_GPU_BUFFER_SIZE); - gpu->specs.instruction_count = get_param(dev, core, ETNA_GPU_INSTRUCTION_COUNT); - gpu->specs.num_constants = get_param(dev, core, ETNA_GPU_NUM_CONSTANTS); - gpu->specs.num_varyings = get_param(dev, core, ETNA_GPU_NUM_VARYINGS); - - if (!gpu->specs.model) + gpu->model = get_param(dev, core, ETNAVIV_PARAM_GPU_MODEL); + gpu->revision = get_param(dev, core, ETNAVIV_PARAM_GPU_REVISION); + + if (!gpu->model) goto fail; - INFO_MSG(" GPU model: 0x%x (rev %x)", gpu->specs.model, gpu->specs.revision); + INFO_MSG(" GPU model: 0x%x (rev %x)", gpu->model, gpu->revision); return gpu; fail: @@ -104,66 +85,69 @@ void etna_gpu_del(struct etna_gpu *gpu) int etna_gpu_get_param(struct etna_gpu *gpu, enum etna_param_id param, uint64_t *value) { + struct etna_device *dev = gpu->dev; + unsigned int core = gpu->core; + switch(param) { case ETNA_GPU_MODEL: - *value = gpu->specs.model;