* [PATCH 01/13] squash! drm/i915: Improve how the memory for crtc state is allocated
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-20 3:57 ` [PATCH 02/13] drm/i915: Move rotation from intel_plane to intel_plane_state Matt Roper
` (11 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
Cc: Ander Conselvan de Oliveira <conselvan2@gmail.com>
---
drivers/gpu/drm/i915/intel_display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index d8b58d6..c5cbcd7 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8950,9 +8950,9 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)
kfree(work);
}
+ intel_crtc_set_state(intel_crtc, NULL);
drm_crtc_cleanup(crtc);
- intel_crtc_set_state(intel_crtc, NULL);
kfree(intel_crtc);
}
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 02/13] drm/i915: Move rotation from intel_plane to intel_plane_state
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
2015-01-20 3:57 ` [PATCH 01/13] squash! drm/i915: Improve how the memory for crtc state is allocated Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-21 10:03 ` Ander Conselvan de Oliveira
2015-01-20 3:57 ` [PATCH 03/13] drm/i915: Consolidate plane handler vtables Matt Roper
` (10 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
Runtime state that can be manipulated via properties should now go in
intel_plane_state instead so that it can be tracked as part of an atomic
transaction.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++++++------------
drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++-
drivers/gpu/drm/i915/intel_fbc.c | 4 +++-
drivers/gpu/drm/i915/intel_sprite.c | 33 ++++++++++++++++++++-------------
4 files changed, 56 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c5cbcd7..7863414 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2435,6 +2435,8 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
{
struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
+ struct intel_plane_state *state =
+ to_intel_plane_state(crtc->primary->state);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct drm_i915_gem_object *obj;
int plane = intel_crtc->plane;
@@ -2532,7 +2534,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
intel_crtc->dspaddr_offset = linear_offset;
}
- if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180)) {
+ if (state->rotation == BIT(DRM_ROTATE_180)) {
dspcntr |= DISPPLANE_ROTATE_180;
x += (intel_crtc->config->pipe_src_w - 1);
@@ -2568,6 +2570,8 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+ struct intel_plane_state *state =
+ to_intel_plane_state(crtc->primary->state);
struct drm_i915_gem_object *obj;
int plane = intel_crtc->plane;
unsigned long linear_offset;
@@ -2634,7 +2638,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
pixel_size,
fb->pitches[0]);
linear_offset -= intel_crtc->dspaddr_offset;
- if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180)) {
+ if (state->rotation == BIT(DRM_ROTATE_180)) {
dspcntr |= DISPPLANE_ROTATE_180;
if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
@@ -2673,6 +2677,8 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+ struct intel_plane_state *state =
+ to_intel_plane_state(crtc->primary->state);
struct intel_framebuffer *intel_fb;
struct drm_i915_gem_object *obj;
int pipe = intel_crtc->pipe;
@@ -2731,7 +2737,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
}
plane_ctl |= PLANE_CTL_PLANE_GAMMA_DISABLE;
- if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180))
+ if (state->rotation == BIT(DRM_ROTATE_180))
plane_ctl |= PLANE_CTL_ROTATE_180;
I915_WRITE(PLANE_CTL(pipe, 0), plane_ctl);
@@ -8216,6 +8222,8 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+ struct intel_plane_state *state =
+ to_intel_plane_state(crtc->cursor->state);
int pipe = intel_crtc->pipe;
uint32_t cntl;
@@ -8242,7 +8250,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
cntl |= CURSOR_PIPE_CSC_ENABLE;
}
- if (to_intel_plane(crtc->cursor)->rotation == BIT(DRM_ROTATE_180))
+ if (state->rotation == BIT(DRM_ROTATE_180))
cntl |= CURSOR_ROTATE_180;
if (intel_crtc->cursor_cntl != cntl) {
@@ -8265,6 +8273,8 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+ struct intel_plane_state *state =
+ to_intel_plane_state(crtc->cursor->state);
int pipe = intel_crtc->pipe;
int x = crtc->cursor_x;
int y = crtc->cursor_y;
@@ -8303,8 +8313,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
I915_WRITE(CURPOS(pipe), pos);
/* ILK+ do this automagically */
- if (HAS_GMCH_DISPLAY(dev) &&
- to_intel_plane(crtc->cursor)->rotation == BIT(DRM_ROTATE_180)) {
+ if (HAS_GMCH_DISPLAY(dev) && state->rotation == BIT(DRM_ROTATE_180)) {
base += (intel_crtc->cursor_height *
intel_crtc->cursor_width - 1) * 4;
}
@@ -11756,7 +11765,6 @@ intel_check_primary_plane(struct drm_plane *plane,
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_crtc *crtc = state->base.crtc;
struct intel_crtc *intel_crtc;
- struct intel_plane *intel_plane = to_intel_plane(plane);
struct drm_framebuffer *fb = state->base.fb;
struct drm_rect *dest = &state->dst;
struct drm_rect *src = &state->src;
@@ -11790,7 +11798,7 @@ intel_check_primary_plane(struct drm_plane *plane,
if (intel_crtc->primary_enabled &&
INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
dev_priv->fbc.plane == intel_crtc->plane &&
- intel_plane->rotation != BIT(DRM_ROTATE_0)) {
+ state->rotation != BIT(DRM_ROTATE_0)) {
intel_crtc->atomic.disable_fbc = true;
}
@@ -11974,6 +11982,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
int pipe)
{
struct intel_plane *primary;
+ struct intel_plane_state *state;
const uint32_t *intel_primary_formats;
int num_formats;
@@ -11986,12 +11995,13 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
kfree(primary);
return NULL;
}
+ state = to_intel_plane_state(primary->base.state);
primary->can_scale = false;
primary->max_downscale = 1;
primary->pipe = pipe;
primary->plane = pipe;
- primary->rotation = BIT(DRM_ROTATE_0);
+ state->rotation = BIT(DRM_ROTATE_0);
primary->check_plane = intel_check_primary_plane;
primary->commit_plane = intel_commit_primary_plane;
if (HAS_FBC(dev) && INTEL_INFO(dev)->gen < 4)
@@ -12019,7 +12029,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
if (dev->mode_config.rotation_property)
drm_object_attach_property(&primary->base.base,
dev->mode_config.rotation_property,
- primary->rotation);
+ state->rotation);
}
drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs);
@@ -12147,6 +12157,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
int pipe)
{
struct intel_plane *cursor;
+ struct intel_plane_state *state;
cursor = kzalloc(sizeof(*cursor), GFP_KERNEL);
if (cursor == NULL)
@@ -12157,12 +12168,13 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
kfree(cursor);
return NULL;
}
+ state = to_intel_plane_state(cursor->base.state);
cursor->can_scale = false;
cursor->max_downscale = 1;
cursor->pipe = pipe;
cursor->plane = pipe;
- cursor->rotation = BIT(DRM_ROTATE_0);
+ state->rotation = BIT(DRM_ROTATE_0);
cursor->check_plane = intel_check_cursor_plane;
cursor->commit_plane = intel_commit_cursor_plane;
@@ -12181,7 +12193,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
if (dev->mode_config.rotation_property)
drm_object_attach_property(&cursor->base.base,
dev->mode_config.rotation_property,
- cursor->rotation);
+ state->rotation);
}
drm_plane_helper_add(&cursor->base, &intel_plane_helper_funcs);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index c8c0b7f..918cce2 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -250,6 +250,9 @@ struct intel_plane_state {
struct drm_rect clip;
bool visible;
+ /* Intel-specific plane properties */
+ unsigned int rotation;
+
/*
* used only for sprite planes to determine when to implicitly
* enable/disable the primary plane
@@ -509,7 +512,6 @@ struct intel_plane {
struct drm_i915_gem_object *obj;
bool can_scale;
int max_downscale;
- unsigned int rotation;
/* Since we need to change the watermarks before/after
* enabling/disabling the planes, we need to store the parameters here
@@ -518,6 +520,12 @@ struct intel_plane {
*/
struct intel_plane_wm_parameters wm;
+ /*
+ * NOTE: Do not place new plane state fields here (e.g., when adding
+ * new plane properties). New runtime state should now be placed in
+ * the intel_plane_state structure and accessed via drm_plane->state.
+ */
+
void (*update_plane)(struct drm_plane *plane,
struct drm_crtc *crtc,
struct drm_framebuffer *fb,
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index 5b1d7c4..3e87454 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -496,6 +496,7 @@ void intel_fbc_update(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_crtc *crtc = NULL, *tmp_crtc;
struct intel_crtc *intel_crtc;
+ struct intel_plane_state *primary_state;
struct drm_framebuffer *fb;
struct drm_i915_gem_object *obj;
const struct drm_display_mode *adjusted_mode;
@@ -540,6 +541,7 @@ void intel_fbc_update(struct drm_device *dev)
}
intel_crtc = to_intel_crtc(crtc);
+ primary_state = to_intel_plane_state(crtc->primary->state);
fb = crtc->primary->fb;
obj = intel_fb_obj(fb);
adjusted_mode = &intel_crtc->config->base.adjusted_mode;
@@ -595,7 +597,7 @@ void intel_fbc_update(struct drm_device *dev)
goto out_disable;
}
if (INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
- to_intel_plane(crtc->primary)->rotation != BIT(DRM_ROTATE_0)) {
+ primary_state->rotation != BIT(DRM_ROTATE_0)) {
if (set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE))
DRM_DEBUG_KMS("Rotation unsupported, disabling\n");
goto out_disable;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 0a6094e..140c5b7 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -187,6 +187,8 @@ 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 intel_plane_state *state =
+ to_intel_plane_state(drm_plane->state);
const int pipe = intel_plane->pipe;
const int plane = intel_plane->plane + 1;
u32 plane_ctl, stride;
@@ -256,7 +258,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
default:
BUG();
}
- if (intel_plane->rotation == BIT(DRM_ROTATE_180))
+ if (state->rotation == BIT(DRM_ROTATE_180))
plane_ctl |= PLANE_CTL_ROTATE_180;
plane_ctl |= PLANE_CTL_ENABLE;
@@ -407,6 +409,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
struct drm_device *dev = dplane->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_plane *intel_plane = to_intel_plane(dplane);
+ struct intel_plane_state *state = to_intel_plane_state(dplane->state);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int pipe = intel_plane->pipe;
int plane = intel_plane->plane;
@@ -493,7 +496,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
fb->pitches[0]);
linear_offset -= sprsurf_offset;
- if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
+ if (state->rotation == BIT(DRM_ROTATE_180)) {
sprctl |= SP_ROTATE_180;
x += src_w;
@@ -608,6 +611,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
struct drm_device *dev = plane->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_plane *intel_plane = to_intel_plane(plane);
+ struct intel_plane_state *state = to_intel_plane_state(plane->state);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int pipe = intel_plane->pipe;
u32 sprctl, sprscale = 0;
@@ -684,7 +688,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
pixel_size, fb->pitches[0]);
linear_offset -= sprsurf_offset;
- if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
+ if (state->rotation == BIT(DRM_ROTATE_180)) {
sprctl |= SPRITE_ROTATE_180;
/* HSW and BDW does this automagically in hardware */
@@ -813,6 +817,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
struct drm_device *dev = plane->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_plane *intel_plane = to_intel_plane(plane);
+ struct intel_plane_state *state = to_intel_plane_state(plane->state);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int pipe = intel_plane->pipe;
unsigned long dvssurf_offset, linear_offset;
@@ -884,7 +889,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
pixel_size, fb->pitches[0]);
linear_offset -= dvssurf_offset;
- if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
+ if (state->rotation == BIT(DRM_ROTATE_180)) {
dvscntr |= DVS_ROTATE_180;
x += src_w;
@@ -1125,7 +1130,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
min_scale = intel_plane->can_scale ? 1 : (1 << 16);
drm_rect_rotate(src, fb->width << 16, fb->height << 16,
- intel_plane->rotation);
+ state->rotation);
hscale = drm_rect_calc_hscale_relaxed(src, dst, min_scale, max_scale);
BUG_ON(hscale < 0);
@@ -1166,7 +1171,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
drm_rect_height(dst) * vscale - drm_rect_height(src));
drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16,
- intel_plane->rotation);
+ state->rotation);
/* sanity check to make sure the src viewport wasn't enlarged */
WARN_ON(src->x1 < (int) state->base.src_x ||
@@ -1367,7 +1372,7 @@ int intel_plane_set_property(struct drm_plane *plane,
uint64_t val)
{
struct drm_device *dev = plane->dev;
- struct intel_plane *intel_plane = to_intel_plane(plane);
+ struct intel_plane_state *state = to_intel_plane_state(plane->state);
uint64_t old_val;
int ret = -ENOENT;
@@ -1376,14 +1381,14 @@ int intel_plane_set_property(struct drm_plane *plane,
if (hweight32(val & 0xf) != 1)
return -EINVAL;
- if (intel_plane->rotation == val)
+ if (state->rotation == val)
return 0;
- old_val = intel_plane->rotation;
- intel_plane->rotation = val;
+ old_val = state->rotation;
+ state->rotation = val;
ret = intel_plane_restore(plane);
if (ret)
- intel_plane->rotation = old_val;
+ state->rotation = old_val;
}
return ret;
@@ -1457,6 +1462,7 @@ int
intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
{
struct intel_plane *intel_plane;
+ struct intel_plane_state *state;
unsigned long possible_crtcs;
const uint32_t *plane_formats;
int num_plane_formats;
@@ -1475,6 +1481,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
kfree(intel_plane);
return -ENOMEM;
}
+ state = to_intel_plane_state(intel_plane->base.state);
switch (INTEL_INFO(dev)->gen) {
case 5:
@@ -1545,7 +1552,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
intel_plane->pipe = pipe;
intel_plane->plane = plane;
- intel_plane->rotation = BIT(DRM_ROTATE_0);
+ state->rotation = BIT(DRM_ROTATE_0);
intel_plane->check_plane = intel_check_sprite_plane;
intel_plane->commit_plane = intel_commit_sprite_plane;
possible_crtcs = (1 << pipe);
@@ -1567,7 +1574,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
if (dev->mode_config.rotation_property)
drm_object_attach_property(&intel_plane->base.base,
dev->mode_config.rotation_property,
- intel_plane->rotation);
+ state->rotation);
drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 02/13] drm/i915: Move rotation from intel_plane to intel_plane_state
2015-01-20 3:57 ` [PATCH 02/13] drm/i915: Move rotation from intel_plane to intel_plane_state Matt Roper
@ 2015-01-21 10:03 ` Ander Conselvan de Oliveira
0 siblings, 0 replies; 22+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-21 10:03 UTC (permalink / raw)
To: Matt Roper, intel-gfx
On 01/20/2015 05:57 AM, Matt Roper wrote:
> Runtime state that can be manipulated via properties should now go in
> intel_plane_state instead so that it can be tracked as part of an atomic
> transaction.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++++++------------
> drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++-
> drivers/gpu/drm/i915/intel_fbc.c | 4 +++-
> drivers/gpu/drm/i915/intel_sprite.c | 33 ++++++++++++++++++++-------------
> 4 files changed, 56 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index c5cbcd7..7863414 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2435,6 +2435,8 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
> {
> struct drm_device *dev = crtc->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> + struct intel_plane_state *state =
> + to_intel_plane_state(crtc->primary->state);
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> struct drm_i915_gem_object *obj;
> int plane = intel_crtc->plane;
> @@ -2532,7 +2534,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
> intel_crtc->dspaddr_offset = linear_offset;
> }
>
> - if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180)) {
> + if (state->rotation == BIT(DRM_ROTATE_180)) {
> dspcntr |= DISPPLANE_ROTATE_180;
>
> x += (intel_crtc->config->pipe_src_w - 1);
> @@ -2568,6 +2570,8 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
> struct drm_device *dev = crtc->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> + struct intel_plane_state *state =
> + to_intel_plane_state(crtc->primary->state);
> struct drm_i915_gem_object *obj;
> int plane = intel_crtc->plane;
> unsigned long linear_offset;
> @@ -2634,7 +2638,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
> pixel_size,
> fb->pitches[0]);
> linear_offset -= intel_crtc->dspaddr_offset;
> - if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180)) {
> + if (state->rotation == BIT(DRM_ROTATE_180)) {
> dspcntr |= DISPPLANE_ROTATE_180;
>
> if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
> @@ -2673,6 +2677,8 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
> struct drm_device *dev = crtc->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> + struct intel_plane_state *state =
> + to_intel_plane_state(crtc->primary->state);
> struct intel_framebuffer *intel_fb;
> struct drm_i915_gem_object *obj;
> int pipe = intel_crtc->pipe;
> @@ -2731,7 +2737,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
> }
>
> plane_ctl |= PLANE_CTL_PLANE_GAMMA_DISABLE;
> - if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180))
> + if (state->rotation == BIT(DRM_ROTATE_180))
> plane_ctl |= PLANE_CTL_ROTATE_180;
>
> I915_WRITE(PLANE_CTL(pipe, 0), plane_ctl);
> @@ -8216,6 +8222,8 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
> struct drm_device *dev = crtc->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> + struct intel_plane_state *state =
> + to_intel_plane_state(crtc->cursor->state);
> int pipe = intel_crtc->pipe;
> uint32_t cntl;
>
> @@ -8242,7 +8250,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
> cntl |= CURSOR_PIPE_CSC_ENABLE;
> }
>
> - if (to_intel_plane(crtc->cursor)->rotation == BIT(DRM_ROTATE_180))
> + if (state->rotation == BIT(DRM_ROTATE_180))
> cntl |= CURSOR_ROTATE_180;
>
> if (intel_crtc->cursor_cntl != cntl) {
> @@ -8265,6 +8273,8 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
> struct drm_device *dev = crtc->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> + struct intel_plane_state *state =
> + to_intel_plane_state(crtc->cursor->state);
> int pipe = intel_crtc->pipe;
> int x = crtc->cursor_x;
> int y = crtc->cursor_y;
> @@ -8303,8 +8313,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
> I915_WRITE(CURPOS(pipe), pos);
>
> /* ILK+ do this automagically */
> - if (HAS_GMCH_DISPLAY(dev) &&
> - to_intel_plane(crtc->cursor)->rotation == BIT(DRM_ROTATE_180)) {
> + if (HAS_GMCH_DISPLAY(dev) && state->rotation == BIT(DRM_ROTATE_180)) {
> base += (intel_crtc->cursor_height *
> intel_crtc->cursor_width - 1) * 4;
> }
> @@ -11756,7 +11765,6 @@ intel_check_primary_plane(struct drm_plane *plane,
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct drm_crtc *crtc = state->base.crtc;
> struct intel_crtc *intel_crtc;
> - struct intel_plane *intel_plane = to_intel_plane(plane);
> struct drm_framebuffer *fb = state->base.fb;
> struct drm_rect *dest = &state->dst;
> struct drm_rect *src = &state->src;
> @@ -11790,7 +11798,7 @@ intel_check_primary_plane(struct drm_plane *plane,
> if (intel_crtc->primary_enabled &&
> INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
> dev_priv->fbc.plane == intel_crtc->plane &&
> - intel_plane->rotation != BIT(DRM_ROTATE_0)) {
> + state->rotation != BIT(DRM_ROTATE_0)) {
> intel_crtc->atomic.disable_fbc = true;
> }
>
> @@ -11974,6 +11982,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
> int pipe)
> {
> struct intel_plane *primary;
> + struct intel_plane_state *state;
> const uint32_t *intel_primary_formats;
> int num_formats;
>
> @@ -11986,12 +11995,13 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
> kfree(primary);
> return NULL;
> }
> + state = to_intel_plane_state(primary->base.state);
>
> primary->can_scale = false;
> primary->max_downscale = 1;
> primary->pipe = pipe;
> primary->plane = pipe;
> - primary->rotation = BIT(DRM_ROTATE_0);
> + state->rotation = BIT(DRM_ROTATE_0);
I'm thinking it would be better to split the part of
intel_plane_duplicate_state() that allocates the state into a separate
function and do this there. That way there is a clear place to
initialize state default values like this.
Ander
> primary->check_plane = intel_check_primary_plane;
> primary->commit_plane = intel_commit_primary_plane;
> if (HAS_FBC(dev) && INTEL_INFO(dev)->gen < 4)
> @@ -12019,7 +12029,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
> if (dev->mode_config.rotation_property)
> drm_object_attach_property(&primary->base.base,
> dev->mode_config.rotation_property,
> - primary->rotation);
> + state->rotation);
> }
>
> drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs);
> @@ -12147,6 +12157,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
> int pipe)
> {
> struct intel_plane *cursor;
> + struct intel_plane_state *state;
>
> cursor = kzalloc(sizeof(*cursor), GFP_KERNEL);
> if (cursor == NULL)
> @@ -12157,12 +12168,13 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
> kfree(cursor);
> return NULL;
> }
> + state = to_intel_plane_state(cursor->base.state);
>
> cursor->can_scale = false;
> cursor->max_downscale = 1;
> cursor->pipe = pipe;
> cursor->plane = pipe;
> - cursor->rotation = BIT(DRM_ROTATE_0);
> + state->rotation = BIT(DRM_ROTATE_0);
> cursor->check_plane = intel_check_cursor_plane;
> cursor->commit_plane = intel_commit_cursor_plane;
>
> @@ -12181,7 +12193,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
> if (dev->mode_config.rotation_property)
> drm_object_attach_property(&cursor->base.base,
> dev->mode_config.rotation_property,
> - cursor->rotation);
> + state->rotation);
> }
>
> drm_plane_helper_add(&cursor->base, &intel_plane_helper_funcs);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index c8c0b7f..918cce2 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -250,6 +250,9 @@ struct intel_plane_state {
> struct drm_rect clip;
> bool visible;
>
> + /* Intel-specific plane properties */
> + unsigned int rotation;
> +
> /*
> * used only for sprite planes to determine when to implicitly
> * enable/disable the primary plane
> @@ -509,7 +512,6 @@ struct intel_plane {
> struct drm_i915_gem_object *obj;
> bool can_scale;
> int max_downscale;
> - unsigned int rotation;
>
> /* Since we need to change the watermarks before/after
> * enabling/disabling the planes, we need to store the parameters here
> @@ -518,6 +520,12 @@ struct intel_plane {
> */
> struct intel_plane_wm_parameters wm;
>
> + /*
> + * NOTE: Do not place new plane state fields here (e.g., when adding
> + * new plane properties). New runtime state should now be placed in
> + * the intel_plane_state structure and accessed via drm_plane->state.
> + */
> +
> void (*update_plane)(struct drm_plane *plane,
> struct drm_crtc *crtc,
> struct drm_framebuffer *fb,
> diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
> index 5b1d7c4..3e87454 100644
> --- a/drivers/gpu/drm/i915/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/intel_fbc.c
> @@ -496,6 +496,7 @@ void intel_fbc_update(struct drm_device *dev)
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct drm_crtc *crtc = NULL, *tmp_crtc;
> struct intel_crtc *intel_crtc;
> + struct intel_plane_state *primary_state;
> struct drm_framebuffer *fb;
> struct drm_i915_gem_object *obj;
> const struct drm_display_mode *adjusted_mode;
> @@ -540,6 +541,7 @@ void intel_fbc_update(struct drm_device *dev)
> }
>
> intel_crtc = to_intel_crtc(crtc);
> + primary_state = to_intel_plane_state(crtc->primary->state);
> fb = crtc->primary->fb;
> obj = intel_fb_obj(fb);
> adjusted_mode = &intel_crtc->config->base.adjusted_mode;
> @@ -595,7 +597,7 @@ void intel_fbc_update(struct drm_device *dev)
> goto out_disable;
> }
> if (INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
> - to_intel_plane(crtc->primary)->rotation != BIT(DRM_ROTATE_0)) {
> + primary_state->rotation != BIT(DRM_ROTATE_0)) {
> if (set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE))
> DRM_DEBUG_KMS("Rotation unsupported, disabling\n");
> goto out_disable;
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 0a6094e..140c5b7 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -187,6 +187,8 @@ 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 intel_plane_state *state =
> + to_intel_plane_state(drm_plane->state);
> const int pipe = intel_plane->pipe;
> const int plane = intel_plane->plane + 1;
> u32 plane_ctl, stride;
> @@ -256,7 +258,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
> default:
> BUG();
> }
> - if (intel_plane->rotation == BIT(DRM_ROTATE_180))
> + if (state->rotation == BIT(DRM_ROTATE_180))
> plane_ctl |= PLANE_CTL_ROTATE_180;
>
> plane_ctl |= PLANE_CTL_ENABLE;
> @@ -407,6 +409,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
> struct drm_device *dev = dplane->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_plane *intel_plane = to_intel_plane(dplane);
> + struct intel_plane_state *state = to_intel_plane_state(dplane->state);
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> int pipe = intel_plane->pipe;
> int plane = intel_plane->plane;
> @@ -493,7 +496,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
> fb->pitches[0]);
> linear_offset -= sprsurf_offset;
>
> - if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
> + if (state->rotation == BIT(DRM_ROTATE_180)) {
> sprctl |= SP_ROTATE_180;
>
> x += src_w;
> @@ -608,6 +611,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
> struct drm_device *dev = plane->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_plane *intel_plane = to_intel_plane(plane);
> + struct intel_plane_state *state = to_intel_plane_state(plane->state);
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> int pipe = intel_plane->pipe;
> u32 sprctl, sprscale = 0;
> @@ -684,7 +688,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
> pixel_size, fb->pitches[0]);
> linear_offset -= sprsurf_offset;
>
> - if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
> + if (state->rotation == BIT(DRM_ROTATE_180)) {
> sprctl |= SPRITE_ROTATE_180;
>
> /* HSW and BDW does this automagically in hardware */
> @@ -813,6 +817,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
> struct drm_device *dev = plane->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_plane *intel_plane = to_intel_plane(plane);
> + struct intel_plane_state *state = to_intel_plane_state(plane->state);
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> int pipe = intel_plane->pipe;
> unsigned long dvssurf_offset, linear_offset;
> @@ -884,7 +889,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
> pixel_size, fb->pitches[0]);
> linear_offset -= dvssurf_offset;
>
> - if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
> + if (state->rotation == BIT(DRM_ROTATE_180)) {
> dvscntr |= DVS_ROTATE_180;
>
> x += src_w;
> @@ -1125,7 +1130,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
> min_scale = intel_plane->can_scale ? 1 : (1 << 16);
>
> drm_rect_rotate(src, fb->width << 16, fb->height << 16,
> - intel_plane->rotation);
> + state->rotation);
>
> hscale = drm_rect_calc_hscale_relaxed(src, dst, min_scale, max_scale);
> BUG_ON(hscale < 0);
> @@ -1166,7 +1171,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
> drm_rect_height(dst) * vscale - drm_rect_height(src));
>
> drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16,
> - intel_plane->rotation);
> + state->rotation);
>
> /* sanity check to make sure the src viewport wasn't enlarged */
> WARN_ON(src->x1 < (int) state->base.src_x ||
> @@ -1367,7 +1372,7 @@ int intel_plane_set_property(struct drm_plane *plane,
> uint64_t val)
> {
> struct drm_device *dev = plane->dev;
> - struct intel_plane *intel_plane = to_intel_plane(plane);
> + struct intel_plane_state *state = to_intel_plane_state(plane->state);
> uint64_t old_val;
> int ret = -ENOENT;
>
> @@ -1376,14 +1381,14 @@ int intel_plane_set_property(struct drm_plane *plane,
> if (hweight32(val & 0xf) != 1)
> return -EINVAL;
>
> - if (intel_plane->rotation == val)
> + if (state->rotation == val)
> return 0;
>
> - old_val = intel_plane->rotation;
> - intel_plane->rotation = val;
> + old_val = state->rotation;
> + state->rotation = val;
> ret = intel_plane_restore(plane);
> if (ret)
> - intel_plane->rotation = old_val;
> + state->rotation = old_val;
> }
>
> return ret;
> @@ -1457,6 +1462,7 @@ int
> intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
> {
> struct intel_plane *intel_plane;
> + struct intel_plane_state *state;
> unsigned long possible_crtcs;
> const uint32_t *plane_formats;
> int num_plane_formats;
> @@ -1475,6 +1481,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
> kfree(intel_plane);
> return -ENOMEM;
> }
> + state = to_intel_plane_state(intel_plane->base.state);
>
> switch (INTEL_INFO(dev)->gen) {
> case 5:
> @@ -1545,7 +1552,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
>
> intel_plane->pipe = pipe;
> intel_plane->plane = plane;
> - intel_plane->rotation = BIT(DRM_ROTATE_0);
> + state->rotation = BIT(DRM_ROTATE_0);
> intel_plane->check_plane = intel_check_sprite_plane;
> intel_plane->commit_plane = intel_commit_sprite_plane;
> possible_crtcs = (1 << pipe);
> @@ -1567,7 +1574,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
> if (dev->mode_config.rotation_property)
> drm_object_attach_property(&intel_plane->base.base,
> dev->mode_config.rotation_property,
> - intel_plane->rotation);
> + state->rotation);
>
> drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
>
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 03/13] drm/i915: Consolidate plane handler vtables
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
2015-01-20 3:57 ` [PATCH 01/13] squash! drm/i915: Improve how the memory for crtc state is allocated Matt Roper
2015-01-20 3:57 ` [PATCH 02/13] drm/i915: Move rotation from intel_plane to intel_plane_state Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-21 10:09 ` Ander Conselvan de Oliveira
2015-01-20 3:57 ` [PATCH 04/13] drm/plane-helper: Add transitional helper for .set_plane() Matt Roper
` (9 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
All of the previous refactoring/consolidation of plane code has resulted
in intel_primary_plane_funcs, intel_cursor_plane_funcs, and
intel_sprite_plane_funcs being identical. Replace all of these with a
single 'intel_plane_funcs' vtable for simplicity.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 15 +++------------
drivers/gpu/drm/i915/intel_drv.h | 1 +
drivers/gpu/drm/i915/intel_sprite.c | 11 +----------
3 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 7863414..9bf5221 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11968,7 +11968,7 @@ void intel_plane_destroy(struct drm_plane *plane)
kfree(intel_plane);
}
-static const struct drm_plane_funcs intel_primary_plane_funcs = {
+const struct drm_plane_funcs intel_plane_funcs = {
.update_plane = drm_plane_helper_update,
.disable_plane = drm_plane_helper_disable,
.destroy = intel_plane_destroy,
@@ -12016,7 +12016,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
}
drm_universal_plane_init(dev, &primary->base, 0,
- &intel_primary_plane_funcs,
+ &intel_plane_funcs,
intel_primary_formats, num_formats,
DRM_PLANE_TYPE_PRIMARY);
@@ -12144,15 +12144,6 @@ update:
intel_crtc_update_cursor(crtc, state->visible);
}
-static const struct drm_plane_funcs intel_cursor_plane_funcs = {
- .update_plane = drm_plane_helper_update,
- .disable_plane = drm_plane_helper_disable,
- .destroy = intel_plane_destroy,
- .set_property = intel_plane_set_property,
- .atomic_duplicate_state = intel_plane_duplicate_state,
- .atomic_destroy_state = intel_plane_destroy_state,
-};
-
static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
int pipe)
{
@@ -12179,7 +12170,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
cursor->commit_plane = intel_commit_cursor_plane;
drm_universal_plane_init(dev, &cursor->base, 0,
- &intel_cursor_plane_funcs,
+ &intel_plane_funcs,
intel_cursor_formats,
ARRAY_SIZE(intel_cursor_formats),
DRM_PLANE_TYPE_CURSOR);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 918cce2..2133fd1 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -908,6 +908,7 @@ void i915_audio_component_init(struct drm_i915_private *dev_priv);
void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);
/* intel_display.c */
+extern const struct drm_plane_funcs intel_plane_funcs;
bool intel_has_pending_fb_unpin(struct drm_device *dev);
int intel_pch_rawclk(struct drm_device *dev);
void intel_mark_busy(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 140c5b7..8af4c69 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1406,15 +1406,6 @@ int intel_plane_restore(struct drm_plane *plane)
plane->state->src_w, plane->state->src_h);
}
-static const struct drm_plane_funcs intel_sprite_plane_funcs = {
- .update_plane = drm_plane_helper_update,
- .disable_plane = drm_plane_helper_disable,
- .destroy = intel_plane_destroy,
- .set_property = intel_plane_set_property,
- .atomic_duplicate_state = intel_plane_duplicate_state,
- .atomic_destroy_state = intel_plane_destroy_state,
-};
-
static uint32_t ilk_plane_formats[] = {
DRM_FORMAT_XRGB8888,
DRM_FORMAT_YUYV,
@@ -1557,7 +1548,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
intel_plane->commit_plane = intel_commit_sprite_plane;
possible_crtcs = (1 << pipe);
ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs,
- &intel_sprite_plane_funcs,
+ &intel_plane_funcs,
plane_formats, num_plane_formats,
DRM_PLANE_TYPE_OVERLAY);
if (ret) {
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 03/13] drm/i915: Consolidate plane handler vtables
2015-01-20 3:57 ` [PATCH 03/13] drm/i915: Consolidate plane handler vtables Matt Roper
@ 2015-01-21 10:09 ` Ander Conselvan de Oliveira
0 siblings, 0 replies; 22+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-21 10:09 UTC (permalink / raw)
To: Matt Roper, intel-gfx
Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
On 01/20/2015 05:57 AM, Matt Roper wrote:
> All of the previous refactoring/consolidation of plane code has resulted
> in intel_primary_plane_funcs, intel_cursor_plane_funcs, and
> intel_sprite_plane_funcs being identical. Replace all of these with a
> single 'intel_plane_funcs' vtable for simplicity.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 15 +++------------
> drivers/gpu/drm/i915/intel_drv.h | 1 +
> drivers/gpu/drm/i915/intel_sprite.c | 11 +----------
> 3 files changed, 5 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 7863414..9bf5221 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11968,7 +11968,7 @@ void intel_plane_destroy(struct drm_plane *plane)
> kfree(intel_plane);
> }
>
> -static const struct drm_plane_funcs intel_primary_plane_funcs = {
> +const struct drm_plane_funcs intel_plane_funcs = {
> .update_plane = drm_plane_helper_update,
> .disable_plane = drm_plane_helper_disable,
> .destroy = intel_plane_destroy,
> @@ -12016,7 +12016,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
> }
>
> drm_universal_plane_init(dev, &primary->base, 0,
> - &intel_primary_plane_funcs,
> + &intel_plane_funcs,
> intel_primary_formats, num_formats,
> DRM_PLANE_TYPE_PRIMARY);
>
> @@ -12144,15 +12144,6 @@ update:
> intel_crtc_update_cursor(crtc, state->visible);
> }
>
> -static const struct drm_plane_funcs intel_cursor_plane_funcs = {
> - .update_plane = drm_plane_helper_update,
> - .disable_plane = drm_plane_helper_disable,
> - .destroy = intel_plane_destroy,
> - .set_property = intel_plane_set_property,
> - .atomic_duplicate_state = intel_plane_duplicate_state,
> - .atomic_destroy_state = intel_plane_destroy_state,
> -};
> -
> static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
> int pipe)
> {
> @@ -12179,7 +12170,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
> cursor->commit_plane = intel_commit_cursor_plane;
>
> drm_universal_plane_init(dev, &cursor->base, 0,
> - &intel_cursor_plane_funcs,
> + &intel_plane_funcs,
> intel_cursor_formats,
> ARRAY_SIZE(intel_cursor_formats),
> DRM_PLANE_TYPE_CURSOR);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 918cce2..2133fd1 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -908,6 +908,7 @@ void i915_audio_component_init(struct drm_i915_private *dev_priv);
> void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);
>
> /* intel_display.c */
> +extern const struct drm_plane_funcs intel_plane_funcs;
> bool intel_has_pending_fb_unpin(struct drm_device *dev);
> int intel_pch_rawclk(struct drm_device *dev);
> void intel_mark_busy(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 140c5b7..8af4c69 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -1406,15 +1406,6 @@ int intel_plane_restore(struct drm_plane *plane)
> plane->state->src_w, plane->state->src_h);
> }
>
> -static const struct drm_plane_funcs intel_sprite_plane_funcs = {
> - .update_plane = drm_plane_helper_update,
> - .disable_plane = drm_plane_helper_disable,
> - .destroy = intel_plane_destroy,
> - .set_property = intel_plane_set_property,
> - .atomic_duplicate_state = intel_plane_duplicate_state,
> - .atomic_destroy_state = intel_plane_destroy_state,
> -};
> -
> static uint32_t ilk_plane_formats[] = {
> DRM_FORMAT_XRGB8888,
> DRM_FORMAT_YUYV,
> @@ -1557,7 +1548,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
> intel_plane->commit_plane = intel_commit_sprite_plane;
> possible_crtcs = (1 << pipe);
> ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs,
> - &intel_sprite_plane_funcs,
> + &intel_plane_funcs,
> plane_formats, num_plane_formats,
> DRM_PLANE_TYPE_OVERLAY);
> if (ret) {
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 04/13] drm/plane-helper: Add transitional helper for .set_plane().
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
` (2 preceding siblings ...)
2015-01-20 3:57 ` [PATCH 03/13] drm/i915: Consolidate plane handler vtables Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-20 3:57 ` [PATCH 05/13] drm/plane-helper: Fix transitional helper kerneldocs Matt Roper
` (8 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx; +Cc: dri-devel
Add a transitional helper for planes' .set_property() entrypoint,
similar to what we already have for .update_plane() and
.disable_plane(). This allows drivers that are still in the process of
transitioning to implement and exercise the .atomic_set_property()
driver entrypoint that will eventually be used by atomic.
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/drm_plane_helper.c | 105 +++++++++++++++++++++++++++++++++++++
include/drm/drm_plane_helper.h | 3 ++
2 files changed, 108 insertions(+)
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 7a5814a..0dce064 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -586,3 +586,108 @@ int drm_plane_helper_disable(struct drm_plane *plane)
return drm_plane_helper_commit(plane, plane_state, plane->fb);
}
EXPORT_SYMBOL(drm_plane_helper_disable);
+
+/**
+ * drm_plane_helper_set_property() - Transitional helper for property updates
+ * @plane: plane object to update
+ * @prop: property to update
+ * @val: value to set property to
+ *
+ * Provides a default plane property handler using the atomic plane update
+ * functions. Drivers in the process of transitioning to atomic should
+ * replace their plane.set_property() entrypoint with this function and
+ * then implement the plane.atomic_set_property() entrypoint.
+ *
+ * This is useful for piecewise transitioning of a driver to the atomic helpers.
+ *
+ * Note that this helper assumes that no hardware programming should be
+ * performed if the plane is disabled. When the plane is not attached to a
+ * crtc, we just swap in the validated plane state and return; there's no
+ * call to atomic_begin()/atomic_update()/atomic_flush().
+ *
+ * RETURNS:
+ * Zero on success, error code on failure
+ */
+int drm_plane_helper_set_property(struct drm_plane *plane,
+ struct drm_property *prop,
+ uint64_t val)
+{
+ struct drm_plane_state *plane_state;
+ struct drm_plane_helper_funcs *plane_funcs = plane->helper_private;
+ struct drm_crtc_helper_funcs *crtc_funcs;
+ int ret;
+
+ /*
+ * Drivers may not have an .atomic_set_property() handler if they have
+ * no driver-specific properties, but they generally wouldn't setup a
+ * .set_property() handler (pointing to this function) for the plane in
+ * that case either; throw a warning since this is probably a mistake.
+ */
+ if (WARN_ON(!plane->funcs->atomic_set_property))
+ return -EINVAL;
+
+ if (plane->funcs->atomic_duplicate_state)
+ plane_state = plane->funcs->atomic_duplicate_state(plane);
+ else if (plane->state)
+ plane_state = drm_atomic_helper_plane_duplicate_state(plane);
+ else
+ plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL);
+ if (!plane_state)
+ return -ENOMEM;
+ plane_state->plane = plane;
+
+ /*
+ * Update the state object with the new property value we want to
+ * set. If the property is not recognized as a driver-specific property,
+ * -EINVAL will be returned here.
+ */
+ ret = plane->funcs->atomic_set_property(plane, plane_state, prop, val);
+ if (ret)
+ goto out;
+
+ /*
+ * Check that the updated plane state is actually programmable (e.g.,
+ * doesn't violate hardware constraints).
+ */
+ if (plane_funcs->atomic_check) {
+ ret = plane_funcs->atomic_check(plane, plane_state);
+ if (ret)
+ goto out;
+ }
+
+ /* Point of no return, commit sw state. */
+ swap(plane->state, plane_state);
+
+ /*
+ * If the plane is disabled, we're done. No hardware programming is
+ * attempted when the plane is disabled.
+ */
+ if (!plane->crtc)
+ goto out;
+
+ /* Start hardware transaction to commit new state to hardware */
+ crtc_funcs = plane->crtc->helper_private;
+ if (crtc_funcs && crtc_funcs->atomic_begin)
+ crtc_funcs->atomic_begin(plane->crtc);
+ plane_funcs->atomic_update(plane, plane_state);
+ if (crtc_funcs && crtc_funcs->atomic_flush)
+ crtc_funcs->atomic_flush(plane->crtc);
+
+ /*
+ * Since we're not using full atomic yet, we still need to update the shadow
+ * property value that's managed by the DRM core since that's where the
+ * property values will be read back from.
+ */
+ drm_object_property_set_value(&plane->base, prop, val);
+
+out:
+ if (plane_state) {
+ if (plane->funcs->atomic_destroy_state)
+ plane->funcs->atomic_destroy_state(plane, plane_state);
+ else
+ drm_atomic_helper_plane_destroy_state(plane, plane_state);
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL(drm_plane_helper_set_property);
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index a185392..4a56961 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -107,6 +107,9 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h);
int drm_plane_helper_disable(struct drm_plane *plane);
+int drm_plane_helper_set_property(struct drm_plane *plane,
+ struct drm_property *prop,
+ uint64_t val);
/* For use by drm_crtc_helper.c */
int drm_plane_helper_commit(struct drm_plane *plane,
--
1.8.5.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 05/13] drm/plane-helper: Fix transitional helper kerneldocs
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
` (3 preceding siblings ...)
2015-01-20 3:57 ` [PATCH 04/13] drm/plane-helper: Add transitional helper for .set_plane() Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-20 3:57 ` [PATCH 06/13] drm/i915: Add .atomic_{get, set}_property() entrypoints to planes Matt Roper
` (7 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx; +Cc: dri-devel
drm_plane_helper_{update,disable} are not specific to primary planes;
fix some copy/paste summaries to avoid confusion.
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/drm_plane_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 0dce064..0d2068d 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -492,7 +492,7 @@ out:
}
/**
- * drm_plane_helper_update() - Helper for primary plane update
+ * drm_plane_helper_update() - Transitional helper for plane update
* @plane: plane object to update
* @crtc: owning CRTC of owning plane
* @fb: framebuffer to flip onto plane
@@ -549,7 +549,7 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
EXPORT_SYMBOL(drm_plane_helper_update);
/**
- * drm_plane_helper_disable() - Helper for primary plane disable
+ * drm_plane_helper_disable() - Transitional helper for plane disable
* @plane: plane to disable
*
* Provides a default plane disable handler using the atomic plane update
--
1.8.5.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 06/13] drm/i915: Add .atomic_{get, set}_property() entrypoints to planes
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
` (4 preceding siblings ...)
2015-01-20 3:57 ` [PATCH 05/13] drm/plane-helper: Fix transitional helper kerneldocs Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-20 3:57 ` [PATCH 07/13] drm/i915: Replace intel_set_property() with transitional helper Matt Roper
` (6 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
When we flip on the DRIVER_ATOMIC bit, the DRM core will start calling
this entrypoint to set and lookup driver-specific plane property values,
rather than maintaining a shadow copy in object->properties.
Note that although we add these functions to the plane vtable, they will
not yet be called. Future patches that switch our .set_property()
handler and/or enable full atomic functionality are required before
these code paths will be executed.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/intel_atomic_plane.c | 60 +++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_display.c | 2 ++
drivers/gpu/drm/i915/intel_drv.h | 8 +++++
3 files changed, 70 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index 4027fc0..0b07b90 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -150,3 +150,63 @@ const struct drm_plane_helper_funcs intel_plane_helper_funcs = {
.atomic_update = intel_plane_atomic_update,
};
+/**
+ * intel_plane_atomic_get_property - fetch plane property value
+ * @plane: plane to fetch property for
+ * @state: state containing the property value
+ * @property: property to look up
+ * @val: pointer to write property value into
+ *
+ * The DRM core does not store shadow copies of properties for
+ * atomic-capable drivers. This entrypoint is used to fetch
+ * the current value of a driver-specific plane property.
+ */
+int
+intel_plane_atomic_get_property(struct drm_plane *plane,
+ const struct drm_plane_state *state,
+ struct drm_property *property,
+ uint64_t *val)
+{
+ struct drm_mode_config *config = &plane->dev->mode_config;
+ struct intel_plane_state *intel_state = to_intel_plane_state(state);
+
+ if (property == config->rotation_property) {
+ *val = intel_state->rotation;
+ } else {
+ DRM_DEBUG_KMS("Unknown plane property '%s'\n", property->name);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+/**
+ * intel_plane_atomic_set_property - set plane property value
+ * @plane: plane to set property for
+ * @state: state to update property value in
+ * @property: property to set
+ * @val: value to set property to
+ *
+ * Writes the specified property value for a plane into the provided atomic
+ * state object.
+ *
+ * Returns 0 on success, -EINVAL on unrecognized properties
+ */
+int
+intel_plane_atomic_set_property(struct drm_plane *plane,
+ struct drm_plane_state *state,
+ struct drm_property *property,
+ uint64_t val)
+{
+ struct drm_mode_config *config = &plane->dev->mode_config;
+ struct intel_plane_state *intel_state = to_intel_plane_state(state);
+
+ if (property == config->rotation_property) {
+ intel_state->rotation = val;
+ } else {
+ DRM_DEBUG_KMS("Unknown plane property '%s'\n", property->name);
+ return -EINVAL;
+ }
+
+ return 0;
+}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9bf5221..90008b8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11973,6 +11973,8 @@ const struct drm_plane_funcs intel_plane_funcs = {
.disable_plane = drm_plane_helper_disable,
.destroy = intel_plane_destroy,
.set_property = intel_plane_set_property,
+ .atomic_get_property = intel_plane_atomic_get_property,
+ .atomic_set_property = intel_plane_atomic_set_property,
.atomic_duplicate_state = intel_plane_duplicate_state,
.atomic_destroy_state = intel_plane_destroy_state,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 2133fd1..97c3ace 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -963,6 +963,14 @@ int intel_prepare_plane_fb(struct drm_plane *plane,
struct drm_framebuffer *fb);
void intel_cleanup_plane_fb(struct drm_plane *plane,
struct drm_framebuffer *fb);
+int intel_plane_atomic_get_property(struct drm_plane *plane,
+ const struct drm_plane_state *state,
+ struct drm_property *property,
+ uint64_t *val);
+int intel_plane_atomic_set_property(struct drm_plane *plane,
+ struct drm_plane_state *state,
+ struct drm_property *property,
+ uint64_t val);
/* shared dpll functions */
struct intel_shared_dpll *intel_crtc_to_shared_dpll(struct intel_crtc *crtc);
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 07/13] drm/i915: Replace intel_set_property() with transitional helper
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
` (5 preceding siblings ...)
2015-01-20 3:57 ` [PATCH 06/13] drm/i915: Add .atomic_{get, set}_property() entrypoints to planes Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-20 3:57 ` [PATCH 08/13] drm/i915: Add main atomic entrypoints Matt Roper
` (5 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
This switch allows us to exercise the .atomic_set_property() that will
be used by atomic. The only real changes we need to make here are:
* extract the property validation from our old set_property handler and
stick it in intel_plane_atomic_check().
* make intel_check_*_plane() functions capable of handling a NULL crtc
(which will happen if userspace tries to set a property value on a
disabled plane).
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/intel_atomic_plane.c | 24 +++++++++++++++++++-----
drivers/gpu/drm/i915/intel_display.c | 10 +++++++++-
drivers/gpu/drm/i915/intel_drv.h | 3 ---
drivers/gpu/drm/i915/intel_sprite.c | 31 ++++---------------------------
4 files changed, 32 insertions(+), 36 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index 0b07b90..966c908 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -104,13 +104,20 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
intel_state->dst.x2 = state->crtc_x + state->crtc_w;
intel_state->dst.y2 = state->crtc_y + state->crtc_h;
- /* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */
+ /*
+ * Clip all planes to CRTC size, or 0x0 if CRTC unset or disabled.
+ * Note that CRTC may be unset if we're setting a property of a
+ * disabled plane.
+ */
intel_state->clip.x1 = 0;
intel_state->clip.y1 = 0;
- intel_state->clip.x2 =
- intel_crtc->active ? intel_crtc->config->pipe_src_w : 0;
- intel_state->clip.y2 =
- intel_crtc->active ? intel_crtc->config->pipe_src_h : 0;
+ if (crtc && intel_crtc->active) {
+ intel_state->clip.x2 = intel_crtc->config->pipe_src_w;
+ intel_state->clip.y2 = intel_crtc->config->pipe_src_h;
+ } else {
+ intel_state->clip.x2 = 0;
+ intel_state->clip.y2 = 0;
+ }
/*
* Disabling a plane is always okay; we just need to update
@@ -118,6 +125,9 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
* get called by the plane helpers.
*/
if (state->fb == NULL && plane->state->fb != NULL) {
+ if (WARN_ON(!crtc))
+ return -EINVAL;
+
/*
* 'prepare' is never called when plane is being disabled, so
* we need to handle frontbuffer tracking as a special case
@@ -126,6 +136,10 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
(1 << drm_plane_index(plane));
}
+ /* Rotation property should contain only a single rotation bit */
+ if (hweight32(intel_state->rotation & 0xf) != 1)
+ return -EINVAL;
+
return intel_plane->check_plane(plane, intel_state);
}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 90008b8..50ae3b1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11774,6 +11774,10 @@ intel_check_primary_plane(struct drm_plane *plane,
crtc = crtc ? crtc : plane->crtc;
intel_crtc = to_intel_crtc(crtc);
+ /* CRTC may be unset if we're updating a property of a disabled plane */
+ if (!crtc)
+ return 0;
+
ret = drm_plane_helper_check_update(plane, crtc, fb,
src, dest, clip,
DRM_PLANE_HELPER_NO_SCALING,
@@ -11972,7 +11976,7 @@ const struct drm_plane_funcs intel_plane_funcs = {
.update_plane = drm_plane_helper_update,
.disable_plane = drm_plane_helper_disable,
.destroy = intel_plane_destroy,
- .set_property = intel_plane_set_property,
+ .set_property = drm_plane_helper_set_property,
.atomic_get_property = intel_plane_atomic_get_property,
.atomic_set_property = intel_plane_atomic_set_property,
.atomic_duplicate_state = intel_plane_duplicate_state,
@@ -12057,6 +12061,10 @@ intel_check_cursor_plane(struct drm_plane *plane,
crtc = crtc ? crtc : plane->crtc;
intel_crtc = to_intel_crtc(crtc);
+ /* CRTC may be unset if we're updating a property of a disabled plane */
+ if (!crtc)
+ return 0;
+
ret = drm_plane_helper_check_update(plane, crtc, fb,
src, dest, clip,
DRM_PLANE_HELPER_NO_SCALING,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 97c3ace..2d9e9a4 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1246,9 +1246,6 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob);
int intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane);
void intel_flush_primary_plane(struct drm_i915_private *dev_priv,
enum plane plane);
-int intel_plane_set_property(struct drm_plane *plane,
- struct drm_property *prop,
- uint64_t val);
int intel_plane_restore(struct drm_plane *plane);
int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
struct drm_file *file_priv);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 8af4c69..c62f263 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1094,6 +1094,10 @@ intel_check_sprite_plane(struct drm_plane *plane,
intel_crtc = intel_crtc ? intel_crtc : to_intel_crtc(plane->crtc);
+ /* CRTC may be unset if we're updating a property of a disabled plane */
+ if (!intel_crtc)
+ return 0;
+
if (!fb) {
state->visible = false;
goto finish;
@@ -1367,33 +1371,6 @@ out_unlock:
return ret;
}
-int intel_plane_set_property(struct drm_plane *plane,
- struct drm_property *prop,
- uint64_t val)
-{
- struct drm_device *dev = plane->dev;
- struct intel_plane_state *state = to_intel_plane_state(plane->state);
- uint64_t old_val;
- int ret = -ENOENT;
-
- if (prop == dev->mode_config.rotation_property) {
- /* exactly one rotation angle please */
- if (hweight32(val & 0xf) != 1)
- return -EINVAL;
-
- if (state->rotation == val)
- return 0;
-
- old_val = state->rotation;
- state->rotation = val;
- ret = intel_plane_restore(plane);
- if (ret)
- state->rotation = old_val;
- }
-
- return ret;
-}
-
int intel_plane_restore(struct drm_plane *plane)
{
if (!plane->crtc || !plane->fb)
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 08/13] drm/i915: Add main atomic entrypoints
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
` (6 preceding siblings ...)
2015-01-20 3:57 ` [PATCH 07/13] drm/i915: Replace intel_set_property() with transitional helper Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-21 13:48 ` Ander Conselvan de Oliveira
2015-01-20 3:57 ` [PATCH 09/13] drm/i915: Setup dummy atomic state for connectors Matt Roper
` (4 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
Add the top-level atomic entrypoints for check/commit. These won't get
called yet; we still need to either enable the atomic ioctl or switch to
using the non-transitional atomic helpers for legacy operations.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/Makefile | 1 +
drivers/gpu/drm/i915/intel_atomic.c | 161 +++++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_display.c | 2 +
drivers/gpu/drm/i915/intel_drv.h | 7 ++
4 files changed, 171 insertions(+)
create mode 100644 drivers/gpu/drm/i915/intel_atomic.c
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 16e3dc3..c7e2ab5 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -66,6 +66,7 @@ i915-y += dvo_ch7017.o \
dvo_ns2501.o \
dvo_sil164.o \
dvo_tfp410.o \
+ intel_atomic.o \
intel_atomic_plane.o \
intel_crt.o \
intel_ddi.o \
diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
new file mode 100644
index 0000000..1542005
--- /dev/null
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * DOC: atomic modeset support
+ *
+ * The functions here implement the state management and hardware programming
+ * dispatch required by the atomic modeset infrastructure.
+ * See intel_atomic_plane.c for the plane-specific atomic functionality.
+ */
+
+#include <drm/drmP.h>
+#include <drm/drm_atomic.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_plane_helper.h>
+#include "intel_drv.h"
+
+
+/**
+ * intel_atomic_check - validate state object
+ * @dev: drm device
+ * @state: state to validate
+ */
+int intel_atomic_check(struct drm_device *dev,
+ struct drm_atomic_state *state)
+{
+ int nplanes = dev->mode_config.num_total_plane;
+ int ncrtcs = dev->mode_config.num_crtc;
+ int nconnectors = dev->mode_config.num_connector;
+ int crtc_mask = 0;
+ int ret;
+ int i;
+ bool not_nuclear = false;
+
+ /* Figure out what crtcs are involved */
+ for (i = 0; i < nplanes; i++) {
+ struct drm_plane *plane = state->planes[i];
+ if (!plane)
+ continue;
+ crtc_mask |= plane->possible_crtcs;
+ }
+
+ /*
+ * FIXME: At the moment, we only support "nuclear pageflip" on a
+ * single CRTC. Cross-crtc updates will be added later.
+ */
+ if (hweight32(crtc_mask) > 1) {
+ DRM_DEBUG_KMS("i915 only support atomic plane operations on a single CRTC at the moment\n");
+ return -EINVAL;
+ }
+
+ /*
+ * FIXME: We only handle planes for now; make sure there are no CRTC's
+ * or connectors involved.
+ */
+ state->allow_modeset = false;
+ for (i = 0; i < ncrtcs; i++)
+ not_nuclear |= (state->crtcs[i] &&
+ drm_crtc_mask(state->crtcs[i]) != crtc_mask);
+ for (i = 0; i < nconnectors; i++)
+ not_nuclear |= (state->connectors[i] != NULL);
+
+ if (not_nuclear) {
+ DRM_DEBUG_KMS("i915 only supports atomic plane operations at the moment\n");
+ return -EINVAL;
+ }
+
+ ret = drm_atomic_helper_check_planes(dev, state);
+ if (ret)
+ return ret;
+
+ return ret;
+}
+
+
+/**
+ * intel_atomic_commit - commit validated state object
+ * @dev: DRM device
+ * @state: the top-level driver state object
+ * @async: asynchronous commit
+ *
+ * This function commits a top-level state object that has been validated
+ * with drm_atomic_helper_check().
+ *
+ * FIXME: Atomic modeset support for i915 is not yet complete. At the moment
+ * we can only handle plane-related operations and do not yet support
+ * asynchronous commit.
+ *
+ * RETURNS
+ * Zero for success or -errno.
+ */
+int intel_atomic_commit(struct drm_device *dev,
+ struct drm_atomic_state *state,
+ bool async)
+{
+ int ret;
+ int i;
+
+ if (async) {
+ DRM_DEBUG_KMS("i915 does not yet support async commit\n");
+ return -EINVAL;
+ }
+
+ ret = drm_atomic_helper_prepare_planes(dev, state);
+ if (ret)
+ return ret;
+
+ /* Point of no return */
+
+ /*
+ * FIXME: The proper sequence here will eventually be:
+ *
+ * drm_atomic_helper_swap_state(dev, state)
+ * drm_atomic_helper_commit_pre_planes(dev, state);
+ * drm_atomic_helper_commit_planes(dev, state);
+ * drm_atomic_helper_commit_post_planes(dev, state);
+ * drm_atomic_helper_wait_for_vblanks(dev, state);
+ * drm_atomic_helper_cleanup_planes(dev, state);
+ * drm_atomic_state_free(state);
+ *
+ * once we have full atomic modeset. For now, just manually update
+ * plane states to avoid clobbering good states with dummy states
+ * while nuclear pageflipping.
+ */
+ for (i = 0; i < dev->mode_config.num_total_plane; i++) {
+ struct drm_plane *plane = state->planes[i];
+
+ if (!plane)
+ continue;
+
+ plane->state->state = state;
+ swap(state->plane_states[i], plane->state);
+ plane->state->state = NULL;
+ }
+ drm_atomic_helper_commit_planes(dev, state);
+ drm_atomic_helper_wait_for_vblanks(dev, state);
+ drm_atomic_helper_cleanup_planes(dev, state);
+ drm_atomic_state_free(state);
+
+ return 0;
+}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 50ae3b1..0e18879 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12681,6 +12681,8 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
static const struct drm_mode_config_funcs intel_mode_funcs = {
.fb_create = intel_user_framebuffer_create,
.output_poll_changed = intel_fbdev_output_poll_changed,
+ .atomic_check = intel_atomic_check,
+ .atomic_commit = intel_atomic_commit,
};
/* Set up chip specific display functions */
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 2d9e9a4..503e2f2 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1261,6 +1261,13 @@ void intel_pre_disable_primary(struct drm_crtc *crtc);
void intel_tv_init(struct drm_device *dev);
/* intel_atomic.c */
+int intel_atomic_check(struct drm_device *dev,
+ struct drm_atomic_state *state);
+int intel_atomic_commit(struct drm_device *dev,
+ struct drm_atomic_state *state,
+ bool async);
+
+/* intel_atomic_plane.c */
struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
void intel_plane_destroy_state(struct drm_plane *plane,
struct drm_plane_state *state);
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 08/13] drm/i915: Add main atomic entrypoints
2015-01-20 3:57 ` [PATCH 08/13] drm/i915: Add main atomic entrypoints Matt Roper
@ 2015-01-21 13:48 ` Ander Conselvan de Oliveira
0 siblings, 0 replies; 22+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-21 13:48 UTC (permalink / raw)
To: Matt Roper, intel-gfx
On 01/20/2015 05:57 AM, Matt Roper wrote:
> Add the top-level atomic entrypoints for check/commit. These won't get
> called yet; we still need to either enable the atomic ioctl or switch to
> using the non-transitional atomic helpers for legacy operations.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
> drivers/gpu/drm/i915/Makefile | 1 +
> drivers/gpu/drm/i915/intel_atomic.c | 161 +++++++++++++++++++++++++++++++++++
> drivers/gpu/drm/i915/intel_display.c | 2 +
> drivers/gpu/drm/i915/intel_drv.h | 7 ++
> 4 files changed, 171 insertions(+)
> create mode 100644 drivers/gpu/drm/i915/intel_atomic.c
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 16e3dc3..c7e2ab5 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -66,6 +66,7 @@ i915-y += dvo_ch7017.o \
> dvo_ns2501.o \
> dvo_sil164.o \
> dvo_tfp410.o \
> + intel_atomic.o \
> intel_atomic_plane.o \
> intel_crt.o \
> intel_ddi.o \
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> new file mode 100644
> index 0000000..1542005
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -0,0 +1,161 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/**
> + * DOC: atomic modeset support
> + *
> + * The functions here implement the state management and hardware programming
> + * dispatch required by the atomic modeset infrastructure.
> + * See intel_atomic_plane.c for the plane-specific atomic functionality.
> + */
> +
> +#include <drm/drmP.h>
> +#include <drm/drm_atomic.h>
> +#include <drm/drm_atomic_helper.h>
> +#include <drm/drm_plane_helper.h>
> +#include "intel_drv.h"
> +
> +
> +/**
> + * intel_atomic_check - validate state object
> + * @dev: drm device
> + * @state: state to validate
> + */
> +int intel_atomic_check(struct drm_device *dev,
> + struct drm_atomic_state *state)
> +{
> + int nplanes = dev->mode_config.num_total_plane;
> + int ncrtcs = dev->mode_config.num_crtc;
> + int nconnectors = dev->mode_config.num_connector;
> + int crtc_mask = 0;
> + int ret;
> + int i;
> + bool not_nuclear = false;
> +
> + /* Figure out what crtcs are involved */
> + for (i = 0; i < nplanes; i++) {
> + struct drm_plane *plane = state->planes[i];
> + if (!plane)
> + continue;
> + crtc_mask |= plane->possible_crtcs;
This would compute the wrong mask for older gens, where the planes are
not mapped to one specific pipe. But we don't support planes at all in
that case, so I guess this is fine.
> + }
> +
> + /*
> + * FIXME: At the moment, we only support "nuclear pageflip" on a
> + * single CRTC. Cross-crtc updates will be added later.
> + */
> + if (hweight32(crtc_mask) > 1) {
> + DRM_DEBUG_KMS("i915 only support atomic plane operations on a single CRTC at the moment\n");
> + return -EINVAL;
> + }
> +
> + /*
> + * FIXME: We only handle planes for now; make sure there are no CRTC's
> + * or connectors involved.
> + */
> + state->allow_modeset = false;
> + for (i = 0; i < ncrtcs; i++)
> + not_nuclear |= (state->crtcs[i] &&
> + drm_crtc_mask(state->crtcs[i]) != crtc_mask);
> + for (i = 0; i < nconnectors; i++)
> + not_nuclear |= (state->connectors[i] != NULL);
I think "if (condition) not_nuclear = true;" would be more clear here.
Ander
> +
> + if (not_nuclear) {
> + DRM_DEBUG_KMS("i915 only supports atomic plane operations at the moment\n");
> + return -EINVAL;
> + }
> +
> + ret = drm_atomic_helper_check_planes(dev, state);
> + if (ret)
> + return ret;
> +
> + return ret;
> +}
> +
> +
> +/**
> + * intel_atomic_commit - commit validated state object
> + * @dev: DRM device
> + * @state: the top-level driver state object
> + * @async: asynchronous commit
> + *
> + * This function commits a top-level state object that has been validated
> + * with drm_atomic_helper_check().
> + *
> + * FIXME: Atomic modeset support for i915 is not yet complete. At the moment
> + * we can only handle plane-related operations and do not yet support
> + * asynchronous commit.
> + *
> + * RETURNS
> + * Zero for success or -errno.
> + */
> +int intel_atomic_commit(struct drm_device *dev,
> + struct drm_atomic_state *state,
> + bool async)
> +{
> + int ret;
> + int i;
> +
> + if (async) {
> + DRM_DEBUG_KMS("i915 does not yet support async commit\n");
> + return -EINVAL;
> + }
> +
> + ret = drm_atomic_helper_prepare_planes(dev, state);
> + if (ret)
> + return ret;
> +
> + /* Point of no return */
> +
> + /*
> + * FIXME: The proper sequence here will eventually be:
> + *
> + * drm_atomic_helper_swap_state(dev, state)
> + * drm_atomic_helper_commit_pre_planes(dev, state);
> + * drm_atomic_helper_commit_planes(dev, state);
> + * drm_atomic_helper_commit_post_planes(dev, state);
> + * drm_atomic_helper_wait_for_vblanks(dev, state);
> + * drm_atomic_helper_cleanup_planes(dev, state);
> + * drm_atomic_state_free(state);
> + *
> + * once we have full atomic modeset. For now, just manually update
> + * plane states to avoid clobbering good states with dummy states
> + * while nuclear pageflipping.
> + */
> + for (i = 0; i < dev->mode_config.num_total_plane; i++) {
> + struct drm_plane *plane = state->planes[i];
> +
> + if (!plane)
> + continue;
> +
> + plane->state->state = state;
> + swap(state->plane_states[i], plane->state);
> + plane->state->state = NULL;
> + }
> + drm_atomic_helper_commit_planes(dev, state);
> + drm_atomic_helper_wait_for_vblanks(dev, state);
> + drm_atomic_helper_cleanup_planes(dev, state);
> + drm_atomic_state_free(state);
> +
> + return 0;
> +}
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 50ae3b1..0e18879 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12681,6 +12681,8 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
> static const struct drm_mode_config_funcs intel_mode_funcs = {
> .fb_create = intel_user_framebuffer_create,
> .output_poll_changed = intel_fbdev_output_poll_changed,
> + .atomic_check = intel_atomic_check,
> + .atomic_commit = intel_atomic_commit,
> };
>
> /* Set up chip specific display functions */
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 2d9e9a4..503e2f2 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1261,6 +1261,13 @@ void intel_pre_disable_primary(struct drm_crtc *crtc);
> void intel_tv_init(struct drm_device *dev);
>
> /* intel_atomic.c */
> +int intel_atomic_check(struct drm_device *dev,
> + struct drm_atomic_state *state);
> +int intel_atomic_commit(struct drm_device *dev,
> + struct drm_atomic_state *state,
> + bool async);
> +
> +/* intel_atomic_plane.c */
> struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
> void intel_plane_destroy_state(struct drm_plane *plane,
> struct drm_plane_state *state);
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 09/13] drm/i915: Setup dummy atomic state for connectors
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
` (7 preceding siblings ...)
2015-01-20 3:57 ` [PATCH 08/13] drm/i915: Add main atomic entrypoints Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-21 18:21 ` Ander Conselvan de Oliveira
2015-01-20 3:57 ` [PATCH 10/13] drm/i915: Set connector state destruction handler Matt Roper
` (3 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
We want to enable/test plane updates via the atomic interface, but as
soon as we flip DRIVER_ATOMIC on, the DRM core will take some atomic
codepaths to lookup properties during drmModeGetConnector() and some of
those codepaths unconditionally dereference connector->state
(specifically when looking up the CRTC ID property in
drm_atomic_connector_get_property()). Create a dummy connector state
for each connector at init time to ensure the DRM core doesn't try to
dereference a NULL connector->state. The actual connector properties
will never be updated or contain useful information, but since we're
doing this specifically for testing/debug of the plane operations (and
only when a specific kernel module option is given), that shouldn't
really matter.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0e18879..82defd3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12368,6 +12368,7 @@ static void intel_setup_outputs(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_encoder *encoder;
+ struct drm_connector *connector;
bool dpd_is_edp = false;
intel_lvds_init(dev);
@@ -12498,6 +12499,33 @@ static void intel_setup_outputs(struct drm_device *dev)
if (SUPPORTS_TV(dev))
intel_tv_init(dev);
+ /*
+ * FIXME: We don't have full atomic support yet, but we want to be
+ * able to enable/test plane updates via the atomic interface in the
+ * meantime. However as soon as we flip DRIVER_ATOMIC on, the DRM core
+ * will take some atomic codepaths to lookup properties during
+ * drmModeGetConnector() that unconditionally dereference
+ * connector->state.
+ *
+ * We create a dummy connector state here for each connector to ensure
+ * the DRM core doesn't try to dereference a NULL connector->state.
+ * The actual connector properties will never be updated or contain
+ * useful information, but since we're doing this specifically for
+ * testing/debug of the plane operations (and only when a specific
+ * kernel module option is given), that shouldn't really matter.
+ *
+ * Once atomic support for crtc's + connectors lands, this loop should
+ * be removed since we'll be setting up real connector state, which
+ * will contain Intel-specific properties.
+ */
+ list_for_each_entry(connector,
+ &dev->mode_config.connector_list,
+ head) {
+ if (!WARN_ON(connector->state))
+ connector->state = kzalloc(sizeof(*connector->state),
+ GFP_KERNEL);
+ }
+
intel_psr_init(dev);
for_each_intel_encoder(dev, encoder) {
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 09/13] drm/i915: Setup dummy atomic state for connectors
2015-01-20 3:57 ` [PATCH 09/13] drm/i915: Setup dummy atomic state for connectors Matt Roper
@ 2015-01-21 18:21 ` Ander Conselvan de Oliveira
0 siblings, 0 replies; 22+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-21 18:21 UTC (permalink / raw)
To: Matt Roper, intel-gfx
On 01/20/2015 05:57 AM, Matt Roper wrote:
> We want to enable/test plane updates via the atomic interface, but as
> soon as we flip DRIVER_ATOMIC on, the DRM core will take some atomic
> codepaths to lookup properties during drmModeGetConnector() and some of
> those codepaths unconditionally dereference connector->state
> (specifically when looking up the CRTC ID property in
> drm_atomic_connector_get_property()). Create a dummy connector state
> for each connector at init time to ensure the DRM core doesn't try to
> dereference a NULL connector->state. The actual connector properties
> will never be updated or contain useful information, but since we're
> doing this specifically for testing/debug of the plane operations (and
> only when a specific kernel module option is given), that shouldn't
> really matter.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 0e18879..82defd3 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12368,6 +12368,7 @@ static void intel_setup_outputs(struct drm_device *dev)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_encoder *encoder;
> + struct drm_connector *connector;
> bool dpd_is_edp = false;
>
> intel_lvds_init(dev);
> @@ -12498,6 +12499,33 @@ static void intel_setup_outputs(struct drm_device *dev)
> if (SUPPORTS_TV(dev))
> intel_tv_init(dev);
>
> + /*
> + * FIXME: We don't have full atomic support yet, but we want to be
> + * able to enable/test plane updates via the atomic interface in the
> + * meantime. However as soon as we flip DRIVER_ATOMIC on, the DRM core
> + * will take some atomic codepaths to lookup properties during
> + * drmModeGetConnector() that unconditionally dereference
> + * connector->state.
> + *
> + * We create a dummy connector state here for each connector to ensure
> + * the DRM core doesn't try to dereference a NULL connector->state.
> + * The actual connector properties will never be updated or contain
> + * useful information, but since we're doing this specifically for
> + * testing/debug of the plane operations (and only when a specific
> + * kernel module option is given), that shouldn't really matter.
> + *
> + * Once atomic support for crtc's + connectors lands, this loop should
> + * be removed since we'll be setting up real connector state, which
> + * will contain Intel-specific properties.
> + */
> + list_for_each_entry(connector,
> + &dev->mode_config.connector_list,
> + head) {
> + if (!WARN_ON(connector->state))
> + connector->state = kzalloc(sizeof(*connector->state),
> + GFP_KERNEL);
> + }
> +
I think this will trigger a WARN in drm_connector_cleanup() on driver
unload, and we also leak the dummy state.
Also, I'm not sure if this changes the behaviour of
drm_mode_getconnector(), since now the call to
drm_connector_get_encoder() will always return NULL.
Ander
> intel_psr_init(dev);
>
> for_each_intel_encoder(dev, encoder) {
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 10/13] drm/i915: Set connector state destruction handler
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
` (8 preceding siblings ...)
2015-01-20 3:57 ` [PATCH 09/13] drm/i915: Setup dummy atomic state for connectors Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-21 18:24 ` Ander Conselvan de Oliveira
2015-01-20 3:57 ` [PATCH 11/13] drm/i915: Add atomic_get_property entrypoint for connectors Matt Roper
` (2 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
Once we start creating connector states, the DRM core will want to be
able to clean them up for us. Hook up the destruction entrypoint to the
core's helper.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/intel_crt.c | 2 ++
drivers/gpu/drm/i915/intel_dp.c | 2 ++
drivers/gpu/drm/i915/intel_dp_mst.c | 2 ++
drivers/gpu/drm/i915/intel_dsi.c | 2 ++
drivers/gpu/drm/i915/intel_dvo.c | 2 ++
drivers/gpu/drm/i915/intel_hdmi.c | 2 ++
drivers/gpu/drm/i915/intel_lvds.c | 2 ++
drivers/gpu/drm/i915/intel_sdvo.c | 2 ++
drivers/gpu/drm/i915/intel_tv.c | 2 ++
9 files changed, 18 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index bb55368..18ee41e 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -28,6 +28,7 @@
#include <linux/i2c.h>
#include <linux/slab.h>
#include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_edid.h>
@@ -792,6 +793,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = intel_crt_destroy,
.set_property = intel_crt_set_property,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index a8bc043..1a691a1 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -31,6 +31,7 @@
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_edid.h>
@@ -4402,6 +4403,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_dp_set_property,
.destroy = intel_dp_connector_destroy,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 0091a84..f86da0f 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -26,6 +26,7 @@
#include <drm/drmP.h>
#include "i915_drv.h"
#include "intel_drv.h"
+#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_edid.h>
@@ -314,6 +315,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_dp_mst_set_property,
.destroy = intel_dp_mst_connector_destroy,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static int intel_dp_mst_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 6620124..e9226ac 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -24,6 +24,7 @@
*/
#include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_edid.h>
#include <drm/i915_drm.h>
@@ -791,6 +792,7 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
.detect = intel_dsi_detect,
.destroy = intel_dsi_destroy,
.fill_modes = drm_helper_probe_single_connector_modes,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
void intel_dsi_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index 706ab99..1cf2e352 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -27,6 +27,7 @@
#include <linux/i2c.h>
#include <linux/slab.h>
#include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include "intel_drv.h"
#include <drm/i915_drm.h>
@@ -390,6 +391,7 @@ static const struct drm_connector_funcs intel_dvo_connector_funcs = {
.detect = intel_dvo_detect,
.destroy = intel_dvo_destroy,
.fill_modes = drm_helper_probe_single_connector_modes,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static const struct drm_connector_helper_funcs intel_dvo_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 200a0e7..b8fab8c 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -31,6 +31,7 @@
#include <linux/delay.h>
#include <linux/hdmi.h>
#include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_edid.h>
#include "intel_drv.h"
@@ -1615,6 +1616,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_hdmi_set_property,
.destroy = intel_hdmi_destroy,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index c7c6414..908bd42 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -32,6 +32,7 @@
#include <linux/i2c.h>
#include <linux/slab.h>
#include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_edid.h>
#include "intel_drv.h"
@@ -532,6 +533,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_lvds_set_property,
.destroy = intel_lvds_destroy,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static const struct drm_encoder_funcs intel_lvds_enc_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 5b8275b..ae00bf9 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -30,6 +30,7 @@
#include <linux/delay.h>
#include <linux/export.h>
#include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_edid.h>
#include "intel_drv.h"
@@ -2191,6 +2192,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_sdvo_set_property,
.destroy = intel_sdvo_destroy,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 10e7ebd..d450054 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -31,6 +31,7 @@
*/
#include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_edid.h>
#include "intel_drv.h"
@@ -1513,6 +1514,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
.destroy = intel_tv_destroy,
.set_property = intel_tv_set_property,
.fill_modes = drm_helper_probe_single_connector_modes,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 10/13] drm/i915: Set connector state destruction handler
2015-01-20 3:57 ` [PATCH 10/13] drm/i915: Set connector state destruction handler Matt Roper
@ 2015-01-21 18:24 ` Ander Conselvan de Oliveira
0 siblings, 0 replies; 22+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-21 18:24 UTC (permalink / raw)
To: Matt Roper, intel-gfx
Spoke too soon, this fix the warning I mentioned on the previous patch.
Perhaps it makes sense to squash this?
Ander
On 01/20/2015 05:57 AM, Matt Roper wrote:
> Once we start creating connector states, the DRM core will want to be
> able to clean them up for us. Hook up the destruction entrypoint to the
> core's helper.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
> drivers/gpu/drm/i915/intel_crt.c | 2 ++
> drivers/gpu/drm/i915/intel_dp.c | 2 ++
> drivers/gpu/drm/i915/intel_dp_mst.c | 2 ++
> drivers/gpu/drm/i915/intel_dsi.c | 2 ++
> drivers/gpu/drm/i915/intel_dvo.c | 2 ++
> drivers/gpu/drm/i915/intel_hdmi.c | 2 ++
> drivers/gpu/drm/i915/intel_lvds.c | 2 ++
> drivers/gpu/drm/i915/intel_sdvo.c | 2 ++
> drivers/gpu/drm/i915/intel_tv.c | 2 ++
> 9 files changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index bb55368..18ee41e 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -28,6 +28,7 @@
> #include <linux/i2c.h>
> #include <linux/slab.h>
> #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc.h>
> #include <drm/drm_crtc_helper.h>
> #include <drm/drm_edid.h>
> @@ -792,6 +793,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = {
> .fill_modes = drm_helper_probe_single_connector_modes,
> .destroy = intel_crt_destroy,
> .set_property = intel_crt_set_property,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index a8bc043..1a691a1 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -31,6 +31,7 @@
> #include <linux/notifier.h>
> #include <linux/reboot.h>
> #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc.h>
> #include <drm/drm_crtc_helper.h>
> #include <drm/drm_edid.h>
> @@ -4402,6 +4403,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
> .fill_modes = drm_helper_probe_single_connector_modes,
> .set_property = intel_dp_set_property,
> .destroy = intel_dp_connector_destroy,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = {
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 0091a84..f86da0f 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -26,6 +26,7 @@
> #include <drm/drmP.h>
> #include "i915_drv.h"
> #include "intel_drv.h"
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc_helper.h>
> #include <drm/drm_edid.h>
>
> @@ -314,6 +315,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
> .fill_modes = drm_helper_probe_single_connector_modes,
> .set_property = intel_dp_mst_set_property,
> .destroy = intel_dp_mst_connector_destroy,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> static int intel_dp_mst_get_modes(struct drm_connector *connector)
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 6620124..e9226ac 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -24,6 +24,7 @@
> */
>
> #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc.h>
> #include <drm/drm_edid.h>
> #include <drm/i915_drm.h>
> @@ -791,6 +792,7 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
> .detect = intel_dsi_detect,
> .destroy = intel_dsi_destroy,
> .fill_modes = drm_helper_probe_single_connector_modes,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> void intel_dsi_init(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> index 706ab99..1cf2e352 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -27,6 +27,7 @@
> #include <linux/i2c.h>
> #include <linux/slab.h>
> #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc.h>
> #include "intel_drv.h"
> #include <drm/i915_drm.h>
> @@ -390,6 +391,7 @@ static const struct drm_connector_funcs intel_dvo_connector_funcs = {
> .detect = intel_dvo_detect,
> .destroy = intel_dvo_destroy,
> .fill_modes = drm_helper_probe_single_connector_modes,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> static const struct drm_connector_helper_funcs intel_dvo_connector_helper_funcs = {
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 200a0e7..b8fab8c 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -31,6 +31,7 @@
> #include <linux/delay.h>
> #include <linux/hdmi.h>
> #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc.h>
> #include <drm/drm_edid.h>
> #include "intel_drv.h"
> @@ -1615,6 +1616,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
> .fill_modes = drm_helper_probe_single_connector_modes,
> .set_property = intel_hdmi_set_property,
> .destroy = intel_hdmi_destroy,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = {
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index c7c6414..908bd42 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -32,6 +32,7 @@
> #include <linux/i2c.h>
> #include <linux/slab.h>
> #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc.h>
> #include <drm/drm_edid.h>
> #include "intel_drv.h"
> @@ -532,6 +533,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
> .fill_modes = drm_helper_probe_single_connector_modes,
> .set_property = intel_lvds_set_property,
> .destroy = intel_lvds_destroy,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> static const struct drm_encoder_funcs intel_lvds_enc_funcs = {
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 5b8275b..ae00bf9 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -30,6 +30,7 @@
> #include <linux/delay.h>
> #include <linux/export.h>
> #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc.h>
> #include <drm/drm_edid.h>
> #include "intel_drv.h"
> @@ -2191,6 +2192,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
> .fill_modes = drm_helper_probe_single_connector_modes,
> .set_property = intel_sdvo_set_property,
> .destroy = intel_sdvo_destroy,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcs = {
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index 10e7ebd..d450054 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -31,6 +31,7 @@
> */
>
> #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc.h>
> #include <drm/drm_edid.h>
> #include "intel_drv.h"
> @@ -1513,6 +1514,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
> .destroy = intel_tv_destroy,
> .set_property = intel_tv_set_property,
> .fill_modes = drm_helper_probe_single_connector_modes,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 11/13] drm/i915: Add atomic_get_property entrypoint for connectors
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
` (9 preceding siblings ...)
2015-01-20 3:57 ` [PATCH 10/13] drm/i915: Set connector state destruction handler Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-20 3:57 ` [PATCH 12/13] drm/i915: Add crtc state duplication/destruction functions Matt Roper
2015-01-20 3:57 ` [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic Matt Roper
12 siblings, 0 replies; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
Even though we only support atomic plane updates at the moment, we still
need to add an .atomic_get_property() entrypoint for connectors before
we allow the driver to flip on the DRIVER_ATOMIC bit. As soon as that
bit gets set, the DRM core will start adding atomic connector properties
(in addition to the plane properties we care about at the moment), so we
need to be able to handle the new way the DRM core will interact with
us.
For simplicity, we just lookup driver-specific connector properties in
the usual shadow array maintained by the core. Once we get real atomic
modeset support for crtc's and planes, this code should be re-written to
pull the data out of crtc/connector state structures.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/intel_atomic.c | 38 +++++++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_crt.c | 1 +
drivers/gpu/drm/i915/intel_dp.c | 1 +
drivers/gpu/drm/i915/intel_dp_mst.c | 1 +
drivers/gpu/drm/i915/intel_drv.h | 4 ++++
drivers/gpu/drm/i915/intel_hdmi.c | 1 +
drivers/gpu/drm/i915/intel_lvds.c | 1 +
drivers/gpu/drm/i915/intel_sdvo.c | 1 +
drivers/gpu/drm/i915/intel_tv.c | 1 +
9 files changed, 49 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index 1542005..d44ff8f 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -159,3 +159,41 @@ int intel_atomic_commit(struct drm_device *dev,
return 0;
}
+
+/**
+ * intel_connector_atomic_get_property - fetch connector property value
+ * @connector: connector to fetch property for
+ * @state: state containing the property value
+ * @property: property to look up
+ * @val: pointer to write property value into
+ *
+ * The DRM core does not store shadow copies of properties for
+ * atomic-capable drivers. This entrypoint is used to fetch
+ * the current value of a driver-specific connector property.
+ */
+int
+intel_connector_atomic_get_property(struct drm_connector *connector,
+ const struct drm_connector_state *state,
+ struct drm_property *property,
+ uint64_t *val)
+{
+ int i;
+
+ /*
+ * TODO: We only have atomic modeset for planes at the moment, so the
+ * crtc/connector code isn't quite ready yet. Until it's ready,
+ * continue to look up all property values in the DRM's shadow copy
+ * in obj->properties->values[].
+ *
+ * When the crtc/connector state work matures, this function should
+ * be updated to read the values out of the state structure instead.
+ */
+ for (i = 0; i < connector->base.properties->count; i++) {
+ if (connector->base.properties->properties[i] == property) {
+ *val = connector->base.properties->values[i];
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 18ee41e..e66e17a 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -794,6 +794,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = {
.destroy = intel_crt_destroy,
.set_property = intel_crt_set_property,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
+ .atomic_get_property = intel_connector_atomic_get_property,
};
static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 1a691a1..b2b0f0b2 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4402,6 +4402,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
.force = intel_dp_force,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_dp_set_property,
+ .atomic_get_property = intel_connector_atomic_get_property,
.destroy = intel_dp_connector_destroy,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index f86da0f..2856b0b 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -314,6 +314,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
.detect = intel_dp_mst_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_dp_mst_set_property,
+ .atomic_get_property = intel_connector_atomic_get_property,
.destroy = intel_dp_mst_connector_destroy,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 503e2f2..bfe241c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1266,6 +1266,10 @@ int intel_atomic_check(struct drm_device *dev,
int intel_atomic_commit(struct drm_device *dev,
struct drm_atomic_state *state,
bool async);
+int intel_connector_atomic_get_property(struct drm_connector *connector,
+ const struct drm_connector_state *state,
+ struct drm_property *property,
+ uint64_t *val);
/* intel_atomic_plane.c */
struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index b8fab8c..995c5b2 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1615,6 +1615,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
.force = intel_hdmi_force,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_hdmi_set_property,
+ .atomic_get_property = intel_connector_atomic_get_property,
.destroy = intel_hdmi_destroy,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 908bd42..071b96d 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -532,6 +532,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
.detect = intel_lvds_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_lvds_set_property,
+ .atomic_get_property = intel_connector_atomic_get_property,
.destroy = intel_lvds_destroy,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index ae00bf9..64ad2b4 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2191,6 +2191,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
.detect = intel_sdvo_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = intel_sdvo_set_property,
+ .atomic_get_property = intel_connector_atomic_get_property,
.destroy = intel_sdvo_destroy,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index d450054..892d23c 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1513,6 +1513,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
.detect = intel_tv_detect,
.destroy = intel_tv_destroy,
.set_property = intel_tv_set_property,
+ .atomic_get_property = intel_connector_atomic_get_property,
.fill_modes = drm_helper_probe_single_connector_modes,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 12/13] drm/i915: Add crtc state duplication/destruction functions
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
` (10 preceding siblings ...)
2015-01-20 3:57 ` [PATCH 11/13] drm/i915: Add atomic_get_property entrypoint for connectors Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-20 3:57 ` [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic Matt Roper
12 siblings, 0 replies; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
The atomic helpers need these to prepare a new state object when
starting a new atomic operation.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/intel_atomic.c | 35 +++++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_display.c | 2 ++
drivers/gpu/drm/i915/intel_drv.h | 3 +++
3 files changed, 40 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index d44ff8f..9be1f16 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -197,3 +197,38 @@ intel_connector_atomic_get_property(struct drm_connector *connector,
return -EINVAL;
}
+
+/*
+ * intel_crtc_duplicate_state - duplicate crtc state
+ * @crtc: drm crtc
+ *
+ * Allocates and returns a copy of the crtc state (both common and
+ * Intel-specific) for the specified crtc.
+ *
+ * Returns: The newly allocated crtc state, or NULL on failure.
+ */
+struct drm_crtc_state *
+intel_crtc_duplicate_state(struct drm_crtc *crtc)
+{
+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+ if (WARN_ON(!intel_crtc->config))
+ return kzalloc(sizeof(*intel_crtc->config), GFP_KERNEL);
+
+ return kmemdup(intel_crtc->config, sizeof(*intel_crtc->config),
+ GFP_KERNEL);
+}
+
+/**
+ * intel_crtc_destroy_state - destroy crtc state
+ * @crtc: drm crtc
+ *
+ * Destroys the crtc state (both common and Intel-specific) for the
+ * specified crtc.
+ */
+void
+intel_crtc_destroy_state(struct drm_crtc *crtc,
+ struct drm_crtc_state *state)
+{
+ drm_atomic_helper_crtc_destroy_state(crtc, state);
+}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 82defd3..567ea33 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11571,6 +11571,8 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {
.set_config = intel_crtc_set_config,
.destroy = intel_crtc_destroy,
.page_flip = intel_crtc_page_flip,
+ .atomic_duplicate_state = intel_crtc_duplicate_state,
+ .atomic_destroy_state = intel_crtc_destroy_state,
};
static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index bfe241c..b84c12a 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1270,6 +1270,9 @@ int intel_connector_atomic_get_property(struct drm_connector *connector,
const struct drm_connector_state *state,
struct drm_property *property,
uint64_t *val);
+struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
+void intel_crtc_destroy_state(struct drm_crtc *crtc,
+ struct drm_crtc_state *state);
/* intel_atomic_plane.c */
struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic
2015-01-20 3:57 [PATCH 00/13] i915 nuclear pageflip Matt Roper
` (11 preceding siblings ...)
2015-01-20 3:57 ` [PATCH 12/13] drm/i915: Add crtc state duplication/destruction functions Matt Roper
@ 2015-01-20 3:57 ` Matt Roper
2015-01-20 10:17 ` Daniel Vetter
2015-01-21 18:44 ` Ander Conselvan de Oliveira
12 siblings, 2 replies; 22+ messages in thread
From: Matt Roper @ 2015-01-20 3:57 UTC (permalink / raw)
To: intel-gfx
We don't have full atomic modeset support yet, but the "nuclear
pageflip" subset of functionality (i.e., plane operations only) should
be ready. Allow the user to force atomic on for debug purposes, or for
fixed-purpose embedded devices that will only use atomic for plane
updates.
The term 'nuclear' is used here instead of 'atomic' to make it clear
that this doesn't allow full atomic modeset support, just a (very
useful) subset of the atomic functionality.
We'll drop the kernel parameter and unconditionally enable atomic in a
future patch once all of the necessary pieces are in.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++++++
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/i915_params.c | 5 +++++
3 files changed, 18 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 308774f..173747a 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1642,6 +1642,18 @@ static int __init i915_init(void)
#endif
}
+ /*
+ * FIXME: We don't yet support full atomic modeset, just the plane
+ * operations subset (i.e., the "nuclear pageflip" functionality).
+ * Allow us to advertise atomic functionality when specifically
+ * requested on the kernel command line.
+ *
+ * We'll remove this module parameter and just advertise DRIVER_ATOMIC
+ * unconditionally once the rest of the atomic infrastructure is ready.
+ */
+ if (i915.nuclear)
+ driver.driver_features |= DRIVER_ATOMIC;
+
return drm_pci_init(&driver, &i915_pci_driver);
}
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1d55c94..b53564b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2445,6 +2445,7 @@ struct i915_params {
int use_mmio_flip;
bool mmio_debug;
bool verbose_state_checks;
+ bool nuclear;
};
extern struct i915_params i915 __read_mostly;
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index 07252d8..54ea182 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -52,6 +52,7 @@ struct i915_params i915 __read_mostly = {
.use_mmio_flip = 0,
.mmio_debug = 0,
.verbose_state_checks = 1,
+ .nuclear = 0,
};
module_param_named(modeset, i915.modeset, int, 0400);
@@ -178,3 +179,7 @@ MODULE_PARM_DESC(mmio_debug,
module_param_named(verbose_state_checks, i915.verbose_state_checks, bool, 0600);
MODULE_PARM_DESC(verbose_state_checks,
"Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
+
+module_param_named(nuclear, i915.nuclear, bool, 0600);
+MODULE_PARM_DESC(nuclear,
+ "Force atomic modeset functionality; only planes work for now (default: false).");
--
1.8.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic
2015-01-20 3:57 ` [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic Matt Roper
@ 2015-01-20 10:17 ` Daniel Vetter
2015-01-20 14:22 ` Jani Nikula
2015-01-21 18:44 ` Ander Conselvan de Oliveira
1 sibling, 1 reply; 22+ messages in thread
From: Daniel Vetter @ 2015-01-20 10:17 UTC (permalink / raw)
To: Matt Roper; +Cc: intel-gfx
On Mon, Jan 19, 2015 at 07:57:46PM -0800, Matt Roper wrote:
> We don't have full atomic modeset support yet, but the "nuclear
> pageflip" subset of functionality (i.e., plane operations only) should
> be ready. Allow the user to force atomic on for debug purposes, or for
> fixed-purpose embedded devices that will only use atomic for plane
> updates.
>
> The term 'nuclear' is used here instead of 'atomic' to make it clear
> that this doesn't allow full atomic modeset support, just a (very
> useful) subset of the atomic functionality.
>
> We'll drop the kernel parameter and unconditionally enable atomic in a
> future patch once all of the necessary pieces are in.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++++++
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/i915_params.c | 5 +++++
> 3 files changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 308774f..173747a 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1642,6 +1642,18 @@ static int __init i915_init(void)
> #endif
> }
>
> + /*
> + * FIXME: We don't yet support full atomic modeset, just the plane
> + * operations subset (i.e., the "nuclear pageflip" functionality).
> + * Allow us to advertise atomic functionality when specifically
> + * requested on the kernel command line.
> + *
> + * We'll remove this module parameter and just advertise DRIVER_ATOMIC
> + * unconditionally once the rest of the atomic infrastructure is ready.
> + */
Imo self-explanatory comment (if you do the suggestion below).
> + if (i915.nuclear)
> + driver.driver_features |= DRIVER_ATOMIC;
> +
> return drm_pci_init(&driver, &i915_pci_driver);
> }
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1d55c94..b53564b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2445,6 +2445,7 @@ struct i915_params {
> int use_mmio_flip;
> bool mmio_debug;
> bool verbose_state_checks;
> + bool nuclear;
> };
> extern struct i915_params i915 __read_mostly;
>
> diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
> index 07252d8..54ea182 100644
> --- a/drivers/gpu/drm/i915/i915_params.c
> +++ b/drivers/gpu/drm/i915/i915_params.c
> @@ -52,6 +52,7 @@ struct i915_params i915 __read_mostly = {
> .use_mmio_flip = 0,
> .mmio_debug = 0,
> .verbose_state_checks = 1,
> + .nuclear = 0,
> };
>
> module_param_named(modeset, i915.modeset, int, 0400);
> @@ -178,3 +179,7 @@ MODULE_PARM_DESC(mmio_debug,
> module_param_named(verbose_state_checks, i915.verbose_state_checks, bool, 0600);
> MODULE_PARM_DESC(verbose_state_checks,
> "Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
> +
> +module_param_named(nuclear, i915.nuclear, bool, 0600);
module_param_named_debug please.
-Daniel
> +MODULE_PARM_DESC(nuclear,
> + "Force atomic modeset functionality; only planes work for now (default: false).");
> --
> 1.8.5.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic
2015-01-20 10:17 ` Daniel Vetter
@ 2015-01-20 14:22 ` Jani Nikula
0 siblings, 0 replies; 22+ messages in thread
From: Jani Nikula @ 2015-01-20 14:22 UTC (permalink / raw)
To: Daniel Vetter, Matt Roper; +Cc: intel-gfx
On Tue, 20 Jan 2015, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Jan 19, 2015 at 07:57:46PM -0800, Matt Roper wrote:
>> +module_param_named(nuclear, i915.nuclear, bool, 0600);
>
> module_param_named_debug please.
ITYM module_param_named_unsafe.
BR,
Jani.
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic
2015-01-20 3:57 ` [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic Matt Roper
2015-01-20 10:17 ` Daniel Vetter
@ 2015-01-21 18:44 ` Ander Conselvan de Oliveira
1 sibling, 0 replies; 22+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-21 18:44 UTC (permalink / raw)
To: Matt Roper, intel-gfx
On 01/20/2015 05:57 AM, Matt Roper wrote:
> We don't have full atomic modeset support yet, but the "nuclear
> pageflip" subset of functionality (i.e., plane operations only) should
> be ready. Allow the user to force atomic on for debug purposes, or for
> fixed-purpose embedded devices that will only use atomic for plane
> updates.
>
> The term 'nuclear' is used here instead of 'atomic' to make it clear
> that this doesn't allow full atomic modeset support, just a (very
> useful) subset of the atomic functionality.
Can we make that i915.nuclear_pageflip instead? I think it should make
it more clear.
Cheers,
Ander
> We'll drop the kernel parameter and unconditionally enable atomic in a
> future patch once all of the necessary pieces are in.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++++++
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/i915_params.c | 5 +++++
> 3 files changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 308774f..173747a 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1642,6 +1642,18 @@ static int __init i915_init(void)
> #endif
> }
>
> + /*
> + * FIXME: We don't yet support full atomic modeset, just the plane
> + * operations subset (i.e., the "nuclear pageflip" functionality).
> + * Allow us to advertise atomic functionality when specifically
> + * requested on the kernel command line.
> + *
> + * We'll remove this module parameter and just advertise DRIVER_ATOMIC
> + * unconditionally once the rest of the atomic infrastructure is ready.
> + */
> + if (i915.nuclear)
> + driver.driver_features |= DRIVER_ATOMIC;
> +
> return drm_pci_init(&driver, &i915_pci_driver);
> }
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1d55c94..b53564b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2445,6 +2445,7 @@ struct i915_params {
> int use_mmio_flip;
> bool mmio_debug;
> bool verbose_state_checks;
> + bool nuclear;
> };
> extern struct i915_params i915 __read_mostly;
>
> diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
> index 07252d8..54ea182 100644
> --- a/drivers/gpu/drm/i915/i915_params.c
> +++ b/drivers/gpu/drm/i915/i915_params.c
> @@ -52,6 +52,7 @@ struct i915_params i915 __read_mostly = {
> .use_mmio_flip = 0,
> .mmio_debug = 0,
> .verbose_state_checks = 1,
> + .nuclear = 0,
> };
>
> module_param_named(modeset, i915.modeset, int, 0400);
> @@ -178,3 +179,7 @@ MODULE_PARM_DESC(mmio_debug,
> module_param_named(verbose_state_checks, i915.verbose_state_checks, bool, 0600);
> MODULE_PARM_DESC(verbose_state_checks,
> "Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
> +
> +module_param_named(nuclear, i915.nuclear, bool, 0600);
> +MODULE_PARM_DESC(nuclear,
> + "Force atomic modeset functionality; only planes work for now (default: false).");
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread