Skip to content

Commit 6bf129d

Browse files
Damien Lespiaudanvet
authored andcommitted
drm/i915: Use an intermediate variable to avoid repeating ourselves
The code look slightly better this way and will ease the next commit, changing where we take the fb pointer from. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 5ba76c4 commit 6bf129d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/gpu/drm/i915/intel_display.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2371,6 +2371,7 @@ intel_alloc_plane_obj(struct intel_crtc *crtc,
23712371
struct drm_device *dev = crtc->base.dev;
23722372
struct drm_i915_gem_object *obj = NULL;
23732373
struct drm_mode_fb_cmd2 mode_cmd = { 0 };
2374+
struct drm_framebuffer *fb = crtc->base.primary->fb;
23742375
u32 base = plane_config->base;
23752376

23762377
if (plane_config->size == 0)
@@ -2383,16 +2384,16 @@ intel_alloc_plane_obj(struct intel_crtc *crtc,
23832384

23842385
obj->tiling_mode = plane_config->tiling;
23852386
if (obj->tiling_mode == I915_TILING_X)
2386-
obj->stride = crtc->base.primary->fb->pitches[0];
2387+
obj->stride = fb->pitches[0];
23872388

2388-
mode_cmd.pixel_format = crtc->base.primary->fb->pixel_format;
2389-
mode_cmd.width = crtc->base.primary->fb->width;
2390-
mode_cmd.height = crtc->base.primary->fb->height;
2391-
mode_cmd.pitches[0] = crtc->base.primary->fb->pitches[0];
2389+
mode_cmd.pixel_format = fb->pixel_format;
2390+
mode_cmd.width = fb->width;
2391+
mode_cmd.height = fb->height;
2392+
mode_cmd.pitches[0] = fb->pitches[0];
23922393

23932394
mutex_lock(&dev->struct_mutex);
23942395

2395-
if (intel_framebuffer_init(dev, to_intel_framebuffer(crtc->base.primary->fb),
2396+
if (intel_framebuffer_init(dev, to_intel_framebuffer(fb),
23962397
&mode_cmd, obj)) {
23972398
DRM_DEBUG_KMS("intel fb init failed\n");
23982399
goto out_unref_obj;

0 commit comments

Comments
 (0)