Skip to contentSkip to conversation

drm/msm: dpu: Various cleanup patches

PATCH In review Sean Paul 2 participants 14 messages Sep 20, 2018 – Oct 8, 2018 8 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Sean Paul

author
#0 lore raw

cover drm/msm: dpu: Various cleanup patches

From: Sean Paul <[email protected]>

I kept notes of things to revisit while I was working on the cursor. These are the low-hanging fruit that I noticed.

Sean

Sean Paul (6):
drm/msm: Remove dpu_encoder_phys_ops->hw_reset() drm/msm: dpu: Remove unused functions from msm_media_info.h drm/msm: dpu: Remove _dpu_encoder_power_enable() drm/msm: dpu: Remove 'inline' from several functions drm/msm: dpu: Remove empty/useless labels
drm/msm: dpu: Clean up _dpu_core_video_mode_intf_connected()

 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c |  10 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c      |   4 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h      |  16 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   |  43 +---
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h  |  12 --
 .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  |   9 +-
 .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c  |   5 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c   |   5 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c    |   6 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c     |  12 +-
 .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c   |   3 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c   |   2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       |  15 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c     |  20 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c      |   4 +-
 .../gpu/drm/msm/disp/dpu1/msm_media_info.h    | 195 ++----------------
 16 files changed, 52 insertions(+), 309 deletions(-)
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180920145818.32468-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org

author
#2 lore raw

PATCH 1/6 drm/msm: Remove dpu_encoder_phys_ops->hw_reset()

From: Sean Paul <[email protected]>

We call out of the virt encoder into phys only to call back into the virt for hw reset. So remove the indirection and just call the virt function directly.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c          |  6 ++----
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h     | 12 ------------
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c |  1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c |  1 -
 4 files changed, 2 insertions(+), 18 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +2 -4
index 8f6880db5c99..7842b66fbe2e 100644
@@ -1509,7 +1509,7 @@ static int dpu_encoder_helper_wait_event_timeout(
 	return rc;
 }
 
-void dpu_encoder_helper_hw_reset(struct dpu_encoder_phys *phys_enc)
+static void dpu_encoder_helper_hw_reset(struct dpu_encoder_phys *phys_enc)
 {
 	struct dpu_encoder_virt *dpu_enc;
 	struct dpu_hw_ctl *ctl;
@@ -1805,9 +1805,7 @@ void dpu_encoder_prepare_for_kickoff(struct drm_encoder *drm_enc,
 	if (needs_hw_reset) {
 		trace_dpu_enc_prepare_kickoff_reset(DRMID(drm_enc));
 		for (i = 0; i < dpu_enc->num_phys_encs; i++) {
-			phys = dpu_enc->phys_encs[i];
-			if (phys && phys->ops.hw_reset)
-				phys->ops.hw_reset(phys);
+			dpu_encoder_helper_hw_reset(dpu_enc->phys_encs[i]);
 		}
 	}
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +0 -12
index 964efcc757a4..3a67bb9f9d9d 100644
@@ -114,8 +114,6 @@ struct dpu_encoder_virt_ops {
  * @handle_post_kickoff:	Do any work necessary post-kickoff work
  * @trigger_start:		Process start event on physical encoder
  * @needs_single_flush:		Whether encoder slaves need to be flushed
- * @hw_reset:			Issue HW recovery such as CTL reset and clear
- *				DPU_ENC_ERR_NEEDS_HW_RESET state
  * @irq_control:		Handler to enable/disable all the encoder IRQs
  * @prepare_idle_pc:		phys encoder can update the vsync_enable status
  *                              on idle power collapse prepare
@@ -151,7 +149,6 @@ struct dpu_encoder_phys_ops {
 	void (*handle_post_kickoff)(struct dpu_encoder_phys *phys_enc);
 	void (*trigger_start)(struct dpu_encoder_phys *phys_enc);
 	bool (*needs_single_flush)(struct dpu_encoder_phys *phys_enc);
-	void (*hw_reset)(struct dpu_encoder_phys *phys_enc);
 	void (*irq_control)(struct dpu_encoder_phys *phys, bool enable);
 	void (*prepare_idle_pc)(struct dpu_encoder_phys *phys_enc);
 	void (*restore)(struct dpu_encoder_phys *phys);
@@ -342,15 +339,6 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
  */
 void dpu_encoder_helper_trigger_start(struct dpu_encoder_phys *phys_enc);
 
-/**
- * dpu_encoder_helper_hw_reset - issue ctl hw reset
- *	This helper function may be optionally specified by physical
- *	encoders if they require ctl hw reset. If state is currently
- *	DPU_ENC_ERR_NEEDS_HW_RESET, it is set back to DPU_ENC_ENABLED.
- * @phys_enc: Pointer to physical encoder structure
- */
-void dpu_encoder_helper_hw_reset(struct dpu_encoder_phys *phys_enc);
-
 static inline enum dpu_3d_blend_mode dpu_encoder_helper_get_3d_blend_mode(
 		struct dpu_encoder_phys *phys_enc)
 {
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -1
index b2d7f0ded24c..c30ae05b3349 100644
@@ -776,7 +776,6 @@ static void dpu_encoder_phys_cmd_init_ops(
 	ops->wait_for_vblank = dpu_encoder_phys_cmd_wait_for_vblank;
 	ops->trigger_start = dpu_encoder_phys_cmd_trigger_start;
 	ops->needs_single_flush = dpu_encoder_phys_cmd_needs_single_flush;
-	ops->hw_reset = dpu_encoder_helper_hw_reset;
 	ops->irq_control = dpu_encoder_phys_cmd_irq_control;
 	ops->restore = dpu_encoder_phys_cmd_enable_helper;
 	ops->prepare_idle_pc = dpu_encoder_phys_cmd_prepare_idle_pc;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +0 -1
index 84de385a9f62..283a2491f3e3 100644
@@ -766,7 +766,6 @@ static void dpu_encoder_phys_vid_init_ops(struct dpu_encoder_phys_ops *ops)
 	ops->prepare_for_kickoff = dpu_encoder_phys_vid_prepare_for_kickoff;
 	ops->handle_post_kickoff = dpu_encoder_phys_vid_handle_post_kickoff;
 	ops->needs_single_flush = dpu_encoder_phys_vid_needs_single_flush;
-	ops->hw_reset = dpu_encoder_helper_hw_reset;
 	ops->get_line_count = dpu_encoder_phys_vid_get_line_count;
 }
 
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180920145818.32468-2-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH 1/6] drm/msm: Remove dpu_encoder_phys_ops->hw_reset()

Quoted 7 lines · Sean Paul

From: Sean Paul <[email protected]>

We call out of the virt encoder into phys only to call back into the virt for hw reset. So remove the indirection and just call the virt function directly.

Quoted 108 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c          |  6 ++----
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h     | 12 ------------
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c |  1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c |  1 -
 4 files changed, 2 insertions(+), 18 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -1
index 8f6880db5c99..7842b66fbe2e 100644
@@ -1509,7 +1509,7 @@ static int dpu_encoder_helper_wait_event_timeout(
 	return rc;
 }
 
-void dpu_encoder_helper_hw_reset(struct dpu_encoder_phys *phys_enc)
+static void dpu_encoder_helper_hw_reset(struct dpu_encoder_phys
 *phys_enc)
 {
 	struct dpu_encoder_virt *dpu_enc;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -3
 	struct dpu_hw_ctl *ctl;
@@ -1805,9 +1805,7 @@ void dpu_encoder_prepare_for_kickoff(struct
 drm_encoder *drm_enc,
 	if (needs_hw_reset) {
 		trace_dpu_enc_prepare_kickoff_reset(DRMID(drm_enc));
 		for (i = 0; i < dpu_enc->num_phys_encs; i++) {
-			phys = dpu_enc->phys_encs[i];
-			if (phys && phys->ops.hw_reset)
-				phys->ops.hw_reset(phys);
+
 dpu_encoder_helper_hw_reset(dpu_enc->phys_encs[i]);
 		}
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +0 -0
 	}
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +0 -0
index 964efcc757a4..3a67bb9f9d9d 100644
@@ -114,8 +114,6 @@ struct dpu_encoder_virt_ops {
  * @handle_post_kickoff:	Do any work necessary post-kickoff work
  * @trigger_start:		Process start event on physical encoder
  * @needs_single_flush:		Whether encoder slaves need to be

flushed
- * @hw_reset: Issue HW recovery such as CTL reset and
clear
- * DPU_ENC_ERR_NEEDS_HW_RESET state
* @irq_control: Handler to enable/disable all the encoder
IRQs
* @prepare_idle_pc: phys encoder can update the vsync_enable
status
* on idle power collapse prepare

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +0 -10
@@ -151,7 +149,6 @@ struct dpu_encoder_phys_ops {
 	void (*handle_post_kickoff)(struct dpu_encoder_phys *phys_enc);
 	void (*trigger_start)(struct dpu_encoder_phys *phys_enc);
 	bool (*needs_single_flush)(struct dpu_encoder_phys *phys_enc);
-	void (*hw_reset)(struct dpu_encoder_phys *phys_enc);
 	void (*irq_control)(struct dpu_encoder_phys *phys, bool enable);
 	void (*prepare_idle_pc)(struct dpu_encoder_phys *phys_enc);
 	void (*restore)(struct dpu_encoder_phys *phys);
@@ -342,15 +339,6 @@ struct dpu_encoder_phys 
 *dpu_encoder_phys_cmd_init(
  */
 void dpu_encoder_helper_trigger_start(struct dpu_encoder_phys 
 *phys_enc);
 
-/**
- * dpu_encoder_helper_hw_reset - issue ctl hw reset
- *	This helper function may be optionally specified by physical
- *	encoders if they require ctl hw reset. If state is currently
- *	DPU_ENC_ERR_NEEDS_HW_RESET, it is set back to DPU_ENC_ENABLED.
- * @phys_enc: Pointer to physical encoder structure
- */
-void dpu_encoder_helper_hw_reset(struct dpu_encoder_phys *phys_enc);
-
 static inline enum dpu_3d_blend_mode

dpu_encoder_helper_get_3d_blend_mode(

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +0 -0
 		struct dpu_encoder_phys *phys_enc)
 {
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -1
index b2d7f0ded24c..c30ae05b3349 100644
@@ -776,7 +776,6 @@ static void dpu_encoder_phys_cmd_init_ops(
 	ops->wait_for_vblank = dpu_encoder_phys_cmd_wait_for_vblank;
 	ops->trigger_start = dpu_encoder_phys_cmd_trigger_start;
 	ops->needs_single_flush = dpu_encoder_phys_cmd_needs_single_flush;
-	ops->hw_reset = dpu_encoder_helper_hw_reset;
 	ops->irq_control = dpu_encoder_phys_cmd_irq_control;
 	ops->restore = dpu_encoder_phys_cmd_enable_helper;
 	ops->prepare_idle_pc = dpu_encoder_phys_cmd_prepare_idle_pc;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +0 -1
index 84de385a9f62..283a2491f3e3 100644
@@ -766,7 +766,6 @@ static void dpu_encoder_phys_vid_init_ops(struct
 dpu_encoder_phys_ops *ops)
 	ops->prepare_for_kickoff =
 dpu_encoder_phys_vid_prepare_for_kickoff;
 	ops->handle_post_kickoff =
 dpu_encoder_phys_vid_handle_post_kickoff;
 	ops->needs_single_flush = dpu_encoder_phys_vid_needs_single_flush;
-	ops->hw_reset = dpu_encoder_helper_hw_reset;

ops->get_line_count = dpu_encoder_phys_vid_get_line_count;
}

Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#5 lore raw

PATCH 2/6 drm/msm: dpu: Remove unused functions from msm_media_info.h

In reply to a message not in the archive

From: Sean Paul <[email protected]>

These functions aren't used anywhere, remove them.

---
 .../gpu/drm/msm/disp/dpu1/msm_media_info.h    | 171 ------------------
 1 file changed, 171 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -171
index 4f12e5c534c8..1a35dfb4a4e5 100644
@@ -813,18 +813,6 @@ enum color_fmts {
 #define COLOR_FMT_P010_UBWC		COLOR_FMT_P010_UBWC
 #define COLOR_FMT_P010		COLOR_FMT_P010
 
-static inline unsigned int VENUS_EXTRADATA_SIZE(int width, int height)
-{
-	(void)height;
-	(void)width;
-
-	/*
-	 * In the future, calculate the size based on the w/h but just
-	 * hardcode it for now since 16K satisfies all current usecases.
-	 */
-	return 16 * 1024;
-}
-
 /*
  * Function arguments:
  * @color_fmt
@@ -1214,163 +1202,4 @@ static inline unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height)
 	return rgb_meta_scanlines;
 }
 
-/*
- * Function arguments:
- * @color_fmt
- * @width
- * Progressive: width
- * Interlaced: width
- * @height
- * Progressive: height
- * Interlaced: height
- */
-static inline unsigned int VENUS_BUFFER_SIZE(
-	int color_fmt, int width, int height)
-{
-	const unsigned int extra_size = VENUS_EXTRADATA_SIZE(width, height);
-	unsigned int uv_alignment = 0, size = 0;
-	unsigned int y_plane, uv_plane, y_stride,
-		uv_stride, y_sclines, uv_sclines;
-	unsigned int y_ubwc_plane = 0, uv_ubwc_plane = 0;
-	unsigned int y_meta_stride = 0, y_meta_scanlines = 0;
-	unsigned int uv_meta_stride = 0, uv_meta_scanlines = 0;
-	unsigned int y_meta_plane = 0, uv_meta_plane = 0;
-	unsigned int rgb_stride = 0, rgb_scanlines = 0;
-	unsigned int rgb_plane = 0, rgb_ubwc_plane = 0, rgb_meta_plane = 0;
-	unsigned int rgb_meta_stride = 0, rgb_meta_scanlines = 0;
-
-	if (!width || !height)
-		goto invalid_input;
-
-	y_stride = VENUS_Y_STRIDE(color_fmt, width);
-	uv_stride = VENUS_UV_STRIDE(color_fmt, width);
-	y_sclines = VENUS_Y_SCANLINES(color_fmt, height);
-	uv_sclines = VENUS_UV_SCANLINES(color_fmt, height);
-	rgb_stride = VENUS_RGB_STRIDE(color_fmt, width);
-	rgb_scanlines = VENUS_RGB_SCANLINES(color_fmt, height);
-
-	switch (color_fmt) {
-	case COLOR_FMT_NV21:
-	case COLOR_FMT_NV12:
-	case COLOR_FMT_P010:
-		uv_alignment = 4096;
-		y_plane = y_stride * y_sclines;
-		uv_plane = uv_stride * uv_sclines + uv_alignment;
-		size = y_plane + uv_plane +
-				MSM_MEDIA_MAX(extra_size, 8 * y_stride);
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_NV12_MVTB:
-		uv_alignment = 4096;
-		y_plane = y_stride * y_sclines;
-		uv_plane = uv_stride * uv_sclines + uv_alignment;
-		size = y_plane + uv_plane;
-		size = 2 * size + extra_size;
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_NV12_UBWC:
-		y_sclines = VENUS_Y_SCANLINES(color_fmt, (height+1)>>1);
-		y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
-		uv_sclines = VENUS_UV_SCANLINES(color_fmt, (height+1)>>1);
-		uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
-		y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
-		y_meta_scanlines =
-			VENUS_Y_META_SCANLINES(color_fmt, (height+1)>>1);
-		y_meta_plane = MSM_MEDIA_ALIGN(
-			y_meta_stride * y_meta_scanlines, 4096);
-		uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
-		uv_meta_scanlines =
-			VENUS_UV_META_SCANLINES(color_fmt, (height+1)>>1);
-		uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
-			uv_meta_scanlines, 4096);
-
-		size = (y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
-			uv_meta_plane)*2 +
-			MSM_MEDIA_MAX(extra_size + 8192, 48 * y_stride);
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_NV12_BPP10_UBWC:
-		y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
-		uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
-		y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
-		y_meta_scanlines = VENUS_Y_META_SCANLINES(color_fmt, height);
-		y_meta_plane = MSM_MEDIA_ALIGN(
-				y_meta_stride * y_meta_scanlines, 4096);
-		uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
-		uv_meta_scanlines = VENUS_UV_META_SCANLINES(color_fmt, height);
-		uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
-					uv_meta_scanlines, 4096);
-
-		size = y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
-			uv_meta_plane +
-			MSM_MEDIA_MAX(extra_size + 8192, 48 * y_stride);
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_P010_UBWC:
-		y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
-		uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
-		y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
-		y_meta_scanlines = VENUS_Y_META_SCANLINES(color_fmt, height);
-		y_meta_plane = MSM_MEDIA_ALIGN(
-				y_meta_stride * y_meta_scanlines, 4096);
-		uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
-		uv_meta_scanlines = VENUS_UV_META_SCANLINES(color_fmt, height);
-		uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
-					uv_meta_scanlines, 4096);
-
-		size = y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
-			uv_meta_plane;
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_RGBA8888:
-		rgb_plane = MSM_MEDIA_ALIGN(rgb_stride  * rgb_scanlines, 4096);
-		size = rgb_plane;
-		size =  MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_RGBA8888_UBWC:
-	case COLOR_FMT_RGBA1010102_UBWC:
-	case COLOR_FMT_RGB565_UBWC:
-		rgb_ubwc_plane = MSM_MEDIA_ALIGN(rgb_stride * rgb_scanlines,
-							4096);
-		rgb_meta_stride = VENUS_RGB_META_STRIDE(color_fmt, width);
-		rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color_fmt,
-					height);
-		rgb_meta_plane = MSM_MEDIA_ALIGN(rgb_meta_stride *
-					rgb_meta_scanlines, 4096);
-		size = rgb_ubwc_plane + rgb_meta_plane;
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	default:
-		break;
-	}
-invalid_input:
-	return size;
-}
-
-static inline unsigned int VENUS_VIEW2_OFFSET(
-	int color_fmt, int width, int height)
-{
-	unsigned int offset = 0;
-	unsigned int y_plane, uv_plane, y_stride,
-		uv_stride, y_sclines, uv_sclines;
-	if (!width || !height)
-		goto invalid_input;
-
-	y_stride = VENUS_Y_STRIDE(color_fmt, width);
-	uv_stride = VENUS_UV_STRIDE(color_fmt, width);
-	y_sclines = VENUS_Y_SCANLINES(color_fmt, height);
-	uv_sclines = VENUS_UV_SCANLINES(color_fmt, height);
-	switch (color_fmt) {
-	case COLOR_FMT_NV12_MVTB:
-		y_plane = y_stride * y_sclines;
-		uv_plane = uv_stride * uv_sclines;
-		offset = y_plane + uv_plane;
-		break;
-	default:
-		break;
-	}
-invalid_input:
-	return offset;
-}
-
 #endif
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180920145818.32468-3-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org

Reviewed-by
#7 lore raw

Re: [PATCH 2/6] drm/msm: dpu: Remove unused functions from msm_media_info.h

Quoted 5 lines · Sean Paul

From: Sean Paul <[email protected]>

These functions aren't used anywhere, remove them.

Quoted 207 lines
---
 .../gpu/drm/msm/disp/dpu1/msm_media_info.h    | 171 ------------------
 1 file changed, 171 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -26
index 4f12e5c534c8..1a35dfb4a4e5 100644
@@ -813,18 +813,6 @@ enum color_fmts {
 #define COLOR_FMT_P010_UBWC		COLOR_FMT_P010_UBWC
 #define COLOR_FMT_P010		COLOR_FMT_P010
 
-static inline unsigned int VENUS_EXTRADATA_SIZE(int width, int height)
-{
-	(void)height;
-	(void)width;
-
-	/*
-	 * In the future, calculate the size based on the w/h but just
-	 * hardcode it for now since 16K satisfies all current usecases.
-	 */
-	return 16 * 1024;
-}
-
 /*
  * Function arguments:
  * @color_fmt
@@ -1214,163 +1202,4 @@ static inline unsigned int
 VENUS_RGB_META_SCANLINES(int color_fmt, int height)
 	return rgb_meta_scanlines;
 }
 
-/*
- * Function arguments:
- * @color_fmt
- * @width
- * Progressive: width
- * Interlaced: width
- * @height
- * Progressive: height
- * Interlaced: height
- */
-static inline unsigned int VENUS_BUFFER_SIZE(
-	int color_fmt, int width, int height)
-{
-	const unsigned int extra_size = VENUS_EXTRADATA_SIZE(width,

height);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -9
-	unsigned int uv_alignment = 0, size = 0;
-	unsigned int y_plane, uv_plane, y_stride,
-		uv_stride, y_sclines, uv_sclines;
-	unsigned int y_ubwc_plane = 0, uv_ubwc_plane = 0;
-	unsigned int y_meta_stride = 0, y_meta_scanlines = 0;
-	unsigned int uv_meta_stride = 0, uv_meta_scanlines = 0;
-	unsigned int y_meta_plane = 0, uv_meta_plane = 0;
-	unsigned int rgb_stride = 0, rgb_scanlines = 0;
-	unsigned int rgb_plane = 0, rgb_ubwc_plane = 0, rgb_meta_plane =

0;

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -34
-	unsigned int rgb_meta_stride = 0, rgb_meta_scanlines = 0;
-
-	if (!width || !height)
-		goto invalid_input;
-
-	y_stride = VENUS_Y_STRIDE(color_fmt, width);
-	uv_stride = VENUS_UV_STRIDE(color_fmt, width);
-	y_sclines = VENUS_Y_SCANLINES(color_fmt, height);
-	uv_sclines = VENUS_UV_SCANLINES(color_fmt, height);
-	rgb_stride = VENUS_RGB_STRIDE(color_fmt, width);
-	rgb_scanlines = VENUS_RGB_SCANLINES(color_fmt, height);
-
-	switch (color_fmt) {
-	case COLOR_FMT_NV21:
-	case COLOR_FMT_NV12:
-	case COLOR_FMT_P010:
-		uv_alignment = 4096;
-		y_plane = y_stride * y_sclines;
-		uv_plane = uv_stride * uv_sclines + uv_alignment;
-		size = y_plane + uv_plane +
-				MSM_MEDIA_MAX(extra_size, 8 * y_stride);
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_NV12_MVTB:
-		uv_alignment = 4096;
-		y_plane = y_stride * y_sclines;
-		uv_plane = uv_stride * uv_sclines + uv_alignment;
-		size = y_plane + uv_plane;
-		size = 2 * size + extra_size;
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_NV12_UBWC:
-		y_sclines = VENUS_Y_SCANLINES(color_fmt, (height+1)>>1);
-		y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines,

4096);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -2
-		uv_sclines = VENUS_UV_SCANLINES(color_fmt, (height+1)>>1);
-		uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines,

4096);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -18
-		y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
-		y_meta_scanlines =
-			VENUS_Y_META_SCANLINES(color_fmt, (height+1)>>1);
-		y_meta_plane = MSM_MEDIA_ALIGN(
-			y_meta_stride * y_meta_scanlines, 4096);
-		uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
-		uv_meta_scanlines =
-			VENUS_UV_META_SCANLINES(color_fmt, (height+1)>>1);
-		uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
-			uv_meta_scanlines, 4096);
-
-		size = (y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
-			uv_meta_plane)*2 +
-			MSM_MEDIA_MAX(extra_size + 8192, 48 * y_stride);
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_NV12_BPP10_UBWC:
-		y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines,

4096);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -1
-		uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines,

4096);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -2
-		y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
-		y_meta_scanlines = VENUS_Y_META_SCANLINES(color_fmt,

height);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -4
-		y_meta_plane = MSM_MEDIA_ALIGN(
-				y_meta_stride * y_meta_scanlines, 4096);
-		uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
-		uv_meta_scanlines = VENUS_UV_META_SCANLINES(color_fmt,

height);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -10
-		uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
-					uv_meta_scanlines, 4096);
-
-		size = y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
-			uv_meta_plane +
-			MSM_MEDIA_MAX(extra_size + 8192, 48 * y_stride);
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_P010_UBWC:
-		y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines,

4096);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -1
-		uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines,

4096);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -2
-		y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
-		y_meta_scanlines = VENUS_Y_META_SCANLINES(color_fmt,

height);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -4
-		y_meta_plane = MSM_MEDIA_ALIGN(
-				y_meta_stride * y_meta_scanlines, 4096);
-		uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
-		uv_meta_scanlines = VENUS_UV_META_SCANLINES(color_fmt,

height);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -9
-		uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
-					uv_meta_scanlines, 4096);
-
-		size = y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
-			uv_meta_plane;
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_RGBA8888:
-		rgb_plane = MSM_MEDIA_ALIGN(rgb_stride  * rgb_scanlines,

4096);

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -7
-		size = rgb_plane;
-		size =  MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	case COLOR_FMT_RGBA8888_UBWC:
-	case COLOR_FMT_RGBA1010102_UBWC:
-	case COLOR_FMT_RGB565_UBWC:
-		rgb_ubwc_plane = MSM_MEDIA_ALIGN(rgb_stride *

rgb_scanlines,

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -42
-							4096);
-		rgb_meta_stride = VENUS_RGB_META_STRIDE(color_fmt, width);
-		rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color_fmt,
-					height);
-		rgb_meta_plane = MSM_MEDIA_ALIGN(rgb_meta_stride *
-					rgb_meta_scanlines, 4096);
-		size = rgb_ubwc_plane + rgb_meta_plane;
-		size = MSM_MEDIA_ALIGN(size, 4096);
-		break;
-	default:
-		break;
-	}
-invalid_input:
-	return size;
-}
-
-static inline unsigned int VENUS_VIEW2_OFFSET(
-	int color_fmt, int width, int height)
-{
-	unsigned int offset = 0;
-	unsigned int y_plane, uv_plane, y_stride,
-		uv_stride, y_sclines, uv_sclines;
-	if (!width || !height)
-		goto invalid_input;
-
-	y_stride = VENUS_Y_STRIDE(color_fmt, width);
-	uv_stride = VENUS_UV_STRIDE(color_fmt, width);
-	y_sclines = VENUS_Y_SCANLINES(color_fmt, height);
-	uv_sclines = VENUS_UV_SCANLINES(color_fmt, height);
-	switch (color_fmt) {
-	case COLOR_FMT_NV12_MVTB:
-		y_plane = y_stride * y_sclines;
-		uv_plane = uv_stride * uv_sclines;
-		offset = y_plane + uv_plane;
-		break;
-	default:
-		break;
-	}
-invalid_input:
-	return offset;
-}
-
 #endif
Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#8 lore raw

PATCH 3/6 drm/msm: dpu: Remove _dpu_encoder_power_enable()

In reply to a message not in the archive

From: Sean Paul <[email protected]>

It's unused, remove it.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 33 ---------------------
 1 file changed, 33 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +0 -33
index 7842b66fbe2e..1f7f3c2e09c2 100644
@@ -210,39 +210,6 @@ struct dpu_encoder_virt {
 };
 
 #define to_dpu_encoder_virt(x) container_of(x, struct dpu_encoder_virt, base)
-static inline int _dpu_encoder_power_enable(struct dpu_encoder_virt *dpu_enc,
-								bool enable)
-{
-	struct drm_encoder *drm_enc;
-	struct msm_drm_private *priv;
-	struct dpu_kms *dpu_kms;
-
-	if (!dpu_enc) {
-		DPU_ERROR("invalid dpu enc\n");
-		return -EINVAL;
-	}
-
-	drm_enc = &dpu_enc->base;
-	if (!drm_enc->dev || !drm_enc->dev->dev_private) {
-		DPU_ERROR("drm device invalid\n");
-		return -EINVAL;
-	}
-
-	priv = drm_enc->dev->dev_private;
-	if (!priv->kms) {
-		DPU_ERROR("invalid kms\n");
-		return -EINVAL;
-	}
-
-	dpu_kms = to_dpu_kms(priv->kms);
-
-	if (enable)
-		pm_runtime_get_sync(&dpu_kms->pdev->dev);
-	else
-		pm_runtime_put_sync(&dpu_kms->pdev->dev);
-
-	return 0;
-}
 
 void dpu_encoder_helper_report_irq_timeout(struct dpu_encoder_phys *phys_enc,
 		enum dpu_intr_idx intr_idx)
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180920145818.32468-4-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org

Reviewed-by
#10 lore raw

Re: [PATCH 3/6] drm/msm: dpu: Remove _dpu_encoder_power_enable()

Quoted 5 lines · Sean Paul

From: Sean Paul <[email protected]>

It's unused, remove it.

Quoted 54 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 33 ---------------------
 1 file changed, 33 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +0 -2
index 7842b66fbe2e..1f7f3c2e09c2 100644
@@ -210,39 +210,6 @@ struct dpu_encoder_virt {
 };
 
 #define to_dpu_encoder_virt(x) container_of(x, struct 
 dpu_encoder_virt,
 base)
-static inline int _dpu_encoder_power_enable(struct dpu_encoder_virt
 *dpu_enc,
-								bool

enable)

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +0 -31
-{
-	struct drm_encoder *drm_enc;
-	struct msm_drm_private *priv;
-	struct dpu_kms *dpu_kms;
-
-	if (!dpu_enc) {
-		DPU_ERROR("invalid dpu enc\n");
-		return -EINVAL;
-	}
-
-	drm_enc = &dpu_enc->base;
-	if (!drm_enc->dev || !drm_enc->dev->dev_private) {
-		DPU_ERROR("drm device invalid\n");
-		return -EINVAL;
-	}
-
-	priv = drm_enc->dev->dev_private;
-	if (!priv->kms) {
-		DPU_ERROR("invalid kms\n");
-		return -EINVAL;
-	}
-
-	dpu_kms = to_dpu_kms(priv->kms);
-
-	if (enable)
-		pm_runtime_get_sync(&dpu_kms->pdev->dev);
-	else
-		pm_runtime_put_sync(&dpu_kms->pdev->dev);
-
-	return 0;
-}
 
 void dpu_encoder_helper_report_irq_timeout(struct dpu_encoder_phys

*phys_enc,
enum dpu_intr_idx intr_idx)

Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#11 lore raw

PATCH 4/6 drm/msm: dpu: Remove 'inline' from several functions

In reply to a message not in the archive

From: Sean Paul <[email protected]>

Per chapter 15 of coding-style, removing 'inline' keyword from functions that are larger than a typical macro. In a couple of cases I've simplified the function and kept the inline.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c      |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h      | 16 ++-----------
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   |  4 ++--
 .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c  |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c    |  6 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c     | 12 +++-------
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c   |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c     |  6 ++---
 .../gpu/drm/msm/disp/dpu1/msm_media_info.h    | 24 +++++++++----------
 9 files changed, 30 insertions(+), 48 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2 -2
index a8f2dd7a37c7..5ff23f00582b 100644
@@ -53,7 +53,7 @@ static inline int _dpu_crtc_get_mixer_width(struct dpu_crtc_state *cstate,
 	return mode->hdisplay / cstate->num_mixers;
 }
 
-static inline struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc)
+static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc)
 {
 	struct msm_drm_private *priv;
 
@@ -70,7 +70,7 @@ static inline struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc)
 	return to_dpu_kms(priv->kms);
 }
 
