Commit 88595ac9 authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: always preserve bios swizzling

Currently we only set preserve_bios_swizzling when the initial fb is
shared and totally miss the single-screen case. Fix this by
consolidating all the logic for both cases.

This seems to go back to when swizzle preservation was originally
merged in

commit d9ceb816
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Thu Oct 9 12:57:43 2014 -0700

    drm/i915: preserve swizzle settings if necessary v4

Cc: Kristian Høgsberg <hoegsberg@gmail.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
parent f6936e29
...@@ -2543,14 +2543,11 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc, ...@@ -2543,14 +2543,11 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
mode_cmd.flags = DRM_MODE_FB_MODIFIERS; mode_cmd.flags = DRM_MODE_FB_MODIFIERS;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
if (intel_framebuffer_init(dev, to_intel_framebuffer(fb), if (intel_framebuffer_init(dev, to_intel_framebuffer(fb),
&mode_cmd, obj)) { &mode_cmd, obj)) {
DRM_DEBUG_KMS("intel fb init failed\n"); DRM_DEBUG_KMS("intel fb init failed\n");
goto out_unref_obj; goto out_unref_obj;
} }
obj->frontbuffer_bits = INTEL_FRONTBUFFER_PRIMARY(crtc->pipe);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
DRM_DEBUG_KMS("initial plane fb obj %p\n", obj); DRM_DEBUG_KMS("initial plane fb obj %p\n", obj);
...@@ -2585,19 +2582,15 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, ...@@ -2585,19 +2582,15 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
struct drm_crtc *c; struct drm_crtc *c;
struct intel_crtc *i; struct intel_crtc *i;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
struct drm_plane *primary = intel_crtc->base.primary;
struct drm_framebuffer *fb;
if (!plane_config->fb) if (!plane_config->fb)
return; return;
if (intel_alloc_initial_plane_obj(intel_crtc, plane_config)) { if (intel_alloc_initial_plane_obj(intel_crtc, plane_config)) {
struct drm_plane *primary = intel_crtc->base.primary; fb = &plane_config->fb->base;
goto valid_fb;
primary->fb = &plane_config->fb->base;
primary->state->crtc = &intel_crtc->base;
primary->crtc = &intel_crtc->base;
update_state_fb(primary);
return;
} }
kfree(plane_config->fb); kfree(plane_config->fb);
...@@ -2615,25 +2608,29 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, ...@@ -2615,25 +2608,29 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
if (!i->active) if (!i->active)
continue; continue;
obj = intel_fb_obj(c->primary->fb); fb = c->primary->fb;
if (obj == NULL) if (!fb)
continue; continue;
obj = intel_fb_obj(fb);
if (i915_gem_obj_ggtt_offset(obj) == plane_config->base) { if (i915_gem_obj_ggtt_offset(obj) == plane_config->base) {
struct drm_plane *primary = intel_crtc->base.primary; drm_framebuffer_reference(fb);
goto valid_fb;
if (obj->tiling_mode != I915_TILING_NONE)
dev_priv->preserve_bios_swizzle = true;
drm_framebuffer_reference(c->primary->fb);
primary->fb = c->primary->fb;
primary->state->crtc = &intel_crtc->base;
primary->crtc = &intel_crtc->base;
update_state_fb(intel_crtc->base.primary);
obj->frontbuffer_bits |= INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe);
break;
} }
} }
return;
valid_fb:
obj = intel_fb_obj(fb);
if (obj->tiling_mode != I915_TILING_NONE)
dev_priv->preserve_bios_swizzle = true;
primary->fb = fb;
primary->state->crtc = &intel_crtc->base;
primary->crtc = &intel_crtc->base;
update_state_fb(primary);
obj->frontbuffer_bits |= INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe);
} }
static void i9xx_update_primary_plane(struct drm_crtc *crtc, static void i9xx_update_primary_plane(struct drm_crtc *crtc,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment