From patchwork Wed Feb 1 15:32:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 9549981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DFC5C60424 for ; Wed, 1 Feb 2017 15:35:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF3E92844A for ; Wed, 1 Feb 2017 15:35:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C211728451; Wed, 1 Feb 2017 15:35:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5C6032844A for ; Wed, 1 Feb 2017 15:35:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 857F36E814; Wed, 1 Feb 2017 15:35:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wj0-x242.google.com (mail-wj0-x242.google.com [IPv6:2a00:1450:400c:c01::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 400056E814 for ; Wed, 1 Feb 2017 15:35:15 +0000 (UTC) Received: by mail-wj0-x242.google.com with SMTP id le4so4076332wjb.0 for ; Wed, 01 Feb 2017 07:35:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=11+mPBjnD/fcE8lGzPni/g+HjBAZCfPSTl2SVyRKDIs=; b=a42TYsHVRgPNctg5tII6mUpSinI+rxT2XOkNOIeEimA7EVnrN9GZw9e5I7ZdKiouO2 wpYelM5XvmdQwb/DigJcdmPtluVqJ0ibONdHOoHgObXX90SZpmVO/Azr+Zk8CvO/N4q1 Sfb2p3tHtSCIeORVqC1vgmuNb08opopP10PEVeZbfYQ+xxSG8yV1wOXFyd1stLlJIHYH alHmztHQkuETvRCF8JBFnDhw+w4X9405CsEYhjY9Zz8yxixhYrB1Y6VQSonwa11eVoke Tx/+kqjwhBKHkgejaRRfNG4XLGO1FyawPVjT9B8TGrBfMBuI6cWKjndjbHl+eq2/ScEr OyMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=11+mPBjnD/fcE8lGzPni/g+HjBAZCfPSTl2SVyRKDIs=; b=Hq7asdQ/x7vkOsa+o4DbvZ6VLqHAhP1xNAKDm9+19CyrmUoPvCNoI3X1oj6gsiKkK1 m4N1qcl5Oul93MS+8Bu43d7FJEm5wjG1pSZoTqxDxjDyE9TlwCpnm0vekiaTp+aOWwZz +rw3O4yu5RtXOTGaT0RvHKDMJIh3zsaH8tPHIJXzJAqzwnaXpY0ntMz6DZhJ2jD322+g ZaGNTk77w3LAExlF5Z4Okl8uGtRF6Z9x0Prs22/G9Sxk1iDTuMOXtuaulxDMrljA+at5 1bECTBNvfV4QDuyBIVzxbYPH9OvDLqOl7bw4yHLqShmwEc0XZJCv8SQQR/CqKsvBSo6X cggw== X-Gm-Message-State: AIkVDXJyKnjN1U0J5/TSPlkzDBn0WOO4AC4jQpavZgERXgpfZMjCXrDDgvtqJq9+S74Qyg== X-Received: by 10.223.164.66 with SMTP id e2mr3122450wra.47.1485963313527; Wed, 01 Feb 2017 07:35:13 -0800 (PST) Received: from localhost.localdomain ([77.78.16.138]) by smtp.gmail.com with ESMTPSA id a35sm34849755wra.21.2017.02.01.07.35.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 07:35:12 -0800 (PST) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm] Remove unused tests/drmstat.c Date: Wed, 1 Feb 2017 15:32:51 +0000 Message-Id: <20170201153251.27101-1-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.11.0 Cc: emil.l.velikov@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Emil Velikov Earlier commit removed all the legacy 'tests' but a file was left danglig. Cc: Andreas Boll Reported-by: Andreas Boll Fixes: 0c80fddd1d0 "tests: remove useless legacy tests" Signed-off-by: Emil Velikov Reviewed-by: Andreas Boll --- tests/drmstat.c | 419 -------------------------------------------------------- 1 file changed, 419 deletions(-) delete mode 100644 tests/drmstat.c diff --git a/tests/drmstat.c b/tests/drmstat.c deleted file mode 100644 index 023aa069..00000000 --- a/tests/drmstat.c +++ /dev/null @@ -1,419 +0,0 @@ -/* drmstat.c -- DRM device status and testing program - * Created: Tue Jan 5 08:19:24 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * 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 - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_ALLOCA_H -# include -#endif -#include "xf86drm.h" - -int sigio_fd; - -static double usec(struct timeval *end, struct timeval *start) -{ - double e = end->tv_sec * 1000000 + end->tv_usec; - double s = start->tv_sec * 1000000 + start->tv_usec; - - return e - s; -} - -static void getversion(int fd) -{ - drmVersionPtr version; - - version = drmGetVersion(fd); - if (version) { - printf( "Name: %s\n", version->name ? version->name : "?" ); - printf( " Version: %d.%d.%d\n", - version->version_major, - version->version_minor, - version->version_patchlevel ); - printf( " Date: %s\n", version->date ? version->date : "?" ); - printf( " Desc: %s\n", version->desc ? version->desc : "?" ); - drmFreeVersion(version); - } else { - printf( "No driver available\n" ); - } -} - -static void process_sigio(char *device) -{ - int fd; - - if ((fd = open(device, 0)) < 0) { - drmError(-errno, __func__); - exit(1); - } - - sigio_fd = fd; - for (;;) sleep(60); -} - -int main(int argc, char **argv) -{ - int c; - int r = 0; - int fd = -1; - drm_handle_t handle; - void *address; - char *pt; - unsigned long count; - unsigned long offset; - unsigned long size; - drm_context_t context; - int loops; - char buf[1024]; - int i; - drmBufInfoPtr info; - drmBufMapPtr bufs; - drmLockPtr lock; - int secs; - - while ((c = getopt(argc, argv, - "lc:vo:O:f:s:w:W:b:r:R:P:L:C:XS:B:F:")) != EOF) - switch (c) { - case 'F': - count = strtoul(optarg, NULL, 0); - if (!fork()) { - dup(fd); - sleep(count); - } - close(fd); - break; - case 'v': getversion(fd); break; - case 'X': - if ((r = drmCreateContext(fd, &context))) { - drmError(r, argv[0]); - return 1; - } - printf( "Got %d\n", context); - break; - case 'S': - process_sigio(optarg); - break; - case 'C': - if ((r = drmSwitchToContext(fd, strtoul(optarg, NULL, 0)))) { - drmError(r, argv[0]); - return 1; - } - break; - case 'c': - if ((r = drmSetBusid(fd,optarg))) { - drmError(r, argv[0]); - return 1; - } - break; - case 'o': - if ((fd = drmOpen(optarg, NULL)) < 0) { - drmError(fd, argv[0]); - return 1; - } - break; - case 'O': - if ((fd = drmOpen(NULL, optarg)) < 0) { - drmError(fd, argv[0]); - return 1; - } - break; - case 'B': /* Test buffer allocation */ - count = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, &pt, 0); - secs = strtoul(pt+1, NULL, 0); - { - drmDMAReq dma; - int *indices, *sizes; - - indices = alloca(sizeof(*indices) * count); - sizes = alloca(sizeof(*sizes) * count); - dma.context = context; - dma.send_count = 0; - dma.request_count = count; - dma.request_size = size; - dma.request_list = indices; - dma.request_sizes = sizes; - dma.flags = DRM_DMA_WAIT; - if ((r = drmDMA(fd, &dma))) { - drmError(r, argv[0]); - return 1; - } - for (i = 0; i < dma.granted_count; i++) { - printf("%5d: index = %d, size = %d\n", - i, dma.request_list[i], dma.request_sizes[i]); - } - sleep(secs); - drmFreeBufs(fd, dma.granted_count, indices); - } - break; - case 'b': - count = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, NULL, 0); - if ((r = drmAddBufs(fd, count, size, 0, 65536)) < 0) { - drmError(r, argv[0]); - return 1; - } - if (!(info = drmGetBufInfo(fd))) { - drmError(0, argv[0]); - return 1; - } - for (i = 0; i < info->count; i++) { - printf("%5d buffers of size %6d (low = %d, high = %d)\n", - info->list[i].count, - info->list[i].size, - info->list[i].low_mark, - info->list[i].high_mark); - } - if ((r = drmMarkBufs(fd, 0.50, 0.80))) { - drmError(r, argv[0]); - return 1; - } - if (!(info = drmGetBufInfo(fd))) { - drmError(0, argv[0]); - return 1; - } - for (i = 0; i < info->count; i++) { - printf("%5d buffers of size %6d (low = %d, high = %d)\n", - info->list[i].count, - info->list[i].size, - info->list[i].low_mark, - info->list[i].high_mark); - } - printf("===== /proc/dri/0/mem =====\n"); - sprintf(buf, "cat /proc/dri/0/mem"); - system(buf); -#if 1 - if (!(bufs = drmMapBufs(fd))) { - drmError(0, argv[0]); - return 1; - } - printf("===============================\n"); - printf( "%d bufs\n", bufs->count); - for (i = 0; i < bufs->count; i++) { - printf( " %4d: %8d bytes at %p\n", - i, - bufs->list[i].total, - bufs->list[i].address); - } - printf("===== /proc/dri/0/vma =====\n"); - sprintf(buf, "cat /proc/dri/0/vma"); - system(buf); -#endif - break; - case 'f': - offset = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, NULL, 0); - handle = 0; - if ((r = drmAddMap(fd, offset, size, - DRM_FRAME_BUFFER, 0, &handle))) { - drmError(r, argv[0]); - return 1; - } - printf("0x%08lx:0x%04lx added\n", offset, size); - printf("===== /proc/dri/0/mem =====\n"); - sprintf(buf, "cat /proc/dri/0/mem"); - system(buf); - break; - case 'r': - case 'R': - offset = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, NULL, 0); - handle = 0; - if ((r = drmAddMap(fd, offset, size, - DRM_REGISTERS, - c == 'R' ? DRM_READ_ONLY : 0, - &handle))) { - drmError(r, argv[0]); - return 1; - } - printf("0x%08lx:0x%04lx added\n", offset, size); - printf("===== /proc/dri/0/mem =====\n"); - sprintf(buf, "cat /proc/dri/0/mem"); - system(buf); - break; - case 's': - size = strtoul(optarg, &pt, 0); - handle = 0; - if ((r = drmAddMap(fd, 0, size, - DRM_SHM, DRM_CONTAINS_LOCK, - &handle))) { - drmError(r, argv[0]); - return 1; - } - printf("0x%04lx byte shm added at 0x%08lx\n", size, handle); - sprintf(buf, "cat /proc/dri/0/vm"); - system(buf); - break; - case 'P': - offset = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, NULL, 0); - address = NULL; - if ((r = drmMap(fd, offset, size, &address))) { - drmError(r, argv[0]); - return 1; - } - printf("0x%08lx:0x%04lx mapped at %p for pid %d\n", - offset, size, address, getpid()); - printf("===== /proc/dri/0/vma =====\n"); - sprintf(buf, "cat /proc/dri/0/vma"); - system(buf); - mprotect((void *)offset, size, PROT_READ); - printf("===== /proc/dri/0/vma =====\n"); - sprintf(buf, "cat /proc/dri/0/vma"); - system(buf); - break; - case 'w': - case 'W': - offset = strtoul(optarg, &pt, 0); - size = strtoul(pt+1, NULL, 0); - address = NULL; - if ((r = drmMap(fd, offset, size, &address))) { - drmError(r, argv[0]); - return 1; - } - printf("0x%08lx:0x%04lx mapped at %p for pid %d\n", - offset, size, address, getpid()); - printf("===== /proc/%d/maps =====\n", getpid()); - sprintf(buf, "cat /proc/%d/maps", getpid()); - system(buf); - printf("===== /proc/dri/0/mem =====\n"); - sprintf(buf, "cat /proc/dri/0/mem"); - system(buf); - printf("===== /proc/dri/0/vma =====\n"); - sprintf(buf, "cat /proc/dri/0/vma"); - system(buf); - printf("===== READING =====\n"); - for (i = 0; i < 0x10; i++) - printf("%02x ", (unsigned int)((unsigned char *)address)[i]); - printf("\n"); - if (c == 'w') { - printf("===== WRITING =====\n"); - for (i = 0; i < size; i+=2) { - ((char *)address)[i] = i & 0xff; - ((char *)address)[i+1] = i & 0xff; - } - } - printf("===== READING =====\n"); - for (i = 0; i < 0x10; i++) - printf("%02x ", (unsigned int)((unsigned char *)address)[i]); - printf("\n"); - printf("===== /proc/dri/0/vma =====\n"); - sprintf(buf, "cat /proc/dri/0/vma"); - system(buf); - break; - case 'L': - context = strtoul(optarg, &pt, 0); - offset = strtoul(pt+1, &pt, 0); - size = strtoul(pt+1, &pt, 0); - loops = strtoul(pt+1, NULL, 0); - address = NULL; - if ((r = drmMap(fd, offset, size, &address))) { - drmError(r, argv[0]); - return 1; - } - lock = address; -#if 1 - { - int counter = 0; - struct timeval loop_start, loop_end; - struct timeval lock_start, lock_end; - double wt; -#define HISTOSIZE 9 - int histo[HISTOSIZE]; - int output = 0; - int fast = 0; - - if (loops < 0) { - loops = -loops; - ++output; - } - - for (i = 0; i < HISTOSIZE; i++) histo[i] = 0; - - gettimeofday(&loop_start, NULL); - for (i = 0; i < loops; i++) { - gettimeofday(&lock_start, NULL); - DRM_LIGHT_LOCK_COUNT(fd,lock,context,fast); - gettimeofday(&lock_end, NULL); - DRM_UNLOCK(fd,lock,context); - ++counter; - wt = usec(&lock_end, &lock_start); - if (wt <= 2.5) ++histo[8]; - if (wt < 5.0) ++histo[0]; - else if (wt < 50.0) ++histo[1]; - else if (wt < 500.0) ++histo[2]; - else if (wt < 5000.0) ++histo[3]; - else if (wt < 50000.0) ++histo[4]; - else if (wt < 500000.0) ++histo[5]; - else if (wt < 5000000.0) ++histo[6]; - else ++histo[7]; - if (output) printf( "%.2f uSec, %d fast\n", wt, fast); - } - gettimeofday(&loop_end, NULL); - printf( "Average wait time = %.2f usec, %d fast\n", - usec(&loop_end, &loop_start) / counter, fast); - printf( "%9d <= 2.5 uS\n", histo[8]); - printf( "%9d < 5 uS\n", histo[0]); - printf( "%9d < 50 uS\n", histo[1]); - printf( "%9d < 500 uS\n", histo[2]); - printf( "%9d < 5000 uS\n", histo[3]); - printf( "%9d < 50000 uS\n", histo[4]); - printf( "%9d < 500000 uS\n", histo[5]); - printf( "%9d < 5000000 uS\n", histo[6]); - printf( "%9d >= 5000000 uS\n", histo[7]); - } -#else - printf( "before lock: 0x%08x\n", lock->lock); - printf( "lock: 0x%08x\n", lock->lock); - sleep(5); - printf( "unlock: 0x%08x\n", lock->lock); -#endif - break; - default: - fprintf( stderr, "Usage: drmstat [options]\n" ); - return 1; - } - - return r; -} - -int xf86ConfigDRI[10];