-static inline int _dpu_crtc_power_enable(struct dpu_crtc *dpu_crtc, bool enable)
+static int _dpu_crtc_power_enable(struct dpu_crtc *dpu_crtc, bool enable)
 {
 	struct drm_crtc *crtc;
 	struct msm_drm_private *priv;
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h +2 -14
index 3723b4830335..cc18eca8f527 100644
@@ -266,13 +266,7 @@ static inline int dpu_crtc_get_mixer_height(struct dpu_crtc *dpu_crtc,
  */
 static inline int dpu_crtc_frame_pending(struct drm_crtc *crtc)
 {
-	struct dpu_crtc *dpu_crtc;
-
-	if (!crtc)
-		return -EINVAL;
-
-	dpu_crtc = to_dpu_crtc(crtc);
-	return atomic_read(&dpu_crtc->frame_pending);
+	return crtc ? atomic_read(&to_dpu_crtc(crtc)->frame_pending) : -EINVAL;
 }
 
 /**
@@ -329,13 +323,7 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct drm_crtc *crtc);
 static inline enum dpu_crtc_client_type dpu_crtc_get_client_type(
 						struct drm_crtc *crtc)
 {
-	struct dpu_crtc_state *cstate =
-			crtc ? to_dpu_crtc_state(crtc->state) : NULL;
-
-	if (!cstate)
-		return NRT_CLIENT;
-
-	return RT_CLIENT;
+	return crtc && crtc->state ? RT_CLIENT : NRT_CLIENT;
 }
 
 /**
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +2 -2
index 1f7f3c2e09c2..79a6c6b7350b 100644
@@ -1376,7 +1376,7 @@ static void dpu_encoder_off_work(struct kthread_work *work)
  * phys: Pointer to physical encoder structure
  * extra_flush_bits: Additional bit mask to include in flush trigger
  */
-static inline void _dpu_encoder_trigger_flush(struct drm_encoder *drm_enc,
+static void _dpu_encoder_trigger_flush(struct drm_encoder *drm_enc,
 		struct dpu_encoder_phys *phys, uint32_t extra_flush_bits)
 {
 	struct dpu_hw_ctl *ctl;
@@ -1419,7 +1419,7 @@ static inline void _dpu_encoder_trigger_flush(struct drm_encoder *drm_enc,
  * _dpu_encoder_trigger_start - trigger start for a physical encoder
  * phys: Pointer to physical encoder structure
  */
-static inline void _dpu_encoder_trigger_start(struct dpu_encoder_phys *phys)
+static void _dpu_encoder_trigger_start(struct dpu_encoder_phys *phys)
 {
 	if (!phys) {
 		DPU_ERROR("invalid argument(s)\n");
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +2 -2
index 283a2491f3e3..b3c68c4fcc8e 100644
@@ -110,7 +110,7 @@ static void drm_mode_to_intf_timing_params(
 	 */
 }
 
-static inline u32 get_horizontal_total(const struct intf_timing_params *timing)
+static u32 get_horizontal_total(const struct intf_timing_params *timing)
 {
 	u32 active = timing->xres;
 	u32 inactive =
@@ -119,7 +119,7 @@ static inline u32 get_horizontal_total(const struct intf_timing_params *timing)
 	return active + inactive;
 }
 
-static inline u32 get_vertical_total(const struct intf_timing_params *timing)
+static u32 get_vertical_total(const struct intf_timing_params *timing)
 {
 	u32 active = timing->yres;
 	u32 inactive =
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +3 -3
index b394a1818c5d..cd27ba42efab 100644
@@ -114,7 +114,7 @@ static inline u32 dpu_hw_ctl_get_flush_register(struct dpu_hw_ctl *ctx)
 	return DPU_REG_READ(c, CTL_FLUSH);
 }
 
-static inline uint32_t dpu_hw_ctl_get_bitmask_sspp(struct dpu_hw_ctl *ctx,
+static uint32_t dpu_hw_ctl_get_bitmask_sspp(struct dpu_hw_ctl *ctx,
 	enum dpu_sspp sspp)
 {
 	uint32_t flushbits = 0;
@@ -169,7 +169,7 @@ static inline uint32_t dpu_hw_ctl_get_bitmask_sspp(struct dpu_hw_ctl *ctx,
 	return flushbits;
 }
 
-static inline uint32_t dpu_hw_ctl_get_bitmask_mixer(struct dpu_hw_ctl *ctx,
+static uint32_t dpu_hw_ctl_get_bitmask_mixer(struct dpu_hw_ctl *ctx,
 	enum dpu_lm lm)
 {
 	uint32_t flushbits = 0;
@@ -202,7 +202,7 @@ static inline uint32_t dpu_hw_ctl_get_bitmask_mixer(struct dpu_hw_ctl *ctx,
 	return flushbits;
 }
 
-static inline int dpu_hw_ctl_get_bitmask_intf(struct dpu_hw_ctl *ctx,
+static int dpu_hw_ctl_get_bitmask_intf(struct dpu_hw_ctl *ctx,
 		u32 *flushbits, enum dpu_intf intf)
 {
 	switch (intf) {
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +3 -9
index acb8dc8acaa5..dbe48e006414 100644
@@ -64,16 +64,10 @@ static struct dpu_lm_cfg *_lm_offset(enum dpu_lm mixer,
 static inline int _stage_offset(struct dpu_hw_mixer *ctx, enum dpu_stage stage)
 {
 	const struct dpu_lm_sub_blks *sblk = ctx->cap->sblk;
-	int rc;
-
-	if (stage == DPU_STAGE_BASE)
-		rc = -EINVAL;
-	else if (stage <= sblk->maxblendstages)
-		rc = sblk->blendstage_base[stage - DPU_STAGE_0];
-	else
-		rc = -EINVAL;
+	if (stage != DPU_STAGE_BASE && stage <= sblk->maxblendstages)
+		return sblk->blendstage_base[stage - DPU_STAGE_0];
 
-	return rc;
+	return -EINVAL;
 }
 
 static void dpu_hw_lm_setup_out(struct dpu_hw_mixer *ctx,
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +1 -1
index c25b52a6b219..8745018ffdd6 100644
@@ -141,7 +141,7 @@
 /* traffic shaper clock in Hz */
 #define TS_CLK			19200000
 
-static inline int _sspp_subblk_offset(struct dpu_hw_pipe *ctx,
+static int _sspp_subblk_offset(struct dpu_hw_pipe *ctx,
 		int s_id,
 		u32 *idx)
 {
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +3 -3
index 1ce76460d710..2b23b95f4a6f 100644
@@ -140,7 +140,7 @@ static struct dpu_kms *_dpu_plane_get_kms(struct drm_plane *plane)
  * @src_wdith:		width of source buffer
  * Return: fill level corresponding to the source buffer/format or 0 if error
  */
-static inline int _dpu_plane_calc_fill_level(struct drm_plane *plane,
+static int _dpu_plane_calc_fill_level(struct drm_plane *plane,
 		const struct dpu_format *fmt, u32 src_width)
 {
 	struct dpu_plane *pdpu, *tmp;
@@ -559,7 +559,7 @@ static int _dpu_plane_get_aspace(
 	return 0;
 }
 
-static inline void _dpu_plane_set_scanout(struct drm_plane *plane,
+static void _dpu_plane_set_scanout(struct drm_plane *plane,
 		struct dpu_plane_state *pstate,
 		struct dpu_hw_pipe_cfg *pipe_cfg,
 		struct drm_framebuffer *fb)
@@ -671,7 +671,7 @@ static void _dpu_plane_setup_scaler3(struct dpu_plane *pdpu,
 	scale_cfg->enable = 1;
 }
 
-static inline void _dpu_plane_setup_csc(struct dpu_plane *pdpu)
+static void _dpu_plane_setup_csc(struct dpu_plane *pdpu)
 {
 	static const struct dpu_csc_cfg dpu_csc_YUV2RGB_601L = {
 		{
drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +12 -12
index 1a35dfb4a4e5..75470ee5b18f 100644
@@ -820,7 +820,7 @@ enum color_fmts {
  * Progressive: width
  * Interlaced: width
  */
-static inline unsigned int VENUS_Y_STRIDE(int color_fmt, int width)
+static unsigned int VENUS_Y_STRIDE(int color_fmt, int width)
 {
 	unsigned int alignment, stride = 0;
 
@@ -862,7 +862,7 @@ static inline unsigned int VENUS_Y_STRIDE(int color_fmt, int width)
  * Progressive: width
  * Interlaced: width
  */
-static inline unsigned int VENUS_UV_STRIDE(int color_fmt, int width)
+static unsigned int VENUS_UV_STRIDE(int color_fmt, int width)
 {
 	unsigned int alignment, stride = 0;
 
@@ -904,7 +904,7 @@ static inline unsigned int VENUS_UV_STRIDE(int color_fmt, int width)
  * Progressive: height
  * Interlaced: (height+1)>>1
  */
-static inline unsigned int VENUS_Y_SCANLINES(int color_fmt, int height)
+static unsigned int VENUS_Y_SCANLINES(int color_fmt, int height)
 {
 	unsigned int alignment, sclines = 0;
 
@@ -938,7 +938,7 @@ static inline unsigned int VENUS_Y_SCANLINES(int color_fmt, int height)
  * Progressive: height
  * Interlaced: (height+1)>>1
  */
-static inline unsigned int VENUS_UV_SCANLINES(int color_fmt, int height)
+static unsigned int VENUS_UV_SCANLINES(int color_fmt, int height)
 {
 	unsigned int alignment, sclines = 0;
 
@@ -974,7 +974,7 @@ static inline unsigned int VENUS_UV_SCANLINES(int color_fmt, int height)
  * Progressive: width
  * Interlaced: width
  */
-static inline unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width)
+static unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width)
 {
 	int y_tile_width = 0, y_meta_stride = 0;
 
@@ -1007,7 +1007,7 @@ static inline unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width)
  * Progressive: height
  * Interlaced: (height+1)>>1
  */
-static inline unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)
+static unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)
 {
 	int y_tile_height = 0, y_meta_scanlines = 0;
 
@@ -1040,7 +1040,7 @@ static inline unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)
  * Progressive: width
  * Interlaced: width
  */
-static inline unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width)
+static unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width)
 {
 	int uv_tile_width = 0, uv_meta_stride = 0;
 
@@ -1073,7 +1073,7 @@ static inline unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width)
  * Progressive: height
  * Interlaced: (height+1)>>1
  */
-static inline unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height)
+static unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height)
 {
 	int uv_tile_height = 0, uv_meta_scanlines = 0;
 
@@ -1099,7 +1099,7 @@ static inline unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height)
 	return uv_meta_scanlines;
 }
 
-static inline unsigned int VENUS_RGB_STRIDE(int color_fmt, int width)
+static unsigned int VENUS_RGB_STRIDE(int color_fmt, int width)
 {
 	unsigned int alignment = 0, stride = 0, bpp = 4;
 
@@ -1128,7 +1128,7 @@ static inline unsigned int VENUS_RGB_STRIDE(int color_fmt, int width)
 	return stride;
 }
 
-static inline unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height)
+static unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height)
 {
 	unsigned int alignment = 0, scanlines = 0;
 
@@ -1154,7 +1154,7 @@ static inline unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height)
 	return scanlines;
 }
 
-static inline unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width)
+static unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width)
 {
 	int rgb_tile_width = 0, rgb_meta_stride = 0;
 
@@ -1178,7 +1178,7 @@ static inline unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width)
 	return rgb_meta_stride;
 }
 
-static inline unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height)
+static unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height)
 {
 	int rgb_tile_height = 0, rgb_meta_scanlines = 0;
 
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180920145818.32468-5-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org

Reviewed-by
#13 lore raw

Re: [PATCH 4/6] drm/msm: dpu: Remove 'inline' from several functions

Quoted 7 lines · Sean Paul

From: Sean Paul <[email protected]>

Per chapter 15 of coding-style, removing 'inline' keyword from functions that are larger than a typical macro. In a couple of cases I've simplified the function and kept the inline.

Quoted 389 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c      |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h      | 16 ++-----------
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   |  4 ++--
 .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c  |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c    |  6 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c     | 12 +++-------
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c   |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c     |  6 ++---
 .../gpu/drm/msm/disp/dpu1/msm_media_info.h    | 24 +++++++++----------
 9 files changed, 30 insertions(+), 48 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1 -2
index a8f2dd7a37c7..5ff23f00582b 100644
@@ -53,7 +53,7 @@ static inline int _dpu_crtc_get_mixer_width(struct
 dpu_crtc_state *cstate,
 	return mode->hdisplay / cstate->num_mixers;
 }
 
-static inline struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc)
+static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc)
 {
 	struct msm_drm_private *priv;
@@ -70,7 +70,7 @@ static inline struct dpu_kms 
 *_dpu_crtc_get_kms(struct
 drm_crtc *crtc)
 	return to_dpu_kms(priv->kms);
 }
 
-static inline int _dpu_crtc_power_enable(struct dpu_crtc *dpu_crtc, 

bool
enable)
+static int _dpu_crtc_power_enable(struct dpu_crtc *dpu_crtc, bool enable)
{

drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +0 -0
 	struct drm_crtc *crtc;
 	struct msm_drm_private *priv;
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h +2 -15
index 3723b4830335..cc18eca8f527 100644
@@ -266,13 +266,7 @@ static inline int dpu_crtc_get_mixer_height(struct
 dpu_crtc *dpu_crtc,
  */
 static inline int dpu_crtc_frame_pending(struct drm_crtc *crtc)
 {
-	struct dpu_crtc *dpu_crtc;
-
-	if (!crtc)
-		return -EINVAL;
-
-	dpu_crtc = to_dpu_crtc(crtc);
-	return atomic_read(&dpu_crtc->frame_pending);
+	return crtc ? atomic_read(&to_dpu_crtc(crtc)->frame_pending) :
-EINVAL;
 }
 
 /**
@@ -329,13 +323,7 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct
 drm_crtc *crtc);
 static inline enum dpu_crtc_client_type dpu_crtc_get_client_type(
 						struct drm_crtc *crtc)
 {
-	struct dpu_crtc_state *cstate =
-			crtc ? to_dpu_crtc_state(crtc->state) : NULL;
-
-	if (!cstate)
-		return NRT_CLIENT;
-
-	return RT_CLIENT;
+	return crtc && crtc->state ? RT_CLIENT : NRT_CLIENT;
 }
 

/**

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +0 -0
index 1f7f3c2e09c2..79a6c6b7350b 100644
@@ -1376,7 +1376,7 @@ static void dpu_encoder_off_work(struct 

kthread_work
*work)
* phys: Pointer to physical encoder structure
* extra_flush_bits: Additional bit mask to include in flush trigger */
-static inline void _dpu_encoder_trigger_flush(struct drm_encoder *drm_enc,

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -0
+static void _dpu_encoder_trigger_flush(struct drm_encoder *drm_enc,
 		struct dpu_encoder_phys *phys, uint32_t extra_flush_bits)
 {
 	struct dpu_hw_ctl *ctl;
@@ -1419,7 +1419,7 @@ static inline void 

_dpu_encoder_trigger_flush(struct
drm_encoder *drm_enc,
* _dpu_encoder_trigger_start - trigger start for a physical encoder
* phys: Pointer to physical encoder structure
*/
-static inline void _dpu_encoder_trigger_start(struct dpu_encoder_phys *phys)

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -0
+static void _dpu_encoder_trigger_start(struct dpu_encoder_phys *phys)
 {
 	if (!phys) {
 		DPU_ERROR("invalid argument(s)\n");
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +1 -1
index 283a2491f3e3..b3c68c4fcc8e 100644
@@ -110,7 +110,7 @@ static void drm_mode_to_intf_timing_params(
 	 */
 }
 
-static inline u32 get_horizontal_total(const struct intf_timing_params
 *timing)
+static u32 get_horizontal_total(const struct intf_timing_params 
 *timing)
 {
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +1 -1
 	u32 active = timing->xres;
 	u32 inactive =
@@ -119,7 +119,7 @@ static inline u32 get_horizontal_total(const struct
 intf_timing_params *timing)
 	return active + inactive;
 }
 
-static inline u32 get_vertical_total(const struct intf_timing_params
 *timing)
+static u32 get_vertical_total(const struct intf_timing_params *timing)
 {
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +0 -0
 	u32 active = timing->yres;
 	u32 inactive =
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +0 -0
index b394a1818c5d..cd27ba42efab 100644
@@ -114,7 +114,7 @@ static inline u32 

dpu_hw_ctl_get_flush_register(struct
dpu_hw_ctl *ctx)

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +0 -1
 	return DPU_REG_READ(c, CTL_FLUSH);
 }
 
-static inline uint32_t dpu_hw_ctl_get_bitmask_sspp(struct dpu_hw_ctl

*ctx,

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +2 -1
+static uint32_t dpu_hw_ctl_get_bitmask_sspp(struct dpu_hw_ctl *ctx,
 	enum dpu_sspp sspp)
 {
 	uint32_t flushbits = 0;
@@ -169,7 +169,7 @@ static inline uint32_t
 dpu_hw_ctl_get_bitmask_sspp(struct dpu_hw_ctl *ctx,
 	return flushbits;
 }
 
-static inline uint32_t dpu_hw_ctl_get_bitmask_mixer(struct dpu_hw_ctl
 *ctx,
+static uint32_t dpu_hw_ctl_get_bitmask_mixer(struct dpu_hw_ctl *ctx,
 	enum dpu_lm lm)

{

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +1 -1
 	uint32_t flushbits = 0;
@@ -202,7 +202,7 @@ static inline uint32_t
 dpu_hw_ctl_get_bitmask_mixer(struct dpu_hw_ctl *ctx,
 	return flushbits;
 }
 
-static inline int dpu_hw_ctl_get_bitmask_intf(struct dpu_hw_ctl *ctx,
+static int dpu_hw_ctl_get_bitmask_intf(struct dpu_hw_ctl *ctx,
 		u32 *flushbits, enum dpu_intf intf)
 {
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +0 -0
 	switch (intf) {
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +0 -0
index acb8dc8acaa5..dbe48e006414 100644
@@ -64,16 +64,10 @@ static struct dpu_lm_cfg *_lm_offset(enum dpu_lm
 mixer,
 static inline int _stage_offset(struct dpu_hw_mixer *ctx, enum 

dpu_stage
stage)
{

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +3 -9
 	const struct dpu_lm_sub_blks *sblk = ctx->cap->sblk;
-	int rc;
-
-	if (stage == DPU_STAGE_BASE)
-		rc = -EINVAL;
-	else if (stage <= sblk->maxblendstages)
-		rc = sblk->blendstage_base[stage - DPU_STAGE_0];
-	else
-		rc = -EINVAL;
+	if (stage != DPU_STAGE_BASE && stage <= sblk->maxblendstages)
+		return sblk->blendstage_base[stage - DPU_STAGE_0];
 
-	return rc;
+	return -EINVAL;
 }
 
 static void dpu_hw_lm_setup_out(struct dpu_hw_mixer *ctx,
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +1 -1
index c25b52a6b219..8745018ffdd6 100644
@@ -141,7 +141,7 @@
 /* traffic shaper clock in Hz */
 #define TS_CLK			19200000
 
-static inline int _sspp_subblk_offset(struct dpu_hw_pipe *ctx,
+static int _sspp_subblk_offset(struct dpu_hw_pipe *ctx,
 		int s_id,
 		u32 *idx)
 {
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0 -0
index 1ce76460d710..2b23b95f4a6f 100644
@@ -140,7 +140,7 @@ static struct dpu_kms *_dpu_plane_get_kms(struct
 drm_plane *plane)
  * @src_wdith:		width of source buffer
  * Return: fill level corresponding to the source buffer/format or 0 

if
error
*/

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +2 -2
-static inline int _dpu_plane_calc_fill_level(struct drm_plane *plane,
+static int _dpu_plane_calc_fill_level(struct drm_plane *plane,
 		const struct dpu_format *fmt, u32 src_width)
 {
 	struct dpu_plane *pdpu, *tmp;
@@ -559,7 +559,7 @@ static int _dpu_plane_get_aspace(
 	return 0;
 }
 
-static inline void _dpu_plane_set_scanout(struct drm_plane *plane,
+static void _dpu_plane_set_scanout(struct drm_plane *plane,
 		struct dpu_plane_state *pstate,
 		struct dpu_hw_pipe_cfg *pipe_cfg,
 		struct drm_framebuffer *fb)
@@ -671,7 +671,7 @@ static void _dpu_plane_setup_scaler3(struct 

dpu_plane
*pdpu,

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1 -1
 	scale_cfg->enable = 1;
 }
 
-static inline void _dpu_plane_setup_csc(struct dpu_plane *pdpu)
+static void _dpu_plane_setup_csc(struct dpu_plane *pdpu)
 {
 	static const struct dpu_csc_cfg dpu_csc_YUV2RGB_601L = {
 		{
drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +3 -3
index 1a35dfb4a4e5..75470ee5b18f 100644
@@ -820,7 +820,7 @@ enum color_fmts {
  * Progressive: width
  * Interlaced: width
  */
-static inline unsigned int VENUS_Y_STRIDE(int color_fmt, int width)
+static unsigned int VENUS_Y_STRIDE(int color_fmt, int width)
 {
 	unsigned int alignment, stride = 0;
 
@@ -862,7 +862,7 @@ static inline unsigned int VENUS_Y_STRIDE(int
 color_fmt, int width)
  * Progressive: width
  * Interlaced: width
  */
-static inline unsigned int VENUS_UV_STRIDE(int color_fmt, int width)
+static unsigned int VENUS_UV_STRIDE(int color_fmt, int width)
 {
 	unsigned int alignment, stride = 0;
@@ -904,7 +904,7 @@ static inline unsigned int VENUS_UV_STRIDE(int
 color_fmt, int width)
  * Progressive: height
  * Interlaced: (height+1)>>1
  */
-static inline unsigned int VENUS_Y_SCANLINES(int color_fmt, int 
 height)
+static unsigned int VENUS_Y_SCANLINES(int color_fmt, int height)
 {
drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +1 -1
 	unsigned int alignment, sclines = 0;
@@ -938,7 +938,7 @@ static inline unsigned int VENUS_Y_SCANLINES(int
 color_fmt, int height)
  * Progressive: height
  * Interlaced: (height+1)>>1
  */
-static inline unsigned int VENUS_UV_SCANLINES(int color_fmt, int 
 height)
+static unsigned int VENUS_UV_SCANLINES(int color_fmt, int height)
 {
drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +1 -1
 	unsigned int alignment, sclines = 0;
@@ -974,7 +974,7 @@ static inline unsigned int VENUS_UV_SCANLINES(int
 color_fmt, int height)
  * Progressive: width
  * Interlaced: width
  */
-static inline unsigned int VENUS_Y_META_STRIDE(int color_fmt, int 
 width)
+static unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width)
 {
drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -0
 	int y_tile_width = 0, y_meta_stride = 0;
@@ -1007,7 +1007,7 @@ static inline unsigned int 

VENUS_Y_META_STRIDE(int
color_fmt, int width)
* Progressive: height
* Interlaced: (height+1)>>1
*/
-static inline unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +2 -1
+static unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)
 {
 	int y_tile_height = 0, y_meta_scanlines = 0;
@@ -1040,7 +1040,7 @@ static inline unsigned int
 VENUS_Y_META_SCANLINES(int color_fmt, int height)
  * Progressive: width
  * Interlaced: width
  */
-static inline unsigned int VENUS_UV_META_STRIDE(int color_fmt, int 
 width)
+static unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width)
 {
drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -0
 	int uv_tile_width = 0, uv_meta_stride = 0;
@@ -1073,7 +1073,7 @@ static inline unsigned int 

VENUS_UV_META_STRIDE(int
color_fmt, int width)
* Progressive: height
* Interlaced: (height+1)>>1
*/
-static inline unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height)

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +3 -2
+static unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height)
 {
 	int uv_tile_height = 0, uv_meta_scanlines = 0;
@@ -1099,7 +1099,7 @@ static inline unsigned int
 VENUS_UV_META_SCANLINES(int color_fmt, int height)
 	return uv_meta_scanlines;
 }
 
-static inline unsigned int VENUS_RGB_STRIDE(int color_fmt, int width)
+static unsigned int VENUS_RGB_STRIDE(int color_fmt, int width)
 {
 	unsigned int alignment = 0, stride = 0, bpp = 4;
@@ -1128,7 +1128,7 @@ static inline unsigned int VENUS_RGB_STRIDE(int
 color_fmt, int width)
 	return stride;
 }
 
-static inline unsigned int VENUS_RGB_SCANLINES(int color_fmt, int 
 height)
+static unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height)
 {
drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -0
 	unsigned int alignment = 0, scanlines = 0;
@@ -1154,7 +1154,7 @@ static inline unsigned int 

VENUS_RGB_SCANLINES(int
color_fmt, int height)

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -1
 	return scanlines;
 }
 
-static inline unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int

width)

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +1 -0
+static unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width)
 {
 	int rgb_tile_width = 0, rgb_meta_stride = 0;
@@ -1178,7 +1178,7 @@ static inline unsigned int 

VENUS_RGB_META_STRIDE(int
color_fmt, int width)

drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +0 -1
 	return rgb_meta_stride;
 }
 
-static inline unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int

height)
+static unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height)
{
int rgb_tile_height = 0, rgb_meta_scanlines = 0;

Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#14 lore raw

PATCH 5/6 drm/msm: dpu: Remove empty/useless labels

In reply to a message not in the archive

From: Sean Paul <[email protected]>

I noticed an empty label while driving by and decided to use coccinelle to see if there were any more. Here's the spatch and the invocation:

---

@@
identifier lbl;
expression E;
@@

- goto lbl;
+ return E;
...
- lbl:

	return E;

@@
identifier lbl;
@@

- goto lbl;
+ return;
...
- lbl:
- return;

---
spatch --allow-inconsistent-paths --sp-file file.spatch --dir drivers/gpu/drm/msm/disp/dpu1 --in-place
---

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c     |  5 ++---
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  |  8 ++------
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c       |  5 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c   |  3 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c           | 15 ++++++---------
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c         | 14 ++++++--------
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c          |  4 +---
 7 files changed, 20 insertions(+), 34 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +2 -3
index 41c5191f9056..affc9738e2b5 100644
@@ -68,7 +68,7 @@ static bool _dpu_core_video_mode_intf_connected(struct drm_crtc *crtc)
 	bool intf_connected = false;
 
 	if (!crtc)
-		goto end;
+		return intf_connected;
 
 	drm_for_each_crtc(tmp_crtc, crtc->dev) {
 		if ((dpu_crtc_get_intf_mode(tmp_crtc) == INTF_MODE_VIDEO) &&
@@ -76,11 +76,10 @@ static bool _dpu_core_video_mode_intf_connected(struct drm_crtc *crtc)
 			DPU_DEBUG("video interface connected crtc:%d\n",
 				tmp_crtc->base.id);
 			intf_connected = true;
-			goto end;
+			return intf_connected;
 		}
 	}
 
-end:
 	return intf_connected;
 }
 
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +2 -6
index c30ae05b3349..24a98f4e1f44 100644
@@ -496,14 +496,11 @@ static void dpu_encoder_phys_cmd_enable_helper(
 	_dpu_encoder_phys_cmd_pingpong_config(phys_enc);
 
 	if (!dpu_encoder_phys_cmd_is_master(phys_enc))
-		goto skip_flush;
+		return;
 
 	ctl = phys_enc->hw_ctl;
 	ctl->ops.get_bitmask_intf(ctl, &flush_mask, phys_enc->intf_idx);
 	ctl->ops.update_pending_flush(ctl, flush_mask);
-
-skip_flush:
-	return;
 }
 
 static void dpu_encoder_phys_cmd_enable(struct dpu_encoder_phys *phys_enc)
@@ -797,7 +794,7 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
 	if (!cmd_enc) {
 		ret = -ENOMEM;
 		DPU_ERROR("failed to allocate\n");
-		goto fail;
+		return ERR_PTR(ret);
 	}
 	phys_enc = &cmd_enc->base;
 	phys_enc->hw_mdptop = p->dpu_kms->hw_mdp;
@@ -855,6 +852,5 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
 
 	return phys_enc;
 
-fail:
 	return ERR_PTR(ret);
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +2 -3
index bfcd165e96df..0aa9b8e1ae70 100644
@@ -921,7 +921,7 @@ static int _dpu_format_populate_addrs_ubwc(
 			+ layout->plane_size[2] + layout->plane_size[3];
 
 		if (!meta)
-			goto done;
+			return 0;
 
 		/* configure Y metadata plane */
 		layout->plane_addr[2] = base_addr;
@@ -952,12 +952,11 @@ static int _dpu_format_populate_addrs_ubwc(
 		layout->plane_addr[1] = 0;
 
 		if (!meta)
-			goto done;
+			return 0;
 
 		layout->plane_addr[2] = base_addr;
 		layout->plane_addr[3] = 0;
 	}
-done:
 	return 0;
 }
 
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +1 -2
index cc3a623903f4..52fca13da176 100644
@@ -177,7 +177,7 @@ static u32 dpu_hw_pp_get_line_count(struct dpu_hw_pingpong *pp)
 	height = DPU_REG_READ(c, PP_SYNC_CONFIG_HEIGHT) & 0xFFFF;
 
 	if (height < init)
-		goto line_count_exit;
+		return line;
 
 	line = DPU_REG_READ(c, PP_INT_COUNT_VAL) & 0xFFFF;
 
@@ -186,7 +186,6 @@ static u32 dpu_hw_pp_get_line_count(struct dpu_hw_pingpong *pp)
 	else
 		line -= init;
 
-line_count_exit:
 	return line;
 }
 
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +6 -9
index 0a683e65a9f3..d51992014e41 100644
@@ -979,20 +979,20 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 
 	if (!kms) {
 		DPU_ERROR("invalid kms\n");
-		goto end;
+		return rc;
 	}
 
 	dpu_kms = to_dpu_kms(kms);
 	dev = dpu_kms->dev;
 	if (!dev) {
 		DPU_ERROR("invalid device\n");
-		goto end;
+		return rc;
 	}
 
 	rc = dpu_dbg_init(&dpu_kms->pdev->dev);
 	if (rc) {
 		DRM_ERROR("failed to init dpu dbg: %d\n", rc);
-		goto end;
+		return rc;
 	}
 
 	priv = dev->dev_private;
@@ -1173,7 +1173,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 	_dpu_kms_hw_destroy(dpu_kms);
 dbg_destroy:
 	dpu_dbg_destroy();
-end:
 	return rc;
 }
 
@@ -1278,7 +1277,7 @@ static int __maybe_unused dpu_runtime_suspend(struct device *dev)
 	ddev = dpu_kms->dev;
 	if (!ddev) {
 		DPU_ERROR("invalid drm_device\n");
-		goto exit;
+		return rc;
 	}
 
 	rc = dpu_power_resource_enable(&dpu_kms->phandle,
@@ -1290,7 +1289,6 @@ static int __maybe_unused dpu_runtime_suspend(struct device *dev)
 	if (rc)
 		DPU_ERROR("clock disable failed rc:%d\n", rc);
 
-exit:
 	return rc;
 }
 
@@ -1305,13 +1303,13 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev)
 	ddev = dpu_kms->dev;
 	if (!ddev) {
 		DPU_ERROR("invalid drm_device\n");
-		goto exit;
+		return rc;
 	}
 
 	rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true);
 	if (rc) {
 		DPU_ERROR("clock enable failed rc:%d\n", rc);
-		goto exit;
+		return rc;
 	}
 
 	rc = dpu_power_resource_enable(&dpu_kms->phandle,
@@ -1319,7 +1317,6 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev)
 	if (rc)
 		DPU_ERROR("resource enable failed: %d\n", rc);
 
-exit:
 	return rc;
 }
 
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +6 -8
index 2b23b95f4a6f..1fa0ba0019ed 100644
@@ -432,13 +432,12 @@ int dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
 	pdpu = to_dpu_plane(plane);
 
 	if (!pdpu->is_rt_pipe)
-		goto end;
+		return 0;
 
 	pm_runtime_get_sync(&dpu_kms->pdev->dev);
 	_dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL);
 	pm_runtime_put_sync(&dpu_kms->pdev->dev);
 
-end:
 	return 0;
 }
 
@@ -1744,24 +1743,24 @@ struct drm_plane *dpu_plane_init(struct drm_device *dev,
 
 	if (!dev) {
 		DPU_ERROR("[%u]device is NULL\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	priv = dev->dev_private;
 	if (!priv) {
 		DPU_ERROR("[%u]private data is NULL\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	if (!priv->kms) {
 		DPU_ERROR("[%u]invalid KMS reference\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 	kms = to_dpu_kms(priv->kms);
 
 	if (!kms->catalog) {
 		DPU_ERROR("[%u]invalid catalog reference\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	/* create and zero local structure */
@@ -1769,7 +1768,7 @@ struct drm_plane *dpu_plane_init(struct drm_device *dev,
 	if (!pdpu) {
 		DPU_ERROR("[%u]failed to allocate local plane struct\n", pipe);
 		ret = -ENOMEM;
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	/* cache local stuff for later */
@@ -1855,6 +1854,5 @@ struct drm_plane *dpu_plane_init(struct drm_device *dev,
 		dpu_hw_sspp_destroy(pdpu->pipe_hw);
 clean_plane:
 	kfree(pdpu);
-exit:
 	return ERR_PTR(ret);
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +1 -3
index 295528292296..ff5091d2555d 100644
@@ -191,7 +191,7 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms,
 	ot_lim = _dpu_vbif_get_ot_limit(vbif, params) & 0xFF;
 
 	if (ot_lim == 0)
-		goto exit;
+		return;
 
 	trace_dpu_perf_set_ot(params->num, params->xin_id, ot_lim,
 		params->vbif_idx);
@@ -210,8 +210,6 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms,
 
 	if (forced_on)
 		mdp->ops.setup_clk_force_ctrl(mdp, params->clk_ctrl, false);
-exit:
-	return;
 }
 
 void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms,
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180920145818.32468-6-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org

#16 lore raw

Re: [PATCH 5/6] drm/msm: dpu: Remove empty/useless labels

Quoted 53 lines · Sean Paul

From: Sean Paul <[email protected]>

I noticed an empty label while driving by and decided to use coccinelle to see if there were any more. Here's the spatch and the invocation:

---

@@
identifier lbl;
expression E;
@@

- goto lbl;
+ return E;
...
- lbl:

	return E;

@@
identifier lbl;
@@

- goto lbl;
+ return;
...
- lbl:

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -2
-	return;
 
---

spatch --allow-inconsistent-paths --sp-file file.spatch --dir drivers/gpu/drm/msm/disp/dpu1 --in-place
---

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c     |  5 ++---
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  |  8 ++------
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c       |  5 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c   |  3 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c           | 15 ++++++---------
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c         | 14 ++++++--------
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c          |  4 +---
 7 files changed, 20 insertions(+), 34 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +0 -0
index 41c5191f9056..affc9738e2b5 100644
@@ -68,7 +68,7 @@ static bool 

_dpu_core_video_mode_intf_connected(struct
drm_crtc *crtc)

drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c static bool _dpu_core_video_mode_intf_connected(struct drm_crtc *crtc) · line 71

Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +1 -1
 	bool intf_connected = false;
 
 	if (!crtc)
-		goto end;
+		return intf_connected;

This can be further cleaned up by removing this intermediate var.

Quoted 291 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +0 -0
 	drm_for_each_crtc(tmp_crtc, crtc->dev) {
 		if ((dpu_crtc_get_intf_mode(tmp_crtc) == INTF_MODE_VIDEO)

&&

drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +0 -0
@@ -76,11 +76,10 @@ static bool 

_dpu_core_video_mode_intf_connected(struct
drm_crtc *crtc)

drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +1 -2
 			DPU_DEBUG("video interface connected crtc:%d\n",
 				tmp_crtc->base.id);
 			intf_connected = true;
-			goto end;
+			return intf_connected;
 		}
 	}
 
-end:
 	return intf_connected;
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +1 -4
index c30ae05b3349..24a98f4e1f44 100644
@@ -496,14 +496,11 @@ static void dpu_encoder_phys_cmd_enable_helper(
 	_dpu_encoder_phys_cmd_pingpong_config(phys_enc);
 
 	if (!dpu_encoder_phys_cmd_is_master(phys_enc))
-		goto skip_flush;
+		return;
 
 	ctl = phys_enc->hw_ctl;
 	ctl->ops.get_bitmask_intf(ctl, &flush_mask, phys_enc->intf_idx);
 	ctl->ops.update_pending_flush(ctl, flush_mask);
-
-skip_flush:
-	return;
 }
 
 static void dpu_encoder_phys_cmd_enable(struct dpu_encoder_phys

*phys_enc)

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +1 -2
@@ -797,7 +794,7 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
 	if (!cmd_enc) {
 		ret = -ENOMEM;
 		DPU_ERROR("failed to allocate\n");
-		goto fail;
+		return ERR_PTR(ret);
 	}
 	phys_enc = &cmd_enc->base;
 	phys_enc->hw_mdptop = p->dpu_kms->hw_mdp;
@@ -855,6 +852,5 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
 
 	return phys_enc;
 
-fail:
 	return ERR_PTR(ret);
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +2 -3
index bfcd165e96df..0aa9b8e1ae70 100644
@@ -921,7 +921,7 @@ static int _dpu_format_populate_addrs_ubwc(
 			+ layout->plane_size[2] + layout->plane_size[3];
 
 		if (!meta)
-			goto done;
+			return 0;
 
 		/* configure Y metadata plane */
 		layout->plane_addr[2] = base_addr;
@@ -952,12 +952,11 @@ static int _dpu_format_populate_addrs_ubwc(
 		layout->plane_addr[1] = 0;
 
 		if (!meta)
-			goto done;
+			return 0;
 
 		layout->plane_addr[2] = base_addr;
 		layout->plane_addr[3] = 0;
 	}
-done:
 	return 0;
 }
 
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +1 -2
index cc3a623903f4..52fca13da176 100644
@@ -177,7 +177,7 @@ static u32 dpu_hw_pp_get_line_count(struct
 dpu_hw_pingpong *pp)
 	height = DPU_REG_READ(c, PP_SYNC_CONFIG_HEIGHT) & 0xFFFF;
 
 	if (height < init)
-		goto line_count_exit;
+		return line;
 
 	line = DPU_REG_READ(c, PP_INT_COUNT_VAL) & 0xFFFF;
@@ -186,7 +186,6 @@ static u32 dpu_hw_pp_get_line_count(struct
 dpu_hw_pingpong *pp)
 	else
 		line -= init;
 
-line_count_exit:
 	return line;
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -4
index 0a683e65a9f3..d51992014e41 100644
@@ -979,20 +979,20 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 
 	if (!kms) {
 		DPU_ERROR("invalid kms\n");
-		goto end;
+		return rc;
 	}
 
 	dpu_kms = to_dpu_kms(kms);
 	dev = dpu_kms->dev;
 	if (!dev) {
 		DPU_ERROR("invalid device\n");
-		goto end;
+		return rc;
 	}
 
 	rc = dpu_dbg_init(&dpu_kms->pdev->dev);
 	if (rc) {
 		DRM_ERROR("failed to init dpu dbg: %d\n", rc);
-		goto end;
+		return rc;
 	}
 
 	priv = dev->dev_private;
@@ -1173,7 +1173,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 	_dpu_kms_hw_destroy(dpu_kms);
 dbg_destroy:
 	dpu_dbg_destroy();
-end:
 	return rc;
 }
 
@@ -1278,7 +1277,7 @@ static int __maybe_unused 

dpu_runtime_suspend(struct
device *dev)

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -1
 	ddev = dpu_kms->dev;
 	if (!ddev) {
 		DPU_ERROR("invalid drm_device\n");
-		goto exit;
+		return rc;
 	}
 
 	rc = dpu_power_resource_enable(&dpu_kms->phandle,
@@ -1290,7 +1289,6 @@ static int __maybe_unused 

dpu_runtime_suspend(struct
device *dev)

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +2 -3
 	if (rc)
 		DPU_ERROR("clock disable failed rc:%d\n", rc);
 
-exit:
 	return rc;
 }
@@ -1305,13 +1303,13 @@ static int __maybe_unused
 dpu_runtime_resume(struct device *dev)
 	ddev = dpu_kms->dev;
 	if (!ddev) {
 		DPU_ERROR("invalid drm_device\n");
-		goto exit;
+		return rc;
 	}
 
 	rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true);
 	if (rc) {
 		DPU_ERROR("clock enable failed rc:%d\n", rc);
-		goto exit;
+		return rc;
 	}
 
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -0
 	rc = dpu_power_resource_enable(&dpu_kms->phandle,
@@ -1319,7 +1317,6 @@ static int __maybe_unused 

dpu_runtime_resume(struct
device *dev)

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -1
 	if (rc)
 		DPU_ERROR("resource enable failed: %d\n", rc);
 
-exit:
 	return rc;
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1 -2
index 2b23b95f4a6f..1fa0ba0019ed 100644
@@ -432,13 +432,12 @@ int dpu_plane_danger_signal_ctrl(struct drm_plane
 *plane, bool enable)
 	pdpu = to_dpu_plane(plane);
 
 	if (!pdpu->is_rt_pipe)
-		goto end;
+		return 0;
 
 	pm_runtime_get_sync(&dpu_kms->pdev->dev);
 	_dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL);
 	pm_runtime_put_sync(&dpu_kms->pdev->dev);
 
-end:
 	return 0;
 }
@@ -1744,24 +1743,24 @@ struct drm_plane *dpu_plane_init(struct 

drm_device
*dev,

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +4 -4
 	if (!dev) {
 		DPU_ERROR("[%u]device is NULL\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	priv = dev->dev_private;
 	if (!priv) {
 		DPU_ERROR("[%u]private data is NULL\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	if (!priv->kms) {
 		DPU_ERROR("[%u]invalid KMS reference\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 	kms = to_dpu_kms(priv->kms);
 
 	if (!kms->catalog) {
 		DPU_ERROR("[%u]invalid catalog reference\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	/* create and zero local structure */
@@ -1769,7 +1768,7 @@ struct drm_plane *dpu_plane_init(struct 

drm_device
*dev,

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0 -0
 	if (!pdpu) {
 		DPU_ERROR("[%u]failed to allocate local plane struct\n",

pipe);

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1 -1
 		ret = -ENOMEM;
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	/* cache local stuff for later */
@@ -1855,6 +1854,5 @@ struct drm_plane *dpu_plane_init(struct 

drm_device
*dev,

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0 -1
 		dpu_hw_sspp_destroy(pdpu->pipe_hw);
 clean_plane:
 	kfree(pdpu);
-exit:
 	return ERR_PTR(ret);
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +1 -3
index 295528292296..ff5091d2555d 100644
@@ -191,7 +191,7 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms,
 	ot_lim = _dpu_vbif_get_ot_limit(vbif, params) & 0xFF;
 
 	if (ot_lim == 0)
-		goto exit;
+		return;
 
 	trace_dpu_perf_set_ot(params->num, params->xin_id, ot_lim,
 		params->vbif_idx);
@@ -210,8 +210,6 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms,
 
 	if (forced_on)
 		mdp->ops.setup_clk_force_ctrl(mdp, params->clk_ctrl,
 false);
-exit:
-	return;
 }
 

void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms,

Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): f27fd1ba508b4b3efdd17b31971d37c7-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org

Reviewed-by
#18 lore raw

Re: [PATCH 5/6] drm/msm: dpu: Remove empty/useless labels

Quoted 30 lines · Jeykumar Sankaran
Quoted 29 lines · Sean Paul

From: Sean Paul <[email protected]>

I noticed an empty label while driving by and decided to use coccinelle to see if there were any more. Here's the spatch and the invocation:

---

@@
identifier lbl;
expression E;
@@

- goto lbl;
+ return E;
...
- lbl:

	return E;

@@
identifier lbl;
@@

- goto lbl;
+ return;
...
- lbl:

(quoted diff) +0 -1
-	return;
Quoted 6 lines
Quoted 6 lines

---
spatch --allow-inconsistent-paths --sp-file file.spatch --dir drivers/gpu/drm/msm/disp/dpu1 --in-place
---

Quoted 21 lines
Quoted 21 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c     |  5 ++---
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  |  8 ++------
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c       |  5 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c   |  3 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c           | 15 
++++++---------
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c         | 14 ++++++--------
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c          |  4 +---
 7 files changed, 20 insertions(+), 34 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +0 -0
index 41c5191f9056..affc9738e2b5 100644
@@ -68,7 +68,7 @@ static bool 

_dpu_core_video_mode_intf_connected(struct
drm_crtc *crtc)
bool intf_connected = false;

Quoted 4 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c static bool _dpu_core_video_mode_intf_connected(struct drm_crtc *crtc) · line 71

Quoted 3 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +1 -1
 	if (!crtc)
-		goto end;
+		return intf_connected;

This can be further cleaned up by removing this intermediate var.

Nevermind. Just checked patch 6/6.

Quoted 296 lines
Quoted 296 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +0 -0
 	drm_for_each_crtc(tmp_crtc, crtc->dev) {
 		if ((dpu_crtc_get_intf_mode(tmp_crtc) == INTF_MODE_VIDEO)

&&

drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +0 -0
@@ -76,11 +76,10 @@ static bool 

_dpu_core_video_mode_intf_connected(struct
drm_crtc *crtc)

drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +1 -2
 			DPU_DEBUG("video interface connected crtc:%d\n",
 				tmp_crtc->base.id);
 			intf_connected = true;
-			goto end;
+			return intf_connected;
 		}
 	}
 
-end:
 	return intf_connected;
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +1 -4
index c30ae05b3349..24a98f4e1f44 100644
@@ -496,14 +496,11 @@ static void dpu_encoder_phys_cmd_enable_helper(
 	_dpu_encoder_phys_cmd_pingpong_config(phys_enc);
 
 	if (!dpu_encoder_phys_cmd_is_master(phys_enc))
-		goto skip_flush;
+		return;
 
 	ctl = phys_enc->hw_ctl;
 	ctl->ops.get_bitmask_intf(ctl, &flush_mask, phys_enc->intf_idx);
 	ctl->ops.update_pending_flush(ctl, flush_mask);
-
-skip_flush:
-	return;
 }
 
 static void dpu_encoder_phys_cmd_enable(struct dpu_encoder_phys

*phys_enc)

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +1 -1
@@ -797,7 +794,7 @@ struct dpu_encoder_phys 
 *dpu_encoder_phys_cmd_init(
 	if (!cmd_enc) {
 		ret = -ENOMEM;
 		DPU_ERROR("failed to allocate\n");
-		goto fail;
+		return ERR_PTR(ret);
 	}
 	phys_enc = &cmd_enc->base;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -1
 	phys_enc->hw_mdptop = p->dpu_kms->hw_mdp;
@@ -855,6 +852,5 @@ struct dpu_encoder_phys 
 *dpu_encoder_phys_cmd_init(
 
 	return phys_enc;
 
-fail:
 	return ERR_PTR(ret);

}

drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +2 -3
index bfcd165e96df..0aa9b8e1ae70 100644
@@ -921,7 +921,7 @@ static int _dpu_format_populate_addrs_ubwc(
 			+ layout->plane_size[2] + layout->plane_size[3];
 
 		if (!meta)
-			goto done;
+			return 0;
 
 		/* configure Y metadata plane */
 		layout->plane_addr[2] = base_addr;
@@ -952,12 +952,11 @@ static int _dpu_format_populate_addrs_ubwc(
 		layout->plane_addr[1] = 0;
 
 		if (!meta)
-			goto done;
+			return 0;
 
 		layout->plane_addr[2] = base_addr;
 		layout->plane_addr[3] = 0;
 	}
-done:
 	return 0;
 }
 
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +1 -2
index cc3a623903f4..52fca13da176 100644
@@ -177,7 +177,7 @@ static u32 dpu_hw_pp_get_line_count(struct
 dpu_hw_pingpong *pp)
 	height = DPU_REG_READ(c, PP_SYNC_CONFIG_HEIGHT) & 0xFFFF;
 
 	if (height < init)
-		goto line_count_exit;
+		return line;
 
 	line = DPU_REG_READ(c, PP_INT_COUNT_VAL) & 0xFFFF;
@@ -186,7 +186,6 @@ static u32 dpu_hw_pp_get_line_count(struct
 dpu_hw_pingpong *pp)
 	else
 		line -= init;
 
-line_count_exit:
 	return line;
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -4
index 0a683e65a9f3..d51992014e41 100644
@@ -979,20 +979,20 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 
 	if (!kms) {
 		DPU_ERROR("invalid kms\n");
-		goto end;
+		return rc;
 	}
 
 	dpu_kms = to_dpu_kms(kms);
 	dev = dpu_kms->dev;
 	if (!dev) {
 		DPU_ERROR("invalid device\n");
-		goto end;
+		return rc;
 	}
 
 	rc = dpu_dbg_init(&dpu_kms->pdev->dev);
 	if (rc) {
 		DRM_ERROR("failed to init dpu dbg: %d\n", rc);
-		goto end;
+		return rc;
 	}
 
 	priv = dev->dev_private;
@@ -1173,7 +1173,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 	_dpu_kms_hw_destroy(dpu_kms);
 dbg_destroy:
 	dpu_dbg_destroy();
-end:
 	return rc;
 }
 
@@ -1278,7 +1277,7 @@ static int __maybe_unused 

dpu_runtime_suspend(struct
device *dev)

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -1
 	ddev = dpu_kms->dev;
 	if (!ddev) {
 		DPU_ERROR("invalid drm_device\n");
-		goto exit;
+		return rc;
 	}
 
 	rc = dpu_power_resource_enable(&dpu_kms->phandle,
@@ -1290,7 +1289,6 @@ static int __maybe_unused 

dpu_runtime_suspend(struct
device *dev)

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +2 -3
 	if (rc)
 		DPU_ERROR("clock disable failed rc:%d\n", rc);
 
-exit:
 	return rc;
 }
@@ -1305,13 +1303,13 @@ static int __maybe_unused
 dpu_runtime_resume(struct device *dev)
 	ddev = dpu_kms->dev;
 	if (!ddev) {
 		DPU_ERROR("invalid drm_device\n");
-		goto exit;
+		return rc;
 	}
 
 	rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true);
 	if (rc) {
 		DPU_ERROR("clock enable failed rc:%d\n", rc);
-		goto exit;
+		return rc;
 	}
 
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -0
 	rc = dpu_power_resource_enable(&dpu_kms->phandle,
@@ -1319,7 +1317,6 @@ static int __maybe_unused 

dpu_runtime_resume(struct
device *dev)

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -1
 	if (rc)
 		DPU_ERROR("resource enable failed: %d\n", rc);
 
-exit:
 	return rc;
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0 -0
index 2b23b95f4a6f..1fa0ba0019ed 100644
@@ -432,13 +432,12 @@ int dpu_plane_danger_signal_ctrl(struct 

drm_plane
*plane, bool enable)

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1 -2
 	pdpu = to_dpu_plane(plane);
 
 	if (!pdpu->is_rt_pipe)
-		goto end;
+		return 0;
 
 	pm_runtime_get_sync(&dpu_kms->pdev->dev);
 	_dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL);
 	pm_runtime_put_sync(&dpu_kms->pdev->dev);
 
-end:
 	return 0;
 }
@@ -1744,24 +1743,24 @@ struct drm_plane *dpu_plane_init(struct 

drm_device
*dev,

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +4 -4
 	if (!dev) {
 		DPU_ERROR("[%u]device is NULL\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	priv = dev->dev_private;
 	if (!priv) {
 		DPU_ERROR("[%u]private data is NULL\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	if (!priv->kms) {
 		DPU_ERROR("[%u]invalid KMS reference\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 	kms = to_dpu_kms(priv->kms);
 
 	if (!kms->catalog) {
 		DPU_ERROR("[%u]invalid catalog reference\n", pipe);
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	/* create and zero local structure */
@@ -1769,7 +1768,7 @@ struct drm_plane *dpu_plane_init(struct 

drm_device
*dev,

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0 -0
 	if (!pdpu) {
 		DPU_ERROR("[%u]failed to allocate local plane struct\n",

pipe);

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +1 -1
 		ret = -ENOMEM;
-		goto exit;
+		return ERR_PTR(ret);
 	}
 
 	/* cache local stuff for later */
@@ -1855,6 +1854,5 @@ struct drm_plane *dpu_plane_init(struct 

drm_device
*dev,

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +0 -1
 		dpu_hw_sspp_destroy(pdpu->pipe_hw);
 clean_plane:
 	kfree(pdpu);
-exit:
 	return ERR_PTR(ret);
 }
drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +1 -1
index 295528292296..ff5091d2555d 100644
@@ -191,7 +191,7 @@ void dpu_vbif_set_ot_limit(struct dpu_kms 
 *dpu_kms,
 	ot_lim = _dpu_vbif_get_ot_limit(vbif, params) & 0xFF;
 
 	if (ot_lim == 0)
-		goto exit;
+		return;
 
 	trace_dpu_perf_set_ot(params->num, params->xin_id, ot_lim,
drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +0 -2
 		params->vbif_idx);
@@ -210,8 +210,6 @@ void dpu_vbif_set_ot_limit(struct dpu_kms 
 *dpu_kms,
 
 	if (forced_on)
 		mdp->ops.setup_clk_force_ctrl(mdp, params->clk_ctrl,
 false);
-exit:
-	return;
 }

void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms,

Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#19 lore raw

PATCH 6/6 drm/msm: dpu: Clean up _dpu_core_video_mode_intf_connected()

In reply to a message not in the archive

From: Sean Paul <[email protected]>

Local variable is not needed and condition can't be hit.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +2 -7
index affc9738e2b5..22e84b3d7f98 100644
@@ -65,22 +65,17 @@ static bool _dpu_core_perf_crtc_is_power_on(struct drm_crtc *crtc)
 static bool _dpu_core_video_mode_intf_connected(struct drm_crtc *crtc)
 {
 	struct drm_crtc *tmp_crtc;
-	bool intf_connected = false;
-
-	if (!crtc)
-		return intf_connected;
 
 	drm_for_each_crtc(tmp_crtc, crtc->dev) {
 		if ((dpu_crtc_get_intf_mode(tmp_crtc) == INTF_MODE_VIDEO) &&
 				_dpu_core_perf_crtc_is_power_on(tmp_crtc)) {
 			DPU_DEBUG("video interface connected crtc:%d\n",
 				tmp_crtc->base.id);
-			intf_connected = true;
-			return intf_connected;
+			return true;
 		}
 	}
 
-	return intf_connected;
+	return false;
 }
 
 static void _dpu_core_perf_calc_crtc(struct dpu_kms *kms,
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180920145818.32468-7-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org

Reviewed-by
#21 lore raw

Re: [PATCH 6/6] drm/msm: dpu: Clean up _dpu_core_video_mode_intf_connected()

Quoted 5 lines · Sean Paul

From: Sean Paul <[email protected]>

Local variable is not needed and condition can't be hit.

Quoted 37 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +0 -4
index affc9738e2b5..22e84b3d7f98 100644
@@ -65,22 +65,17 @@ static bool _dpu_core_perf_crtc_is_power_on(struct
 drm_crtc *crtc)
 static bool _dpu_core_video_mode_intf_connected(struct drm_crtc *crtc)
 {
 	struct drm_crtc *tmp_crtc;
-	bool intf_connected = false;
-
-	if (!crtc)
-		return intf_connected;
 
 	drm_for_each_crtc(tmp_crtc, crtc->dev) {
 		if ((dpu_crtc_get_intf_mode(tmp_crtc) == INTF_MODE_VIDEO)

&&
_dpu_core_perf_crtc_is_power_on(tmp_crtc))
{

drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +2 -3
 			DPU_DEBUG("video interface connected crtc:%d\n",
 				tmp_crtc->base.id);
-			intf_connected = true;
-			return intf_connected;
+			return true;
 		}
 	}
 
-	return intf_connected;
+	return false;
 }
 
 static void _dpu_core_perf_calc_crtc(struct dpu_kms *kms,
Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno