Skip to content

Commit

Permalink
WIP: drm/msm: add trace points
Browse files Browse the repository at this point in the history
  • Loading branch information
robclark committed Sep 14, 2013
1 parent dc1a638 commit e915a42
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 4 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/msm/mdp4/mdp4_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "mdp4_kms.h"
#include "msm_trace.h"

#include <drm/drm_mode.h>
#include "drm_crtc.h"
Expand Down Expand Up @@ -99,6 +100,8 @@ static void complete_flip(struct drm_crtc *crtc, bool canceled)
struct drm_pending_vblank_event *event;
unsigned long flags;

trace_msm_flip_complete(mdp4_crtc->id);

spin_lock_irqsave(&dev->event_lock, flags);
event = mdp4_crtc->event;
if (event) {
Expand Down Expand Up @@ -388,6 +391,8 @@ static int mdp4_crtc_page_flip(struct drm_crtc *crtc,
mdp4_crtc->event = event;
update_fb(crtc, true, new_fb);

trace_msm_flip_request(mdp4_crtc->id, obj);

return msm_gem_queue_inactive_work(obj,
&mdp4_crtc->pageflip_work);
}
Expand Down
8 changes: 7 additions & 1 deletion drivers/gpu/drm/msm/msm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
#include "msm_drv.h"
#include "msm_gpu.h"

#ifndef __CHECKER__
#define CREATE_TRACE_POINTS
#include "msm_trace.h"
#endif

#include <mach/iommu.h>

static void msm_fb_output_poll_changed(struct drm_device *dev)
Expand Down Expand Up @@ -537,17 +542,18 @@ int msm_wait_fence_interruptable(struct drm_device *dev, uint32_t fence,
else
remaining_jiffies = timeout_jiffies - start_jiffies;

trace_msm_fence_wait_request(fence);
ret = wait_event_interruptible_timeout(priv->fence_event,
fence_completed(dev, fence),
remaining_jiffies);

if (ret == 0) {
DBG("timeout waiting for fence: %u (completed: %u)",
fence, priv->completed_fence);
ret = -ETIMEDOUT;
} else if (ret != -ERESTARTSYS) {
ret = 0;
}
trace_msm_fence_wait_complete(fence, ret);
}

return ret;
Expand Down
8 changes: 5 additions & 3 deletions drivers/gpu/drm/msm/msm_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "msm_gpu.h"
#include "msm_gem.h"

#include "msm_trace.h"

/*
* Power Management:
Expand Down Expand Up @@ -368,6 +368,8 @@ static void retire_worker(struct work_struct *work)
struct drm_device *dev = gpu->dev;
uint32_t fence = gpu->funcs->last_fence(gpu);

trace_msm_gpu_complete(fence);

mutex_lock(&dev->struct_mutex);

while (!list_empty(&gpu->active_list)) {
Expand Down Expand Up @@ -412,12 +414,12 @@ int msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,

submit->fence = ++priv->next_fence;

trace_msm_gpu_request(submit->fence);

gpu->submitted_fence = submit->fence;

msm_rd_dump_submit(submit);

gpu->submitted_fence = submit->fence;

update_sw_cntrs(gpu);

ret = gpu->funcs->submit(gpu, submit, ctx);
Expand Down
140 changes: 140 additions & 0 deletions drivers/gpu/drm/msm/msm_trace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/*
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/

#if !defined(__MSM_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
#define __MSM_TRACE_H__

#include <linux/stringify.h>
#include <linux/types.h>
#include <linux/tracepoint.h>

#include <drm/drmP.h>
#include "msm_drv.h"
#include "msm_gpu.h"

#undef TRACE_SYSTEM
#define TRACE_SYSTEM msm
#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
#define TRACE_INCLUDE_FILE msm_trace


TRACE_EVENT(msm_flip_request,
TP_PROTO(int id, struct drm_gem_object *obj),

TP_ARGS(id, obj),

TP_STRUCT__entry(
__field(int, id)
__field(struct drm_gem_object *, obj)
),

TP_fast_assign(
__entry->id = id;
__entry->obj = obj;
),

TP_printk("id=%d, obj=%p", __entry->id, __entry->obj)
);

TRACE_EVENT(msm_flip_complete,
TP_PROTO(int id),

TP_ARGS(id),

TP_STRUCT__entry(
__field(int, id)
),

TP_fast_assign(
__entry->id = id;
),

TP_printk("id=%d", __entry->id)
);

TRACE_EVENT(msm_fence_wait_request,
TP_PROTO(uint32_t fence),

TP_ARGS(fence),

TP_STRUCT__entry(
__field(uint32_t, fence)
),

TP_fast_assign(
__entry->fence = fence;
),

TP_printk("fence=%u", __entry->fence)
);

TRACE_EVENT(msm_fence_wait_complete,
TP_PROTO(uint32_t fence, int ret),

TP_ARGS(fence, ret),

TP_STRUCT__entry(
__field(uint32_t, fence)
__field(int, ret)
),

TP_fast_assign(
__entry->fence = fence;
__entry->ret = ret;
),

TP_printk("fence=%u, ret=%d", __entry->fence, __entry->ret)
);

TRACE_EVENT(msm_gpu_request,
TP_PROTO(uint32_t fence),

TP_ARGS(fence),

TP_STRUCT__entry(
__field(uint32_t, fence)
),

TP_fast_assign(
__entry->fence = fence;
),

TP_printk("fence=%u", __entry->fence)
);

TRACE_EVENT(msm_gpu_complete,
TP_PROTO(uint32_t fence),

TP_ARGS(fence),

TP_STRUCT__entry(
__field(uint32_t, fence)
),

TP_fast_assign(
__entry->fence = fence;
),

TP_printk("fence=%u", __entry->fence)
);

#endif /* __MSM_TRACE_H__ */

/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#include <trace/define_trace.h>

0 comments on commit e915a42

Please sign in to comment.