* [RFC 1/3] drm/i915: Pass in plane state instead of plane to intel_plane_obj_offset
@ 2015-06-16 13:34 Tvrtko Ursulin
2015-06-16 13:34 ` [RFC 2/3] drm/i915: Cache display address in plane state Tvrtko Ursulin
2015-06-16 13:34 ` [RFC 3/3] drm/i915: Use intel_plane_obj_offset from more places Tvrtko Ursulin
0 siblings, 2 replies; 3+ messages in thread
From: Tvrtko Ursulin @ 2015-06-16 13:34 UTC (permalink / raw
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
We don't need the plane but just it's state and so it will be more
handy to pass it in directly.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 13 +++++++------
drivers/gpu/drm/i915/intel_drv.h | 6 ++++--
drivers/gpu/drm/i915/intel_sprite.c | 3 ++-
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index afe91a8..95a2375 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2897,12 +2897,13 @@ u32 intel_fb_stride_alignment(struct drm_device *dev, uint64_t fb_modifier,
}
}
-unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
- struct drm_i915_gem_object *obj)
+unsigned long
+intel_plane_obj_offset(struct intel_plane_state *intel_plane_state,
+ struct drm_i915_gem_object *obj)
{
const struct i915_ggtt_view *view = &i915_ggtt_view_normal;
- if (intel_rotation_90_or_270(intel_plane->base.state->rotation))
+ if (intel_rotation_90_or_270(intel_plane_state->base.rotation))
view = &i915_ggtt_view_rotated;
return i915_gem_obj_ggtt_offset_view(obj, view);
@@ -3063,7 +3064,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
obj = intel_fb_obj(fb);
stride_div = intel_fb_stride_alignment(dev, fb->modifier[0],
fb->pixel_format);
- surf_addr = intel_plane_obj_offset(to_intel_plane(plane), obj);
+ surf_addr = intel_plane_obj_offset(plane_state, obj);
/*
* FIXME: intel_plane_state->src, dst aren't set when transitional
@@ -11557,8 +11558,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
if (ret)
goto cleanup_pending;
- work->gtt_offset = intel_plane_obj_offset(to_intel_plane(primary), obj)
- + intel_crtc->dspaddr_offset;
+ work->gtt_offset = intel_plane_obj_offset(to_intel_plane_state(primary->state),
+ obj) + intel_crtc->dspaddr_offset;
if (mmio_flip) {
ret = intel_queue_mmio_flip(dev, crtc, fb, obj, ring,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index b28029a..5599f43 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1153,8 +1153,10 @@ int skl_update_scaler_users(struct intel_crtc *intel_crtc,
struct intel_plane_state *plane_state, int force_detach);
int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state);
-unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
- struct drm_i915_gem_object *obj);
+unsigned long
+intel_plane_obj_offset(struct intel_plane_state *intel_plane_state,
+ struct drm_i915_gem_object *obj);
+
u32 skl_plane_ctl_format(uint32_t pixel_format);
u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
u32 skl_plane_ctl_rotation(unsigned int rotation);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 8193a35..f123090 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -225,7 +225,8 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
else if (key->flags & I915_SET_COLORKEY_SOURCE)
plane_ctl |= PLANE_CTL_KEY_ENABLE_SOURCE;
- surf_addr = intel_plane_obj_offset(intel_plane, obj);
+ surf_addr = intel_plane_obj_offset(to_intel_plane_state(drm_plane->state),
+ obj);
if (intel_rotation_90_or_270(rotation)) {
/* stride: Surface height in tiles */
--
2.4.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC 2/3] drm/i915: Cache display address in plane state
2015-06-16 13:34 [RFC 1/3] drm/i915: Pass in plane state instead of plane to intel_plane_obj_offset Tvrtko Ursulin
@ 2015-06-16 13:34 ` Tvrtko Ursulin
2015-06-16 13:34 ` [RFC 3/3] drm/i915: Use intel_plane_obj_offset from more places Tvrtko Ursulin
1 sibling, 0 replies; 3+ messages in thread
From: Tvrtko Ursulin @ 2015-06-16 13:34 UTC (permalink / raw
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
There is no need to "recompute" it every time since it is guaranteed
to be static for the lifetime of a frame buffer being assigned to a
plane for display purposes.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++------
drivers/gpu/drm/i915/intel_drv.h | 6 ++++++
drivers/gpu/drm/i915/intel_sprite.c | 8 ++------
3 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 95a2375..182477f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2334,6 +2334,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
struct drm_device *dev = fb->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
+ struct intel_plane_state *intel_plane_state;
struct i915_ggtt_view view;
u32 alignment;
int ret;
@@ -2398,6 +2399,12 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
if (ret)
goto err_interruptible;
+ if (plane_state) {
+ intel_plane_state = to_intel_plane_state(plane_state);
+ intel_plane_state->disp_addr =
+ intel_plane_obj_offset(intel_plane_state, obj);
+ }
+
/* Install a fence for tiled scan-out. Pre-i965 always needs a
* fence, whereas 965+ only requires a fence if using
* framebuffer compression. For simplicity, we always install
@@ -3034,7 +3041,6 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
u32 tile_height, plane_offset, plane_size;
unsigned int rotation;
int x_offset, y_offset;
- unsigned long surf_addr;
struct intel_crtc_state *crtc_state = intel_crtc->config;
struct intel_plane_state *plane_state;
int src_x = 0, src_y = 0, src_w = 0, src_h = 0;
@@ -3064,7 +3070,6 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
obj = intel_fb_obj(fb);
stride_div = intel_fb_stride_alignment(dev, fb->modifier[0],
fb->pixel_format);
- surf_addr = intel_plane_obj_offset(plane_state, obj);
/*
* FIXME: intel_plane_state->src, dst aren't set when transitional
@@ -3124,7 +3129,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
I915_WRITE(PLANE_POS(pipe, 0), (dst_y << 16) | dst_x);
}
- I915_WRITE(PLANE_SURF(pipe, 0), surf_addr);
+ I915_WRITE(PLANE_SURF(pipe, 0), plane_state->disp_addr);
POSTING_READ(PLANE_SURF(pipe, 0));
}
@@ -11558,8 +11563,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
if (ret)
goto cleanup_pending;
- work->gtt_offset = intel_plane_obj_offset(to_intel_plane_state(primary->state),
- obj) + intel_crtc->dspaddr_offset;
+ work->gtt_offset = to_intel_plane_state(primary->state)->disp_addr +
+ intel_crtc->dspaddr_offset;
if (mmio_flip) {
ret = intel_queue_mmio_flip(dev, crtc, fb, obj, ring,
@@ -13990,7 +13995,7 @@ intel_commit_cursor_plane(struct drm_plane *plane,
if (!obj)
addr = 0;
else if (!INTEL_INFO(dev)->cursor_needs_physical)
- addr = i915_gem_obj_ggtt_offset(obj);
+ addr = state->disp_addr;
else
addr = obj->phys_handle->busaddr;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 5599f43..5e18a42 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -274,6 +274,12 @@ struct intel_plane_state {
* update_scaler_users.
*/
int scaler_id;
+
+ /*
+ * Cached display address at the time framebuffer is prepared for use
+ * on a plane.
+ */
+ unsigned long disp_addr;
};
struct intel_initial_plane_config {
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index f123090..fc9e797 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -177,13 +177,11 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
struct drm_device *dev = drm_plane->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_plane *intel_plane = to_intel_plane(drm_plane);
- struct drm_i915_gem_object *obj = intel_fb_obj(fb);
const int pipe = intel_plane->pipe;
const int plane = intel_plane->plane + 1;
u32 plane_ctl, stride_div, stride;
int pixel_size = drm_format_plane_cpp(fb->pixel_format, 0);
const struct drm_intel_sprite_colorkey *key = &intel_plane->ckey;
- unsigned long surf_addr;
u32 tile_height, plane_offset, plane_size;
unsigned int rotation;
int x_offset, y_offset;
@@ -225,9 +223,6 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
else if (key->flags & I915_SET_COLORKEY_SOURCE)
plane_ctl |= PLANE_CTL_KEY_ENABLE_SOURCE;
- surf_addr = intel_plane_obj_offset(to_intel_plane_state(drm_plane->state),
- obj);
-
if (intel_rotation_90_or_270(rotation)) {
/* stride: Surface height in tiles */
tile_height = intel_tile_height(dev, fb->pixel_format,
@@ -268,7 +263,8 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
}
I915_WRITE(PLANE_CTL(pipe, plane), plane_ctl);
- I915_WRITE(PLANE_SURF(pipe, plane), surf_addr);
+ I915_WRITE(PLANE_SURF(pipe, plane),
+ to_intel_plane_state(drm_plane->state)->disp_addr);
POSTING_READ(PLANE_SURF(pipe, plane));
}
--
2.4.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC 3/3] drm/i915: Use intel_plane_obj_offset from more places
2015-06-16 13:34 [RFC 1/3] drm/i915: Pass in plane state instead of plane to intel_plane_obj_offset Tvrtko Ursulin
2015-06-16 13:34 ` [RFC 2/3] drm/i915: Cache display address in plane state Tvrtko Ursulin
@ 2015-06-16 13:34 ` Tvrtko Ursulin
1 sibling, 0 replies; 3+ messages in thread
From: Tvrtko Ursulin @ 2015-06-16 13:34 UTC (permalink / raw
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
These are the display call sites so should use the proper helper.
Also requires intel_plane_obj_offset to assume normal view when
plane pointer is not available.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 6 ++++--
drivers/gpu/drm/i915/intel_fbdev.c | 9 +++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 182477f..92bb17a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2624,7 +2624,8 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
continue;
obj = intel_fb_obj(fb);
- if (i915_gem_obj_ggtt_offset(obj) == plane_config->base) {
+ if (intel_plane_obj_offset(to_intel_plane_state(c->primary->state),
+ obj) == plane_config->base) {
drm_framebuffer_reference(fb);
goto valid_fb;
}
@@ -2910,7 +2911,8 @@ intel_plane_obj_offset(struct intel_plane_state *intel_plane_state,
{
const struct i915_ggtt_view *view = &i915_ggtt_view_normal;
- if (intel_rotation_90_or_270(intel_plane_state->base.rotation))
+ if (intel_plane_state &&
+ intel_rotation_90_or_270(intel_plane_state->base.rotation))
view = &i915_ggtt_view_rotated;
return i915_gem_obj_ggtt_offset_view(obj, view);
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 6372cfc..6572840 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -206,6 +206,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
struct fb_info *info;
struct drm_framebuffer *fb;
struct drm_i915_gem_object *obj;
+ unsigned long disp_addr;
int size, ret;
bool prealloc = false;
@@ -269,12 +270,12 @@ static int intelfb_create(struct drm_fb_helper *helper,
info->apertures->ranges[0].base = dev->mode_config.fb_base;
info->apertures->ranges[0].size = dev_priv->gtt.mappable_end;
- info->fix.smem_start = dev->mode_config.fb_base + i915_gem_obj_ggtt_offset(obj);
+ disp_addr = intel_plane_obj_offset(NULL, obj);
+ info->fix.smem_start = dev->mode_config.fb_base + disp_addr;
info->fix.smem_len = size;
info->screen_base =
- ioremap_wc(dev_priv->gtt.mappable_base + i915_gem_obj_ggtt_offset(obj),
- size);
+ ioremap_wc(dev_priv->gtt.mappable_base + disp_addr, size);
if (!info->screen_base) {
ret = -ENOSPC;
goto out_unpin;
@@ -298,7 +299,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
DRM_DEBUG_KMS("allocated %dx%d fb: 0x%08lx, bo %p\n",
fb->width, fb->height,
- i915_gem_obj_ggtt_offset(obj), obj);
+ disp_addr, obj);
mutex_unlock(&dev->struct_mutex);
vga_switcheroo_client_fb_set(dev->pdev, info);
--
2.4.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-16 13:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-16 13:34 [RFC 1/3] drm/i915: Pass in plane state instead of plane to intel_plane_obj_offset Tvrtko Ursulin
2015-06-16 13:34 ` [RFC 2/3] drm/i915: Cache display address in plane state Tvrtko Ursulin
2015-06-16 13:34 ` [RFC 3/3] drm/i915: Use intel_plane_obj_offset from more places Tvrtko Ursulin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).