diff options
author | Dave Airlie <airlied@redhat.com> | 2016-05-03 01:31:12 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-05-22 21:20:36 -0400 |
commit | 5e546cd5b3bc76824069ffa98c52a5f48cf91aba (patch) | |
tree | 8901e795fdb1bec6097be2133e3bc106c2ba94be | |
parent | fcee59065e58498682c60069cc6fb90694bab27e (diff) |
drm/edid: move displayid tiled block parsing into separate function.
This just makes the code easier to follow.
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 110 |
1 files changed, 59 insertions, 51 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 96b181a881e2..4724596ebf53 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -4152,6 +4152,60 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, | |||
4152 | } | 4152 | } |
4153 | EXPORT_SYMBOL(drm_hdmi_vendor_infoframe_from_display_mode); | 4153 | EXPORT_SYMBOL(drm_hdmi_vendor_infoframe_from_display_mode); |
4154 | 4154 | ||
4155 | static int drm_parse_tiled_block(struct drm_connector *connector, | ||
4156 | struct displayid_block *block) | ||
4157 | { | ||
4158 | struct displayid_tiled_block *tile = (struct displayid_tiled_block *)block; | ||
4159 | u16 w, h; | ||
4160 | u8 tile_v_loc, tile_h_loc; | ||
4161 | u8 num_v_tile, num_h_tile; | ||
4162 | struct drm_tile_group *tg; | ||
4163 | |||
4164 | w = tile->tile_size[0] | tile->tile_size[1] << 8; | ||
4165 | h = tile->tile_size[2] | tile->tile_size[3] << 8; | ||
4166 | |||
4167 | num_v_tile = (tile->topo[0] & 0xf) | (tile->topo[2] & 0x30); | ||
4168 | num_h_tile = (tile->topo[0] >> 4) | ((tile->topo[2] >> 2) & 0x30); | ||
4169 | tile_v_loc = (tile->topo[1] & 0xf) | ((tile->topo[2] & 0x3) << 4); | ||
4170 | tile_h_loc = (tile->topo[1] >> 4) | (((tile->topo[2] >> 2) & 0x3) << 4); | ||
4171 | |||
4172 | connector->has_tile = true; | ||
4173 | if (tile->tile_cap & 0x80) | ||
4174 | connector->tile_is_single_monitor = true; | ||
4175 | |||
4176 | connector->num_h_tile = num_h_tile + 1; | ||
4177 | connector->num_v_tile = num_v_tile + 1; | ||
4178 | connector->tile_h_loc = tile_h_loc; | ||
4179 | connector->tile_v_loc = tile_v_loc; | ||
4180 | connector->tile_h_size = w + 1; | ||
4181 | connector->tile_v_size = h + 1; | ||
4182 | |||
4183 | DRM_DEBUG_KMS("tile cap 0x%x\n", tile->tile_cap); | ||
4184 | DRM_DEBUG_KMS("tile_size %d x %d\n", w + 1, h + 1); | ||
4185 | DRM_DEBUG_KMS("topo num tiles %dx%d, location %dx%d\n", | ||
4186 | num_h_tile + 1, num_v_tile + 1, tile_h_loc, tile_v_loc); | ||
4187 | DRM_DEBUG_KMS("vend %c%c%c\n", tile->topology_id[0], tile->topology_id[1], tile->topology_id[2]); | ||
4188 | |||
4189 | tg = drm_mode_get_tile_group(connector->dev, tile->topology_id); | ||
4190 | if (!tg) { | ||
4191 | tg = drm_mode_create_tile_group(connector->dev, tile->topology_id); | ||
4192 | } | ||
4193 | if (!tg) | ||
4194 | return -ENOMEM; | ||
4195 | |||
4196 | if (connector->tile_group != tg) { | ||
4197 | /* if we haven't got a pointer, | ||
4198 | take the reference, drop ref to old tile group */ | ||
4199 | if (connector->tile_group) { | ||
4200 | drm_mode_put_tile_group(connector->dev, connector->tile_group); | ||
4201 | } | ||
4202 | connector->tile_group = tg; | ||
4203 | } else | ||
4204 | /* if same tile group, then release the ref we just took. */ | ||
4205 | drm_mode_put_tile_group(connector->dev, tg); | ||
4206 | return 0; | ||
4207 | } | ||
4208 | |||
4155 | static int drm_parse_display_id(struct drm_connector *connector, | 4209 | static int drm_parse_display_id(struct drm_connector *connector, |
4156 | u8 *displayid, int length, | 4210 | u8 *displayid, int length, |
4157 | bool is_edid_extension) | 4211 | bool is_edid_extension) |
@@ -4162,6 +4216,7 @@ static int drm_parse_display_id(struct drm_connector *connector, | |||
4162 | struct displayid_block *block; | 4216 | struct displayid_block *block; |
4163 | u8 csum = 0; | 4217 | u8 csum = 0; |
4164 | int i; | 4218 | int i; |
4219 | int ret; | ||
4165 | 4220 | ||
4166 | if (is_edid_extension) | 4221 | if (is_edid_extension) |
4167 | idx = 1; | 4222 | idx = 1; |
@@ -4187,57 +4242,10 @@ static int drm_parse_display_id(struct drm_connector *connector, | |||
4187 | block->tag, block->rev, block->num_bytes); | 4242 | block->tag, block->rev, block->num_bytes); |
4188 | 4243 | ||
4189 | switch (block->tag) { | 4244 | switch (block->tag) { |
4190 | case DATA_BLOCK_TILED_DISPLAY: { | 4245 | case DATA_BLOCK_TILED_DISPLAY: |
4191 | struct displayid_tiled_block *tile = (struct displayid_tiled_block *)block; | 4246 | ret = drm_parse_tiled_block(connector, block); |
4192 | 4247 | if (ret) | |
4193 | u16 w, h; | 4248 | return ret; |
4194 | u8 tile_v_loc, tile_h_loc; | ||
4195 | u8 num_v_tile, num_h_tile; | ||
4196 | struct drm_tile_group *tg; | ||
4197 | |||
4198 | w = tile->tile_size[0] | tile->tile_size[1] << 8; | ||
4199 | h = tile->tile_size[2] | tile->tile_size[3] << 8; | ||
4200 | |||
4201 | num_v_tile = (tile->topo[0] & 0xf) | (tile->topo[2] & 0x30); | ||
4202 | num_h_tile = (tile->topo[0] >> 4) | ((tile->topo[2] >> 2) & 0x30); | ||
4203 | tile_v_loc = (tile->topo[1] & 0xf) | ((tile->topo[2] & 0x3) << 4); | ||
4204 | tile_h_loc = (tile->topo[1] >> 4) | (((tile->topo[2] >> 2) & 0x3) << 4); | ||
4205 | |||
4206 | connector->has_tile = true; | ||
4207 | if (tile->tile_cap & 0x80) | ||
4208 | connector->tile_is_single_monitor = true; | ||
4209 | |||
4210 | connector->num_h_tile = num_h_tile + 1; | ||
4211 | connector->num_v_tile = num_v_tile + 1; | ||
4212 | connector->tile_h_loc = tile_h_loc; | ||
4213 | connector->tile_v_loc = tile_v_loc; | ||
4214 | connector->tile_h_size = w + 1; | ||
4215 | connector->tile_v_size = h + 1; | ||
4216 | |||
4217 | DRM_DEBUG_KMS("tile cap 0x%x\n", tile->tile_cap); | ||
4218 | DRM_DEBUG_KMS("tile_size %d x %d\n", w + 1, h + 1); | ||
4219 | DRM_DEBUG_KMS("topo num tiles %dx%d, location %dx%d\n", | ||
4220 | num_h_tile + 1, num_v_tile + 1, tile_h_loc, tile_v_loc); | ||
4221 | DRM_DEBUG_KMS("vend %c%c%c\n", tile->topology_id[0], tile->topology_id[1], tile->topology_id[2]); | ||
4222 | |||
4223 | tg = drm_mode_get_tile_group(connector->dev, tile->topology_id); | ||
4224 | if (!tg) { | ||
4225 | tg = drm_mode_create_tile_group(connector->dev, tile->topology_id); | ||
4226 | } | ||
4227 | if (!tg) | ||
4228 | return -ENOMEM; | ||
4229 | |||
4230 | if (connector->tile_group != tg) { | ||
4231 | /* if we haven't got a pointer, | ||
4232 | take the reference, drop ref to old tile group */ | ||
4233 | if (connector->tile_group) { | ||
4234 | drm_mode_put_tile_group(connector->dev, connector->tile_group); | ||
4235 | } | ||
4236 | connector->tile_group = tg; | ||
4237 | } else | ||
4238 | /* if same tile group, then release the ref we just took. */ | ||
4239 | drm_mode_put_tile_group(connector->dev, tg); | ||
4240 | } | ||
4241 | break; | 4249 | break; |
4242 | default: | 4250 | default: |
4243 | printk("unknown displayid tag %d\n", block->tag); | 4251 | printk("unknown displayid tag %d\n", block->tag); |