Commit 32ecf92a authored by Jeykumar Sankaran's avatar Jeykumar Sankaran Committed by Rob Clark

drm/msm/dpu: remove RM dependency on connector state

Connector states were passed around RM to update the custom
topology connector property with chosen topology data. Now that
we got rid of both custom properties and topology names, this
change cleans up the mechanism to pass connector states across
RM helpers and encoder functions.

changes in v5:
	- Introduced in the series
changes in v6:
	- remove parameter checking in rm reserve (Jordan)
Signed-off-by: default avatarJeykumar Sankaran <jsanka@codeaurora.org>
Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent d0a13816
...@@ -436,15 +436,14 @@ int dpu_encoder_helper_unregister_irq(struct dpu_encoder_phys *phys_enc, ...@@ -436,15 +436,14 @@ int dpu_encoder_helper_unregister_irq(struct dpu_encoder_phys *phys_enc,
} }
void dpu_encoder_get_hw_resources(struct drm_encoder *drm_enc, void dpu_encoder_get_hw_resources(struct drm_encoder *drm_enc,
struct dpu_encoder_hw_resources *hw_res, struct dpu_encoder_hw_resources *hw_res)
struct drm_connector_state *conn_state)
{ {
struct dpu_encoder_virt *dpu_enc = NULL; struct dpu_encoder_virt *dpu_enc = NULL;
int i = 0; int i = 0;
if (!hw_res || !drm_enc || !conn_state) { if (!hw_res || !drm_enc) {
DPU_ERROR("invalid argument(s), drm_enc %d, res %d, state %d\n", DPU_ERROR("invalid argument(s), drm_enc %d, res %d\n",
drm_enc != 0, hw_res != 0, conn_state != 0); drm_enc != 0, hw_res != 0);
return; return;
} }
...@@ -458,7 +457,7 @@ void dpu_encoder_get_hw_resources(struct drm_encoder *drm_enc, ...@@ -458,7 +457,7 @@ void dpu_encoder_get_hw_resources(struct drm_encoder *drm_enc,
struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i];
if (phys && phys->ops.get_hw_resources) if (phys && phys->ops.get_hw_resources)
phys->ops.get_hw_resources(phys, hw_res, conn_state); phys->ops.get_hw_resources(phys, hw_res);
} }
} }
...@@ -652,7 +651,7 @@ static int dpu_encoder_virt_atomic_check( ...@@ -652,7 +651,7 @@ static int dpu_encoder_virt_atomic_check(
if (drm_atomic_crtc_needs_modeset(crtc_state) if (drm_atomic_crtc_needs_modeset(crtc_state)
&& dpu_enc->mode_set_complete) { && dpu_enc->mode_set_complete) {
ret = dpu_rm_reserve(&dpu_kms->rm, drm_enc, crtc_state, ret = dpu_rm_reserve(&dpu_kms->rm, drm_enc, crtc_state,
conn_state, topology, true); topology, true);
dpu_enc->mode_set_complete = false; dpu_enc->mode_set_complete = false;
} }
} }
...@@ -1044,7 +1043,7 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, ...@@ -1044,7 +1043,7 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc,
/* Reserve dynamic resources now. Indicating non-AtomicTest phase */ /* Reserve dynamic resources now. Indicating non-AtomicTest phase */
ret = dpu_rm_reserve(&dpu_kms->rm, drm_enc, drm_enc->crtc->state, ret = dpu_rm_reserve(&dpu_kms->rm, drm_enc, drm_enc->crtc->state,
conn->state, topology, false); topology, false);
if (ret) { if (ret) {
DPU_ERROR_ENC(dpu_enc, DPU_ERROR_ENC(dpu_enc,
"failed to reserve hw resources, %d\n", ret); "failed to reserve hw resources, %d\n", ret);
......
...@@ -51,11 +51,9 @@ struct dpu_encoder_kickoff_params { ...@@ -51,11 +51,9 @@ struct dpu_encoder_kickoff_params {
* dpu_encoder_get_hw_resources - Populate table of required hardware resources * dpu_encoder_get_hw_resources - Populate table of required hardware resources
* @encoder: encoder pointer * @encoder: encoder pointer
* @hw_res: resource table to populate with encoder required resources * @hw_res: resource table to populate with encoder required resources
* @conn_state: report hw reqs based on this proposed connector state
*/ */
void dpu_encoder_get_hw_resources(struct drm_encoder *encoder, void dpu_encoder_get_hw_resources(struct drm_encoder *encoder,
struct dpu_encoder_hw_resources *hw_res, struct dpu_encoder_hw_resources *hw_res);
struct drm_connector_state *conn_state);
/** /**
* dpu_encoder_register_vblank_callback - provide callback to encoder that * dpu_encoder_register_vblank_callback - provide callback to encoder that
......
...@@ -140,8 +140,7 @@ struct dpu_encoder_phys_ops { ...@@ -140,8 +140,7 @@ struct dpu_encoder_phys_ops {
struct drm_connector_state *conn_state); struct drm_connector_state *conn_state);
void (*destroy)(struct dpu_encoder_phys *encoder); void (*destroy)(struct dpu_encoder_phys *encoder);
void (*get_hw_resources)(struct dpu_encoder_phys *encoder, void (*get_hw_resources)(struct dpu_encoder_phys *encoder,
struct dpu_encoder_hw_resources *hw_res, struct dpu_encoder_hw_resources *hw_res);
struct drm_connector_state *conn_state);
int (*control_vblank_irq)(struct dpu_encoder_phys *enc, bool enable); int (*control_vblank_irq)(struct dpu_encoder_phys *enc, bool enable);
int (*wait_for_commit_done)(struct dpu_encoder_phys *phys_enc); int (*wait_for_commit_done)(struct dpu_encoder_phys *phys_enc);
int (*wait_for_tx_complete)(struct dpu_encoder_phys *phys_enc); int (*wait_for_tx_complete)(struct dpu_encoder_phys *phys_enc);
......
...@@ -599,8 +599,7 @@ static void dpu_encoder_phys_cmd_destroy(struct dpu_encoder_phys *phys_enc) ...@@ -599,8 +599,7 @@ static void dpu_encoder_phys_cmd_destroy(struct dpu_encoder_phys *phys_enc)
static void dpu_encoder_phys_cmd_get_hw_resources( static void dpu_encoder_phys_cmd_get_hw_resources(
struct dpu_encoder_phys *phys_enc, struct dpu_encoder_phys *phys_enc,
struct dpu_encoder_hw_resources *hw_res, struct dpu_encoder_hw_resources *hw_res)
struct drm_connector_state *conn_state)
{ {
struct dpu_encoder_phys_cmd *cmd_enc = struct dpu_encoder_phys_cmd *cmd_enc =
to_dpu_encoder_phys_cmd(phys_enc); to_dpu_encoder_phys_cmd(phys_enc);
......
...@@ -537,12 +537,11 @@ static void dpu_encoder_phys_vid_destroy(struct dpu_encoder_phys *phys_enc) ...@@ -537,12 +537,11 @@ static void dpu_encoder_phys_vid_destroy(struct dpu_encoder_phys *phys_enc)
static void dpu_encoder_phys_vid_get_hw_resources( static void dpu_encoder_phys_vid_get_hw_resources(
struct dpu_encoder_phys *phys_enc, struct dpu_encoder_phys *phys_enc,
struct dpu_encoder_hw_resources *hw_res, struct dpu_encoder_hw_resources *hw_res)
struct drm_connector_state *conn_state)
{ {
if (!phys_enc || !hw_res) { if (!phys_enc || !hw_res) {
DPU_ERROR("invalid arg(s), enc %d hw_res %d conn_state %d\n", DPU_ERROR("invalid arg(s), enc %d hw_res %d\n",
phys_enc != 0, hw_res != 0, conn_state != 0); phys_enc != 0, hw_res != 0);
return; return;
} }
......
...@@ -682,7 +682,6 @@ static int _dpu_rm_make_next_rsvp( ...@@ -682,7 +682,6 @@ static int _dpu_rm_make_next_rsvp(
struct dpu_rm *rm, struct dpu_rm *rm,
struct drm_encoder *enc, struct drm_encoder *enc,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state,
struct dpu_rm_rsvp *rsvp, struct dpu_rm_rsvp *rsvp,
struct dpu_rm_requirements *reqs) struct dpu_rm_requirements *reqs)
{ {
...@@ -728,7 +727,6 @@ static int _dpu_rm_populate_requirements( ...@@ -728,7 +727,6 @@ static int _dpu_rm_populate_requirements(
struct dpu_rm *rm, struct dpu_rm *rm,
struct drm_encoder *enc, struct drm_encoder *enc,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state,
struct dpu_rm_requirements *reqs, struct dpu_rm_requirements *reqs,
struct msm_display_topology req_topology) struct msm_display_topology req_topology)
{ {
...@@ -736,7 +734,7 @@ static int _dpu_rm_populate_requirements( ...@@ -736,7 +734,7 @@ static int _dpu_rm_populate_requirements(
memset(reqs, 0, sizeof(*reqs)); memset(reqs, 0, sizeof(*reqs));
dpu_encoder_get_hw_resources(enc, &reqs->hw_res, conn_state); dpu_encoder_get_hw_resources(enc, &reqs->hw_res);
for (i = 0; i < DPU_RM_TOPOLOGY_MAX; i++) { for (i = 0; i < DPU_RM_TOPOLOGY_MAX; i++) {
if (RM_IS_TOPOLOGY_MATCH(g_top_table[i], if (RM_IS_TOPOLOGY_MATCH(g_top_table[i],
...@@ -780,29 +778,12 @@ static struct dpu_rm_rsvp *_dpu_rm_get_rsvp( ...@@ -780,29 +778,12 @@ static struct dpu_rm_rsvp *_dpu_rm_get_rsvp(
return NULL; return NULL;
} }
static struct drm_connector *_dpu_rm_get_connector(
struct drm_encoder *enc)
{
struct drm_connector *conn = NULL;
struct list_head *connector_list =
&enc->dev->mode_config.connector_list;
list_for_each_entry(conn, connector_list, head)
if (conn->encoder == enc)
return conn;
return NULL;
}
/** /**
* _dpu_rm_release_rsvp - release resources and release a reservation * _dpu_rm_release_rsvp - release resources and release a reservation
* @rm: KMS handle * @rm: KMS handle
* @rsvp: RSVP pointer to release and release resources for * @rsvp: RSVP pointer to release and release resources for
*/ */
static void _dpu_rm_release_rsvp( static void _dpu_rm_release_rsvp(struct dpu_rm *rm, struct dpu_rm_rsvp *rsvp)
struct dpu_rm *rm,
struct dpu_rm_rsvp *rsvp,
struct drm_connector *conn)
{ {
struct dpu_rm_rsvp *rsvp_c, *rsvp_n; struct dpu_rm_rsvp *rsvp_c, *rsvp_n;
struct dpu_rm_hw_blk *blk; struct dpu_rm_hw_blk *blk;
...@@ -843,7 +824,6 @@ static void _dpu_rm_release_rsvp( ...@@ -843,7 +824,6 @@ static void _dpu_rm_release_rsvp(
void dpu_rm_release(struct dpu_rm *rm, struct drm_encoder *enc) void dpu_rm_release(struct dpu_rm *rm, struct drm_encoder *enc)
{ {
struct dpu_rm_rsvp *rsvp; struct dpu_rm_rsvp *rsvp;
struct drm_connector *conn;
if (!rm || !enc) { if (!rm || !enc) {
DPU_ERROR("invalid params\n"); DPU_ERROR("invalid params\n");
...@@ -858,21 +838,12 @@ void dpu_rm_release(struct dpu_rm *rm, struct drm_encoder *enc) ...@@ -858,21 +838,12 @@ void dpu_rm_release(struct dpu_rm *rm, struct drm_encoder *enc)
goto end; goto end;
} }
conn = _dpu_rm_get_connector(enc); _dpu_rm_release_rsvp(rm, rsvp);
if (!conn) {
DPU_ERROR("failed to get connector for enc %d\n", enc->base.id);
goto end;
}
_dpu_rm_release_rsvp(rm, rsvp, conn);
end: end:
mutex_unlock(&rm->rm_lock); mutex_unlock(&rm->rm_lock);
} }
static int _dpu_rm_commit_rsvp( static int _dpu_rm_commit_rsvp(struct dpu_rm *rm, struct dpu_rm_rsvp *rsvp)
struct dpu_rm *rm,
struct dpu_rm_rsvp *rsvp,
struct drm_connector_state *conn_state)
{ {
struct dpu_rm_hw_blk *blk; struct dpu_rm_hw_blk *blk;
enum dpu_hw_blk_type type; enum dpu_hw_blk_type type;
...@@ -899,7 +870,6 @@ int dpu_rm_reserve( ...@@ -899,7 +870,6 @@ int dpu_rm_reserve(
struct dpu_rm *rm, struct dpu_rm *rm,
struct drm_encoder *enc, struct drm_encoder *enc,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state,
struct msm_display_topology topology, struct msm_display_topology topology,
bool test_only) bool test_only)
{ {
...@@ -907,25 +877,19 @@ int dpu_rm_reserve( ...@@ -907,25 +877,19 @@ int dpu_rm_reserve(
struct dpu_rm_requirements reqs; struct dpu_rm_requirements reqs;
int ret; int ret;
if (!rm || !enc || !crtc_state || !conn_state) {
DPU_ERROR("invalid arguments\n");
return -EINVAL;
}
/* Check if this is just a page-flip */ /* Check if this is just a page-flip */
if (!drm_atomic_crtc_needs_modeset(crtc_state)) if (!drm_atomic_crtc_needs_modeset(crtc_state))
return 0; return 0;
DRM_DEBUG_KMS("reserving hw for conn %d enc %d crtc %d test_only %d\n", DRM_DEBUG_KMS("reserving hw for enc %d crtc %d test_only %d\n",
conn_state->connector->base.id, enc->base.id, enc->base.id, crtc_state->crtc->base.id, test_only);
crtc_state->crtc->base.id, test_only);
mutex_lock(&rm->rm_lock); mutex_lock(&rm->rm_lock);
_dpu_rm_print_rsvps(rm, DPU_RM_STAGE_BEGIN); _dpu_rm_print_rsvps(rm, DPU_RM_STAGE_BEGIN);
ret = _dpu_rm_populate_requirements(rm, enc, crtc_state, ret = _dpu_rm_populate_requirements(rm, enc, crtc_state, &reqs,
conn_state, &reqs, topology); topology);
if (ret) { if (ret) {
DPU_ERROR("failed to populate hw requirements\n"); DPU_ERROR("failed to populate hw requirements\n");
goto end; goto end;
...@@ -951,14 +915,13 @@ int dpu_rm_reserve( ...@@ -951,14 +915,13 @@ int dpu_rm_reserve(
rsvp_cur = _dpu_rm_get_rsvp(rm, enc); rsvp_cur = _dpu_rm_get_rsvp(rm, enc);
/* Check the proposed reservation, store it in hw's "next" field */ /* Check the proposed reservation, store it in hw's "next" field */
ret = _dpu_rm_make_next_rsvp(rm, enc, crtc_state, conn_state, ret = _dpu_rm_make_next_rsvp(rm, enc, crtc_state, rsvp_nxt, &reqs);
rsvp_nxt, &reqs);
_dpu_rm_print_rsvps(rm, DPU_RM_STAGE_AFTER_RSVPNEXT); _dpu_rm_print_rsvps(rm, DPU_RM_STAGE_AFTER_RSVPNEXT);
if (ret) { if (ret) {
DPU_ERROR("failed to reserve hw resources: %d\n", ret); DPU_ERROR("failed to reserve hw resources: %d\n", ret);
_dpu_rm_release_rsvp(rm, rsvp_nxt, conn_state->connector); _dpu_rm_release_rsvp(rm, rsvp_nxt);
} else if (test_only) { } else if (test_only) {
/* /*
* Normally, if test_only, test the reservation and then undo * Normally, if test_only, test the reservation and then undo
...@@ -967,11 +930,11 @@ int dpu_rm_reserve( ...@@ -967,11 +930,11 @@ int dpu_rm_reserve(
*/ */
DPU_DEBUG("test_only: discard test rsvp[s%de%d]\n", DPU_DEBUG("test_only: discard test rsvp[s%de%d]\n",
rsvp_nxt->seq, rsvp_nxt->enc_id); rsvp_nxt->seq, rsvp_nxt->enc_id);
_dpu_rm_release_rsvp(rm, rsvp_nxt, conn_state->connector); _dpu_rm_release_rsvp(rm, rsvp_nxt);
} else { } else {
_dpu_rm_release_rsvp(rm, rsvp_cur, conn_state->connector); _dpu_rm_release_rsvp(rm, rsvp_cur);
ret = _dpu_rm_commit_rsvp(rm, rsvp_nxt, conn_state); _dpu_rm_commit_rsvp(rm, rsvp_nxt);
} }
_dpu_rm_print_rsvps(rm, DPU_RM_STAGE_FINAL); _dpu_rm_print_rsvps(rm, DPU_RM_STAGE_FINAL);
......
...@@ -107,7 +107,6 @@ int dpu_rm_destroy(struct dpu_rm *rm); ...@@ -107,7 +107,6 @@ int dpu_rm_destroy(struct dpu_rm *rm);
* @rm: DPU Resource Manager handle * @rm: DPU Resource Manager handle
* @drm_enc: DRM Encoder handle * @drm_enc: DRM Encoder handle
* @crtc_state: Proposed Atomic DRM CRTC State handle * @crtc_state: Proposed Atomic DRM CRTC State handle
* @conn_state: Proposed Atomic DRM Connector State handle
* @topology: Pointer to topology info for the display * @topology: Pointer to topology info for the display
* @test_only: Atomic-Test phase, discard results (unless property overrides) * @test_only: Atomic-Test phase, discard results (unless property overrides)
* @Return: 0 on Success otherwise -ERROR * @Return: 0 on Success otherwise -ERROR
...@@ -115,7 +114,6 @@ int dpu_rm_destroy(struct dpu_rm *rm); ...@@ -115,7 +114,6 @@ int dpu_rm_destroy(struct dpu_rm *rm);
int dpu_rm_reserve(struct dpu_rm *rm, int dpu_rm_reserve(struct dpu_rm *rm,
struct drm_encoder *drm_enc, struct drm_encoder *drm_enc,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state,
struct msm_display_topology topology, struct msm_display_topology topology,
bool test_only); bool test_only);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment