Hello community, here is the log from the commit of package libdrm for openSUSE:Factory checked in at 2017-11-04 19:28:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libdrm (Old) and /work/SRC/openSUSE:Factory/.libdrm.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "libdrm" Sat Nov 4 19:28:11 2017 rev:131 rq:538312 version:2.4.87 Changes: -------- --- /work/SRC/openSUSE:Factory/libdrm/libdrm.changes 2017-10-25 17:45:16.573737374 +0200 +++ /work/SRC/openSUSE:Factory/.libdrm.new/libdrm.changes 2017-11-04 19:28:15.279389140 +0100 @@ -1,0 +2,11 @@ +Wed Nov 1 13:43:53 UTC 2017 - tobias.johannes.klausmann@mni.thm.de + +- Update to version 2.4.87: + + amdgpu: fix 32-bit build +- This release includes the changes introduced with 2.4.86: + + amdgpu: Add wrappers for AMDGPU_VM IOCTL. + + amdgpu: Add VMID reservation per GPU context test. + + drm: sync drm headers from drm-next. + + drm/syncobj: fix some whitespace issues + +------------------------------------------------------------------- Old: ---- libdrm-2.4.85.tar.bz2 New: ---- libdrm-2.4.87.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libdrm.spec ++++++ --- /var/tmp/diff_new_pack.JImkTi/_old 2017-11-04 19:28:15.831368971 +0100 +++ /var/tmp/diff_new_pack.JImkTi/_new 2017-11-04 19:28:15.835368825 +0100 @@ -17,7 +17,7 @@ Name: libdrm -Version: 2.4.85 +Version: 2.4.87 Release: 0 Summary: Userspace Interface for Kernel DRM Services License: MIT ++++++ libdrm-2.4.85.tar.bz2 -> libdrm-2.4.87.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/amdgpu/Makefile.in new/libdrm-2.4.87/amdgpu/Makefile.in --- old/libdrm-2.4.85/amdgpu/Makefile.in 2017-10-21 00:48:22.000000000 +0200 +++ new/libdrm-2.4.87/amdgpu/Makefile.in 2017-10-31 15:50:06.000000000 +0100 @@ -162,7 +162,7 @@ libdrm_amdgpu_la_DEPENDENCIES = ../libdrm.la am__objects_1 = amdgpu_asic_id.lo amdgpu_bo.lo amdgpu_cs.lo \ amdgpu_device.lo amdgpu_gpu_info.lo amdgpu_vamgr.lo \ - util_hash.lo util_hash_table.lo + amdgpu_vm.lo util_hash.lo util_hash_table.lo am_libdrm_amdgpu_la_OBJECTS = $(am__objects_1) libdrm_amdgpu_la_OBJECTS = $(am_libdrm_amdgpu_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -575,6 +575,7 @@ amdgpu_gpu_info.c \ amdgpu_internal.h \ amdgpu_vamgr.c \ + amdgpu_vm.c \ util_hash.c \ util_hash.h \ util_hash_table.c \ @@ -692,6 +693,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_device.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_gpu_info.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_vamgr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_vm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util_hash.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util_hash_table.Plo@am__quote@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/amdgpu/Makefile.sources new/libdrm-2.4.87/amdgpu/Makefile.sources --- old/libdrm-2.4.85/amdgpu/Makefile.sources 2017-10-21 00:48:16.000000000 +0200 +++ new/libdrm-2.4.87/amdgpu/Makefile.sources 2017-10-31 15:50:00.000000000 +0100 @@ -6,6 +6,7 @@ amdgpu_gpu_info.c \ amdgpu_internal.h \ amdgpu_vamgr.c \ + amdgpu_vm.c \ util_hash.c \ util_hash.h \ util_hash_table.c \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/amdgpu/amdgpu-symbol-check new/libdrm-2.4.87/amdgpu/amdgpu-symbol-check --- old/libdrm-2.4.85/amdgpu/amdgpu-symbol-check 2017-10-21 00:48:16.000000000 +0200 +++ new/libdrm-2.4.87/amdgpu/amdgpu-symbol-check 2017-10-31 15:50:00.000000000 +0100 @@ -64,6 +64,8 @@ amdgpu_va_range_alloc amdgpu_va_range_free amdgpu_va_range_query +amdgpu_vm_reserve_vmid +amdgpu_vm_unreserve_vmid EOF done) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/amdgpu/amdgpu.h new/libdrm-2.4.87/amdgpu/amdgpu.h --- old/libdrm-2.4.85/amdgpu/amdgpu.h 2017-10-21 00:48:16.000000000 +0200 +++ new/libdrm-2.4.87/amdgpu/amdgpu.h 2017-10-31 15:50:00.000000000 +0100 @@ -1489,6 +1489,24 @@ void amdgpu_cs_chunk_fence_info_to_data(struct amdgpu_cs_fence_info *fence_info, struct drm_amdgpu_cs_chunk_data *data); +/** + * Reserve VMID + * \param context - \c [in] GPU Context + * \param flags - \c [in] TBD + * + * \return 0 on success otherwise POSIX Error code +*/ +int amdgpu_vm_reserve_vmid(amdgpu_context_handle context, uint32_t flags); + +/** + * Free reserved VMID + * \param context - \c [in] GPU Context + * \param flags - \c [in] TBD + * + * \return 0 on success otherwise POSIX Error code +*/ +int amdgpu_vm_unreserve_vmid(amdgpu_context_handle context, uint32_t flags); + #ifdef __cplusplus } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/amdgpu/amdgpu_vm.c new/libdrm-2.4.87/amdgpu/amdgpu_vm.c --- old/libdrm-2.4.85/amdgpu/amdgpu_vm.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libdrm-2.4.87/amdgpu/amdgpu_vm.c 2017-10-31 15:50:00.000000000 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright 2017 Advanced Micro Devices, Inc. + * + * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "amdgpu.h" +#include "amdgpu_drm.h" +#include "xf86drm.h" +#include "amdgpu_internal.h" + +int amdgpu_vm_reserve_vmid(amdgpu_context_handle context, uint32_t flags) +{ + union drm_amdgpu_vm vm; + + vm.in.op = AMDGPU_VM_OP_RESERVE_VMID; + vm.in.flags = flags; + + return drmCommandWriteRead(context->dev->fd, DRM_AMDGPU_VM, + &vm, sizeof(vm)); +} + +int amdgpu_vm_unreserve_vmid(amdgpu_context_handle context, uint32_t flags) +{ + union drm_amdgpu_vm vm; + + vm.in.op = AMDGPU_VM_OP_UNRESERVE_VMID; + vm.in.flags = flags; + + return drmCommandWriteRead(context->dev->fd, DRM_AMDGPU_VM, + &vm, sizeof(vm)); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/configure new/libdrm-2.4.87/configure --- old/libdrm-2.4.85/configure 2017-10-21 00:48:21.000000000 +0200 +++ new/libdrm-2.4.87/configure 2017-10-31 15:50:05.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libdrm 2.4.85. +# Generated by GNU Autoconf 2.69 for libdrm 2.4.87. # # Report bugs to https://bugs.freedesktop.org/enter_bug.cgi?product=DRI. # @@ -591,8 +591,8 @@ # Identity of this package. PACKAGE_NAME='libdrm' PACKAGE_TARNAME='libdrm' -PACKAGE_VERSION='2.4.85' -PACKAGE_STRING='libdrm 2.4.85' +PACKAGE_VERSION='2.4.87' +PACKAGE_STRING='libdrm 2.4.87' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=DRI' PACKAGE_URL='' @@ -1433,7 +1433,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libdrm 2.4.85 to adapt to many kinds of systems. +\`configure' configures libdrm 2.4.87 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1504,7 +1504,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libdrm 2.4.85:";; + short | recursive ) echo "Configuration of libdrm 2.4.87:";; esac cat <<\_ACEOF @@ -1676,7 +1676,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libdrm configure 2.4.85 +libdrm configure 2.4.87 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2099,7 +2099,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libdrm $as_me 2.4.85, which was +It was created by libdrm $as_me 2.4.87, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3458,7 +3458,7 @@ # Define the identity of the package. PACKAGE='libdrm' - VERSION='2.4.85' + VERSION='2.4.87' cat >>confdefs.h <<_ACEOF @@ -15294,7 +15294,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libdrm $as_me 2.4.85, which was +This file was extended by libdrm $as_me 2.4.87, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15360,7 +15360,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libdrm config.status 2.4.85 +libdrm config.status 2.4.87 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/configure.ac new/libdrm-2.4.87/configure.ac --- old/libdrm-2.4.85/configure.ac 2017-10-21 00:48:16.000000000 +0200 +++ new/libdrm-2.4.87/configure.ac 2017-10-31 15:50:00.000000000 +0100 @@ -20,7 +20,7 @@ AC_PREREQ([2.63]) AC_INIT([libdrm], - [2.4.85], + [2.4.87], [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI], [libdrm]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/include/drm/drm.h new/libdrm-2.4.87/include/drm/drm.h --- old/libdrm-2.4.85/include/drm/drm.h 2017-10-21 00:48:16.000000000 +0200 +++ new/libdrm-2.4.87/include/drm/drm.h 2017-10-31 15:50:00.000000000 +0100 @@ -731,6 +731,28 @@ __u32 pad; }; +/* Query current scanout sequence number */ +struct drm_crtc_get_sequence { + __u32 crtc_id; /* requested crtc_id */ + __u32 active; /* return: crtc output is active */ + __u64 sequence; /* return: most recent vblank sequence */ + __s64 sequence_ns; /* return: most recent time of first pixel out */ +}; + +/* Queue event to be delivered at specified sequence. Time stamp marks + * when the first pixel of the refresh cycle leaves the display engine + * for the display + */ +#define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */ +#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */ + +struct drm_crtc_queue_sequence { + __u32 crtc_id; + __u32 flags; + __u64 sequence; /* on input, target sequence. on output, actual sequence */ + __u64 user_data; /* user data passed to event */ +}; + #if defined(__cplusplus) } #endif @@ -813,6 +835,9 @@ #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) +#define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence) +#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence) + #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) @@ -857,6 +882,11 @@ #define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array) #define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array) +#define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease) +#define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees) +#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) +#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) + /** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f. @@ -887,6 +917,7 @@ #define DRM_EVENT_VBLANK 0x01 #define DRM_EVENT_FLIP_COMPLETE 0x02 +#define DRM_EVENT_CRTC_SEQUENCE 0x03 struct drm_event_vblank { struct drm_event base; @@ -897,6 +928,16 @@ __u32 crtc_id; /* 0 on older kernels that do not support this */ }; +/* Event delivered at sequence. Time stamp marks when the first pixel + * of the refresh cycle leaves the display engine for the display + */ +struct drm_event_crtc_sequence { + struct drm_event base; + __u64 user_data; + __s64 time_ns; + __u64 sequence; +}; + /* typedef area */ typedef struct drm_clip_rect drm_clip_rect_t; typedef struct drm_drawable_info drm_drawable_info_t; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/include/drm/drm_mode.h new/libdrm-2.4.87/include/drm/drm_mode.h --- old/libdrm-2.4.85/include/drm/drm_mode.h 2017-10-21 00:48:16.000000000 +0200 +++ new/libdrm-2.4.87/include/drm/drm_mode.h 2017-10-31 15:50:00.000000000 +0100 @@ -75,7 +75,7 @@ * (define not exposed to user space). */ #define DRM_MODE_FLAG_3D_MASK (0x1f<<14) -#define DRM_MODE_FLAG_3D_NONE (0<<14) +#define DRM_MODE_FLAG_3D_NONE (0<<14) #define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14) #define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14) #define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14) @@ -85,6 +85,19 @@ #define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14) #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14) +/* Picture aspect ratio options */ +#define DRM_MODE_PICTURE_ASPECT_NONE 0 +#define DRM_MODE_PICTURE_ASPECT_4_3 1 +#define DRM_MODE_PICTURE_ASPECT_16_9 2 + +/* Aspect ratio flag bitmask (4 bits 22:19) */ +#define DRM_MODE_FLAG_PIC_AR_MASK (0x0F<<19) +#define DRM_MODE_FLAG_PIC_AR_NONE \ + (DRM_MODE_PICTURE_ASPECT_NONE<<19) +#define DRM_MODE_FLAG_PIC_AR_4_3 \ + (DRM_MODE_PICTURE_ASPECT_4_3<<19) +#define DRM_MODE_FLAG_PIC_AR_16_9 \ + (DRM_MODE_PICTURE_ASPECT_16_9<<19) /* DPMS flags */ /* bit compatible with the xorg definitions. */ @@ -100,11 +113,6 @@ #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ -/* Picture aspect ratio options */ -#define DRM_MODE_PICTURE_ASPECT_NONE 0 -#define DRM_MODE_PICTURE_ASPECT_4_3 1 -#define DRM_MODE_PICTURE_ASPECT_16_9 2 - /* Dithering mode options */ #define DRM_MODE_DITHERING_OFF 0 #define DRM_MODE_DITHERING_ON 1 @@ -724,7 +732,7 @@ /* Where in this blob the modifiers exist (in bytes) */ __u32 modifiers_offset; - /* u32 formats[] */ + /* __u32 formats[] */ /* struct drm_format_modifier modifiers[] */ }; @@ -741,9 +749,9 @@ * If the number formats grew to 128, and formats 98-102 are * supported with the modifier: * - * 0x0000003c00000000 0000000000000000 + * 0x0000007c00000000 0000000000000000 * ^ - * |__offset = 64, formats = 0x3c00000000 + * |__offset = 64, formats = 0x7c00000000 * */ __u64 formats; @@ -774,6 +782,72 @@ __u32 blob_id; }; +/** + * Lease mode resources, creating another drm_master. + */ +struct drm_mode_create_lease { + /** Pointer to array of object ids (__u32) */ + __u64 object_ids; + /** Number of object ids */ + __u32 object_count; + /** flags for new FD (O_CLOEXEC, etc) */ + __u32 flags; + + /** Return: unique identifier for lessee. */ + __u32 lessee_id; + /** Return: file descriptor to new drm_master file */ + __u32 fd; +}; + +/** + * List lesses from a drm_master + */ +struct drm_mode_list_lessees { + /** Number of lessees. + * On input, provides length of the array. + * On output, provides total number. No + * more than the input number will be written + * back, so two calls can be used to get + * the size and then the data. + */ + __u32 count_lessees; + __u32 pad; + + /** Pointer to lessees. + * pointer to __u64 array of lessee ids + */ + __u64 lessees_ptr; +}; + +/** + * Get leased objects + */ +struct drm_mode_get_lease { + /** Number of leased objects. + * On input, provides length of the array. + * On output, provides total number. No + * more than the input number will be written + * back, so two calls can be used to get + * the size and then the data. + */ + __u32 count_objects; + __u32 pad; + + /** Pointer to objects. + * pointer to __u32 array of object ids + */ + __u64 objects_ptr; +}; + +/** + * Revoke lease + */ +struct drm_mode_revoke_lease { + /** Unique ID of lessee + */ + __u32 lessee_id; +}; + #if defined(__cplusplus) } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/tests/amdgpu/Makefile.am new/libdrm-2.4.87/tests/amdgpu/Makefile.am --- old/libdrm-2.4.85/tests/amdgpu/Makefile.am 2017-10-21 00:48:16.000000000 +0200 +++ new/libdrm-2.4.87/tests/amdgpu/Makefile.am 2017-10-31 15:50:00.000000000 +0100 @@ -31,4 +31,5 @@ uvd_enc_tests.c \ vcn_tests.c \ uve_ib.h \ - deadlock_tests.c + deadlock_tests.c \ + vm_tests.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/tests/amdgpu/Makefile.in new/libdrm-2.4.87/tests/amdgpu/Makefile.in --- old/libdrm-2.4.85/tests/amdgpu/Makefile.in 2017-10-21 00:48:22.000000000 +0200 +++ new/libdrm-2.4.87/tests/amdgpu/Makefile.in 2017-10-31 15:50:07.000000000 +0100 @@ -111,7 +111,8 @@ amdgpu_test-vce_tests.$(OBJEXT) \ amdgpu_test-uvd_enc_tests.$(OBJEXT) \ amdgpu_test-vcn_tests.$(OBJEXT) \ - amdgpu_test-deadlock_tests.$(OBJEXT) + amdgpu_test-deadlock_tests.$(OBJEXT) \ + amdgpu_test-vm_tests.$(OBJEXT) amdgpu_test_OBJECTS = $(am_amdgpu_test_OBJECTS) amdgpu_test_LDADD = $(LDADD) am__DEPENDENCIES_1 = @@ -359,7 +360,8 @@ uvd_enc_tests.c \ vcn_tests.c \ uve_ib.h \ - deadlock_tests.c + deadlock_tests.c \ + vm_tests.c all: all-am @@ -471,6 +473,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-uvd_enc_tests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-vce_tests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-vcn_tests.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdgpu_test-vm_tests.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -605,6 +608,20 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o amdgpu_test-deadlock_tests.obj `if test -f 'deadlock_tests.c'; then $(CYGPATH_W) 'deadlock_tests.c'; else $(CYGPATH_W) '$(srcdir)/deadlock_tests.c'; fi` +amdgpu_test-vm_tests.o: vm_tests.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT amdgpu_test-vm_tests.o -MD -MP -MF $(DEPDIR)/amdgpu_test-vm_tests.Tpo -c -o amdgpu_test-vm_tests.o `test -f 'vm_tests.c' || echo '$(srcdir)/'`vm_tests.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/amdgpu_test-vm_tests.Tpo $(DEPDIR)/amdgpu_test-vm_tests.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vm_tests.c' object='amdgpu_test-vm_tests.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o amdgpu_test-vm_tests.o `test -f 'vm_tests.c' || echo '$(srcdir)/'`vm_tests.c + +amdgpu_test-vm_tests.obj: vm_tests.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT amdgpu_test-vm_tests.obj -MD -MP -MF $(DEPDIR)/amdgpu_test-vm_tests.Tpo -c -o amdgpu_test-vm_tests.obj `if test -f 'vm_tests.c'; then $(CYGPATH_W) 'vm_tests.c'; else $(CYGPATH_W) '$(srcdir)/vm_tests.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/amdgpu_test-vm_tests.Tpo $(DEPDIR)/amdgpu_test-vm_tests.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vm_tests.c' object='amdgpu_test-vm_tests.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(amdgpu_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o amdgpu_test-vm_tests.obj `if test -f 'vm_tests.c'; then $(CYGPATH_W) 'vm_tests.c'; else $(CYGPATH_W) '$(srcdir)/vm_tests.c'; fi` + mostlyclean-libtool: -rm -f *.lo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/tests/amdgpu/amdgpu_test.c new/libdrm-2.4.87/tests/amdgpu/amdgpu_test.c --- old/libdrm-2.4.85/tests/amdgpu/amdgpu_test.c 2017-10-21 00:48:16.000000000 +0200 +++ new/libdrm-2.4.87/tests/amdgpu/amdgpu_test.c 2017-10-31 15:50:00.000000000 +0100 @@ -103,6 +103,13 @@ .pCleanupFunc = suite_deadlock_tests_clean, .pTests = deadlock_tests, }, + { + .pName = "VM Tests", + .pInitFunc = suite_vm_tests_init, + .pCleanupFunc = suite_vm_tests_clean, + .pTests = vm_tests, + }, + CU_SUITE_INFO_NULL, }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/tests/amdgpu/amdgpu_test.h new/libdrm-2.4.87/tests/amdgpu/amdgpu_test.h --- old/libdrm-2.4.85/tests/amdgpu/amdgpu_test.h 2017-10-21 00:48:16.000000000 +0200 +++ new/libdrm-2.4.87/tests/amdgpu/amdgpu_test.h 2017-10-31 15:50:00.000000000 +0100 @@ -150,6 +150,21 @@ extern CU_TestInfo deadlock_tests[]; /** + * Initialize vm test suite + */ +int suite_vm_tests_init(); + +/** + * Deinitialize deadlock test suite + */ +int suite_vm_tests_clean(); + +/** + * Tests in vm test suite + */ +extern CU_TestInfo vm_tests[]; + +/** * Helper functions */ static inline amdgpu_bo_handle gpu_mem_alloc( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/tests/amdgpu/vm_tests.c new/libdrm-2.4.87/tests/amdgpu/vm_tests.c --- old/libdrm-2.4.85/tests/amdgpu/vm_tests.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libdrm-2.4.87/tests/amdgpu/vm_tests.c 2017-10-31 15:50:00.000000000 +0100 @@ -0,0 +1,151 @@ +/* + * Copyright 2017 Advanced Micro Devices, Inc. + * + * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. + * +*/ + +#include "CUnit/Basic.h" + +#include "amdgpu_test.h" +#include "amdgpu_drm.h" + +static amdgpu_device_handle device_handle; +static uint32_t major_version; +static uint32_t minor_version; + + +static void amdgpu_vmid_reserve_test(void); + +int suite_vm_tests_init(void) +{ + struct amdgpu_gpu_info gpu_info = {0}; + int r; + + r = amdgpu_device_initialize(drm_amdgpu[0], &major_version, + &minor_version, &device_handle); + + if (r) { + if ((r == -EACCES) && (errno == EACCES)) + printf("\n\nError:%s. " + "Hint:Try to run this test program as root.", + strerror(errno)); + return CUE_SINIT_FAILED; + } + + return CUE_SUCCESS; +} + +int suite_vm_tests_clean(void) +{ + int r = amdgpu_device_deinitialize(device_handle); + + if (r == 0) + return CUE_SUCCESS; + else + return CUE_SCLEAN_FAILED; +} + + +CU_TestInfo vm_tests[] = { + { "resere vmid test", amdgpu_vmid_reserve_test }, + CU_TEST_INFO_NULL, +}; + +static void amdgpu_vmid_reserve_test(void) +{ + amdgpu_context_handle context_handle; + amdgpu_bo_handle ib_result_handle; + void *ib_result_cpu; + uint64_t ib_result_mc_address; + struct amdgpu_cs_request ibs_request; + struct amdgpu_cs_ib_info ib_info; + struct amdgpu_cs_fence fence_status; + uint32_t expired, flags; + int i, r, instance; + amdgpu_bo_list_handle bo_list; + amdgpu_va_handle va_handle; + union drm_amdgpu_vm vm; + static uint32_t *ptr; + + r = amdgpu_cs_ctx_create(device_handle, &context_handle); + CU_ASSERT_EQUAL(r, 0); + + flags = 0; + r = amdgpu_vm_reserve_vmid(context_handle, flags); + CU_ASSERT_EQUAL(r, 0); + + + r = amdgpu_bo_alloc_and_map(device_handle, 4096, 4096, + AMDGPU_GEM_DOMAIN_GTT, 0, + &ib_result_handle, &ib_result_cpu, + &ib_result_mc_address, &va_handle); + CU_ASSERT_EQUAL(r, 0); + + r = amdgpu_get_bo_list(device_handle, ib_result_handle, NULL, + &bo_list); + CU_ASSERT_EQUAL(r, 0); + + ptr = ib_result_cpu; + + for (i = 0; i < 16; ++i) + ptr[i] = 0xffff1000; + + memset(&ib_info, 0, sizeof(struct amdgpu_cs_ib_info)); + ib_info.ib_mc_address = ib_result_mc_address; + ib_info.size = 16; + + memset(&ibs_request, 0, sizeof(struct amdgpu_cs_request)); + ibs_request.ip_type = AMDGPU_HW_IP_GFX; + ibs_request.ring = 0; + ibs_request.number_of_ibs = 1; + ibs_request.ibs = &ib_info; + ibs_request.resources = bo_list; + ibs_request.fence_info.handle = NULL; + + r = amdgpu_cs_submit(context_handle, 0,&ibs_request, 1); + CU_ASSERT_EQUAL(r, 0); + + + memset(&fence_status, 0, sizeof(struct amdgpu_cs_fence)); + fence_status.context = context_handle; + fence_status.ip_type = AMDGPU_HW_IP_GFX; + fence_status.ip_instance = 0; + fence_status.ring = 0; + fence_status.fence = ibs_request.seq_no; + + r = amdgpu_cs_query_fence_status(&fence_status, + AMDGPU_TIMEOUT_INFINITE,0, &expired); + CU_ASSERT_EQUAL(r, 0); + + r = amdgpu_bo_list_destroy(bo_list); + CU_ASSERT_EQUAL(r, 0); + + r = amdgpu_bo_unmap_and_free(ib_result_handle, va_handle, + ib_result_mc_address, 4096); + CU_ASSERT_EQUAL(r, 0); + + flags = 0; + r = amdgpu_vm_unreserve_vmid(context_handle, flags); + CU_ASSERT_EQUAL(r, 0); + + + r = amdgpu_cs_ctx_free(context_handle); + CU_ASSERT_EQUAL(r, 0); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdrm-2.4.85/xf86drm.c new/libdrm-2.4.87/xf86drm.c --- old/libdrm-2.4.85/xf86drm.c 2017-10-21 00:48:16.000000000 +0200 +++ new/libdrm-2.4.87/xf86drm.c 2017-10-31 15:50:00.000000000 +0100 @@ -4155,7 +4155,7 @@ args.handle = 0; ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_CREATE, &args); if (ret) - return ret; + return ret; *handle = args.handle; return 0; } @@ -4179,7 +4179,7 @@ args.handle = handle; ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, &args); if (ret) - return ret; + return ret; *obj_fd = args.fd; return 0; } @@ -4194,7 +4194,7 @@ args.handle = 0; ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &args); if (ret) - return ret; + return ret; *handle = args.handle; return 0; } @@ -4221,29 +4221,29 @@ args.flags = DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE; ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, &args); if (ret) - return ret; + return ret; *sync_file_fd = args.fd; return 0; } int drmSyncobjWait(int fd, uint32_t *handles, unsigned num_handles, - int64_t timeout_nsec, unsigned flags, - uint32_t *first_signaled) + int64_t timeout_nsec, unsigned flags, + uint32_t *first_signaled) { - struct drm_syncobj_wait args; - int ret; + struct drm_syncobj_wait args; + int ret; - memclear(args); - args.handles = (intptr_t)handles; - args.timeout_nsec = timeout_nsec; - args.count_handles = num_handles; - args.flags = flags; - - ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &args); - if (ret < 0) - return ret; - - if (first_signaled) - *first_signaled = args.first_signaled; - return ret; + memclear(args); + args.handles = (intptr_t)handles; + args.timeout_nsec = timeout_nsec; + args.count_handles = num_handles; + args.flags = flags; + + ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &args); + if (ret < 0) + return ret; + + if (first_signaled) + *first_signaled = args.first_signaled; + return ret; }