Mesa git - auxiliary: compilation error with latest LLVM git in gallivm/lp_bld_debug.lo
make[4]: Entering directory '/opt/mesa/src/gallium/auxiliary' CXX gallivm/lp_bld_debug.lo gallivm/lp_bld_debug.cpp: In function 'size_t disassemble(const void*, llvm::raw_ostream&)': gallivm/lp_bld_debug.cpp:280:54: error: no matching function for call to 'llvm::TargetMachine::getSubtargetImpl()' const TargetInstrInfo *TII = TM->getSubtargetImpl()->getInstrInfo(); ^ gallivm/lp_bld_debug.cpp:280:54: note: candidate is: In file included from gallivm/lp_bld_debug.cpp:31:0: /usr/local/include/llvm/Target/TargetMachine.h:111:38: note: virtual const llvm::TargetSubtargetInfo* llvm::TargetMachine::getSubtargetImpl(const llvm::Function&) const virtual const TargetSubtargetInfo *getSubtargetImpl(const Function &) const { ^ /usr/local/include/llvm/Target/TargetMachine.h:111:38: note: candidate expects 1 argument, 0 provided Makefile:2221: recipe for target 'gallivm/lp_bld_debug.lo' failed make[4]: *** [gallivm/lp_bld_debug.lo] Error 1
Mesa git - auxiliary: compilation error with latest LLVM git in gallivm/lp_bld_debug.lo
Forget this one. Duplicate of: https://bugs.freedesktop.org/show_bug.cgi?id=89705 Sorry for the noise! -Dieter Am 22.03.2015 03:49, schrieb Dieter Nützel: > make[4]: Entering directory '/opt/mesa/src/gallium/auxiliary' > CXX gallivm/lp_bld_debug.lo > gallivm/lp_bld_debug.cpp: In function 'size_t disassemble(const void*, > llvm::raw_ostream&)': > gallivm/lp_bld_debug.cpp:280:54: error: no matching function for call > to 'llvm::TargetMachine::getSubtargetImpl()' > const TargetInstrInfo *TII = > TM->getSubtargetImpl()->getInstrInfo(); > ^ > gallivm/lp_bld_debug.cpp:280:54: note: candidate is: > In file included from gallivm/lp_bld_debug.cpp:31:0: > /usr/local/include/llvm/Target/TargetMachine.h:111:38: note: virtual > const llvm::TargetSubtargetInfo* > llvm::TargetMachine::getSubtargetImpl(const llvm::Function&) const >virtual const TargetSubtargetInfo *getSubtargetImpl(const Function > &) const { > ^ > /usr/local/include/llvm/Target/TargetMachine.h:111:38: note: > candidate expects 1 argument, 0 provided > Makefile:2221: recipe for target 'gallivm/lp_bld_debug.lo' failed > make[4]: *** [gallivm/lp_bld_debug.lo] Error 1
[Bug 89707] webgl/conformance-suites/
https://bugs.freedesktop.org/show_bug.cgi?id=89707 Luke changed: What|Removed |Added URL||https://www.khronos.org/reg ||istry/webgl/conformance-sui ||tes/1.0.2/conformance/ogles ||/GL/sin/sin_001_to_006.html --- Comment #1 from Luke --- The latest 10.6 mesa drivers are causing Ubuntu 14.4 to freeze when running the WebGL Conformance Test version 1.0.2. It's crashing at the WebGL GLSL conformance test: sin_001_to_006.html My video card is an ATI X1300. Both Chrome and Firefox will trigger the bug. Tested with both the stable and nightly FF builds. The test locks the system so hard that even the Magic SysRq key sequence doesn't work. Have to hard power down the system. Reverting back to the default 10.2 drivers fixes the issue. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150322/4252298a/attachment.html>
[Bug 89707] WebGL GLSL conformance test: sin_001_to_006.html causing system freeze
https://bugs.freedesktop.org/show_bug.cgi?id=89707 Luke changed: What|Removed |Added Summary|webgl/conformance-suites/ |WebGL GLSL conformance ||test: sin_001_to_006.html ||causing system freeze -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150322/a6324fc0/attachment.html>
[Bug 73378] [drm:radeon_uvd_send_upll_ctlreq] *ERROR* Timeout setting UVD clocks!
https://bugs.freedesktop.org/show_bug.cgi?id=73378 --- Comment #42 from equeim at gmail.com --- This patch fixed my issue of non-working UVD on cold boot. Thanks! -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150322/893ec495/attachment.html>
[Bug 89713] [radeon]GPU lockup in World of Tanks with gallium nine
https://bugs.freedesktop.org/show_bug.cgi?id=89713 Bug ID: 89713 Summary: [radeon]GPU lockup in World of Tanks with gallium nine Product: Mesa Version: git Hardware: Other OS: All Status: NEW Severity: normal Priority: medium Component: Drivers/Gallium/radeonsi Assignee: dri-devel at lists.freedesktop.org Reporter: pontostroy at gmail.com QA Contact: dri-devel at lists.freedesktop.org Created attachment 114523 --> https://bugs.freedesktop.org/attachment.cgi?id=114523&action=edit dmesg Afrer same time (10-20 min) objects in the game begin to disappear and if i do not close the application for 10-15 seconds I get gpuhang. I tried all R600_DEBUG options but nothing helped 4.0.0-rc3(debug kernel) Mesa\libdrm\ddx\x-server - git 2015.03.20-22 Radeon Hd 7790 Intel i5 3330 Opensuse factory -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150322/f96caaaf/attachment.html>
[Bug 89713] [radeon]GPU lockup in World of Tanks with gallium nine
1552]: Received signal 15; terminating. Mar 22 01:33:51 linux-nxy3 avahi-daemon[762]: Got SIGTERM, quitting. Mar 22 01:33:51 linux-nxy3 avahi-daemon[762]: Leaving mDNS multicast group on interface enp3s0.IPv6 with address fd39:2674:f80b:0:21a5:47bc:15d4:6daa. Mar 22 01:33:51 linux-nxy3 kernel: SFW2-INext-DROP-DEFLT IN=enp3s0 OUT= MAC= SRC=fd39:2674:f80b::21a5:47bc:15d4:6daa DST=ff02:::::::00fb LEN=581 TC=0 HOPLIMIT=255 FLOWLBL=0 PROTO=UDP SPT=5353 DPT=5353 LEN=541 Mar 22 01:33:51 linux-nxy3 avahi-daemon[762]: Leaving mDNS multicast group on interface enp3s0.IPv4 with address 192.168.10.100. Mar 22 01:33:51 linux-nxy3 bluetoothd[1738]: Stopping SDP server Mar 22 01:33:51 linux-nxy3 bluetoothd[1738]: Exit Mar 22 01:33:51 linux-nxy3 iscsiadm[5065]: iscsiadm: No matching sessions found Mar 22 01:33:51 linux-nxy3 avahi-daemon[762]: avahi-daemon 0.6.31 exiting. Mar 22 01:33:51 linux-nxy3 systemd[1344]: pam_unix(systemd-user:session): session closed for user nedr Mar 22 01:33:51 linux-nxy3 ModemManager[768]: ModemManager is shut down Mar 22 01:33:51 linux-nxy3 SuSEfirewall2[5111]: Not unloading firewall rules at system shutdown Mar 22 01:33:51 linux-nxy3 postfix/postfix-script[5122]: stopping the Postfix mail system Mar 22 01:33:51 linux-nxy3 postfix/master[1724]: terminating on signal 15 Mar 22 01:33:51 linux-nxy3 wickedd-dhcp4[879]: enp3s0: Request to release DHCPv4 lease with UUID 44e30d55-3cbc-0400-7203-0500 Mar 22 01:33:51 linux-nxy3 wickedd-dhcp6[880]: enp3s0: no lease set Mar 22 01:33:51 linux-nxy3 wicked[5130]: enp3s0 device-ready -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150322/305de3ef/attachment-0001.html>
[PATCH] drm/amdkfd: Add multiple kgd support
From: xihazhang The current code can only support one kgd instance. We have to support multiple kgd instances in one system. i.e two amdgpu or two radeon or one amdgpu + one radeon or more than two kgd instances. Signed-off-by: Xihan Zhang Signed-off-by: Oded Gabbay --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 3 +- drivers/gpu/drm/amd/amdkfd/kfd_device.c| 17 -- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 14 +++-- drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c | 17 +++--- drivers/gpu/drm/amd/amdkfd/kfd_module.c| 12 +--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c | 13 +++-- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 12 ++-- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 12 ++-- drivers/gpu/drm/amd/include/kgd_kfd_interface.h| 64 +++--- drivers/gpu/drm/radeon/radeon_kfd.c| 10 ++-- 10 files changed, 90 insertions(+), 84 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 50fc8ba..19a4fba 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -442,7 +442,8 @@ static int kfd_ioctl_get_clock_counters(struct file *filep, return -EINVAL; /* Reading GPU clock counter from KGD */ - args->gpu_clock_counter = kfd2kgd->get_gpu_clock_counter(dev->kgd); + args->gpu_clock_counter = + dev->kfd2kgd->get_gpu_clock_counter(dev->kgd); /* No access to rdtsc. Using raw monotonic time */ getrawmonotonic64(&time); diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c index 5bc32c2..ca7f2d3 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -94,7 +94,8 @@ static const struct kfd_device_info *lookup_device_info(unsigned short did) return NULL; } -struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, struct pci_dev *pdev) +struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, + struct pci_dev *pdev, const struct kfd2kgd_calls *f2g) { struct kfd_dev *kfd; @@ -112,6 +113,11 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, struct pci_dev *pdev) kfd->device_info = device_info; kfd->pdev = pdev; kfd->init_complete = false; + kfd->kfd2kgd = f2g; + + mutex_init(&kfd->doorbell_mutex); + memset(&kfd->doorbell_available_index, 0, + sizeof(kfd->doorbell_available_index)); return kfd; } @@ -200,8 +206,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, /* add another 512KB for all other allocations on gart (HPD, fences) */ size += 512 * 1024; - if (kfd2kgd->init_gtt_mem_allocation(kfd->kgd, size, &kfd->gtt_mem, - &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr)) { + if (kfd->kfd2kgd->init_gtt_mem_allocation( + kfd->kgd, size, &kfd->gtt_mem, + &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr)){ dev_err(kfd_device, "Could not allocate %d bytes for device (%x:%x)\n", size, kfd->pdev->vendor, kfd->pdev->device); @@ -270,7 +277,7 @@ device_iommu_pasid_error: kfd_topology_add_device_error: kfd_gtt_sa_fini(kfd); kfd_gtt_sa_init_error: - kfd2kgd->free_gtt_mem(kfd->kgd, kfd->gtt_mem); + kfd->kfd2kgd->free_gtt_mem(kfd->kgd, kfd->gtt_mem); dev_err(kfd_device, "device (%x:%x) NOT added due to errors\n", kfd->pdev->vendor, kfd->pdev->device); @@ -285,7 +292,7 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd) amd_iommu_free_device(kfd->pdev); kfd_topology_remove_device(kfd); kfd_gtt_sa_fini(kfd); - kfd2kgd->free_gtt_mem(kfd->kgd, kfd->gtt_mem); + kfd->kfd2kgd->free_gtt_mem(kfd->kgd, kfd->gtt_mem); } kfree(kfd); diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index be68d58..d717430 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -82,7 +82,8 @@ static inline unsigned int get_pipes_num_cpsch(void) void program_sh_mem_settings(struct device_queue_manager *dqm, struct qcm_process_device *qpd) { - return kfd2kgd->program_sh_mem_settings(dqm->dev->kgd, qpd->vmid, + return dqm->dev->kfd2kgd->program_sh_mem_settings( + dqm->dev->kgd, qpd->vmid, qpd->sh_mem_config, qpd->sh_mem_ape1_base, qpd->sh_mem_ape1_limit, @@ -457,9 +458,12 @@ set_pasid_vmid_mapping(struct device_queue_man
[PATCH libdrm 1/4] drmSL: Fix neighbor printing
On 20/03/15 22:10, Jan Vesely wrote: > v2: zero the update array instead of checking the return value. > SLLocate returns NULL both on failure and if the element is greater > than everything in the list > Can we add to the commit message what the issue is and mention the commit which caused this regression ? With that Acked-by: Emil Velikov -Emil
[PATCH libdrm 2/4] drmSL: Split tests to a separate file
On 20/03/15 22:10, Jan Vesely wrote: Considering that a separate commit removes the test from xf86drmSL.c can you add some information in here. "This moves the test from " > Signed-off-by: Jan Vesely > --- > .gitignore| 1 + > tests/Makefile.am | 3 +- > tests/drmsltest.c | 172 > ++ > 3 files changed, 175 insertions(+), 1 deletion(-) > create mode 100644 tests/drmsltest.c > > diff --git a/.gitignore b/.gitignore > index 06cc928..9c6ecd7 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -75,6 +75,7 @@ via.kld > tests/auth > tests/dristat > tests/drmstat > +tests/drmsltest Perhaps we can omit the trailing test -> tests/drmsl ? > tests/getclient > tests/getstats > tests/getversion > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 10f54e3..ca0f3c7 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -59,7 +59,8 @@ TESTS = \ > getstats\ > setversion \ > updatedraw \ > - name_from_fd > + name_from_fd\ > + drmsltest > Can we try to keep this alphabetically sorted ? I haven't verified that the code movement, although it seems that you've nuked the trailing whitespace :-) With the above comments addressed: Acked-by: Emil Velikov -Emil
[PATCH libdrm 4/4] drmSL: Remove test parts
On 20/03/15 22:10, Jan Vesely wrote: > Signed-off-by: Jan Vesely Can you mention in the commit message that the test was moved to tests/drmsl ? Reviewed-by: Emil Velikov I'm not planning to look at patch 3/4. Thanks for the split, I'll shortly follow up with the other two plus a trivial cleanup :-) -Emil
[PATCH 1/5] tests/exynos: add fimg2d performance analysis
On 20/03/15 22:25, Tobias Jakobi wrote: > Currently only fast solid color clear performance is measured. > A large buffer is allocated and solid color clear operations > are executed on it with randomly chosen properties (position > and size of the region, clear color). Execution time is > measured and output together with the amount of pixels > processed. > > The 'simple' variant only executes one G2D command buffer at > a time, while the 'multi' variant executes multiple ones. This > can be used to measure setup/exec overhead. > > The test also serves a stability check. If clocks/voltages are > too high or low respectively, the test quickly reveals this. > > Signed-off-by: Tobias Jakobi Hi Tobias, As most of this series is quite Exynos specific I will cover the misc bits, and leave the core part to someone familiar with the hardware. > --- > tests/exynos/Makefile.am | 8 +- > tests/exynos/exynos_fimg2d_perf.c | 245 > ++ > 2 files changed, 252 insertions(+), 1 deletion(-) > create mode 100644 tests/exynos/exynos_fimg2d_perf.c > > diff --git a/tests/exynos/Makefile.am b/tests/exynos/Makefile.am > index b21d016..243f957 100644 > --- a/tests/exynos/Makefile.am > +++ b/tests/exynos/Makefile.am > @@ -5,9 +5,11 @@ AM_CFLAGS = \ > -I $(top_srcdir)/exynos \ > -I $(top_srcdir) > > +bin_PROGRAMS = exynos_fimg2d_perf > + Might I suggest that we treat this (and your follow up utility) as a test ? I.e. use if HAVE_INSTALL_TESTS bin_PROGRAMS = \ exynos_fimg2d_perf else noinst_PROGRAMS = \ exynos_fimg2d_perf endif and amend the block below appropriately ? > if HAVE_LIBKMS > if HAVE_INSTALL_TESTS > -bin_PROGRAMS = \ > +bin_PROGRAMS += \ > exynos_fimg2d_test > else > noinst_PROGRAMS = \ > @@ -15,6 +17,10 @@ noinst_PROGRAMS = \ > endif > endif > > +exynos_fimg2d_perf_LDADD = \ > + $(top_builddir)/libdrm.la \ > + $(top_builddir)/exynos/libdrm_exynos.la > + > exynos_fimg2d_test_LDADD = \ > $(top_builddir)/libdrm.la \ > $(top_builddir)/libkms/libkms.la \ > diff --git a/tests/exynos/exynos_fimg2d_perf.c > b/tests/exynos/exynos_fimg2d_perf.c > new file mode 100644 > index 000..f45cacc > --- /dev/null > +++ b/tests/exynos/exynos_fimg2d_perf.c > @@ -0,0 +1,245 @@ Can you add a licence to this file. Would be nice if it's covered by X/MIT so that *BSD folk and others can use your tool. > +#include > +#include > +#include > + > +#include > + > +#include "exynos_drm.h" > +#include "exynos_drmif.h" > +#include "exynos_fimg2d.h" > + > +/* Enable to format the output so that it can be fed into Mathematica. */ > +#define OUTPUT_MATHEMATICA 0 > + > +static int fimg2d_perf_simple(struct exynos_bo *bo, struct g2d_context *ctx, > + unsigned buf_width, unsigned buf_height, unsigned > iterations) > +{ > + struct timespec tspec = { 0 }; > + struct g2d_image img = { 0 }; > + > + unsigned long long g2d_time; > + unsigned i; > + int ret = 0; > + > + img.width = buf_width; > + img.height = buf_height; > + img.stride = buf_width * 4; > + img.color_mode = G2D_COLOR_FMT_ARGB | G2D_ORDER_AXRGB; > + img.buf_type = G2D_IMGBUF_GEM; > + img.bo[0] = bo->handle; > + > + srand(time(NULL)); > + > + printf("starting simple G2D performance test\n"); > + printf("buffer width = %u, buffer height = %u, iterations = %u\n", > + buf_width, buf_height, iterations); > + > +#if (OUTPUT_MATHEMATICA == 1) > + putchar('{'); > +#endif > + I'm suspecting that having this as a runtime option will be better. Something like ./exynos_fimg2d_perf --output mathematica ? As a general note I would recommend keeping statements on separate lines (none of if (foo) far()) as it makes debugging easier. Although all of the above are my take on things, so checks with the Exynos crew if they feel otherwise :-) Cheers, Emil
[PATCH 2/5] exynos: add EXYNOS_G2D_EVENT to drmHandleEvent
On 20/03/15 22:25, Tobias Jakobi wrote: > This event is specific to Exynos G2D DRM driver. Only > process it when Exynos support is enabled. > > Signed-off-by: Tobias Jakobi > --- > exynos/exynos_drm.h | 12 > xf86drm.h | 7 ++- > xf86drmMode.c | 18 ++ > 3 files changed, 36 insertions(+), 1 deletion(-) > I fear we are not (yet) allowed to do either of these changes. The exynos/exynos_drm.h header is (supposed to) be in sync/come from the kernel. And changes here are to be reflected only when the corresponding patch lands in drm-next (as per RELEASING). Wrt extending the current drmEventContext, I'm not sure that adding device specific changes to it are allowed. Wish I would give you some better news but... I cannot sorry :-\ -Emil
[PATCH 2/5] exynos: add EXYNOS_G2D_EVENT to drmHandleEvent
Hello Emil, Emil Velikov wrote: > I fear we are not (yet) allowed to do either of these changes. > > The exynos/exynos_drm.h header is (supposed to) be in sync/come from the > kernel. And changes here are to be reflected only when the corresponding > patch lands in drm-next (as per RELEASING). the point here is, that the current header in libdrm in _not_ in sync with the one in the kernel. It's hopelessly outdated, but mainly because exynos/libdrm doesn't use any new functionality provided by some update. Here's the current kernel header: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/include/uapi/drm/exynos_drm.h The event stuff has been there since 2012: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/include/drm/exynos_drm.h?id=d7f1642c90ab5eb2d7c48af0581c993094f97e1a The only reason why I haven't added the IPP things, is because I don't intend to work on this for the moment. > Wrt extending the current drmEventContext, I'm not sure that adding > device specific changes to it are allowed. Why shouldn't it? Isn't drmHandleEvent supposed to handle all kinds of DRM events that the kernel produces? With best wishes, Tobias
[PATCH 1/5] tests/exynos: add fimg2d performance analysis
Hello Emil, Emil Velikov wrote: > Might I suggest that we treat this (and your follow up utility) as a > test ? I.e. use > > if HAVE_INSTALL_TESTS > bin_PROGRAMS = \ > exynos_fimg2d_perf > else > noinst_PROGRAMS = \ > exynos_fimg2d_perf > endif > > and amend the block below appropriately ? sure, honestly I don't even remember why I didn't add these as tests? *confused* > Can you add a licence to this file. Would be nice if it's covered by > X/MIT so that *BSD folk and others can use your tool. Will do! Even though I probably won't go with a MIT license. > I'm suspecting that having this as a runtime option will be better. > Something like ./exynos_fimg2d_perf --output mathematica ? Well, I was thinking about removing the Mathematica specific code for the submission, but I then left it in. I use Mathematica for parts of my thesis, so it's usually my preferred tool to visualize data. I guess a more 'open-source' friendly solution here would be to provide GnuPlot output, but I guess I leave that to another use :) > As a general note I would recommend keeping statements on separate lines > (none of if (foo) far()) as it makes debugging easier. OK, changing this. With best wishes, Tobias
[PATCH libdrm 0/9] Rework remaining tests
This series covers - Remove the hackish "include xf86drmfoo.c" from dristat - Extract the remaining two xf86drmfoo.c tests to standalone ones - beat them into shape, and - wire them up to make check. -Emil
[PATCH libdrm 1/9] tests/dristat: don't include C files
Remove the hack of including C files, by reworking the only requirement drmOpenMinor() to an open(buf...). After all we do know the exact name of the device we're going to open, so might as well use it. Replace hard-coded 16 with DRM_MAX_MINOR while we're here. Signed-off-by: Emil Velikov --- tests/dristat.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/dristat.c b/tests/dristat.c index cca4b03..cc23e16 100644 --- a/tests/dristat.c +++ b/tests/dristat.c @@ -31,13 +31,14 @@ # include #endif +#include +#include #include #include +#include +#include #include #include "xf86drm.h" -#include "xf86drmRandom.c" -#include "xf86drmHash.c" -#include "xf86drm.c" #define DRM_VERSION 0x0001 #define DRM_MEMORY 0x0002 @@ -267,9 +268,9 @@ int main(int argc, char **argv) return 1; } -for (i = 0; i < 16; i++) if (!minor || i == minor) { +for (i = 0; i < DRM_MAX_MINOR; i++) if (!minor || i == minor) { sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, i); - fd = drmOpenMinor(i, 1, DRM_NODE_PRIMARY); + fd = open(buf, O_RDWR, 0); if (fd >= 0) { printf("%s\n", buf); if (mask & DRM_BUSID) getbusid(fd); -- 2.3.1
[PATCH libdrm 2/9] tests/hash: extract test out of xf86drmHash.c
This way with follow up commits we can fix it and wire it up to make check Signed-off-by: Emil Velikov --- tests/Makefile.am | 3 +- tests/hash.c | 219 ++ xf86drmHash.c | 174 +++ 3 files changed, 231 insertions(+), 165 deletions(-) create mode 100644 tests/hash.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 10f54e3..ea826b5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,7 +29,8 @@ LDADD = $(top_builddir)/libdrm.la check_PROGRAMS = \ dristat \ - drmstat + drmstat \ + hash if HAVE_NOUVEAU SUBDIRS += nouveau diff --git a/tests/hash.c b/tests/hash.c new file mode 100644 index 000..d57d2dc --- /dev/null +++ b/tests/hash.c @@ -0,0 +1,219 @@ +/* xf86drmHash.c -- Small hash table support for integer -> integer mapping + * Created: Sun Apr 18 09:35:45 1999 by faith at precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (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 NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT 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. + * + * Authors: Rickard E. (Rik) Faith + * + * DESCRIPTION + * + * This file contains a straightforward implementation of a fixed-sized + * hash table using self-organizing linked lists [Knuth73, pp. 398-399] for + * collision resolution. There are two potentially interesting things + * about this implementation: + * + * 1) The table is power-of-two sized. Prime sized tables are more + * traditional, but do not have a significant advantage over power-of-two + * sized table, especially when double hashing is not used for collision + * resolution. + * + * 2) The hash computation uses a table of random integers [Hanson97, + * pp. 39-41]. + * + * FUTURE ENHANCEMENTS + * + * With a table size of 512, the current implementation is sufficient for a + * few hundred keys. Since this is well above the expected size of the + * tables for which this implementation was designed, the implementation of + * dynamic hash tables was postponed until the need arises. A common (and + * naive) approach to dynamic hash table implementation simply creates a + * new hash table when necessary, rehashes all the data into the new table, + * and destroys the old table. The approach in [Larson88] is superior in + * two ways: 1) only a portion of the table is expanded when needed, + * distributing the expansion cost over several insertions, and 2) portions + * of the table can be locked, enabling a scalable thread-safe + * implementation. + * + * REFERENCES + * + * [Hanson97] David R. Hanson. C Interfaces and Implementations: + * Techniques for Creating Reusable Software. Reading, Massachusetts: + * Addison-Wesley, 1997. + * + * [Knuth73] Donald E. Knuth. The Art of Computer Programming. Volume 3: + * Sorting and Searching. Reading, Massachusetts: Addison-Wesley, 1973. + * + * [Larson88] Per-Ake Larson. "Dynamic Hash Tables". CACM 31(4), April + * 1988, pp. 446-457. + * + */ + +#include +#include + +#include "xf86drm.h" + +#define HASH_SIZE 512 /* Good for about 100 entries */ + /* If you change this value, you probably + have to change the HashHash hashing + function! */ + +typedef struct HashBucket { +unsigned long key; +void *value; +struct HashBucket *next; +} HashBucket, *HashBucketPtr; + +typedef struct HashTable { +unsigned longmagic; +unsigned longentries; +unsigned longhits; /* At top of linked list */ +unsigned longpartials; /* Not at top of linked list */ +unsigned longmisses; /* Not in table */ +HashBucketPtrbuckets[HASH_SIZE]; +int p0; +HashBucketPtrp1; +} HashTable, *HashTablePtr; + +#define DIST_LIMIT 10 +static int dist[DIST_LIMIT]; + +static void c
[PATCH libdrm 3/9] tests/hash: misc compilation fixes
Get the test from completely broken to working like a charm. - Use the same variable type for both HashInsert and HashLookup. - Use correct storage type for the HashLookup return value. - Remove useless backward iteration of HashLookup(i). Signed-off-by: Emil Velikov --- tests/hash.c | 31 ++- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/tests/hash.c b/tests/hash.c index d57d2dc..902919f 100644 --- a/tests/hash.c +++ b/tests/hash.c @@ -139,27 +139,27 @@ static void compute_dist(HashTablePtr table) static void check_table(HashTablePtr table, unsigned long key, unsigned long value) { -unsigned long retval = 0; -int retcode = drmHashLookup(table, key, &retval); +unsigned long *retval; +int retcode = drmHashLookup(table, key, (void **)&retval); switch (retcode) { case -1: printf("Bad magic = 0x%08lx:" " key = %lu, expected = %lu, returned = %lu\n", - table->magic, key, value, retval); + table->magic, key, value, *retval); break; case 1: - printf("Not found: key = %lu, expected = %lu returned = %lu\n", - key, value, retval); + printf("Not found: key = %lu, expected = %lu, returned = %lu\n", + key, value, *retval); break; case 0: - if (value != retval) + if (value != *retval) printf("Bad value: key = %lu, expected = %lu, returned = %lu\n", - key, value, retval); + key, value, *retval); break; default: printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n", - retcode, key, value, retval); + retcode, key, value, *retval); break; } } @@ -167,36 +167,33 @@ static void check_table(HashTablePtr table, int main(void) { HashTablePtr table; -int i; +unsigned long i; printf("\n* 256 consecutive integers \n"); table = drmHashCreate(); -for (i = 0; i < 256; i++) drmHashInsert(table, i, i); +for (i = 0; i < 256; i++) drmHashInsert(table, i, (void *)&i); for (i = 0; i < 256; i++) check_table(table, i, i); -for (i = 256; i >= 0; i--) check_table(table, i, i); compute_dist(table); drmHashDestroy(table); printf("\n* 1024 consecutive integers \n"); table = drmHashCreate(); -for (i = 0; i < 1024; i++) drmHashInsert(table, i, i); +for (i = 0; i < 1024; i++) drmHashInsert(table, i, (void *)&i); for (i = 0; i < 1024; i++) check_table(table, i, i); -for (i = 1024; i >= 0; i--) check_table(table, i, i); compute_dist(table); drmHashDestroy(table); printf("\n* 1024 consecutive page addresses (4k pages) \n"); table = drmHashCreate(); -for (i = 0; i < 1024; i++) drmHashInsert(table, i*4096, i); +for (i = 0; i < 1024; i++) drmHashInsert(table, i*4096, (void *)&i); for (i = 0; i < 1024; i++) check_table(table, i*4096, i); -for (i = 1024; i >= 0; i--) check_table(table, i*4096, i); compute_dist(table); drmHashDestroy(table); printf("\n* 1024 random integers \n"); table = drmHashCreate(); srandom(0xbeefbeef); -for (i = 0; i < 1024; i++) drmHashInsert(table, random(), i); +for (i = 0; i < 1024; i++) drmHashInsert(table, random(), (void *)&i); srandom(0xbeefbeef); for (i = 0; i < 1024; i++) check_table(table, random(), i); srandom(0xbeefbeef); @@ -207,7 +204,7 @@ int main(void) printf("\n* 5000 random integers \n"); table = drmHashCreate(); srandom(0xbeefbeef); -for (i = 0; i < 5000; i++) drmHashInsert(table, random(), i); +for (i = 0; i < 5000; i++) drmHashInsert(table, random(), (void *)&i); srandom(0xbeefbeef); for (i = 0; i < 5000; i++) check_table(table, random(), i); srandom(0xbeefbeef); -- 2.3.1
[PATCH libdrm 4/9] tests/hash: style fixes
Signed-off-by: Emil Velikov --- tests/hash.c | 102 +++ 1 file changed, 60 insertions(+), 42 deletions(-) diff --git a/tests/hash.c b/tests/hash.c index 902919f..fa9264a 100644 --- a/tests/hash.c +++ b/tests/hash.c @@ -73,8 +73,8 @@ #include "xf86drm.h" -#define HASH_SIZE 512 /* Good for about 100 entries */ - /* If you change this value, you probably +#define HASH_SIZE 512 /* Good for about 100 entries */ +/* If you change this value, you probably have to change the HashHash hashing function! */ @@ -87,9 +87,9 @@ typedef struct HashBucket { typedef struct HashTable { unsigned longmagic; unsigned longentries; -unsigned longhits; /* At top of linked list */ -unsigned longpartials; /* Not at top of linked list */ -unsigned longmisses; /* Not in table */ +unsigned longhits; /* At top of linked list */ +unsigned longpartials; /* Not at top of linked list */ +unsigned longmisses;/* Not in table */ HashBucketPtrbuckets[HASH_SIZE]; int p0; HashBucketPtrp1; @@ -101,21 +101,25 @@ static int dist[DIST_LIMIT]; static void clear_dist(void) { int i; -for (i = 0; i < DIST_LIMIT; i++) dist[i] = 0; +for (i = 0; i < DIST_LIMIT; i++) +dist[i] = 0; } static int count_entries(HashBucketPtr bucket) { -int count = 0; +int count; -for (; bucket; bucket = bucket->next) ++count; +for (count = 0; bucket; bucket = bucket->next) +++count; return count; } static void update_dist(int count) { -if (count >= DIST_LIMIT) ++dist[DIST_LIMIT-1]; -else ++dist[count]; +if (count >= DIST_LIMIT) +++dist[DIST_LIMIT-1]; +else +++dist[count]; } static void compute_dist(HashTablePtr table) @@ -124,43 +128,45 @@ static void compute_dist(HashTablePtr table) HashBucketPtr bucket; printf("Entries = %ld, hits = %ld, partials = %ld, misses = %ld\n", - table->entries, table->hits, table->partials, table->misses); + table->entries, table->hits, table->partials, table->misses); clear_dist(); for (i = 0; i < HASH_SIZE; i++) { - bucket = table->buckets[i]; - update_dist(count_entries(bucket)); +bucket = table->buckets[i]; +update_dist(count_entries(bucket)); } for (i = 0; i < DIST_LIMIT; i++) { - if (i != DIST_LIMIT-1) printf("%5d %10d\n", i, dist[i]); - else printf("other %10d\n", dist[i]); +if (i != DIST_LIMIT-1) +printf("%5d %10d\n", i, dist[i]); +else +printf("other %10d\n", dist[i]); } } static void check_table(HashTablePtr table, - unsigned long key, unsigned long value) +unsigned long key, unsigned long value) { unsigned long *retval; int retcode = drmHashLookup(table, key, (void **)&retval); switch (retcode) { case -1: - printf("Bad magic = 0x%08lx:" - " key = %lu, expected = %lu, returned = %lu\n", - table->magic, key, value, *retval); - break; +printf("Bad magic = 0x%08lx:" + " key = %lu, expected = %lu, returned = %lu\n", + table->magic, key, value, *retval); +break; case 1: - printf("Not found: key = %lu, expected = %lu, returned = %lu\n", - key, value, *retval); - break; +printf("Not found: key = %lu, expected = %lu, returned = %lu\n", + key, value, *retval); +break; case 0: - if (value != *retval) - printf("Bad value: key = %lu, expected = %lu, returned = %lu\n", - key, value, *retval); - break; +if (value != *retval) +printf("Bad value: key = %lu, expected = %lu, returned = %lu\n", + key, value, *retval); +break; default: - printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n", - retcode, key, value, *retval); - break; +printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n", + retcode, key, value, *retval); +break; } } @@ -171,44 +177,56 @@ int main(void) printf("\n* 256 consecutive integers \n"); table = drmHashCreate(); -for (i = 0; i < 256; i++) drmHashInsert(table, i, (void *)&i); -for (i = 0; i < 256; i++) check_table(table, i, i); +for (i = 0; i < 256; i++) +drmHashInsert(table, i, (void *)&i); +for (i = 0; i < 256; i++) +check_table(table, i, i); compute_dist(table); drmHashDestroy(table); printf("\n* 1024 consecutive integers \n"); table = drmHashCreate(); -f
[PATCH libdrm 5/9] tests/hash: return non-zero on failure
... and wire up to `make check' now that it's useful. Signed-off-by: Emil Velikov --- tests/Makefile.am | 12 +++- tests/hash.c | 26 +++--- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index ea826b5..392abf5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,13 +29,15 @@ LDADD = $(top_builddir)/libdrm.la check_PROGRAMS = \ dristat \ - drmstat \ - hash + drmstat if HAVE_NOUVEAU SUBDIRS += nouveau endif +TESTS = \ + hash + if HAVE_LIBUDEV check_LTLIBRARIES = libdrmtest.la @@ -53,7 +55,7 @@ XFAIL_TESTS = \ auth\ lock -TESTS =\ +TESTS += \ openclose \ getversion \ getclient \ @@ -62,6 +64,6 @@ TESTS = \ updatedraw \ name_from_fd -check_PROGRAMS += $(TESTS) - endif + +check_PROGRAMS += $(TESTS) diff --git a/tests/hash.c b/tests/hash.c index fa9264a..46f52f8 100644 --- a/tests/hash.c +++ b/tests/hash.c @@ -142,7 +142,7 @@ static void compute_dist(HashTablePtr table) } } -static void check_table(HashTablePtr table, +static int check_table(HashTablePtr table, unsigned long key, unsigned long value) { unsigned long *retval; @@ -159,28 +159,32 @@ static void check_table(HashTablePtr table, key, value, *retval); break; case 0: -if (value != *retval) +if (value != *retval) { printf("Bad value: key = %lu, expected = %lu, returned = %lu\n", key, value, *retval); +retcode = -1; +} break; default: printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n", retcode, key, value, *retval); break; } +return retcode; } int main(void) { -HashTablePtr table; -unsigned long i; +HashTablePtr table; +unsigned long i; +int ret = 0; printf("\n* 256 consecutive integers \n"); table = drmHashCreate(); for (i = 0; i < 256; i++) drmHashInsert(table, i, (void *)&i); for (i = 0; i < 256; i++) -check_table(table, i, i); +ret = check_table(table, i, i) && ret; compute_dist(table); drmHashDestroy(table); @@ -189,7 +193,7 @@ int main(void) for (i = 0; i < 1024; i++) drmHashInsert(table, i, (void *)&i); for (i = 0; i < 1024; i++) -check_table(table, i, i); +ret = check_table(table, i, i) && ret; compute_dist(table); drmHashDestroy(table); @@ -198,7 +202,7 @@ int main(void) for (i = 0; i < 1024; i++) drmHashInsert(table, i*4096, (void *)&i); for (i = 0; i < 1024; i++) -check_table(table, i*4096, i); +ret = check_table(table, i*4096, i) && ret; compute_dist(table); drmHashDestroy(table); @@ -209,10 +213,10 @@ int main(void) drmHashInsert(table, random(), (void *)&i); srandom(0xbeefbeef); for (i = 0; i < 1024; i++) -check_table(table, random(), i); +ret = check_table(table, random(), i) && ret; srandom(0xbeefbeef); for (i = 0; i < 1024; i++) -check_table(table, random(), i); +ret = check_table(table, random(), i) && ret; compute_dist(table); drmHashDestroy(table); @@ -223,10 +227,10 @@ int main(void) drmHashInsert(table, random(), (void *)&i); srandom(0xbeefbeef); for (i = 0; i < 5000; i++) -check_table(table, random(), i); +ret = check_table(table, random(), i) && ret; srandom(0xbeefbeef); for (i = 0; i < 5000; i++) -check_table(table, random(), i); +ret = check_table(table, random(), i) && ret; compute_dist(table); drmHashDestroy(table); -- 2.3.1
[PATCH libdrm 7/9] tests/random: return non-zero on test failure
... and wire it up to make check Signed-off-by: Emil Velikov --- tests/Makefile.am | 6 +++--- tests/random.c| 6 -- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 9b13b2e..0603241 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,15 +29,15 @@ LDADD = $(top_builddir)/libdrm.la check_PROGRAMS = \ dristat \ - drmstat \ - random + drmstat if HAVE_NOUVEAU SUBDIRS += nouveau endif TESTS = \ - hash + hash \ + random if HAVE_LIBUDEV diff --git a/tests/random.c b/tests/random.c index 6dc8386..6af7d33 100644 --- a/tests/random.c +++ b/tests/random.c @@ -107,15 +107,17 @@ int main(void) { RandomState *state; int i; +int ret; unsigned long rand; state = drmRandomCreate(1); for (i = 0; i < 1; i++) { rand = drmRandom(state); } +ret = rand - state->check; printf("After 1 iterations: %lu (%lu expected): %s\n", rand, state->check, - rand - state->check ? "*INCORRECT*" : "CORRECT"); + ret ? "*INCORRECT*" : "CORRECT"); drmRandomDestroy(state); printf("Checking periods...\n"); @@ -123,5 +125,5 @@ int main(void) check_period(2); check_period(31415926); -return 0; +return ret; } -- 2.3.1
[PATCH libdrm 6/9] tests/random: extract test out of xf86drmRandom.c
With follow up commits we can clear it up and wire to make check Signed-off-by: Emil Velikov --- tests/Makefile.am | 3 +- tests/random.c| 127 ++ xf86drmRandom.c | 67 ++-- 3 files changed, 132 insertions(+), 65 deletions(-) create mode 100644 tests/random.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 392abf5..9b13b2e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,7 +29,8 @@ LDADD = $(top_builddir)/libdrm.la check_PROGRAMS = \ dristat \ - drmstat + drmstat \ + random if HAVE_NOUVEAU SUBDIRS += nouveau diff --git a/tests/random.c b/tests/random.c new file mode 100644 index 000..6dc8386 --- /dev/null +++ b/tests/random.c @@ -0,0 +1,127 @@ +/* xf86drmRandom.c -- "Minimal Standard" PRNG Implementation + * Created: Mon Apr 19 08:28:13 1999 by faith at precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (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 NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT 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. + * + * Authors: Rickard E. (Rik) Faith + * + * DESCRIPTION + * + * This file contains a simple, straightforward implementation of the Park + * & Miller "Minimal Standard" PRNG [PM88, PMS93], which is a Lehmer + * multiplicative linear congruential generator (MLCG) with a period of + * 2^31-1. + * + * This implementation is intended to provide a reliable, portable PRNG + * that is suitable for testing a hash table implementation and for + * implementing skip lists. + * + * FUTURE ENHANCEMENTS + * + * If initial seeds are not selected randomly, two instances of the PRNG + * can be correlated. [Knuth81, pp. 32-33] describes a shuffling technique + * that can eliminate this problem. + * + * If PRNGs are used for simulation, the period of the current + * implementation may be too short. [LE88] discusses methods of combining + * MLCGs to produce much longer periods, and suggests some alternative + * values for A and M. [LE90 and Sch92] also provide information on + * long-period PRNGs. + * + * REFERENCES + * + * [Knuth81] Donald E. Knuth. The Art of Computer Programming. Volume 2: + * Seminumerical Algorithms. Reading, Massachusetts: Addison-Wesley, 1981. + * + * [LE88] Pierre L'Ecuyer. "Efficient and Portable Combined Random Number + * Generators". CACM 31(6), June 1988, pp. 742-774. + * + * [LE90] Pierre L'Ecuyer. "Random Numbers for Simulation". CACM 33(10, + * October 1990, pp. 85-97. + * + * [PM88] Stephen K. Park and Keith W. Miller. "Random Number Generators: + * Good Ones are Hard to Find". CACM 31(10), October 1988, pp. 1192-1201. + * + * [Sch92] Bruce Schneier. "Pseudo-Ransom Sequence Generator for 32-Bit + * CPUs". Dr. Dobb's Journal 17(2), February 1992, pp. 34, 37-38, 40. + * + * [PMS93] Stephen K. Park, Keith W. Miller, and Paul K. Stockmeyer. In + * "Technical Correspondence: Remarks on Choosing and Implementing Random + * Number Generators". CACM 36(7), July 1993, pp. 105-110. + * + */ + +#include +#include + +#include "xf86drm.h" + +typedef struct RandomState { +unsigned long magic; +unsigned long a; +unsigned long m; +unsigned long q; /* m div a */ +unsigned long r; /* m mod a */ +unsigned long check; +unsigned long seed; +} RandomState; + +static void check_period(unsigned long seed) +{ +unsigned long count = 0; +unsigned long initial; +void *state; + +state = drmRandomCreate(seed); +initial = drmRandom(state); +++count; +while (initial != drmRandom(state)) { + if (!++count) break; +} +printf("With seed of %10lu, period = %10lu (0x%08lx)\n", + seed, count, count); +drmRandomDestroy(state); +} + +int main(void) +{ +RandomState *state; +int i; +unsigned long rand; + +state = drmRandomCreate(1); +for (i = 0; i < 1;
[PATCH libdrm 8/9] drm: replace HASH_DEBUG with DEBUG
... and remove the useless SL_DEBUG and RANDOM_DEBUG Signed-off-by: Emil Velikov --- xf86drmHash.c | 5 ++--- xf86drmRandom.c | 1 - xf86drmSL.c | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/xf86drmHash.c b/xf86drmHash.c index 82512a8..12baa62 100644 --- a/xf86drmHash.c +++ b/xf86drmHash.c @@ -74,7 +74,6 @@ #include "xf86drm.h" #define HASH_MAGIC 0xdeadbeef -#define HASH_DEBUG 0 #define HASH_SIZE 512 /* Good for about 100 entries */ /* If you change this value, you probably have to change the HashHash hashing @@ -119,7 +118,7 @@ static unsigned long HashHash(unsigned long key) } hash %= HASH_SIZE; -#if HASH_DEBUG +#if DEBUG printf( "Hash(%d) = %d\n", key, hash); #endif return hash; @@ -222,7 +221,7 @@ int drmHashInsert(void *t, unsigned long key, void *value) bucket->value= value; bucket->next = table->buckets[hash]; table->buckets[hash] = bucket; -#if HASH_DEBUG +#if DEBUG printf("Inserted %d at %d/%p\n", key, hash, bucket); #endif return 0; /* Added to table */ diff --git a/xf86drmRandom.c b/xf86drmRandom.c index 39f3c52..2177d27 100644 --- a/xf86drmRandom.c +++ b/xf86drmRandom.c @@ -77,7 +77,6 @@ #include "xf86drm.h" #define RANDOM_MAGIC 0xfeedbeef -#define RANDOM_DEBUG 0 typedef struct RandomState { unsigned long magic; diff --git a/xf86drmSL.c b/xf86drmSL.c index acddb54..9bbf8fb 100644 --- a/xf86drmSL.c +++ b/xf86drmSL.c @@ -53,7 +53,6 @@ #define SL_ENTRY_MAGIC 0x00fab1edLU #define SL_FREED_MAGIC 0xdecea5edLU #define SL_MAX_LEVEL 16 -#define SL_DEBUG 0 #define SL_RANDOM_SEED 0xc01055a1LU #if SL_MAIN -- 2.3.1
[PATCH libdrm 9/9] drm: use correct printf modifiers
The valies are unsigned long, thus we should use %lu. Signed-off-by: Emil Velikov --- xf86drmHash.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xf86drmHash.c b/xf86drmHash.c index 12baa62..887d6a7 100644 --- a/xf86drmHash.c +++ b/xf86drmHash.c @@ -119,7 +119,7 @@ static unsigned long HashHash(unsigned long key) hash %= HASH_SIZE; #if DEBUG -printf( "Hash(%d) = %d\n", key, hash); +printf( "Hash(%lu) = %lu\n", key, hash); #endif return hash; } @@ -221,8 +221,9 @@ int drmHashInsert(void *t, unsigned long key, void *value) bucket->value= value; bucket->next = table->buckets[hash]; table->buckets[hash] = bucket; -#if DEBUG printf("Inserted %d at %d/%p\n", key, hash, bucket); +#if DEBUG +printf("Inserted %lu at %lu/%p\n", key, hash, bucket); #endif return 0; /* Added to table */ } -- 2.3.1
[OSADL QA 3.18.9-rt4 #1] Radeon driver hangs
Hi Michel, [..] The most striking problem of kernel 3.18.9-rt4 affects all systems that are equipped with Radeon graphics (irrespective whether PCIe cards or APUs with on-chip graphics). They suffer from a hanging radeon driver. The block occurs when accelerated graphics load is created by x11perf or gltestperf. Sometimes only the graphics are frozen while ssh login still is possible, somtimes the entire box is no longer accessible at all. In any case, a reboot is needed to recover from this situation. Here is a selection of kernel messages: >>> [...] >>> The commits from >>> http://cgit.freedesktop.org/~airlied/linux/commit/?h=drm-fixes&id=f957063fee6392bb9365370db6db74dc0b2dce0a >>> >>> to >>> http://cgit.freedesktop.org/~airlied/linux/commit/?h=drm-fixes&id=cffefd9bb31cd35ab745d3b49005d10616d25bdc >>> >>> and >>> http://cgit.freedesktop.org/~airlied/linux/commit/?h=drm-fixes&id=b6610101718d4ab90d793c482625e98eb1262cad >>> >>> might help for this. >> >> Thanks a lot. I have applied these patches to a number of systems: >> # quilt applied | tail -7 >> patches/drm-radeon-do-a-posting-read-in-r100_set_irq.patch >> patches/drm-radeon-do-a-posting-read-in-rs600_set_irq.patch >> patches/drm-radeon-do-a-posting-read-in-r600_set_irq.patch >> patches/drm-radeon-do-a-posting-read-in-evergreen_set_irq.patch >> patches/drm-radeon-do-a-posting-read-in-si_set_irq.patch >> patches/drm-radeon-do-a-posting-read-in-cik_set_irq.patch >> patches/drm-radeon-fix-wait-to-actually-occur-after-the-signaling-callback.patch >> >> >> The graphic boards still crash and freeze the screen, but in contrast >> to the earlier situation the systems remain accessible, and the X >> Window server can be restarted after the offensive programs are >> removed. The crashes were reliably triggered by >> - gltestperf >>or >> - x11perf -repeat 3 -subs 25 -time 2 -rect10 This is not entirely correct, since gltestperf does not reliably crash the graphics controller. However, "x11perf -repeat 3 -subs 25 -time 2 -rect10" always does a reliable job to trigger the crash. >> but the crashes also occur several times per day during normal work >> such as browsing the Internet or writing a text document. If you wish >> me to provide additional diagnostic information such as running test >> programs while the graphic boards are unresponsive, I certainly can do >> that. > > Does it also happen with a kernel built from a current drm-fixes tree? > http://cgit.freedesktop.org/~airlied/linux/log/?h=drm-fixes No. Apparently, you need full preemption to expose the problem. The following list contains the results whether the command "x11perf -repeat 3 -subs 25 -time 2 -rect10" freezes the Radeon board under test (Radeon HD 7970 XFS / R9 280X) or not: linux-3.12.33-rt47 no linux-3.14.34-rt32 no linux-3.14.34-drm-3.16.7-rt32* no linux-3.18.7-rt1YES linux-3.18.9-rt4YES linux-3.18.9-rt5YES linux-3.18.9-drm-3.16.7-rt5**no linux-4.0.0-rc4 no linux-drm-fixes no *DRM subsystem backported from linux-3.16.7 to linux-3.14.34-rt32. **DRM subsystem ported from linux-3.16.7 to linux-3.18.9-rt5. More observations: If full function tracing is enabled (which makes the system about five times slower), the graphics controller no longer freezes. With partial function tracing such as "echo *drm* >set_ftrace_filter", the controller still freezes. The trace then contains vblank interrupt processing only, ioctls are no longer executed. This is the location where the driver hangs: [25104.509258] INFO: task Xorg.bin:16591 blocked for more than 120 seconds. [25104.516322] Not tainted 3.18.9-rt5 #2 [25104.520715] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [25104.528853] Xorg.binD 8171ed90 0 16591 16239 0x10400080 [25104.536102] 8800ba0bb8d8 0002 8800ba0bbfd8 0006 [25104.536103] dc08 880626d0dc08 8800ba0bbfd8 dc08 [25104.536104] 88061b2cdcd0 880616d3a940 880035c1 880616d3a940 [25104.559274] Call Trace: [25104.561844] [] schedule+0x34/0xa0 [25104.561846] [] schedule_timeout+0x23c/0x2a0 [25104.561870] [] ? radeon_fence_process+0x16/0x40 [radeon] [25104.561879] [] ? radeon_fence_any_seq_signaled+0x44/0x90 [radeon] [25104.561887] [] radeon_fence_wait_seq_timeout.constprop.8+0x327/0x380 [radeon] [25104.561889] [] ? __wake_up_sync+0x20/0x20 [25104.561898] [] radeon_fence_wait_any+0x57/0x70 [radeon] [25104.561914] [] radeon_sa_bo_new+0x2af/0x4b0 [radeon] [25104.561916] [] ? debug_smp_processor_id+0x17/0x20 [25104.561918] [] ? __kmalloc+0x8a/0x300 [25104.561932] [] radeon_ib_get+0x37/0xe0 [radeon] [25104.561943] [] radeon_cs_ioctl+0x22e/0x860 [radeon] [25104.561952] [] drm_ioctl+0x197/0x670 [drm] [25104.561954] [] ? debug_smp_processor_id+0x17/0x20 [25104.561956]
[RV280 mesa 10.1.6] Leaking dma buffer object! in r200_radeonReleaseDmaRegions
When playing a certain game (Vagrant Stories) in the pcsx Playstation emulator, i get the reproducible error message /File radeon_dma.c function r200_radeonReleaseDmaRegions line 371// //Leaking dma buffer object!/ in the terminal/console. The piece of code is: /* move waiting bos to free list. wait list provides gpu time to handle data before reuse */ foreach_s(dma_bo, temp, &rmesa->dma.wait) { if (dma_bo->expire_counter == time) { WARN_ONCE("Leaking dma buffer object!\n"); radeon_bo_unref(dma_bo->bo); remove_from_list(dma_bo); free(dma_bo); continue; } in file src/mesa/drivers/dri/r200/radeon_dma.c. That's mesa 10.1.6 from git, kernel 3.18.9 on a Mac mini G4. Any suggestions ? Is this a serious bug or just a little annoyance ? The game continues without problems after the error message. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150322/b881ab5f/attachment.html>
commit 7ce42ae67c49204c0b2252edd06f7920e0a51037 cause various errors
Hello everybody, It seems commit 7ce42ae67c49204c0b2252edd06f7920e0a51037 causes several errors. Here is what I got in dmesg: Mar 22 15:54:45 pc-francois kernel: [0.580964] [ cut here ] Mar 22 15:54:45 pc-francois kernel: [0.580971] WARNING: CPU: 1 PID: 1 at include/linux/kref.h:47 drm_framebuffer_reference+0x3b/0x70() Mar 22 15:54:45 pc-francois kernel: [0.580977] Modules linked in: Mar 22 15:54:45 pc-francois kernel: [0.580982] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.0.0-rc4+ #17 Mar 22 15:54:45 pc-francois kernel: [0.580985] Hardware name: TOSHIBA SATELLITE C70-A/Type2 - Board Product Name1, BIOS 1.00 04/30/2013 Mar 22 15:54:45 pc-francois kernel: [0.580991] 814e40fd 813f9755 Mar 22 15:54:45 pc-francois kernel: [0.580998] 8103bad7 880145e4d3c0 880145e51840 8800a9d4 Mar 22 15:54:45 pc-francois kernel: [0.581004] 8800a9d4 8125ccbb 880145e4d3c0 Mar 22 15:54:45 pc-francois kernel: [0.581010] Call Trace: Mar 22 15:54:45 pc-francois kernel: [0.581016] [] ? dump_stack+0x47/0x67 Mar 22 15:54:45 pc-francois kernel: [0.581022] [] ? warn_slowpath_common+0x77/0xb0 Mar 22 15:54:45 pc-francois kernel: [0.581026] [] ? drm_framebuffer_reference+0x3b/0x70 Mar 22 15:54:45 pc-francois kernel: [0.581032] [] ? drm_atomic_set_fb_for_plane+0x27/0x90 Mar 22 15:54:45 pc-francois kernel: [0.581037] [] ? intel_modeset_init+0x971/0x18c0 Mar 22 15:54:45 pc-francois kernel: [0.581042] [] ? gen6_write32+0x2e/0xa0 Mar 22 15:54:45 pc-francois kernel: [0.581048] [] ? ironlake_irq_postinstall+0xbc/0x180 Mar 22 15:54:45 pc-francois kernel: [0.581053] [] ? i915_driver_load+0xb2a/0x1080 Mar 22 15:54:45 pc-francois kernel: [0.581058] [] ? __wake_up+0x2f/0x50 Mar 22 15:54:45 pc-francois kernel: [0.581062] [] ? call_usermodehelper_exec+0x88/0x120 Mar 22 15:54:45 pc-francois kernel: [0.581067] [] ? walk_system_ram_range+0x80/0xe0 Mar 22 15:54:45 pc-francois kernel: [0.581072] [] ? kobject_uevent_env+0x105/0x550 Mar 22 15:54:45 pc-francois kernel: [0.581077] [] ? get_device+0x12/0x30 Mar 22 15:54:45 pc-francois kernel: [0.581081] [] ? klist_add_tail+0x1f/0x50 Mar 22 15:54:45 pc-francois kernel: [0.581085] [] ? device_add+0x15d/0x560 Mar 22 15:54:45 pc-francois kernel: [0.581091] [] ? drm_dev_register+0x9c/0xf0 Mar 22 15:54:45 pc-francois kernel: [0.581095] [] ? drm_get_pci_dev+0xad/0x1e0 Mar 22 15:54:45 pc-francois kernel: [0.581100] [] ? __pm_runtime_resume+0x47/0x60 Mar 22 15:54:45 pc-francois kernel: [0.581105] [] ? pci_device_probe+0x78/0xd0 Mar 22 15:54:45 pc-francois kernel: [0.581110] [] ? driver_probe_device+0x79/0x260 Mar 22 15:54:45 pc-francois kernel: [0.581115] [] ? __driver_attach+0x7b/0x80 Mar 22 15:54:45 pc-francois kernel: [0.581119] [] ? __device_attach+0x50/0x50 Mar 22 15:54:45 pc-francois kernel: [0.581124] [] ? bus_for_each_dev+0x53/0x90 Mar 22 15:54:45 pc-francois kernel: [0.581128] [] ? bus_add_driver+0x178/0x230 Mar 22 15:54:45 pc-francois kernel: [0.581133] [] ? mipi_dsi_bus_init+0xc/0xc Mar 22 15:54:45 pc-francois kernel: [0.581138] [] ? driver_register+0x5e/0xf0 Mar 22 15:54:45 pc-francois kernel: [0.581143] [] ? do_one_initcall+0x84/0x1c0 Mar 22 15:54:45 pc-francois kernel: [0.581147] [] ? parse_args+0x20a/0x3c0 Mar 22 15:54:45 pc-francois kernel: [0.581153] [] ? kernel_init_freeable+0x109/0x18e Mar 22 15:54:45 pc-francois kernel: [0.581157] [] ? initcall_blacklist+0xaa/0xaa Mar 22 15:54:45 pc-francois kernel: [0.581161] [] ? rest_init+0x80/0x80 Mar 22 15:54:45 pc-francois kernel: [0.581165] [] ? kernel_init+0x9/0xe0 Mar 22 15:54:45 pc-francois kernel: [0.581169] [] ? ret_from_fork+0x58/0x90 Mar 22 15:54:45 pc-francois kernel: [0.581173] [] ? rest_init+0x80/0x80 Mar 22 15:54:45 pc-francois kernel: [0.581179] ---[ end trace 317f8293ec836a06 ]--- Another one is the following: Mar 22 15:54:45 pc-francois kernel: [0.597228] [ cut here ] Mar 22 15:54:45 pc-francois kernel: [0.597233] WARNING: CPU: 1 PID: 6 at drivers/gpu/drm/drm_atomic.c:482 drm_atomic_check_only+0x35d/0x510() Mar 22 15:54:45 pc-francois kernel: [0.597235] Modules linked in: Mar 22 15:54:45 pc-francois kernel: [0.597237] CPU: 1 PID: 6 Comm: kworker/u16:0 Tainted: GW 4.0.0-rc4+ #17 Mar 22 15:54:45 pc-francois kernel: [0.597237] Hardware name: TOSHIBA SATELLITE C70-A/Type2 - Board Product Name1, BIOS 1.00 04/30/2013 Mar 22 15:54:45 pc-francois kernel: [0.597240] Workqueue: events_unbound async_run_entry_fn Mar 22 15:54:45 pc-francois kernel: [0.597242] 81518838 813f9755 Mar 22 15:54:45 pc-francois kernel: [0.597243] 8103bad7 0048 8800a9e84840 Mar 22
Solaris & [PATCH libdrm 1/2] configure.ac: split -fvisibility and __attribute__((visibility)) checks
On 03/ 9/15 05:37 AM, Emil Velikov wrote: > The former does not imply the latter and vice-versa. One such example is > the Sun compiler. > > Cc: Alan Coopersmith > Cc: Thierry Reding > Signed-off-by: Emil Velikov > --- > > Hi Alan, > Can you please take a look it this series covers the symbol visibility > issues mentioned earlier ? In theory it should work like a charm but I > cannot really test it :-\ Patch 1 of 2 breaks configure on Solaris - I get: checking for VALGRIND... no checking whether cc -xc99=%all supports __attribute__((visibility))... ./configure[13393]: set does not quote correctly, so add quotes: double-quote^J # substitution turns \\ into \, and sed turns \ into \.^J sed -n ^I"s//\\/g;^J^I s/^\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\)=\(.*\)/\1=2/p"^J ;; #(^J*)^J # : not found [No such file or directory] ./configure[13393]: {\1+set}: bad substitution ./configure[13992]: : cannot open ./configure[14000]: : cannot open ./configure[14032]: : cannot open ./configure[14051]: : cannot open ./configure[14128]: : cannot open ./configure[14139]: : cannot open ./configure[14150]: : cannot open ./configure[14435]: : cannot open ./configure[14563]: : cannot open ./configure[14603]: : cannot open ./configure[14610]: : cannot open ./configure[14639]: : cannot open ./configure[14671]: : cannot open ./configure[14740]: : cannot open ./configure[14744]: : cannot open ./configure[14778]: : cannot open ./configure[14928]: : cannot open ./configure[14948]: : cannot open ./configure[14962]: : cannot open ./configure[14966]: : cannot open configure: error: write failure creating It also generated new autoconf warnings generating the configure script: configure.ac:422: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... ../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... configure.ac:422: the top level configure.ac:422: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... ../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... configure.ac:422: the top level autoreconf: running: /net/also.us.oracle.com/export/alanc/autotools/install/bin/autoconf --force configure.ac:422: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... ../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... configure.ac:422: the top level autoreconf: running: /net/also.us.oracle.com/export/alanc/autotools/install/bin/autoheader --force configure.ac:422: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... ../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... configure.ac:422: the top level autoreconf: running: automake --add-missing --copy --force-missing configure.ac:422: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... ../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... configure.ac:422: the top level Both seem to have been caused by a misplaced close paren/brace pair and are fixed by: --- a/configure.ac +++ b/configure.ac @@ -422,7 +422,7 @@ AC_MSG_CHECKING([whether $CC supports __attribute__((visibility))]) AC_LINK_IFELSE([AC_LANG_PROGRAM([ int foo_default( void ) __attribute__((visibility("default"))); int foo_hidden( void ) __attribute__((visibility("hidden"))); -], HAVE_ATTRIBUTE_VISIBILITY="yes"; AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])]); +])], [HAVE_ATTRIBUTE_VISIBILITY="yes"; AC_MSG_RESULT([yes])], AC_MSG_RESULT([no])); if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports __attribute__((visibility))]) (Gotta love autoconf and the mysteries of proper [] placements.) After that I can build on Solaris with patch #1 applied, but patch #2 then breaks due to Solaris Studio 12.4 compilers being more pedantic about prototypes in headers having the external visibility declarations too - lots of errors of the form: "intel_bufmgr.c", line 60: redeclaration must have the same or more restrictive linker scoping: drm_intel_bo_alloc_for_render It looks like none of the headers have the drm_public attributes the compiler wants to see there. > Additionally can you guys build libdrm (barring the patch you sent the > other day), or you need some parts of this ancient patch > ht
[PATCH libdrm 1/2] configure.ac: split -fvisibility and __attribute__((visibility)) checks
On 03/20/15 10:30 AM, Emil Velikov wrote: > On 09/03/15 12:37, Emil Velikov wrote: >> The former does not imply the latter and vice-versa. One such example is >> the Sun compiler. >> >> Cc: Alan Coopersmith >> Cc: Thierry Reding >> Signed-off-by: Emil Velikov >> --- >> >> Hi Alan, >> Can you please take a look it this series covers the symbol visibility >> issues mentioned earlier ? In theory it should work like a charm but I >> cannot really test it :-\ >> > [Cutting out accidental garbage] >> Additionally can you guys build libdrm (barring the patch you sent the >> other day), or you need some parts of this ancient patch >> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/x11-libs/libdrm/files/libdrm-2.4.58-solaris.patch?view=markup >> > Hi Alan, > > Suspecting that you're quite busy. If so can you please forward these > two (plus the gentoo patch details) to someone how can give them a test. > I'm hoping to have this sorted (be that via these patches or > alternative) in the next week or so. Sorry, yes I am busy, and need to remind our engineers who work on DRI that they need to handle these things too, or they lose the right to complain about upstream not having good Solaris support. -- -Alan Coopersmith- alan.coopersmith at oracle.com Oracle Solaris Engineering - http://blogs.oracle.com/alanc