提交 580503c7 编写于 作者: V Ville Syrjälä

drm/i915: Pass dev_priv to plane constructors

Unify our approach to things by passing around dev_priv instead of dev.
Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1477946245-14134-2-git-send-email-ville.syrjala@linux.intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
上级 07c9a21a
...@@ -185,7 +185,7 @@ enum plane { ...@@ -185,7 +185,7 @@ enum plane {
}; };
#define plane_name(p) ((p) + 'A') #define plane_name(p) ((p) + 'A')
#define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 'A') #define sprite_name(p, s) ((p) * INTEL_INFO(dev_priv)->num_sprites[(p)] + (s) + 'A')
enum port { enum port {
PORT_NONE = -1, PORT_NONE = -1,
......
...@@ -14960,9 +14960,8 @@ const struct drm_plane_funcs intel_plane_funcs = { ...@@ -14960,9 +14960,8 @@ const struct drm_plane_funcs intel_plane_funcs = {
}; };
static struct intel_plane * static struct intel_plane *
intel_primary_plane_create(struct drm_device *dev, enum pipe pipe) intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
{ {
struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_plane *primary = NULL; struct intel_plane *primary = NULL;
struct intel_plane_state *state = NULL; struct intel_plane_state *state = NULL;
const uint32_t *intel_primary_formats; const uint32_t *intel_primary_formats;
...@@ -14986,7 +14985,7 @@ intel_primary_plane_create(struct drm_device *dev, enum pipe pipe) ...@@ -14986,7 +14985,7 @@ intel_primary_plane_create(struct drm_device *dev, enum pipe pipe)
primary->can_scale = false; primary->can_scale = false;
primary->max_downscale = 1; primary->max_downscale = 1;
if (INTEL_INFO(dev)->gen >= 9) { if (INTEL_GEN(dev_priv) >= 9) {
primary->can_scale = true; primary->can_scale = true;
state->scaler_id = -1; state->scaler_id = -1;
} }
...@@ -14994,10 +14993,10 @@ intel_primary_plane_create(struct drm_device *dev, enum pipe pipe) ...@@ -14994,10 +14993,10 @@ intel_primary_plane_create(struct drm_device *dev, enum pipe pipe)
primary->plane = pipe; primary->plane = pipe;
primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe); primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe);
primary->check_plane = intel_check_primary_plane; primary->check_plane = intel_check_primary_plane;
if (HAS_FBC(dev) && INTEL_INFO(dev)->gen < 4) if (HAS_FBC(dev_priv) && INTEL_GEN(dev_priv) < 4)
primary->plane = !pipe; primary->plane = !pipe;
if (INTEL_INFO(dev)->gen >= 9) { if (INTEL_GEN(dev_priv) >= 9) {
intel_primary_formats = skl_primary_formats; intel_primary_formats = skl_primary_formats;
num_formats = ARRAY_SIZE(skl_primary_formats); num_formats = ARRAY_SIZE(skl_primary_formats);
...@@ -15009,7 +15008,7 @@ intel_primary_plane_create(struct drm_device *dev, enum pipe pipe) ...@@ -15009,7 +15008,7 @@ intel_primary_plane_create(struct drm_device *dev, enum pipe pipe)
primary->update_plane = ironlake_update_primary_plane; primary->update_plane = ironlake_update_primary_plane;
primary->disable_plane = i9xx_disable_primary_plane; primary->disable_plane = i9xx_disable_primary_plane;
} else if (INTEL_INFO(dev)->gen >= 4) { } else if (INTEL_GEN(dev_priv) >= 4) {
intel_primary_formats = i965_primary_formats; intel_primary_formats = i965_primary_formats;
num_formats = ARRAY_SIZE(i965_primary_formats); num_formats = ARRAY_SIZE(i965_primary_formats);
...@@ -15023,21 +15022,21 @@ intel_primary_plane_create(struct drm_device *dev, enum pipe pipe) ...@@ -15023,21 +15022,21 @@ intel_primary_plane_create(struct drm_device *dev, enum pipe pipe)
primary->disable_plane = i9xx_disable_primary_plane; primary->disable_plane = i9xx_disable_primary_plane;
} }
if (INTEL_INFO(dev)->gen >= 9) if (INTEL_GEN(dev_priv) >= 9)
ret = drm_universal_plane_init(dev, &primary->base, 0, ret = drm_universal_plane_init(&dev_priv->drm, &primary->base,
&intel_plane_funcs, 0, &intel_plane_funcs,
intel_primary_formats, num_formats, intel_primary_formats, num_formats,
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
"plane 1%c", pipe_name(pipe)); "plane 1%c", pipe_name(pipe));
else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv)) else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
ret = drm_universal_plane_init(dev, &primary->base, 0, ret = drm_universal_plane_init(&dev_priv->drm, &primary->base,
&intel_plane_funcs, 0, &intel_plane_funcs,
intel_primary_formats, num_formats, intel_primary_formats, num_formats,
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
"primary %c", pipe_name(pipe)); "primary %c", pipe_name(pipe));
else else
ret = drm_universal_plane_init(dev, &primary->base, 0, ret = drm_universal_plane_init(&dev_priv->drm, &primary->base,
&intel_plane_funcs, 0, &intel_plane_funcs,
intel_primary_formats, num_formats, intel_primary_formats, num_formats,
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
"plane %c", plane_name(primary->plane)); "plane %c", plane_name(primary->plane));
...@@ -15165,9 +15164,8 @@ intel_update_cursor_plane(struct drm_plane *plane, ...@@ -15165,9 +15164,8 @@ intel_update_cursor_plane(struct drm_plane *plane,
} }
static struct intel_plane * static struct intel_plane *
intel_cursor_plane_create(struct drm_device *dev, enum pipe pipe) intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
{ {
struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_plane *cursor = NULL; struct intel_plane *cursor = NULL;
struct intel_plane_state *state = NULL; struct intel_plane_state *state = NULL;
int ret; int ret;
...@@ -15195,8 +15193,8 @@ intel_cursor_plane_create(struct drm_device *dev, enum pipe pipe) ...@@ -15195,8 +15193,8 @@ intel_cursor_plane_create(struct drm_device *dev, enum pipe pipe)
cursor->update_plane = intel_update_cursor_plane; cursor->update_plane = intel_update_cursor_plane;
cursor->disable_plane = intel_disable_cursor_plane; cursor->disable_plane = intel_disable_cursor_plane;
ret = drm_universal_plane_init(dev, &cursor->base, 0, ret = drm_universal_plane_init(&dev_priv->drm, &cursor->base,
&intel_plane_funcs, 0, &intel_plane_funcs,
intel_cursor_formats, intel_cursor_formats,
ARRAY_SIZE(intel_cursor_formats), ARRAY_SIZE(intel_cursor_formats),
DRM_PLANE_TYPE_CURSOR, DRM_PLANE_TYPE_CURSOR,
...@@ -15210,7 +15208,7 @@ intel_cursor_plane_create(struct drm_device *dev, enum pipe pipe) ...@@ -15210,7 +15208,7 @@ intel_cursor_plane_create(struct drm_device *dev, enum pipe pipe)
DRM_ROTATE_0 | DRM_ROTATE_0 |
DRM_ROTATE_180); DRM_ROTATE_180);
if (INTEL_INFO(dev)->gen >=9) if (INTEL_GEN(dev_priv) >= 9)
state->scaler_id = -1; state->scaler_id = -1;
drm_plane_helper_add(&cursor->base, &intel_plane_helper_funcs); drm_plane_helper_add(&cursor->base, &intel_plane_helper_funcs);
...@@ -15272,7 +15270,7 @@ static int intel_crtc_init(struct drm_device *dev, enum pipe pipe) ...@@ -15272,7 +15270,7 @@ static int intel_crtc_init(struct drm_device *dev, enum pipe pipe)
skl_init_scalers(dev, intel_crtc, crtc_state); skl_init_scalers(dev, intel_crtc, crtc_state);
} }
primary = intel_primary_plane_create(dev, pipe); primary = intel_primary_plane_create(dev_priv, pipe);
if (IS_ERR(primary)) { if (IS_ERR(primary)) {
ret = PTR_ERR(primary); ret = PTR_ERR(primary);
goto fail; goto fail;
...@@ -15281,14 +15279,14 @@ static int intel_crtc_init(struct drm_device *dev, enum pipe pipe) ...@@ -15281,14 +15279,14 @@ static int intel_crtc_init(struct drm_device *dev, enum pipe pipe)
for_each_sprite(dev_priv, pipe, sprite) { for_each_sprite(dev_priv, pipe, sprite) {
struct intel_plane *plane; struct intel_plane *plane;
plane = intel_sprite_plane_create(dev, pipe, sprite); plane = intel_sprite_plane_create(dev_priv, pipe, sprite);
if (!plane) { if (!plane) {
ret = PTR_ERR(plane); ret = PTR_ERR(plane);
goto fail; goto fail;
} }
} }
cursor = intel_cursor_plane_create(dev, pipe); cursor = intel_cursor_plane_create(dev_priv, pipe);
if (!cursor) { if (!cursor) {
ret = PTR_ERR(cursor); ret = PTR_ERR(cursor);
goto fail; goto fail;
......
...@@ -1769,7 +1769,7 @@ bool intel_sdvo_init(struct drm_device *dev, ...@@ -1769,7 +1769,7 @@ bool intel_sdvo_init(struct drm_device *dev,
/* intel_sprite.c */ /* intel_sprite.c */
int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
int usecs); int usecs);
struct intel_plane *intel_sprite_plane_create(struct drm_device *dev, struct intel_plane *intel_sprite_plane_create(struct drm_i915_private *dev_priv,
enum pipe pipe, int plane); enum pipe pipe, int plane);
int intel_sprite_set_colorkey(struct drm_device *dev, void *data, int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
......
...@@ -1043,9 +1043,9 @@ static uint32_t skl_plane_formats[] = { ...@@ -1043,9 +1043,9 @@ static uint32_t skl_plane_formats[] = {
}; };
struct intel_plane * struct intel_plane *
intel_sprite_plane_create(struct drm_device *dev, enum pipe pipe, int plane) intel_sprite_plane_create(struct drm_i915_private *dev_priv,
enum pipe pipe, int plane)
{ {
struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_plane *intel_plane = NULL; struct intel_plane *intel_plane = NULL;
struct intel_plane_state *state = NULL; struct intel_plane_state *state = NULL;
unsigned long possible_crtcs; unsigned long possible_crtcs;
...@@ -1132,14 +1132,14 @@ intel_sprite_plane_create(struct drm_device *dev, enum pipe pipe, int plane) ...@@ -1132,14 +1132,14 @@ intel_sprite_plane_create(struct drm_device *dev, enum pipe pipe, int plane)
possible_crtcs = (1 << pipe); possible_crtcs = (1 << pipe);
if (INTEL_GEN(dev_priv) >= 9) if (INTEL_GEN(dev_priv) >= 9)
ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs, ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base,
&intel_plane_funcs, possible_crtcs, &intel_plane_funcs,
plane_formats, num_plane_formats, plane_formats, num_plane_formats,
DRM_PLANE_TYPE_OVERLAY, DRM_PLANE_TYPE_OVERLAY,
"plane %d%c", plane + 2, pipe_name(pipe)); "plane %d%c", plane + 2, pipe_name(pipe));
else else
ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs, ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base,
&intel_plane_funcs, possible_crtcs, &intel_plane_funcs,
plane_formats, num_plane_formats, plane_formats, num_plane_formats,
DRM_PLANE_TYPE_OVERLAY, DRM_PLANE_TYPE_OVERLAY,
"sprite %c", sprite_name(pipe, plane)); "sprite %c", sprite_name(pipe, plane));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册