Skip to content

Commit 0138984

Browse files
committed
drm/i915: Plumb 'dsb' all way to the plane hooks
We need to be able to do both MMIO and DSB based pipe/plane programming. To that end plumb the 'dsb' all way from the top into the plane commit hooks. The compiler appears smart enough to combine the branches from all the back-to-back register writes into a single branch. So the generated asm ends up looking more or less like this: plane_hook() { if (dsb) { intel_dsb_reg_write(); intel_dsb_reg_write(); ... } else { intel_de_write_fw(); intel_de_write_fw(); ... } } which seems like a reasonably efficient way to do this. An alternative I was also considering is some kind of closure (register write function + display vs. dsb pointer passed to it). That does result is smaller code as there are no branches anymore, but having each register access go via function pointer sounds less efficient. Not that I actually measured the overhead of either approach yet. Also the reg_rw tracepoint seems to be making a huge mess of the generated code for the mmio path. And additionally there's some kind of IS_GSI_REG() hack in __raw_uncore_read() which ends up generating a pointless branch for every mmio register access. So looks like there might be quite a bit of room for improvement in the mmio path still. Reviewed-by: Animesh Manna <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent dd6ec89 commit 0138984

File tree

11 files changed

+334
-247
lines changed

11 files changed

+334
-247
lines changed

drivers/gpu/drm/i915/display/i9xx_plane.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ static int i9xx_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
416416
return DIV_ROUND_UP(pixel_rate * num, den);
417417
}
418418

419-
static void i9xx_plane_update_noarm(struct intel_plane *plane,
419+
static void i9xx_plane_update_noarm(struct intel_dsb *dsb,
420+
struct intel_plane *plane,
420421
const struct intel_crtc_state *crtc_state,
421422
const struct intel_plane_state *plane_state)
422423
{
@@ -444,7 +445,8 @@ static void i9xx_plane_update_noarm(struct intel_plane *plane,
444445
}
445446
}
446447

447-
static void i9xx_plane_update_arm(struct intel_plane *plane,
448+
static void i9xx_plane_update_arm(struct intel_dsb *dsb,
449+
struct intel_plane *plane,
448450
const struct intel_crtc_state *crtc_state,
449451
const struct intel_plane_state *plane_state)
450452
{
@@ -507,7 +509,8 @@ static void i9xx_plane_update_arm(struct intel_plane *plane,
507509
intel_plane_ggtt_offset(plane_state) + dspaddr_offset);
508510
}
509511

510-
static void i830_plane_update_arm(struct intel_plane *plane,
512+
static void i830_plane_update_arm(struct intel_dsb *dsb,
513+
struct intel_plane *plane,
511514
const struct intel_crtc_state *crtc_state,
512515
const struct intel_plane_state *plane_state)
513516
{
@@ -517,11 +520,12 @@ static void i830_plane_update_arm(struct intel_plane *plane,
517520
* Additional breakage on i830 causes register reads to return
518521
* the last latched value instead of the last written value [ALM026].
519522
*/
520-
i9xx_plane_update_noarm(plane, crtc_state, plane_state);
521-
i9xx_plane_update_arm(plane, crtc_state, plane_state);
523+
i9xx_plane_update_noarm(dsb, plane, crtc_state, plane_state);
524+
i9xx_plane_update_arm(dsb, plane, crtc_state, plane_state);
522525
}
523526

524-
static void i9xx_plane_disable_arm(struct intel_plane *plane,
527+
static void i9xx_plane_disable_arm(struct intel_dsb *dsb,
528+
struct intel_plane *plane,
525529
const struct intel_crtc_state *crtc_state)
526530
{
527531
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
@@ -549,7 +553,8 @@ static void i9xx_plane_disable_arm(struct intel_plane *plane,
549553
}
550554

551555
static void
552-
g4x_primary_async_flip(struct intel_plane *plane,
556+
g4x_primary_async_flip(struct intel_dsb *dsb,
557+
struct intel_plane *plane,
553558
const struct intel_crtc_state *crtc_state,
554559
const struct intel_plane_state *plane_state,
555560
bool async_flip)
@@ -569,7 +574,8 @@ g4x_primary_async_flip(struct intel_plane *plane,
569574
}
570575

571576
static void
572-
vlv_primary_async_flip(struct intel_plane *plane,
577+
vlv_primary_async_flip(struct intel_dsb *dsb,
578+
struct intel_plane *plane,
573579
const struct intel_crtc_state *crtc_state,
574580
const struct intel_plane_state *plane_state,
575581
bool async_flip)

drivers/gpu/drm/i915/display/intel_atomic_plane.c

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,8 @@ skl_next_plane_to_commit(struct intel_atomic_state *state,
774774
return NULL;
775775
}
776776

777-
void intel_plane_update_noarm(struct intel_plane *plane,
777+
void intel_plane_update_noarm(struct intel_dsb *dsb,
778+
struct intel_plane *plane,
778779
const struct intel_crtc_state *crtc_state,
779780
const struct intel_plane_state *plane_state)
780781
{
@@ -783,45 +784,49 @@ void intel_plane_update_noarm(struct intel_plane *plane,
783784
trace_intel_plane_update_noarm(plane, crtc);
784785

785786
if (plane->update_noarm)
786-
plane->update_noarm(plane, crtc_state, plane_state);
787+
plane->update_noarm(dsb, plane, crtc_state, plane_state);
787788
}
788789

789-
void intel_plane_async_flip(struct intel_plane *plane,
790+
void intel_plane_async_flip(struct intel_dsb *dsb,
791+
struct intel_plane *plane,
790792
const struct intel_crtc_state *crtc_state,
791793
const struct intel_plane_state *plane_state,
792794
bool async_flip)
793795
{
794796
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
795797

796798
trace_intel_plane_async_flip(plane, crtc, async_flip);
797-
plane->async_flip(plane, crtc_state, plane_state, async_flip);
799+
plane->async_flip(dsb, plane, crtc_state, plane_state, async_flip);
798800
}
799801

800-
void intel_plane_update_arm(struct intel_plane *plane,
802+
void intel_plane_update_arm(struct intel_dsb *dsb,
803+
struct intel_plane *plane,
801804
const struct intel_crtc_state *crtc_state,
802805
const struct intel_plane_state *plane_state)
803806
{
804807
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
805808

806809
if (crtc_state->do_async_flip && plane->async_flip) {
807-
intel_plane_async_flip(plane, crtc_state, plane_state, true);
810+
intel_plane_async_flip(dsb, plane, crtc_state, plane_state, true);
808811
return;
809812
}
810813

811814
trace_intel_plane_update_arm(plane, crtc);
812-
plane->update_arm(plane, crtc_state, plane_state);
815+
plane->update_arm(dsb, plane, crtc_state, plane_state);
813816
}
814817

815-
void intel_plane_disable_arm(struct intel_plane *plane,
818+
void intel_plane_disable_arm(struct intel_dsb *dsb,
819+
struct intel_plane *plane,
816820
const struct intel_crtc_state *crtc_state)
817821
{
818822
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
819823

820824
trace_intel_plane_disable_arm(plane, crtc);
821-
plane->disable_arm(plane, crtc_state);
825+
plane->disable_arm(dsb, plane, crtc_state);
822826
}
823827

824-
void intel_crtc_planes_update_noarm(struct intel_atomic_state *state,
828+
void intel_crtc_planes_update_noarm(struct intel_dsb *dsb,
829+
struct intel_atomic_state *state,
825830
struct intel_crtc *crtc)
826831
{
827832
struct intel_crtc_state *new_crtc_state =
@@ -846,11 +851,13 @@ void intel_crtc_planes_update_noarm(struct intel_atomic_state *state,
846851
/* TODO: for mailbox updates this should be skipped */
847852
if (new_plane_state->uapi.visible ||
848853
new_plane_state->planar_slave)
849-
intel_plane_update_noarm(plane, new_crtc_state, new_plane_state);
854+
intel_plane_update_noarm(dsb, plane,
855+
new_crtc_state, new_plane_state);
850856
}
851857
}
852858

853-
static void skl_crtc_planes_update_arm(struct intel_atomic_state *state,
859+
static void skl_crtc_planes_update_arm(struct intel_dsb *dsb,
860+
struct intel_atomic_state *state,
854861
struct intel_crtc *crtc)
855862
{
856863
struct intel_crtc_state *old_crtc_state =
@@ -877,13 +884,14 @@ static void skl_crtc_planes_update_arm(struct intel_atomic_state *state,
877884
*/
878885
if (new_plane_state->uapi.visible ||
879886
new_plane_state->planar_slave)
880-
intel_plane_update_arm(plane, new_crtc_state, new_plane_state);
887+
intel_plane_update_arm(dsb, plane, new_crtc_state, new_plane_state);
881888
else
882-
intel_plane_disable_arm(plane, new_crtc_state);
889+
intel_plane_disable_arm(dsb, plane, new_crtc_state);
883890
}
884891
}
885892

886-
static void i9xx_crtc_planes_update_arm(struct intel_atomic_state *state,
893+
static void i9xx_crtc_planes_update_arm(struct intel_dsb *dsb,
894+
struct intel_atomic_state *state,
887895
struct intel_crtc *crtc)
888896
{
889897
struct intel_crtc_state *new_crtc_state =
@@ -903,21 +911,22 @@ static void i9xx_crtc_planes_update_arm(struct intel_atomic_state *state,
903911
* would have to be called here as well.
904912
*/
905913
if (new_plane_state->uapi.visible)
906-
intel_plane_update_arm(plane, new_crtc_state, new_plane_state);
914+
intel_plane_update_arm(dsb, plane, new_crtc_state, new_plane_state);
907915
else
908-
intel_plane_disable_arm(plane, new_crtc_state);
916+
intel_plane_disable_arm(dsb, plane, new_crtc_state);
909917
}
910918
}
911919

912-
void intel_crtc_planes_update_arm(struct intel_atomic_state *state,
920+
void intel_crtc_planes_update_arm(struct intel_dsb *dsb,
921+
struct intel_atomic_state *state,
913922
struct intel_crtc *crtc)
914923
{
915924
struct drm_i915_private *i915 = to_i915(state->base.dev);
916925

917926
if (DISPLAY_VER(i915) >= 9)
918-
skl_crtc_planes_update_arm(state, crtc);
927+
skl_crtc_planes_update_arm(dsb, state, crtc);
919928
else
920-
i9xx_crtc_planes_update_arm(state, crtc);
929+
i9xx_crtc_planes_update_arm(dsb, state, crtc);
921930
}
922931

923932
int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,

drivers/gpu/drm/i915/display/intel_atomic_plane.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct drm_rect;
1414
struct intel_atomic_state;
1515
struct intel_crtc;
1616
struct intel_crtc_state;
17+
struct intel_dsb;
1718
struct intel_plane;
1819
struct intel_plane_state;
1920
enum plane_id;
@@ -32,26 +33,32 @@ void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
3233
struct intel_crtc *crtc);
3334
void intel_plane_copy_hw_state(struct intel_plane_state *plane_state,
3435
const struct intel_plane_state *from_plane_state);
35-
void intel_plane_async_flip(struct intel_plane *plane,
36+
void intel_plane_async_flip(struct intel_dsb *dsb,
37+
struct intel_plane *plane,
3638
const struct intel_crtc_state *crtc_state,
3739
const struct intel_plane_state *plane_state,
3840
bool async_flip);
39-
void intel_plane_update_noarm(struct intel_plane *plane,
41+
void intel_plane_update_noarm(struct intel_dsb *dsb,
42+
struct intel_plane *plane,
4043
const struct intel_crtc_state *crtc_state,
4144
const struct intel_plane_state *plane_state);
42-
void intel_plane_update_arm(struct intel_plane *plane,
45+
void intel_plane_update_arm(struct intel_dsb *dsb,
46+
struct intel_plane *plane,
4347
const struct intel_crtc_state *crtc_state,
4448
const struct intel_plane_state *plane_state);
45-
void intel_plane_disable_arm(struct intel_plane *plane,
49+
void intel_plane_disable_arm(struct intel_dsb *dsb,
50+
struct intel_plane *plane,
4651
const struct intel_crtc_state *crtc_state);
4752
struct intel_plane *intel_plane_alloc(void);
4853
void intel_plane_free(struct intel_plane *plane);
4954
struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
5055
void intel_plane_destroy_state(struct drm_plane *plane,
5156
struct drm_plane_state *state);
52-
void intel_crtc_planes_update_noarm(struct intel_atomic_state *state,
57+
void intel_crtc_planes_update_noarm(struct intel_dsb *dsb,
58+
struct intel_atomic_state *state,
5359
struct intel_crtc *crtc);
54-
void intel_crtc_planes_update_arm(struct intel_atomic_state *state,
60+
void intel_crtc_planes_update_arm(struct intel_dsb *dsbx,
61+
struct intel_atomic_state *state,
5562
struct intel_crtc *crtc);
5663
int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state,
5764
struct intel_crtc_state *crtc_state,

drivers/gpu/drm/i915/display/intel_color.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,7 @@ void intel_color_modeset(const struct intel_crtc_state *crtc_state)
19151915
struct intel_plane *plane = to_intel_plane(crtc->base.primary);
19161916

19171917
/* update DSPCNTR to configure gamma/csc for pipe bottom color */
1918-
plane->disable_arm(plane, crtc_state);
1918+
plane->disable_arm(NULL, plane, crtc_state);
19191919
}
19201920
}
19211921

0 commit comments

Comments
 (0)