drm/omap: remove omap_framebuffer_get_formats()
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 4 May 2017 08:27:49 +0000 (11:27 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 2 Jun 2017 07:57:25 +0000 (10:57 +0300)
We now get a fourcc array from dispc when asking for a plane's supported
pixel formats, so we can drop omap_framebuffer_get_formats() which was
used to convert between DSS and DRM pixel formats.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
drivers/gpu/drm/omapdrm/omap_drv.h
drivers/gpu/drm/omapdrm/omap_fb.c
drivers/gpu/drm/omapdrm/omap_plane.c

index d78b3ff94a077e675bf2c3fcc085a7427b9f1fce..ca087a993909b7d29574913fd667f6e8d6514ce2 100644 (file)
@@ -150,8 +150,6 @@ struct drm_encoder *omap_connector_attached_encoder(
                struct drm_connector *connector);
 bool omap_connector_get_hdmi_mode(struct drm_connector *connector);
 
-uint32_t omap_framebuffer_get_formats(uint32_t *pixel_formats,
-               uint32_t max_formats, const u32 *supported_modes);
 struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev,
                struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd);
 struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev,
index 9d5f6ad2059e5f61cbd926ce5e48a84a9feb714d..489d17ce8f11a32ccd26d45ce76f36201f2ecb00 100644 (file)
@@ -55,28 +55,6 @@ static const struct {
        { DRM_FORMAT_UYVY,        DRM_FORMAT_UYVY },
 };
 
-/* convert from overlay's pixel formats bitmask to an array of fourcc's */
-uint32_t omap_framebuffer_get_formats(uint32_t *pixel_formats,
-               uint32_t max_formats, const u32 *supported_modes)
-{
-       uint32_t nformats = 0;
-       int i = 0;
-
-       for (i = 0; i < ARRAY_SIZE(formats) && nformats < max_formats; i++) {
-               unsigned int t;
-
-               for (t = 0; supported_modes[t]; ++t) {
-                       if (supported_modes[t] != formats[i].dss_format)
-                               continue;
-
-                       pixel_formats[nformats++] = formats[i].pixel_format;
-                       break;
-               }
-       }
-
-       return nformats;
-}
-
 /* per-plane info for the fb: */
 struct plane {
        struct drm_gem_object *bo;
index 40747a625374387f7ccb9b861673453136184b2e..96c15e6d7397af3aade2a9b89336dda24f56ba95 100644 (file)
@@ -34,9 +34,6 @@ struct omap_plane {
        struct drm_plane base;
        enum omap_plane_id id;
        const char *name;
-
-       uint32_t nformats;
-       uint32_t formats[32];
 };
 
 static int omap_plane_prepare_fb(struct drm_plane *plane,
@@ -294,6 +291,8 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
        struct omap_plane *omap_plane;
        enum omap_plane_id id;
        int ret;
+       u32 nformats;
+       const u32 *formats;
 
        if (WARN_ON(idx >= ARRAY_SIZE(plane_idx_to_id)))
                return ERR_PTR(-EINVAL);
@@ -306,17 +305,17 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
        if (!omap_plane)
                return ERR_PTR(-ENOMEM);
 
-       omap_plane->nformats = omap_framebuffer_get_formats(
-                       omap_plane->formats, ARRAY_SIZE(omap_plane->formats),
-                       priv->dispc_ops->ovl_get_color_modes(id));
+       formats = priv->dispc_ops->ovl_get_color_modes(id);
+       for (nformats = 0; formats[nformats]; ++nformats)
+               ;
        omap_plane->id = id;
        omap_plane->name = plane_id_to_name[id];
 
        plane = &omap_plane->base;
 
        ret = drm_universal_plane_init(dev, plane, possible_crtcs,
-                                      &omap_plane_funcs, omap_plane->formats,
-                                      omap_plane->nformats, type, NULL);
+                                      &omap_plane_funcs, formats,
+                                      nformats, type, NULL);
        if (ret < 0)
                goto error;