Commit 7221941c authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/plane: Remove drm_plane_init()

Open-code drm_plane_init() and remove the function from DRM. The
implementation of drm_plane_init() is a simple wrapper around a call
to drm_universal_plane_init(), so drivers can just use that instead.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Lyude Paul <lyude@redhat.com> # nouveau
Acked-by: default avatarJyri Sarha <jyri.sarha@iki.fi>
Link: https://patchwork.freedesktop.org/patch/msgid/20220909105947.6487-2-tzimmermann@suse.de
parent ee34b77f
...@@ -100,8 +100,7 @@ EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct); ...@@ -100,8 +100,7 @@ EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct);
* This is the minimal list of formats that seem to be safe for modeset use * This is the minimal list of formats that seem to be safe for modeset use
* with all current DRM drivers. Most hardware can actually support more * with all current DRM drivers. Most hardware can actually support more
* formats than this and drivers may specify a more accurate list when * formats than this and drivers may specify a more accurate list when
* creating the primary plane. However drivers that still call * creating the primary plane.
* drm_plane_init() will use this minimal format list as the default.
*/ */
static const uint32_t safe_modeset_formats[] = { static const uint32_t safe_modeset_formats[] = {
DRM_FORMAT_XRGB8888, DRM_FORMAT_XRGB8888,
......
...@@ -482,38 +482,6 @@ void drm_plane_unregister_all(struct drm_device *dev) ...@@ -482,38 +482,6 @@ void drm_plane_unregister_all(struct drm_device *dev)
} }
} }
/**
* drm_plane_init - Initialize a legacy plane
* @dev: DRM device
* @plane: plane object to init
* @possible_crtcs: bitmask of possible CRTCs
* @funcs: callbacks for the new plane
* @formats: array of supported formats (DRM_FORMAT\_\*)
* @format_count: number of elements in @formats
* @is_primary: plane type (primary vs overlay)
*
* Legacy API to initialize a DRM plane.
*
* New drivers should call drm_universal_plane_init() instead.
*
* Returns:
* Zero on success, error code on failure.
*/
int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
uint32_t possible_crtcs,
const struct drm_plane_funcs *funcs,
const uint32_t *formats, unsigned int format_count,
bool is_primary)
{
enum drm_plane_type type;
type = is_primary ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY;
return drm_universal_plane_init(dev, plane, possible_crtcs, funcs,
formats, format_count,
NULL, type, NULL);
}
EXPORT_SYMBOL(drm_plane_init);
/** /**
* drm_plane_cleanup - Clean up the core plane usage * drm_plane_cleanup - Clean up the core plane usage
* @plane: plane to cleanup * @plane: plane to cleanup
......
...@@ -296,9 +296,10 @@ nv10_overlay_init(struct drm_device *device) ...@@ -296,9 +296,10 @@ nv10_overlay_init(struct drm_device *device)
break; break;
} }
ret = drm_plane_init(device, &plane->base, 3 /* both crtc's */, ret = drm_universal_plane_init(device, &plane->base, 3 /* both crtc's */,
&nv10_plane_funcs, &nv10_plane_funcs,
formats, num_formats, false); formats, num_formats, NULL,
DRM_PLANE_TYPE_OVERLAY, NULL);
if (ret) if (ret)
goto err; goto err;
...@@ -475,9 +476,9 @@ nv04_overlay_init(struct drm_device *device) ...@@ -475,9 +476,9 @@ nv04_overlay_init(struct drm_device *device)
if (!plane) if (!plane)
return; return;
ret = drm_plane_init(device, &plane->base, 1 /* single crtc */, ret = drm_universal_plane_init(device, &plane->base, 1 /* single crtc */,
&nv04_plane_funcs, &nv04_plane_funcs, formats, 2, NULL,
formats, 2, false); DRM_PLANE_TYPE_OVERLAY, NULL);
if (ret) if (ret)
goto err; goto err;
......
...@@ -252,9 +252,10 @@ int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int index) ...@@ -252,9 +252,10 @@ int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int index)
splane->index = index; splane->index = index;
splane->alpha = 255; splane->alpha = 255;
ret = drm_plane_init(sdev->ddev, &splane->plane, 1, ret = drm_universal_plane_init(sdev->ddev, &splane->plane, 1,
&shmob_drm_plane_funcs, formats, &shmob_drm_plane_funcs,
ARRAY_SIZE(formats), false); formats, ARRAY_SIZE(formats), NULL,
DRM_PLANE_TYPE_OVERLAY, NULL);
return ret; return ret;
} }
...@@ -105,11 +105,10 @@ int tilcdc_plane_init(struct drm_device *dev, ...@@ -105,11 +105,10 @@ int tilcdc_plane_init(struct drm_device *dev,
struct tilcdc_drm_private *priv = dev->dev_private; struct tilcdc_drm_private *priv = dev->dev_private;
int ret; int ret;
ret = drm_plane_init(dev, plane, 1, ret = drm_universal_plane_init(dev, plane, 1, &tilcdc_plane_funcs,
&tilcdc_plane_funcs, priv->pixelformats,
priv->pixelformats, priv->num_pixelformats,
priv->num_pixelformats, NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
true);
if (ret) { if (ret) {
dev_err(dev->dev, "Failed to initialize plane: %d\n", ret); dev_err(dev->dev, "Failed to initialize plane: %d\n", ret);
return ret; return ret;
......
...@@ -631,7 +631,7 @@ struct drm_plane { ...@@ -631,7 +631,7 @@ struct drm_plane {
unsigned int format_count; unsigned int format_count;
/** /**
* @format_default: driver hasn't supplied supported formats for the * @format_default: driver hasn't supplied supported formats for the
* plane. Used by the drm_plane_init compatibility wrapper only. * plane. Used by the non-atomic driver compatibility wrapper only.
*/ */
bool format_default; bool format_default;
...@@ -762,12 +762,6 @@ int drm_universal_plane_init(struct drm_device *dev, ...@@ -762,12 +762,6 @@ int drm_universal_plane_init(struct drm_device *dev,
const uint64_t *format_modifiers, const uint64_t *format_modifiers,
enum drm_plane_type type, enum drm_plane_type type,
const char *name, ...); const char *name, ...);
int drm_plane_init(struct drm_device *dev,
struct drm_plane *plane,
uint32_t possible_crtcs,
const struct drm_plane_funcs *funcs,
const uint32_t *formats, unsigned int format_count,
bool is_primary);
void drm_plane_cleanup(struct drm_plane *plane); void drm_plane_cleanup(struct drm_plane *plane);
__printf(10, 11) __printf(10, 11)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment