drm/i915: Clean up display pipe register accesses
Subsystems (2)
PATCH 1/1 drm/i915: Clean up display pipe register accesses
RFCv2: Reorganize array indexing so that full offsets can be used as is. It makes grepping for registers in i915_reg.h much easier. Also move offset arrays to intel_device_info.
PATCHv1: Fixed offsets for VLV
Upcoming hardware will not have the various display pipe register ranges evenly spaced in memory. Change register address calculations into array lookups.
Tested on SandyBridge and Valleyview
I left the UMS cruft untouched.
--- drivers/gpu/drm/i915/i915_drv.c | 36 +++++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 9 +++- drivers/gpu/drm/i915/i915_reg.h | 98 +++++++++++++++++++++++++++++------------ 3 files changed, 114 insertions(+), 29 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +36 -0
@@ -156,16 +156,27 @@ MODULE_PARM_DESC(prefault_disable,static struct drm_driver driver; +#define GEN_DEFAULT_PIPEOFFSETS \ + .pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, PIPE_C_OFFSET }, \ + .trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \ + TRANSCODER_C_OFFSET, TRANSCODER_EDP_OFFSET }, \ + .dpll_offsets = { DPLL_A_OFFSET, DPLL_B_OFFSET }, \ + .dpll_md_offsets = { DPLL_A_MD_OFFSET, DPLL_B_MD_OFFSET }, \ + .palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET }, + +static const struct intel_device_info intel_i830_info = { .gen =2 , .is_mobile =1 , .cursor_needs_physical =1 , .num_pipes =2 , .has_overlay =1 , .overlay_needs_physical =1 , .ring_mask =RENDER_RING , +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_845g_info = { .gen =2 , .num_pipes =1 , .has_overlay =1 , .overlay_needs_physical =1 , .ring_mask =RENDER_RING , +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_i85x_info = {
@@ -174,18 +185,21 @@ static const struct intel_device_info intel_i85x_info = { .has_overlay = 1, .overlay_needs_physical = 1, .has_fbc = 1, .ring_mask = RENDER_RING, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_i865g_info = { .gen =2 , .num_pipes =1 , .has_overlay =1 , .overlay_needs_physical =1 , .ring_mask =RENDER_RING , +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_i915g_info = { .gen =3 , .is_i915g =1 , .cursor_needs_physical =1 , .num_pipes =2 , .has_overlay =1 , .overlay_needs_physical =1 , .ring_mask =RENDER_RING , +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_i915gm_info = { .gen =3 , .is_mobile =1 , .num_pipes =2 ,
@@ -194,11 +208,13 @@ static const struct intel_device_info intel_i915gm_info = { .supports_tv = 1, .has_fbc = 1, .ring_mask = RENDER_RING, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_i945g_info = { .gen =3 , .has_hotplug =1 , .cursor_needs_physical =1 , .num_pipes =2 , .has_overlay =1 , .overlay_needs_physical =1 , .ring_mask =RENDER_RING , +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_i945gm_info = { .gen =3 , .is_i945gm =1 , .is_mobile =1 , .num_pipes =2 ,
@@ -207,6 +223,7 @@ static const struct intel_device_info intel_i945gm_info = { .supports_tv = 1, .has_fbc = 1, .ring_mask = RENDER_RING, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_i965g_info = {
@@ -214,6 +231,7 @@ static const struct intel_device_info intel_i965g_info = { .has_hotplug = 1, .has_overlay = 1, .ring_mask = RENDER_RING, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_i965gm_info = {
@@ -222,6 +240,7 @@ static const struct intel_device_info intel_i965gm_info = { .has_overlay = 1, .supports_tv = 1, .ring_mask = RENDER_RING, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_g33_info = {
@@ -229,12 +248,14 @@ static const struct intel_device_info intel_g33_info = { .need_gfx_hws = 1, .has_hotplug = 1, .has_overlay = 1, .ring_mask = RENDER_RING, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_g45_info = { .gen =4 , .is_g4x =1 , .need_gfx_hws =1 , .num_pipes =2 , .has_pipe_cxsr =1 , .has_hotplug =1 , .ring_mask =RENDER_RING |BSD_RING , +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_gm45_info = {
@@ -243,18 +264,21 @@ static const struct intel_device_info intel_gm45_info = { .has_pipe_cxsr = 1, .has_hotplug = 1, .supports_tv = 1, .ring_mask = RENDER_RING | BSD_RING, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_pineview_info = { .gen =3 , .is_g33 =1 , .is_pineview =1 , .is_mobile =1 , .num_pipes =2 , .need_gfx_hws =1 , .has_hotplug =1 , .has_overlay =1 , +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_ironlake_d_info = { .gen =5 , .num_pipes =2 , .need_gfx_hws =1 , .has_hotplug =1 , .ring_mask =RENDER_RING |BSD_RING , +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_ironlake_m_info = {
@@ -262,6 +286,7 @@ static const struct intel_device_info intel_ironlake_m_info = { .need_gfx_hws = 1, .has_hotplug = 1, .has_fbc = 1, .ring_mask = RENDER_RING | BSD_RING, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_sandybridge_d_info = {
@@ -270,6 +295,7 @@ static const struct intel_device_info intel_sandybridge_d_info = { .has_fbc = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING, .has_llc = 1, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_sandybridge_m_info = {
@@ -278,6 +304,7 @@ static const struct intel_device_info intel_sandybridge_m_info = { .has_fbc = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING, .has_llc = 1, + GEN_DEFAULT_PIPEOFFSETS };#define GEN7_FEATURES \
@@ -290,18 +317,21 @@ static const struct intel_device_info intel_sandybridge_m_info = {static const struct intel_device_info intel_ivybridge_d_info = {GEN7_FEATURES , .is_ivybridge =1 , +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_ivybridge_m_info = {GEN7_FEATURES , .is_ivybridge =1 , .is_mobile =1 , +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_ivybridge_q_info = {GEN7_FEATURES , .is_ivybridge =1 , .num_pipes =0 ,/* legal, last one wins */ +GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_valleyview_m_info = {
@@ -312,6 +342,7 @@ static const struct intel_device_info intel_valleyview_m_info = { .display_mmio_offset = VLV_DISPLAY_BASE, .has_fbc = 0, /* legal, last one wins */ .has_llc = 0, /* legal, last one wins */ + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_valleyview_d_info = {
@@ -321,6 +352,7 @@ static const struct intel_device_info intel_valleyview_d_info = { .display_mmio_offset = VLV_DISPLAY_BASE, .has_fbc = 0, /* legal, last one wins */ .has_llc = 0, /* legal, last one wins */ + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_haswell_d_info = {
@@ -329,6 +361,7 @@ static const struct intel_device_info intel_haswell_d_info = { .has_ddi = 1, .has_fpga_dbg = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_haswell_m_info = {
@@ -338,6 +371,7 @@ static const struct intel_device_info intel_haswell_m_info = { .has_ddi = 1, .has_fpga_dbg = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_broadwell_d_info = {
@@ -347,6 +381,7 @@ static const struct intel_device_info intel_broadwell_d_info = { .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .has_llc = 1, .has_ddi = 1, + GEN_DEFAULT_PIPEOFFSETS };static const struct intel_device_info intel_broadwell_m_info = {
@@ -356,6 +391,7 @@ static const struct intel_device_info intel_broadwell_m_info = { .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .has_llc = 1, .has_ddi = 1, + GEN_DEFAULT_PIPEOFFSETS };/*
drivers/gpu/drm/i915/i915_drv.h +8 -1
@@ -66,7 +66,8 @@ enum transcoder {TRANSCODER_A =0 ,TRANSCODER_B ,TRANSCODER_C , - TRANSCODER_EDP = 0xF, +TRANSCODER_EDP , + I915_MAX_TRANSCODERS };#define transcoder_name (t) ((t) + 'A')
@@ -506,6 +507,12 @@ struct intel_device_info {u8 gen;u8 ring_mask;/* Rings supported by the HW */ DEV_INFO_FOR_EACH_FLAG (DEFINE_FLAG ,SEP_SEMICOLON ); +/* Register offsets for the various display pipes */ +int pipe_offsets[I915_MAX_PIPES ]; +int trans_offsets[I915_MAX_TRANSCODERS ]; +int dpll_offsets[I915_MAX_PIPES ]; +int dpll_md_offsets[I915_MAX_PIPES ]; +int palette_offsets[I915_MAX_PIPES ]; };#undef DEFINE_FLAG
drivers/gpu/drm/i915/i915_reg.h +70 -28
170 lines not on this page · raw message
Signature · 1 line
1.8.1.5
Sorry, sent the wrong file. Ignore this one.
Signature · 1 line
- Antti
Quoted 11 lines · Antti Koskipaa
RFCv2: Reorganize array indexing so that full offsets can be used as is. It makes grepping for registers in
i915_reg.hmuch easier. Also move offset arrays tointel_device_info.PATCHv1: Fixed offsets for VLV
Upcoming hardware will not have the various display pipe register ranges evenly spaced in memory. Change register address calculations into array lookups.
Tested on SandyBridge and Valleyview
Please also report changes in object size. If we have people complaining that i915.ko is too big, it helps to point why.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 11 lines · Chris Wilson
Quoted 10 lines · Antti Koskipaa
RFCv2: Reorganize array indexing so that full offsets can be used as is. It makes grepping for registers in
i915_reg.hmuch easier. Also move offset arrays tointel_device_info.PATCHv1: Fixed offsets for VLV
Upcoming hardware will not have the various display pipe register ranges evenly spaced in memory. Change register address calculations into array lookups.
Quoted 5 lines
Quoted 1 line
Tested on SandyBridge and Valleyview
Please also report changes in object size. If we have people complaining that i915.ko is too big, it helps to point why.
-Chris
Do you want this to be reported in the commit message, or where?
bloat-o-meter says:
add/remove: 0/0 grow/shrink: 88/10 up/down: 3326/-518 (2808)
Signature · 1 line
- Antti
Quoted 12 lines · Antti Koskipää
Quoted 11 lines · Chris Wilson
Quoted 10 lines · Antti Koskipaa
RFCv2: Reorganize array indexing so that full offsets can be used as is. It makes grepping for registers in
i915_reg.hmuch easier. Also move offset arrays tointel_device_info.PATCHv1: Fixed offsets for VLV
Upcoming hardware will not have the various display pipe register ranges evenly spaced in memory. Change register address calculations into array lookups.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Tested on SandyBridge and Valleyview
Please also report changes in object size. If we have people complaining that i915.ko is too big, it helps to point why.
-ChrisDo you want this to be reported in the commit message, or where?
In the commit message.
Quoted 2 lines
bloat-o-meter says:
add/remove: 0/0 grow/shrink: 88/10 up/down: 3326/-518 (2808)
Just use size i915.ko, then we can see how much data and object expands individually.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
And subject is misleading, I don't call this a clean up. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre