diff options
author | Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> | 2015-01-15 07:55:25 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-01-27 03:50:50 -0500 |
commit | 6e3c9717e079264d605ffa49183c1364d103166e (patch) | |
tree | 8c74583c54378b898b37278cdc9d31723e03e185 /drivers/gpu/drm/i915/intel_fbdev.c | |
parent | 681a8504a07cd4891c74bf59c40950674639cd47 (diff) |
drm/i915: Make intel_crtc->config a pointer
To match the semantics of drm_crtc->state, which this will eventually
become. The allocation of the memory for config will be fixed in a
followup patch. By adding the extra _config field to intel_crtc it was
possible to generate this entire patch with the cocci script below.
@@ @@
struct intel_crtc {
...
-struct intel_crtc_state config;
+struct intel_crtc_state _config;
+struct intel_crtc_state *config;
...
}
@@ struct intel_crtc *crtc; @@
-memset(&crtc->config, 0, sizeof(crtc->config));
+memset(crtc->config, 0, sizeof(*crtc->config));
@@ @@
__intel_set_mode(...) {
<...
-to_intel_crtc(crtc)->config = *pipe_config;
+(*(to_intel_crtc(crtc)->config)) = *pipe_config;
...>
}
@@ @@
intel_crtc_init(...) {
...
WARN_ON(drm_crtc_index(&intel_crtc->base) != intel_crtc->pipe);
+intel_crtc->config = &intel_crtc->_config;
return;
...
}
@@ struct intel_crtc *crtc; @@
-&crtc->config
+crtc->config
@@ struct intel_crtc *crtc; identifier member; @@
-crtc->config.member
+crtc->config->member
@@ expression E; @@
-&(to_intel_crtc(E)->config)
+to_intel_crtc(E)->config
@@ expression E; identifier member; @@
-to_intel_crtc(E)->config.member
+to_intel_crtc(E)->config->member
v2: Clarify manual changes by splitting them into another patch. (Matt)
Improve cocci script to generate even more of the changes. (Ander)
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_fbdev.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_fbdev.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 04d582b50364..3eea7ed84bb1 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c | |||
@@ -443,7 +443,7 @@ retry: | |||
443 | DRM_DEBUG_KMS("looking for current mode on connector %s\n", | 443 | DRM_DEBUG_KMS("looking for current mode on connector %s\n", |
444 | connector->name); | 444 | connector->name); |
445 | intel_mode_from_pipe_config(&encoder->crtc->hwmode, | 445 | intel_mode_from_pipe_config(&encoder->crtc->hwmode, |
446 | &to_intel_crtc(encoder->crtc)->config); | 446 | to_intel_crtc(encoder->crtc)->config); |
447 | modes[i] = &encoder->crtc->hwmode; | 447 | modes[i] = &encoder->crtc->hwmode; |
448 | } | 448 | } |
449 | crtcs[i] = new_crtc; | 449 | crtcs[i] = new_crtc; |
@@ -581,7 +581,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, | |||
581 | * pipe. Note we need to use the selected fb's pitch and bpp | 581 | * pipe. Note we need to use the selected fb's pitch and bpp |
582 | * rather than the current pipe's, since they differ. | 582 | * rather than the current pipe's, since they differ. |
583 | */ | 583 | */ |
584 | cur_size = intel_crtc->config.base.adjusted_mode.crtc_hdisplay; | 584 | cur_size = intel_crtc->config->base.adjusted_mode.crtc_hdisplay; |
585 | cur_size = cur_size * fb->base.bits_per_pixel / 8; | 585 | cur_size = cur_size * fb->base.bits_per_pixel / 8; |
586 | if (fb->base.pitches[0] < cur_size) { | 586 | if (fb->base.pitches[0] < cur_size) { |
587 | DRM_DEBUG_KMS("fb not wide enough for plane %c (%d vs %d)\n", | 587 | DRM_DEBUG_KMS("fb not wide enough for plane %c (%d vs %d)\n", |
@@ -592,13 +592,13 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, | |||
592 | break; | 592 | break; |
593 | } | 593 | } |
594 | 594 | ||
595 | cur_size = intel_crtc->config.base.adjusted_mode.crtc_vdisplay; | 595 | cur_size = intel_crtc->config->base.adjusted_mode.crtc_vdisplay; |
596 | cur_size = ALIGN(cur_size, plane_config->tiled ? (IS_GEN2(dev) ? 16 : 8) : 1); | 596 | cur_size = ALIGN(cur_size, plane_config->tiled ? (IS_GEN2(dev) ? 16 : 8) : 1); |
597 | cur_size *= fb->base.pitches[0]; | 597 | cur_size *= fb->base.pitches[0]; |
598 | DRM_DEBUG_KMS("pipe %c area: %dx%d, bpp: %d, size: %d\n", | 598 | DRM_DEBUG_KMS("pipe %c area: %dx%d, bpp: %d, size: %d\n", |
599 | pipe_name(intel_crtc->pipe), | 599 | pipe_name(intel_crtc->pipe), |
600 | intel_crtc->config.base.adjusted_mode.crtc_hdisplay, | 600 | intel_crtc->config->base.adjusted_mode.crtc_hdisplay, |
601 | intel_crtc->config.base.adjusted_mode.crtc_vdisplay, | 601 | intel_crtc->config->base.adjusted_mode.crtc_vdisplay, |
602 | fb->base.bits_per_pixel, | 602 | fb->base.bits_per_pixel, |
603 | cur_size); | 603 | cur_size); |
604 | 604 | ||