Commit a3f913ca authored by Ville Syrjälä's avatar Ville Syrjälä

drm: Pass 'dev' to drm_helper_mode_fill_fb_struct()

Pass the drm_device to drm_helper_mode_fill_fb_struct() so that we can
populate fb->dev early. Will make it easier to use the fb before we
register it.

@@
identifier fb, mode_cmd;
@@
 void drm_helper_mode_fill_fb_struct(
+				     struct drm_device *dev,
				     struct drm_framebuffer *fb,
				     const struct drm_mode_fb_cmd2 *mode_cmd
				     );

@@
identifier fb, mode_cmd;
@@
 void drm_helper_mode_fill_fb_struct(
+				     struct drm_device *dev,
				     struct drm_framebuffer *fb,
				     const struct drm_mode_fb_cmd2 *mode_cmd
				     )
{ ... }

@@
function func;
identifier dev;
expression E1, E2;
@@
func(struct drm_device *dev, ...)
{
 ...
 drm_helper_mode_fill_fb_struct(
+				dev,
				E1, E2);
 ...
}

@@
expression E1, E2;
@@
 drm_helper_mode_fill_fb_struct(
+				dev,
				E1, E2);

v2: Rerun spatch due to code changes
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1481748539-18283-1-git-send-email-ville.syrjala@linux.intel.com
parent 2289b3e1
...@@ -508,7 +508,7 @@ amdgpu_framebuffer_init(struct drm_device *dev, ...@@ -508,7 +508,7 @@ amdgpu_framebuffer_init(struct drm_device *dev,
{ {
int ret; int ret;
rfb->obj = obj; rfb->obj = obj;
drm_helper_mode_fill_fb_struct(&rfb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd);
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
if (ret) { if (ret) {
rfb->obj = NULL; rfb->obj = NULL;
......
...@@ -81,7 +81,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev, ...@@ -81,7 +81,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
dfb->mod = config; dfb->mod = config;
dfb->obj = obj; dfb->obj = obj;
drm_helper_mode_fill_fb_struct(&dfb->fb, mode); drm_helper_mode_fill_fb_struct(dev, &dfb->fb, mode);
ret = drm_framebuffer_init(dev, &dfb->fb, &armada_fb_funcs); ret = drm_framebuffer_init(dev, &dfb->fb, &armada_fb_funcs);
if (ret) { if (ret) {
......
...@@ -313,7 +313,7 @@ int ast_framebuffer_init(struct drm_device *dev, ...@@ -313,7 +313,7 @@ int ast_framebuffer_init(struct drm_device *dev,
{ {
int ret; int ret;
drm_helper_mode_fill_fb_struct(&ast_fb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &ast_fb->base, mode_cmd);
ast_fb->obj = obj; ast_fb->obj = obj;
ret = drm_framebuffer_init(dev, &ast_fb->base, &ast_fb_funcs); ret = drm_framebuffer_init(dev, &ast_fb->base, &ast_fb_funcs);
if (ret) { if (ret) {
......
...@@ -484,7 +484,7 @@ int bochs_framebuffer_init(struct drm_device *dev, ...@@ -484,7 +484,7 @@ int bochs_framebuffer_init(struct drm_device *dev,
{ {
int ret; int ret;
drm_helper_mode_fill_fb_struct(&gfb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &gfb->base, mode_cmd);
gfb->obj = obj; gfb->obj = obj;
ret = drm_framebuffer_init(dev, &gfb->base, &bochs_fb_funcs); ret = drm_framebuffer_init(dev, &gfb->base, &bochs_fb_funcs);
if (ret) { if (ret) {
......
...@@ -34,7 +34,7 @@ int cirrus_framebuffer_init(struct drm_device *dev, ...@@ -34,7 +34,7 @@ int cirrus_framebuffer_init(struct drm_device *dev,
{ {
int ret; int ret;
drm_helper_mode_fill_fb_struct(&gfb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &gfb->base, mode_cmd);
gfb->obj = obj; gfb->obj = obj;
ret = drm_framebuffer_init(dev, &gfb->base, &cirrus_fb_funcs); ret = drm_framebuffer_init(dev, &gfb->base, &cirrus_fb_funcs);
if (ret) { if (ret) {
......
...@@ -147,7 +147,7 @@ static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev, ...@@ -147,7 +147,7 @@ static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev,
if (!fb_cma) if (!fb_cma)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
drm_helper_mode_fill_fb_struct(&fb_cma->fb, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &fb_cma->fb, mode_cmd);
for (i = 0; i < num_planes; i++) for (i = 0; i < num_planes; i++)
fb_cma->obj[i] = obj[i]; fb_cma->obj[i] = obj[i];
......
...@@ -68,7 +68,8 @@ EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head); ...@@ -68,7 +68,8 @@ EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head);
* This helper can be used in a drivers fb_create callback to pre-fill the fb's * This helper can be used in a drivers fb_create callback to pre-fill the fb's
* metadata fields. * metadata fields.
*/ */
void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
struct drm_framebuffer *fb,
const struct drm_mode_fb_cmd2 *mode_cmd) const struct drm_mode_fb_cmd2 *mode_cmd)
{ {
const struct drm_format_info *info; const struct drm_format_info *info;
......
...@@ -126,7 +126,7 @@ exynos_drm_framebuffer_init(struct drm_device *dev, ...@@ -126,7 +126,7 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
+ mode_cmd->offsets[i]; + mode_cmd->offsets[i];
} }
drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &exynos_fb->fb, mode_cmd);
ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs); ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs);
if (ret < 0) { if (ret < 0) {
......
...@@ -244,7 +244,7 @@ static int psb_framebuffer_init(struct drm_device *dev, ...@@ -244,7 +244,7 @@ static int psb_framebuffer_init(struct drm_device *dev,
if (mode_cmd->pitches[0] & 63) if (mode_cmd->pitches[0] & 63)
return -EINVAL; return -EINVAL;
drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &fb->base, mode_cmd);
fb->gtt = gt; fb->gtt = gt;
ret = drm_framebuffer_init(dev, &fb->base, &psb_fb_funcs); ret = drm_framebuffer_init(dev, &fb->base, &psb_fb_funcs);
if (ret) { if (ret) {
......
...@@ -512,7 +512,7 @@ hibmc_framebuffer_init(struct drm_device *dev, ...@@ -512,7 +512,7 @@ hibmc_framebuffer_init(struct drm_device *dev,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
drm_helper_mode_fill_fb_struct(&hibmc_fb->fb, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &hibmc_fb->fb, mode_cmd);
hibmc_fb->obj = obj; hibmc_fb->obj = obj;
ret = drm_framebuffer_init(dev, &hibmc_fb->fb, &hibmc_fb_funcs); ret = drm_framebuffer_init(dev, &hibmc_fb->fb, &hibmc_fb_funcs);
if (ret) { if (ret) {
......
...@@ -15877,7 +15877,7 @@ static int intel_framebuffer_init(struct drm_device *dev, ...@@ -15877,7 +15877,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
if (mode_cmd->offsets[0] != 0) if (mode_cmd->offsets[0] != 0)
return -EINVAL; return -EINVAL;
drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &intel_fb->base, mode_cmd);
intel_fb->obj = obj; intel_fb->obj = obj;
ret = intel_fill_fb_info(dev_priv, &intel_fb->base); ret = intel_fill_fb_info(dev_priv, &intel_fb->base);
......
...@@ -82,7 +82,7 @@ static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev, ...@@ -82,7 +82,7 @@ static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,
if (!mtk_fb) if (!mtk_fb)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
drm_helper_mode_fill_fb_struct(&mtk_fb->base, mode); drm_helper_mode_fill_fb_struct(dev, &mtk_fb->base, mode);
mtk_fb->gem_obj = obj; mtk_fb->gem_obj = obj;
......
...@@ -34,7 +34,7 @@ int mgag200_framebuffer_init(struct drm_device *dev, ...@@ -34,7 +34,7 @@ int mgag200_framebuffer_init(struct drm_device *dev,
{ {
int ret; int ret;
drm_helper_mode_fill_fb_struct(&gfb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &gfb->base, mode_cmd);
gfb->obj = obj; gfb->obj = obj;
ret = drm_framebuffer_init(dev, &gfb->base, &mga_fb_funcs); ret = drm_framebuffer_init(dev, &gfb->base, &mga_fb_funcs);
if (ret) { if (ret) {
......
...@@ -217,7 +217,7 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, ...@@ -217,7 +217,7 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
msm_fb->planes[i] = bos[i]; msm_fb->planes[i] = bos[i];
} }
drm_helper_mode_fill_fb_struct(fb, mode_cmd); drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
ret = drm_framebuffer_init(dev, fb, &msm_framebuffer_funcs); ret = drm_framebuffer_init(dev, fb, &msm_framebuffer_funcs);
if (ret) { if (ret) {
......
...@@ -259,7 +259,7 @@ nouveau_framebuffer_new(struct drm_device *dev, ...@@ -259,7 +259,7 @@ nouveau_framebuffer_new(struct drm_device *dev,
if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL))) if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &fb->base, mode_cmd);
fb->nvbo = nvbo; fb->nvbo = nvbo;
ret = drm_framebuffer_init(dev, &fb->base, &nouveau_framebuffer_funcs); ret = drm_framebuffer_init(dev, &fb->base, &nouveau_framebuffer_funcs);
......
...@@ -457,7 +457,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, ...@@ -457,7 +457,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev,
plane->paddr = 0; plane->paddr = 0;
} }
drm_helper_mode_fill_fb_struct(fb, mode_cmd); drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
ret = drm_framebuffer_init(dev, fb, &omap_framebuffer_funcs); ret = drm_framebuffer_init(dev, fb, &omap_framebuffer_funcs);
if (ret) { if (ret) {
......
...@@ -629,7 +629,7 @@ qxl_framebuffer_init(struct drm_device *dev, ...@@ -629,7 +629,7 @@ qxl_framebuffer_init(struct drm_device *dev,
qfb->obj = NULL; qfb->obj = NULL;
return ret; return ret;
} }
drm_helper_mode_fill_fb_struct(&qfb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &qfb->base, mode_cmd);
return 0; return 0;
} }
......
...@@ -1327,7 +1327,7 @@ radeon_framebuffer_init(struct drm_device *dev, ...@@ -1327,7 +1327,7 @@ radeon_framebuffer_init(struct drm_device *dev,
{ {
int ret; int ret;
rfb->obj = obj; rfb->obj = obj;
drm_helper_mode_fill_fb_struct(&rfb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd);
ret = drm_framebuffer_init(dev, &rfb->base, &radeon_fb_funcs); ret = drm_framebuffer_init(dev, &rfb->base, &radeon_fb_funcs);
if (ret) { if (ret) {
rfb->obj = NULL; rfb->obj = NULL;
......
...@@ -92,7 +92,7 @@ rockchip_fb_alloc(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cm ...@@ -92,7 +92,7 @@ rockchip_fb_alloc(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cm
if (!rockchip_fb) if (!rockchip_fb)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
drm_helper_mode_fill_fb_struct(&rockchip_fb->fb, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &rockchip_fb->fb, mode_cmd);
for (i = 0; i < num_planes; i++) for (i = 0; i < num_planes; i++)
rockchip_fb->obj[i] = obj[i]; rockchip_fb->obj[i] = obj[i];
......
...@@ -114,7 +114,7 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm, ...@@ -114,7 +114,7 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm,
fb->num_planes = num_planes; fb->num_planes = num_planes;
drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd); drm_helper_mode_fill_fb_struct(drm, &fb->base, mode_cmd);
for (i = 0; i < fb->num_planes; i++) for (i = 0; i < fb->num_planes; i++)
fb->planes[i] = planes[i]; fb->planes[i] = planes[i];
......
...@@ -330,7 +330,7 @@ udl_framebuffer_init(struct drm_device *dev, ...@@ -330,7 +330,7 @@ udl_framebuffer_init(struct drm_device *dev,
int ret; int ret;
ufb->obj = obj; ufb->obj = obj;
drm_helper_mode_fill_fb_struct(&ufb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &ufb->base, mode_cmd);
ret = drm_framebuffer_init(dev, &ufb->base, &udlfb_funcs); ret = drm_framebuffer_init(dev, &ufb->base, &udlfb_funcs);
return ret; return ret;
} }
......
...@@ -93,7 +93,7 @@ virtio_gpu_framebuffer_init(struct drm_device *dev, ...@@ -93,7 +93,7 @@ virtio_gpu_framebuffer_init(struct drm_device *dev,
vgfb->obj = NULL; vgfb->obj = NULL;
return ret; return ret;
} }
drm_helper_mode_fill_fb_struct(&vgfb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &vgfb->base, mode_cmd);
spin_lock_init(&vgfb->dirty_lock); spin_lock_init(&vgfb->dirty_lock);
vgfb->x1 = vgfb->y1 = INT_MAX; vgfb->x1 = vgfb->y1 = INT_MAX;
......
...@@ -583,7 +583,7 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv, ...@@ -583,7 +583,7 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,
goto out_err1; goto out_err1;
} }
drm_helper_mode_fill_fb_struct(&vfbs->base.base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &vfbs->base.base, mode_cmd);
vfbs->surface = vmw_surface_reference(surface); vfbs->surface = vmw_surface_reference(surface);
vfbs->base.user_handle = mode_cmd->handles[0]; vfbs->base.user_handle = mode_cmd->handles[0];
vfbs->is_dmabuf_proxy = is_dmabuf_proxy; vfbs->is_dmabuf_proxy = is_dmabuf_proxy;
...@@ -864,7 +864,7 @@ static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv, ...@@ -864,7 +864,7 @@ static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv,
goto out_err1; goto out_err1;
} }
drm_helper_mode_fill_fb_struct(&vfbd->base.base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &vfbd->base.base, mode_cmd);
vfbd->base.dmabuf = true; vfbd->base.dmabuf = true;
vfbd->buffer = vmw_dmabuf_reference(dmabuf); vfbd->buffer = vmw_dmabuf_reference(dmabuf);
vfbd->base.user_handle = mode_cmd->handles[0]; vfbd->base.user_handle = mode_cmd->handles[0];
......
...@@ -27,7 +27,8 @@ ...@@ -27,7 +27,8 @@
void drm_helper_move_panel_connectors_to_head(struct drm_device *); void drm_helper_move_panel_connectors_to_head(struct drm_device *);
void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
struct drm_framebuffer *fb,
const struct drm_mode_fb_cmd2 *mode_cmd); const struct drm_mode_fb_cmd2 *mode_cmd);
int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
......
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