Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec398da2 authored by Kalyan Thota's avatar Kalyan Thota
Browse files

drm:msm:sde ensure all clients on primary vsyncs are unblocked



Secondary crtc can also wait on primary vsync. During
primary vsync disable, check if any secondary clients are
waiting on vsync wait_queue and unblock them.

Change-Id: I9d2fd21b1be9641ea3870cc80dd2a0a20c0d1b5b
Signed-off-by: default avatarKalyan Thota <kalyant@codeaurora.org>
parent 19181fc3
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <drm/drm_crtc_helper.h>
#include <drm/drm_flip_work.h>
#include <linux/clk/qcom.h>
#include <linux/sde_rsc.h>

#include "sde_kms.h"
#include "sde_hw_lm.h"
@@ -4755,11 +4756,13 @@ static void sde_crtc_disable(struct drm_crtc *crtc)
	struct sde_kms *sde_kms;
	struct sde_crtc *sde_crtc;
	struct sde_crtc_state *cstate;
	struct drm_encoder *encoder;
	struct drm_encoder *encoder = NULL;
	struct msm_drm_private *priv;
	unsigned long flags;
	struct sde_crtc_irq_info *node = NULL;
	struct drm_event event;
	wait_queue_head_t *vblank_queue;
	int primary_crtc_id = -1;
	u32 power_on;
	bool in_cont_splash = false;
	int ret, i;
@@ -4809,6 +4812,17 @@ static void sde_crtc_disable(struct drm_crtc *crtc)
	SDE_EVT32(DRMID(crtc), sde_crtc->enabled, sde_crtc->suspend,
			sde_crtc->vblank_requested,
			crtc->state->active, crtc->state->enable);

	/* check if anyone is waiting for primary vsync */
	primary_crtc_id = get_sde_rsc_primary_crtc(SDE_RSC_INDEX);
	if (crtc->base.id == primary_crtc_id) {
		vblank_queue = drm_crtc_vblank_waitqueue(crtc);
		if (waitqueue_active(vblank_queue)) {/* check for wait_queue */
			drm_crtc_handle_vblank(crtc);
			SDE_EVT32(DRMID(crtc), primary_crtc_id);
		}
	}

	if (sde_crtc->enabled && !sde_crtc->suspend &&
			sde_crtc->vblank_requested) {
		ret = _sde_crtc_vblank_enable_no_lock(sde_crtc, false);
+18 −0
Original line number Diff line number Diff line
@@ -249,6 +249,24 @@ bool is_sde_rsc_available(int rsc_index)
}
EXPORT_SYMBOL(is_sde_rsc_available);

int get_sde_rsc_primary_crtc(int rsc_index)
{
	struct sde_rsc_priv *rsc;

	if (rsc_index >= MAX_RSC_COUNT) {
		pr_err("invalid rsc index:%d\n", rsc_index);
		return 0;
	} else if (!rsc_prv_list[rsc_index]) {
		pr_debug("rsc idx:%d not probed yet or not available\n",
								rsc_index);
		return 0;
	}

	rsc = rsc_prv_list[rsc_index];
	return rsc->primary_client->crtc_id;
}
EXPORT_SYMBOL(get_sde_rsc_primary_crtc);

enum sde_rsc_state get_sde_rsc_current_state(int rsc_index)
{
	struct sde_rsc_priv *rsc;
+14 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -265,6 +265,14 @@ bool is_sde_rsc_available(int rsc_index);
 */
enum sde_rsc_state get_sde_rsc_current_state(int rsc_index);

/**
 * get_sde_rsc_primary_crtc - gets the primary crtc for the sde rsc.
 * @rsc_index:   A client will be created on this RSC. As of now only
 *               SDE_RSC_INDEX is valid rsc index.
 * Returns: crtc id of primary crtc ; 0 for all other cases.
 */
int get_sde_rsc_primary_crtc(int rsc_index);

#else

static inline struct sde_rsc_client *sde_rsc_client_create(u32 rsc_index,
@@ -329,6 +337,11 @@ static inline enum sde_rsc_state get_sde_rsc_current_state(int rsc_index)
{
	return SDE_RSC_IDLE_STATE;
}

static inline int get_sde_rsc_primary_crtc(int rsc_index)
{
	return 0;
}
#endif /* CONFIG_DRM_SDE_RSC */

#endif /* _SDE_RSC_H_ */