AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Airlie <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 3/8] dal: drop register logger and pid/tgid getters
Date: Tue, 13 Dec 2016 16:41:07 +1000	[thread overview]
Message-ID: <20161213064112.20004-4-airlied@gmail.com> (raw)
In-Reply-To: <20161213064112.20004-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

From: Dave Airlie <airlied@redhat.com>

While I'm sure this is useful I think we should bring it back later.

It's usage of pid/tgid is incorrect, you have to get/put
pid/tgids not store them away.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_services.c |  10 --
 drivers/gpu/drm/amd/display/dc/basics/Makefile     |   2 +-
 .../drm/amd/display/dc/basics/register_logger.c    | 197 ---------------------
 drivers/gpu/drm/amd/display/dc/dm_services.h       |  16 --
 .../drm/amd/display/include/dal_register_logger.h  |  42 -----
 5 files changed, 1 insertion(+), 266 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/basics/register_logger.c
 delete mode 100644 drivers/gpu/drm/amd/display/include/dal_register_logger.h

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c
index 9c852a3..565be05 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c
@@ -447,13 +447,3 @@ void dal_notify_setmode_complete(struct dc_context *ctx,
 	/*TODO*/
 }
 /* End of calls to notification */
-
-long dm_get_pid(void)
-{
-	return current->pid;
-}
-
-long dm_get_tgid(void)
-{
-	return current->tgid;
-}
diff --git a/drivers/gpu/drm/amd/display/dc/basics/Makefile b/drivers/gpu/drm/amd/display/dc/basics/Makefile
index a263cad..0658162 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/basics/Makefile
@@ -4,7 +4,7 @@
 # subcomponents.
 
 BASICS = conversion.o fixpt31_32.o fixpt32_32.o grph_object_id.o \
-	logger.o log_helpers.o register_logger.o signal_types.o vector.o
+	logger.o log_helpers.o signal_types.o vector.o
 
 AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS))
 
diff --git a/drivers/gpu/drm/amd/display/dc/basics/register_logger.c b/drivers/gpu/drm/amd/display/dc/basics/register_logger.c
deleted file mode 100644
index b8d57d9..0000000
--- a/drivers/gpu/drm/amd/display/dc/basics/register_logger.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright 2012-15 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.
- *
- * Authors: AMD
- *
- */
-
-#include "dm_services.h"
-#include "include/dal_types.h"
-#include "include/logger_interface.h"
-#include "logger.h"
-
-/******************************************************************************
- * Register Logger.
- * A facility to create register R/W logs.
- * Currently used for DAL Test.
- *****************************************************************************/
-
-/******************************************************************************
- * Private structures
- *****************************************************************************/
-struct dal_reg_dump_stack_location {
-	const char *current_caller_func;
-	long current_pid;
-	long current_tgid;
-	uint32_t rw_count;/* register access counter for current function. */
-};
-
-/* This the maximum number of nested calls to the 'reg_dump' facility. */
-#define DAL_REG_DUMP_STACK_MAX_SIZE 32
-
-struct dal_reg_dump_stack {
-	int32_t stack_pointer;
-	struct dal_reg_dump_stack_location
-		stack_locations[DAL_REG_DUMP_STACK_MAX_SIZE];
-	uint32_t total_rw_count; /* Total count for *all* functions. */
-};
-
-static struct dal_reg_dump_stack reg_dump_stack = {0};
-
-/******************************************************************************
- * Private functions
- *****************************************************************************/
-
-/* Check if current process is the one which requested register dump.
- * The reason for the check:
- * mmCRTC_STATUS_FRAME_COUNT is accessed by dal_controller_get_vblank_counter().
- * Which runs all the time when at least one display is connected.
- * (Triggered by drm_mode_page_flip_ioctl()). */
-static bool is_reg_dump_process(void)
-{
-	uint32_t i;
-
-	/* walk the list of our processes */
-	for (i = 0; i < reg_dump_stack.stack_pointer; i++) {
-		struct dal_reg_dump_stack_location *stack_location
-					= &reg_dump_stack.stack_locations[i];
-
-		if (stack_location->current_pid == dm_get_pid()
-			&& stack_location->current_tgid == dm_get_tgid())
-			return true;
-	}
-
-	return false;
-}
-
-static bool dal_reg_dump_stack_is_empty(void)
-{
-	if (reg_dump_stack.stack_pointer <= 0)
-		return true;
-	else
-		return false;
-}
-
-static struct dal_reg_dump_stack_location *dal_reg_dump_stack_push(void)
-{
-	struct dal_reg_dump_stack_location *current_location = NULL;
-
-	if (reg_dump_stack.stack_pointer >= DAL_REG_DUMP_STACK_MAX_SIZE) {
-		/* stack is full */
-		dm_output_to_console("[REG_DUMP]: %s: stack is full!\n",
-				__func__);
-	} else {
-		current_location =
-		&reg_dump_stack.stack_locations[reg_dump_stack.stack_pointer];
-		++reg_dump_stack.stack_pointer;
-	}
-
-	return current_location;
-}
-
-static struct dal_reg_dump_stack_location *dal_reg_dump_stack_pop(void)
-{
-	struct dal_reg_dump_stack_location *current_location = NULL;
-
-	if (dal_reg_dump_stack_is_empty()) {
-		/* stack is empty */
-		dm_output_to_console("[REG_DUMP]: %s: stack is empty!\n",
-				__func__);
-	} else {
-		--reg_dump_stack.stack_pointer;
-		current_location =
-		&reg_dump_stack.stack_locations[reg_dump_stack.stack_pointer];
-	}
-
-	return current_location;
-}
-
-/******************************************************************************
- * Public functions
- *****************************************************************************/
-
-void dal_reg_logger_push(const char *caller_func)
-{
-	struct dal_reg_dump_stack_location *free_stack_location;
-
-	free_stack_location = dal_reg_dump_stack_push();
-
-	if (NULL == free_stack_location)
-		return;
-
-	memset(free_stack_location, 0, sizeof(*free_stack_location));
-
-	free_stack_location->current_caller_func = caller_func;
-	free_stack_location->current_pid = dm_get_pid();
-	free_stack_location->current_tgid = dm_get_tgid();
-
-	dm_output_to_console("[REG_DUMP]:%s - start (pid:%ld, tgid:%ld)\n",
-		caller_func,
-		free_stack_location->current_pid,
-		free_stack_location->current_tgid);
-}
-
-void dal_reg_logger_pop(void)
-{
-	struct dal_reg_dump_stack_location *top_stack_location;
-
-	top_stack_location = dal_reg_dump_stack_pop();
-
-	if (NULL == top_stack_location) {
-		dm_output_to_console("[REG_DUMP]:%s - Stack is Empty!\n",
-				__func__);
-		return;
-	}
-
-	dm_output_to_console(
-	"[REG_DUMP]:%s - end."\
-	" Reg R/W Count: Total=%d Function=%d. (pid:%ld, tgid:%ld)\n",
-			top_stack_location->current_caller_func,
-			reg_dump_stack.total_rw_count,
-			top_stack_location->rw_count,
-			dm_get_pid(),
-			dm_get_tgid());
-
-	memset(top_stack_location, 0, sizeof(*top_stack_location));
-}
-
-void dal_reg_logger_rw_count_increment(void)
-{
-	++reg_dump_stack.total_rw_count;
-
-	++reg_dump_stack.stack_locations
-		[reg_dump_stack.stack_pointer - 1].rw_count;
-}
-
-bool dal_reg_logger_should_dump_register(void)
-{
-	if (true == dal_reg_dump_stack_is_empty())
-		return false;
-
-	if (false == is_reg_dump_process())
-		return false;
-
-	return true;
-}
-
-/******************************************************************************
- * End of File.
- *****************************************************************************/
diff --git a/drivers/gpu/drm/amd/display/dc/dm_services.h b/drivers/gpu/drm/amd/display/dc/dm_services.h
index 7a3f103..f3f9a40 100644
--- a/drivers/gpu/drm/amd/display/dc/dm_services.h
+++ b/drivers/gpu/drm/amd/display/dc/dm_services.h
@@ -109,12 +109,6 @@ static inline uint32_t dm_read_reg_func(
 
 	value = cgs_read_register(ctx->cgs_device, address);
 
-#if defined(__DAL_REGISTER_LOGGER__)
-	if (true == dal_reg_logger_should_dump_register()) {
-		dal_reg_logger_rw_count_increment();
-		DRM_INFO("%s DC_READ_REG: 0x%x 0x%x\n", func_name, address, value);
-	}
-#endif
 	return value;
 }
 
@@ -127,13 +121,6 @@ static inline void dm_write_reg_func(
 	uint32_t value,
 	const char *func_name)
 {
-#if defined(__DAL_REGISTER_LOGGER__)
-	if (true == dal_reg_logger_should_dump_register()) {
-		dal_reg_logger_rw_count_increment();
-		DRM_INFO("%s DC_WRITE_REG: 0x%x 0x%x\n", func_name, address, value);
-	}
-#endif
-
 	if (address == 0) {
 		DC_ERR("invalid register write. address = 0");
 		return;
@@ -418,7 +405,4 @@ bool dm_dmcu_set_pipe(struct dc_context *ctx, unsigned int controller_id);
 #define dm_log_to_buffer(buffer, size, fmt, args)\
 	vsnprintf(buffer, size, fmt, args)
 
-long dm_get_pid(void);
-long dm_get_tgid(void);
-
 #endif /* __DM_SERVICES_H__ */
diff --git a/drivers/gpu/drm/amd/display/include/dal_register_logger.h b/drivers/gpu/drm/amd/display/include/dal_register_logger.h
deleted file mode 100644
index 00dfcd7..0000000
--- a/drivers/gpu/drm/amd/display/include/dal_register_logger.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2012-15 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.
- *
- * Authors: AMD
- *
- */
-
-#ifndef __DAL_REGISTER_LOGGER__
-#define __DAL_REGISTER_LOGGER__
-
-/****************
- * API functions
- ***************/
-
-/* dal_reg_logger_push - begin Register Logging */
-void dal_reg_logger_push(const char *caller_func);
-/* dal_reg_logger_pop - stop Register Logging */
-void dal_reg_logger_pop(void);
-
-/* for internal use of the Logger only */
-void dal_reg_logger_rw_count_increment(void);
-bool dal_reg_logger_should_dump_register(void);
-
-#endif /* __DAL_REGISTER_LOGGER__ */
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2016-12-13  6:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13  6:41 some minor dal cleanups and example of future patches Dave Airlie
     [not found] ` <20161213064112.20004-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-13  6:41   ` [PATCH 1/8] dc: remove dc hub - this seems unused Dave Airlie
2016-12-13  6:41   ` [PATCH 2/8] dal: remove some unused wrappers Dave Airlie
     [not found]     ` <20161213064112.20004-3-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-14 16:26       ` Harry Wentland
     [not found]         ` <f30d9730-8d3d-4b9d-ced2-4a1bb93138d2-5C7GfCeVMHo@public.gmane.org>
2016-12-14 16:36           ` Alex Deucher
2016-12-14 21:04           ` Dave Airlie
2016-12-19 12:46           ` Emil Velikov
     [not found]             ` <CACvgo53HxQq4HhizR-+VY4W7cGb5O3XXmLUNhEGbipeo8ODjWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-19 12:53               ` StDenis, Tom
     [not found]                 ` <CY4PR12MB1768D6FCEC097FCDE97E314EF7910-rpdhrqHFk06yjjPBNVDk/QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-12-21 14:50                   ` Emil Velikov
     [not found]                     ` <CACvgo5220YNkWfW0xWr9Sn6a-tN8Ja02CZu65H2UWTQh+d_EZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-21 15:04                       ` Sagalovitch, Serguei
     [not found]                         ` <SN1PR12MB07034F6B1DB5696FC2DA9729FE930-z7L1TMIYDg6P/i5UxMCIqAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-12-24 13:29                           ` Emil Velikov
2016-12-19 15:27               ` Harry Wentland
2016-12-13  6:41   ` Dave Airlie [this message]
     [not found]     ` <20161213064112.20004-4-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-13 10:07       ` [PATCH 3/8] dal: drop register logger and pid/tgid getters Christian König
2016-12-13  6:41   ` [PATCH 4/8] dal: drop get platform info Dave Airlie
2016-12-13  6:41   ` [PATCH 5/8] dal: drop setmode complete notifier Dave Airlie
2016-12-13  6:41   ` [PATCH 6/8] drm/dp-helper: add missing defines needed by AMD display core Dave Airlie
2016-12-13  6:41   ` [PATCH 7/8] dal: port to using drm dpcd defines Dave Airlie
2016-12-13  6:41   ` [PATCH 8/8] dal: assign correct enum for edp revision Dave Airlie
2016-12-13  6:57   ` some minor dal cleanups and example of future patches Dave Airlie
2016-12-13  7:48   ` Edward O'Callaghan
2016-12-15 20:44   ` Harry Wentland
     [not found]     ` <b3875cd1-74e2-1902-abe7-e674a352855d-5C7GfCeVMHo@public.gmane.org>
2016-12-16  0:56       ` Michel Dänzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161213064112.20004-4-airlied@gmail.com \
    --to=airlied-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox