Skip to content

Commit b146e3e

Browse files
committed
drm/tegra: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()
Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. For the fbdev case a manual drm_get_format_info() lookup is needed. Cc: Thierry Reding <[email protected]> Cc: Mikko Perttunen <[email protected]> Cc: [email protected] Reviewed-by: Thomas Zimmermann <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 1506b10 commit b146e3e

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

drivers/gpu/drm/tegra/drm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer);
185185
int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer,
186186
struct tegra_bo_tiling *tiling);
187187
struct drm_framebuffer *tegra_fb_alloc(struct drm_device *drm,
188+
const struct drm_format_info *info,
188189
const struct drm_mode_fb_cmd2 *mode_cmd,
189190
struct tegra_bo **planes,
190191
unsigned int num_planes);

drivers/gpu/drm/tegra/fb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ static const struct drm_framebuffer_funcs tegra_fb_funcs = {
102102
};
103103

104104
struct drm_framebuffer *tegra_fb_alloc(struct drm_device *drm,
105+
const struct drm_format_info *info,
105106
const struct drm_mode_fb_cmd2 *mode_cmd,
106107
struct tegra_bo **planes,
107108
unsigned int num_planes)
@@ -114,7 +115,7 @@ struct drm_framebuffer *tegra_fb_alloc(struct drm_device *drm,
114115
if (!fb)
115116
return ERR_PTR(-ENOMEM);
116117

117-
drm_helper_mode_fill_fb_struct(drm, fb, NULL, mode_cmd);
118+
drm_helper_mode_fill_fb_struct(drm, fb, info, mode_cmd);
118119

119120
for (i = 0; i < fb->format->num_planes; i++)
120121
fb->obj[i] = &planes[i]->gem;
@@ -166,7 +167,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
166167
planes[i] = to_tegra_bo(gem);
167168
}
168169

169-
fb = tegra_fb_alloc(drm, cmd, planes, i);
170+
fb = tegra_fb_alloc(drm, info, cmd, planes, i);
170171
if (IS_ERR(fb)) {
171172
err = PTR_ERR(fb);
172173
goto unreference;

drivers/gpu/drm/tegra/fbdev.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ int tegra_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
106106
return PTR_ERR(info);
107107
}
108108

109-
fb = tegra_fb_alloc(drm, &cmd, &bo, 1);
109+
fb = tegra_fb_alloc(drm,
110+
drm_get_format_info(drm, cmd.pixel_format, cmd.modifier[0]),
111+
&cmd, &bo, 1);
110112
if (IS_ERR(fb)) {
111113
err = PTR_ERR(fb);
112114
dev_err(drm->dev, "failed to allocate DRM framebuffer: %d\n",

0 commit comments

Comments
 (0)