* [PATCH 1/6] drm/msm: Do not declare msm_framebuffer_init() as static
2026-04-21 12:51 [PATCH 0/6] drm/msm: fbdev: Use client buffers Thomas Zimmermann
@ 2026-04-21 12:51 ` Thomas Zimmermann
2026-04-21 16:09 ` Dmitry Baryshkov
2026-04-21 12:51 ` [PATCH 2/6] drm/msm: fbdev: Inline msm_alloc_stolen_fb() Thomas Zimmermann
` (5 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Thomas Zimmermann @ 2026-04-21 12:51 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona
Cc: linux-arm-msm, dri-devel, freedreno, Thomas Zimmermann
Declare msm_framebuffer_init() in msm_drv.h and remove the static
qualifier. The function will be required in msm_fbdev.c after inlining
msm_alloc_stolen_fb().
Also move msm_framebuffer_init() before msm_framebuffer_create(), so
that it can later be made static again. Prepares msm's fbdev emulation
for using client buffers.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/msm/msm_drv.h | 4 ++
drivers/gpu/drm/msm/msm_fb.c | 72 +++++++++++++++++------------------
2 files changed, 39 insertions(+), 37 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 6d847d593f1a..efc901c9d8c2 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -259,6 +259,10 @@ void msm_framebuffer_cleanup(struct drm_framebuffer *fb, bool needed_dirtyfb);
uint32_t msm_framebuffer_iova(struct drm_framebuffer *fb, int plane);
struct drm_gem_object *msm_framebuffer_bo(struct drm_framebuffer *fb, int plane);
const struct msm_format *msm_framebuffer_format(struct drm_framebuffer *fb);
+struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
+ const struct drm_format_info *info,
+ const struct drm_mode_fb_cmd2 *mode_cmd,
+ struct drm_gem_object **bos);
struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
struct drm_file *file, const struct drm_format_info *info,
const struct drm_mode_fb_cmd2 *mode_cmd);
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index 9b681e144c07..d7523a0a866a 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -29,10 +29,6 @@ struct msm_framebuffer {
};
#define to_msm_framebuffer(x) container_of(x, struct msm_framebuffer, base)
-static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
- const struct drm_format_info *info,
- const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos);
-
static int msm_framebuffer_dirtyfb(struct drm_framebuffer *fb,
struct drm_file *file_priv, unsigned int flags,
unsigned int color, struct drm_clip_rect *clips,
@@ -139,39 +135,10 @@ const struct msm_format *msm_framebuffer_format(struct drm_framebuffer *fb)
return msm_fb->format;
}
-struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
- struct drm_file *file, const struct drm_format_info *info,
- const struct drm_mode_fb_cmd2 *mode_cmd)
-{
- struct drm_gem_object *bos[4] = {0};
- struct drm_framebuffer *fb;
- int ret, i, n = info->num_planes;
-
- for (i = 0; i < n; i++) {
- bos[i] = drm_gem_object_lookup(file, mode_cmd->handles[i]);
- if (!bos[i]) {
- ret = -ENXIO;
- goto out_unref;
- }
- }
-
- fb = msm_framebuffer_init(dev, info, mode_cmd, bos);
- if (IS_ERR(fb)) {
- ret = PTR_ERR(fb);
- goto out_unref;
- }
-
- return fb;
-
-out_unref:
- for (i = 0; i < n; i++)
- drm_gem_object_put(bos[i]);
- return ERR_PTR(ret);
-}
-
-static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
- const struct drm_format_info *info,
- const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos)
+struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
+ const struct drm_format_info *info,
+ const struct drm_mode_fb_cmd2 *mode_cmd,
+ struct drm_gem_object **bos)
{
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
@@ -251,6 +218,37 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
return ERR_PTR(ret);
}
+struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
+ struct drm_file *file,
+ const struct drm_format_info *info,
+ const struct drm_mode_fb_cmd2 *mode_cmd)
+{
+ struct drm_gem_object *bos[4] = {0};
+ struct drm_framebuffer *fb;
+ int ret, i, n = info->num_planes;
+
+ for (i = 0; i < n; i++) {
+ bos[i] = drm_gem_object_lookup(file, mode_cmd->handles[i]);
+ if (!bos[i]) {
+ ret = -ENXIO;
+ goto out_unref;
+ }
+ }
+
+ fb = msm_framebuffer_init(dev, info, mode_cmd, bos);
+ if (IS_ERR(fb)) {
+ ret = PTR_ERR(fb);
+ goto out_unref;
+ }
+
+ return fb;
+
+out_unref:
+ for (i = 0; i < n; i++)
+ drm_gem_object_put(bos[i]);
+ return ERR_PTR(ret);
+}
+
struct drm_framebuffer *
msm_alloc_stolen_fb(struct drm_device *dev, int w, int h, int p, uint32_t format)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 1/6] drm/msm: Do not declare msm_framebuffer_init() as static
2026-04-21 12:51 ` [PATCH 1/6] drm/msm: Do not declare msm_framebuffer_init() as static Thomas Zimmermann
@ 2026-04-21 16:09 ` Dmitry Baryshkov
0 siblings, 0 replies; 17+ messages in thread
From: Dmitry Baryshkov @ 2026-04-21 16:09 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
freedreno
On Tue, Apr 21, 2026 at 02:51:14PM +0200, Thomas Zimmermann wrote:
> Declare msm_framebuffer_init() in msm_drv.h and remove the static
> qualifier. The function will be required in msm_fbdev.c after inlining
> msm_alloc_stolen_fb().
>
> Also move msm_framebuffer_init() before msm_framebuffer_create(), so
> that it can later be made static again. Prepares msm's fbdev emulation
> for using client buffers.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/msm/msm_drv.h | 4 ++
> drivers/gpu/drm/msm/msm_fb.c | 72 +++++++++++++++++------------------
> 2 files changed, 39 insertions(+), 37 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/6] drm/msm: fbdev: Inline msm_alloc_stolen_fb()
2026-04-21 12:51 [PATCH 0/6] drm/msm: fbdev: Use client buffers Thomas Zimmermann
2026-04-21 12:51 ` [PATCH 1/6] drm/msm: Do not declare msm_framebuffer_init() as static Thomas Zimmermann
@ 2026-04-21 12:51 ` Thomas Zimmermann
2026-04-21 16:22 ` Dmitry Baryshkov
2026-04-21 12:51 ` [PATCH 3/6] drm/msm: fbdev: Fix error reporting Thomas Zimmermann
` (4 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Thomas Zimmermann @ 2026-04-21 12:51 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona
Cc: linux-arm-msm, dri-devel, freedreno, Thomas Zimmermann
Inline msm_alloc_stolen_fb() into its only caller. This is necessary
for converting fbdev emulation to use client buffers.
There are some minor changes:
- Handle errors for the non-stolen BO in the respective branch.
- Fill mode_cmd right before using it with msm_framebuffer_init(). Both
will later be replaced with client-buffer interfaces.
- Set the modifier[0] to DRM_FORMAT_MOD_LINEAR. No functional change.
- Integrate the error handling with the existing clean-up.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/msm/msm_drv.h | 2 --
drivers/gpu/drm/msm/msm_fb.c | 46 ---------------------------------
drivers/gpu/drm/msm/msm_fbdev.c | 44 +++++++++++++++++++++++++------
3 files changed, 36 insertions(+), 56 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index efc901c9d8c2..b3173fa4d222 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -266,8 +266,6 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
struct drm_file *file, const struct drm_format_info *info,
const struct drm_mode_fb_cmd2 *mode_cmd);
-struct drm_framebuffer * msm_alloc_stolen_fb(struct drm_device *dev,
- int w, int h, int p, uint32_t format);
#ifdef CONFIG_DRM_MSM_KMS_FBDEV
int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index d7523a0a866a..dec550e6cf75 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -6,7 +6,6 @@
#include <drm/drm_crtc.h>
#include <drm/drm_damage_helper.h>
-#include <drm/drm_file.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_framebuffer_helper.h>
@@ -248,48 +247,3 @@ struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
drm_gem_object_put(bos[i]);
return ERR_PTR(ret);
}
-
-struct drm_framebuffer *
-msm_alloc_stolen_fb(struct drm_device *dev, int w, int h, int p, uint32_t format)
-{
- struct drm_mode_fb_cmd2 mode_cmd = {
- .pixel_format = format,
- .width = w,
- .height = h,
- .pitches = { p },
- };
- struct drm_gem_object *bo;
- struct drm_framebuffer *fb;
- int size;
-
- /* allocate backing bo */
- size = mode_cmd.pitches[0] * mode_cmd.height;
- DBG("allocating %d bytes for fb %d", size, dev->primary->index);
- bo = msm_gem_new(dev, size, MSM_BO_SCANOUT | MSM_BO_WC | MSM_BO_STOLEN);
- if (IS_ERR(bo)) {
- dev_warn(dev->dev, "could not allocate stolen bo\n");
- /* try regular bo: */
- bo = msm_gem_new(dev, size, MSM_BO_SCANOUT | MSM_BO_WC);
- }
- if (IS_ERR(bo)) {
- DRM_DEV_ERROR(dev->dev, "failed to allocate buffer object\n");
- return ERR_CAST(bo);
- }
-
- msm_gem_object_set_name(bo, "stolenfb");
-
- fb = msm_framebuffer_init(dev,
- drm_get_format_info(dev, mode_cmd.pixel_format,
- mode_cmd.modifier[0]),
- &mode_cmd, &bo);
- if (IS_ERR(fb)) {
- DRM_DEV_ERROR(dev->dev, "failed to allocate fb\n");
- /* note: if fb creation failed, we can't rely on fb destroy
- * to unref the bo:
- */
- drm_gem_object_put(bo);
- return ERR_CAST(fb);
- }
-
- return fb;
-}
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index fd19995b12b5..a507f1de0c5d 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -9,6 +9,7 @@
#include <drm/drm_drv.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_helper.h>
+#include <drm/drm_file.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_prime.h>
@@ -92,11 +93,13 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
struct drm_device *dev = helper->dev;
struct msm_drm_private *priv = dev->dev_private;
struct fb_info *fbi = helper->info;
+ struct drm_mode_fb_cmd2 mode_cmd = { };
struct drm_framebuffer *fb = NULL;
struct drm_gem_object *bo;
uint64_t paddr;
uint32_t format;
int ret, pitch;
+ int size;
format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
@@ -105,16 +108,39 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
sizes->fb_width, sizes->fb_height);
pitch = align_pitch(sizes->surface_width, sizes->surface_bpp);
- fb = msm_alloc_stolen_fb(dev, sizes->surface_width,
- sizes->surface_height, pitch, format);
+ /* allocate backing bo */
+ size = pitch * sizes->surface_height;
+ DBG("allocating %d bytes for fb %d", size, dev->primary->index);
+ bo = msm_gem_new(dev, size, MSM_BO_SCANOUT | MSM_BO_WC | MSM_BO_STOLEN);
+ if (IS_ERR(bo)) {
+ dev_warn(dev->dev, "could not allocate stolen bo\n");
+ /* try regular bo: */
+ bo = msm_gem_new(dev, size, MSM_BO_SCANOUT | MSM_BO_WC);
+ if (IS_ERR(bo)) {
+ DRM_DEV_ERROR(dev->dev, "failed to allocate buffer object\n");
+ return PTR_ERR(bo);
+ }
+ }
+
+ msm_gem_object_set_name(bo, "stolenfb");
+
+ mode_cmd.pixel_format = format;
+ mode_cmd.width = sizes->surface_width;
+ mode_cmd.height = sizes->surface_height;
+ mode_cmd.pitches[0] = pitch;
+ mode_cmd.modifier[0] = DRM_FORMAT_MOD_LINEAR;
+
+ fb = msm_framebuffer_init(dev,
+ drm_get_format_info(dev, mode_cmd.pixel_format,
+ mode_cmd.modifier[0]),
+ &mode_cmd, &bo);
if (IS_ERR(fb)) {
DRM_DEV_ERROR(dev->dev, "failed to allocate fb\n");
- return PTR_ERR(fb);
+ ret = PTR_ERR(fb);
+ goto err_drm_gem_object_put;
}
- bo = msm_framebuffer_bo(fb, 0);
-
/*
* NOTE: if we can be guaranteed to be able to map buffer
* in panic (ie. lock-safe, etc) we could avoid pinning the
@@ -123,7 +149,7 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
ret = msm_gem_get_and_pin_iova(bo, priv->kms->vm, &paddr);
if (ret) {
DRM_DEV_ERROR(dev->dev, "failed to get buffer obj iova: %d\n", ret);
- goto fail;
+ goto err_drm_framebuffer_remove;
}
DBG("fbi=%p, dev=%p", fbi, dev);
@@ -138,7 +164,7 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
fbi->screen_buffer = msm_gem_get_vaddr(bo);
if (IS_ERR(fbi->screen_buffer)) {
ret = PTR_ERR(fbi->screen_buffer);
- goto fail;
+ goto err_drm_framebuffer_remove;
}
fbi->screen_size = bo->size;
fbi->fix.smem_start = paddr;
@@ -149,7 +175,9 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
return 0;
-fail:
+err_drm_framebuffer_remove:
drm_framebuffer_remove(fb);
+err_drm_gem_object_put:
+ drm_gem_object_put(bo);
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 2/6] drm/msm: fbdev: Inline msm_alloc_stolen_fb()
2026-04-21 12:51 ` [PATCH 2/6] drm/msm: fbdev: Inline msm_alloc_stolen_fb() Thomas Zimmermann
@ 2026-04-21 16:22 ` Dmitry Baryshkov
0 siblings, 0 replies; 17+ messages in thread
From: Dmitry Baryshkov @ 2026-04-21 16:22 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
freedreno
On Tue, Apr 21, 2026 at 02:51:15PM +0200, Thomas Zimmermann wrote:
> Inline msm_alloc_stolen_fb() into its only caller. This is necessary
> for converting fbdev emulation to use client buffers.
>
> There are some minor changes:
>
> - Handle errors for the non-stolen BO in the respective branch.
>
> - Fill mode_cmd right before using it with msm_framebuffer_init(). Both
> will later be replaced with client-buffer interfaces.
>
> - Set the modifier[0] to DRM_FORMAT_MOD_LINEAR. No functional change.
>
> - Integrate the error handling with the existing clean-up.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/msm/msm_drv.h | 2 --
> drivers/gpu/drm/msm/msm_fb.c | 46 ---------------------------------
> drivers/gpu/drm/msm/msm_fbdev.c | 44 +++++++++++++++++++++++++------
> 3 files changed, 36 insertions(+), 56 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/6] drm/msm: fbdev: Fix error reporting
2026-04-21 12:51 [PATCH 0/6] drm/msm: fbdev: Use client buffers Thomas Zimmermann
2026-04-21 12:51 ` [PATCH 1/6] drm/msm: Do not declare msm_framebuffer_init() as static Thomas Zimmermann
2026-04-21 12:51 ` [PATCH 2/6] drm/msm: fbdev: Inline msm_alloc_stolen_fb() Thomas Zimmermann
@ 2026-04-21 12:51 ` Thomas Zimmermann
2026-04-21 16:22 ` Dmitry Baryshkov
2026-04-21 12:51 ` [PATCH 4/6] drm/msm: fbdev: Calculate buffer geometry with format helpers Thomas Zimmermann
` (3 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Thomas Zimmermann @ 2026-04-21 12:51 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona
Cc: linux-arm-msm, dri-devel, freedreno, Thomas Zimmermann
Replace deprecated error reporting in msm_fbdev_driver_fbdev_probe().
Use drm_warn() and drm_err() instead.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/msm/msm_fbdev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index a507f1de0c5d..1eb0368a6d07 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -114,11 +114,11 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
DBG("allocating %d bytes for fb %d", size, dev->primary->index);
bo = msm_gem_new(dev, size, MSM_BO_SCANOUT | MSM_BO_WC | MSM_BO_STOLEN);
if (IS_ERR(bo)) {
- dev_warn(dev->dev, "could not allocate stolen bo\n");
+ drm_warn(dev, "could not allocate stolen bo\n");
/* try regular bo: */
bo = msm_gem_new(dev, size, MSM_BO_SCANOUT | MSM_BO_WC);
if (IS_ERR(bo)) {
- DRM_DEV_ERROR(dev->dev, "failed to allocate buffer object\n");
+ drm_err(dev, "failed to allocate buffer object\n");
return PTR_ERR(bo);
}
}
@@ -136,7 +136,7 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
mode_cmd.modifier[0]),
&mode_cmd, &bo);
if (IS_ERR(fb)) {
- DRM_DEV_ERROR(dev->dev, "failed to allocate fb\n");
+ drm_err(dev, "failed to allocate fb\n");
ret = PTR_ERR(fb);
goto err_drm_gem_object_put;
}
@@ -148,7 +148,7 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
*/
ret = msm_gem_get_and_pin_iova(bo, priv->kms->vm, &paddr);
if (ret) {
- DRM_DEV_ERROR(dev->dev, "failed to get buffer obj iova: %d\n", ret);
+ drm_err(dev, "failed to get buffer obj iova: %d\n", ret);
goto err_drm_framebuffer_remove;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 3/6] drm/msm: fbdev: Fix error reporting
2026-04-21 12:51 ` [PATCH 3/6] drm/msm: fbdev: Fix error reporting Thomas Zimmermann
@ 2026-04-21 16:22 ` Dmitry Baryshkov
0 siblings, 0 replies; 17+ messages in thread
From: Dmitry Baryshkov @ 2026-04-21 16:22 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
freedreno
On Tue, Apr 21, 2026 at 02:51:16PM +0200, Thomas Zimmermann wrote:
> Replace deprecated error reporting in msm_fbdev_driver_fbdev_probe().
> Use drm_warn() and drm_err() instead.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/msm/msm_fbdev.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4/6] drm/msm: fbdev: Calculate buffer geometry with format helpers
2026-04-21 12:51 [PATCH 0/6] drm/msm: fbdev: Use client buffers Thomas Zimmermann
` (2 preceding siblings ...)
2026-04-21 12:51 ` [PATCH 3/6] drm/msm: fbdev: Fix error reporting Thomas Zimmermann
@ 2026-04-21 12:51 ` Thomas Zimmermann
2026-04-22 0:07 ` Dmitry Baryshkov
2026-04-21 12:51 ` [PATCH 5/6] drm/msm: fbdev: Use a DRM client buffer Thomas Zimmermann
` (2 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Thomas Zimmermann @ 2026-04-21 12:51 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona
Cc: linux-arm-msm, dri-devel, freedreno, Thomas Zimmermann
Replace the geometry and size calculation in msm's fbdev emulation
with DRM format helpers. This consists of a 4CC lookup from the fbdev
parameters, format lookup, pitch calculation and size calculation.
Then allocate the GEM buffer object for the framebuffer memory from
the calculated size.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/msm/msm_drv.h | 7 -------
drivers/gpu/drm/msm/msm_fbdev.c | 26 ++++++++++++--------------
2 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index b3173fa4d222..00c50d7437d6 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -509,13 +509,6 @@ void msm_hrtimer_work_init(struct msm_hrtimer_work *work,
#define DBG(fmt, ...) DRM_DEBUG_DRIVER(fmt"\n", ##__VA_ARGS__)
#define VERB(fmt, ...) if (0) DRM_DEBUG_DRIVER(fmt"\n", ##__VA_ARGS__)
-static inline int align_pitch(int width, int bpp)
-{
- int bytespp = (bpp + 7) / 8;
- /* adreno needs pitch aligned to 32 pixels: */
- return bytespp * ALIGN(width, 32);
-}
-
/* for the generated headers: */
#define INVALID_IDX(idx) ({BUG(); 0;})
#define fui(x) ({BUG(); 0;})
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 1eb0368a6d07..5532c5779f17 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -95,23 +95,25 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
struct fb_info *fbi = helper->info;
struct drm_mode_fb_cmd2 mode_cmd = { };
struct drm_framebuffer *fb = NULL;
+ const struct drm_format_info *format;
+ u32 fourcc, pitch;
+ u64 size;
struct drm_gem_object *bo;
uint64_t paddr;
- uint32_t format;
- int ret, pitch;
- int size;
-
- format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
+ int ret;
DBG("create fbdev: %dx%d@%d (%dx%d)", sizes->surface_width,
sizes->surface_height, sizes->surface_bpp,
sizes->fb_width, sizes->fb_height);
- pitch = align_pitch(sizes->surface_width, sizes->surface_bpp);
+ fourcc = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
+ format = drm_get_format_info(dev, fourcc, DRM_FORMAT_MOD_LINEAR);
+ /* adreno needs pitch aligned to 32 pixels: */
+ pitch = drm_format_info_min_pitch(format, 0, ALIGN(sizes->surface_width, 32));
+ size = ALIGN(pitch * sizes->surface_height, PAGE_SIZE);
/* allocate backing bo */
- size = pitch * sizes->surface_height;
- DBG("allocating %d bytes for fb %d", size, dev->primary->index);
+ DBG("allocating %llu bytes for fb %d", size, dev->primary->index);
bo = msm_gem_new(dev, size, MSM_BO_SCANOUT | MSM_BO_WC | MSM_BO_STOLEN);
if (IS_ERR(bo)) {
drm_warn(dev, "could not allocate stolen bo\n");
@@ -125,16 +127,12 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
msm_gem_object_set_name(bo, "stolenfb");
- mode_cmd.pixel_format = format;
+ mode_cmd.pixel_format = fourcc;
mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height;
mode_cmd.pitches[0] = pitch;
- mode_cmd.modifier[0] = DRM_FORMAT_MOD_LINEAR;
- fb = msm_framebuffer_init(dev,
- drm_get_format_info(dev, mode_cmd.pixel_format,
- mode_cmd.modifier[0]),
- &mode_cmd, &bo);
+ fb = msm_framebuffer_init(dev, format, &mode_cmd, &bo);
if (IS_ERR(fb)) {
drm_err(dev, "failed to allocate fb\n");
ret = PTR_ERR(fb);
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 4/6] drm/msm: fbdev: Calculate buffer geometry with format helpers
2026-04-21 12:51 ` [PATCH 4/6] drm/msm: fbdev: Calculate buffer geometry with format helpers Thomas Zimmermann
@ 2026-04-22 0:07 ` Dmitry Baryshkov
2026-04-23 7:58 ` Thomas Zimmermann
0 siblings, 1 reply; 17+ messages in thread
From: Dmitry Baryshkov @ 2026-04-22 0:07 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
freedreno
On Tue, Apr 21, 2026 at 02:51:17PM +0200, Thomas Zimmermann wrote:
> Replace the geometry and size calculation in msm's fbdev emulation
> with DRM format helpers. This consists of a 4CC lookup from the fbdev
> parameters, format lookup, pitch calculation and size calculation.
> Then allocate the GEM buffer object for the framebuffer memory from
> the calculated size.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/msm/msm_drv.h | 7 -------
> drivers/gpu/drm/msm/msm_fbdev.c | 26 ++++++++++++--------------
> 2 files changed, 12 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
> index b3173fa4d222..00c50d7437d6 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -509,13 +509,6 @@ void msm_hrtimer_work_init(struct msm_hrtimer_work *work,
> #define DBG(fmt, ...) DRM_DEBUG_DRIVER(fmt"\n", ##__VA_ARGS__)
> #define VERB(fmt, ...) if (0) DRM_DEBUG_DRIVER(fmt"\n", ##__VA_ARGS__)
>
> -static inline int align_pitch(int width, int bpp)
> -{
> - int bytespp = (bpp + 7) / 8;
> - /* adreno needs pitch aligned to 32 pixels: */
> - return bytespp * ALIGN(width, 32);
> -}
> -
> /* for the generated headers: */
> #define INVALID_IDX(idx) ({BUG(); 0;})
> #define fui(x) ({BUG(); 0;})
> diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
> index 1eb0368a6d07..5532c5779f17 100644
> --- a/drivers/gpu/drm/msm/msm_fbdev.c
> +++ b/drivers/gpu/drm/msm/msm_fbdev.c
> @@ -95,23 +95,25 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
> struct fb_info *fbi = helper->info;
> struct drm_mode_fb_cmd2 mode_cmd = { };
> struct drm_framebuffer *fb = NULL;
> + const struct drm_format_info *format;
> + u32 fourcc, pitch;
> + u64 size;
> struct drm_gem_object *bo;
> uint64_t paddr;
> - uint32_t format;
> - int ret, pitch;
> - int size;
> -
> - format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
> + int ret;
>
> DBG("create fbdev: %dx%d@%d (%dx%d)", sizes->surface_width,
> sizes->surface_height, sizes->surface_bpp,
> sizes->fb_width, sizes->fb_height);
>
> - pitch = align_pitch(sizes->surface_width, sizes->surface_bpp);
> + fourcc = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
> + format = drm_get_format_info(dev, fourcc, DRM_FORMAT_MOD_LINEAR);
> + /* adreno needs pitch aligned to 32 pixels: */
> + pitch = drm_format_info_min_pitch(format, 0, ALIGN(sizes->surface_width, 32));
> + size = ALIGN(pitch * sizes->surface_height, PAGE_SIZE);
Hmm, why do we need to align the size to the PAGE_SIZE? I might be
missing a point, but it would be nice to mention it in the commit
message.
Other than that, LGTM.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH 4/6] drm/msm: fbdev: Calculate buffer geometry with format helpers
2026-04-22 0:07 ` Dmitry Baryshkov
@ 2026-04-23 7:58 ` Thomas Zimmermann
0 siblings, 0 replies; 17+ messages in thread
From: Thomas Zimmermann @ 2026-04-23 7:58 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
freedreno
Hi
Am 22.04.26 um 02:07 schrieb Dmitry Baryshkov:
> On Tue, Apr 21, 2026 at 02:51:17PM +0200, Thomas Zimmermann wrote:
>> Replace the geometry and size calculation in msm's fbdev emulation
>> with DRM format helpers. This consists of a 4CC lookup from the fbdev
>> parameters, format lookup, pitch calculation and size calculation.
>> Then allocate the GEM buffer object for the framebuffer memory from
>> the calculated size.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>> drivers/gpu/drm/msm/msm_drv.h | 7 -------
>> drivers/gpu/drm/msm/msm_fbdev.c | 26 ++++++++++++--------------
>> 2 files changed, 12 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
>> index b3173fa4d222..00c50d7437d6 100644
>> --- a/drivers/gpu/drm/msm/msm_drv.h
>> +++ b/drivers/gpu/drm/msm/msm_drv.h
>> @@ -509,13 +509,6 @@ void msm_hrtimer_work_init(struct msm_hrtimer_work *work,
>> #define DBG(fmt, ...) DRM_DEBUG_DRIVER(fmt"\n", ##__VA_ARGS__)
>> #define VERB(fmt, ...) if (0) DRM_DEBUG_DRIVER(fmt"\n", ##__VA_ARGS__)
>>
>> -static inline int align_pitch(int width, int bpp)
>> -{
>> - int bytespp = (bpp + 7) / 8;
>> - /* adreno needs pitch aligned to 32 pixels: */
>> - return bytespp * ALIGN(width, 32);
>> -}
>> -
>> /* for the generated headers: */
>> #define INVALID_IDX(idx) ({BUG(); 0;})
>> #define fui(x) ({BUG(); 0;})
>> diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
>> index 1eb0368a6d07..5532c5779f17 100644
>> --- a/drivers/gpu/drm/msm/msm_fbdev.c
>> +++ b/drivers/gpu/drm/msm/msm_fbdev.c
>> @@ -95,23 +95,25 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
>> struct fb_info *fbi = helper->info;
>> struct drm_mode_fb_cmd2 mode_cmd = { };
>> struct drm_framebuffer *fb = NULL;
>> + const struct drm_format_info *format;
>> + u32 fourcc, pitch;
>> + u64 size;
>> struct drm_gem_object *bo;
>> uint64_t paddr;
>> - uint32_t format;
>> - int ret, pitch;
>> - int size;
>> -
>> - format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
>> + int ret;
>>
>> DBG("create fbdev: %dx%d@%d (%dx%d)", sizes->surface_width,
>> sizes->surface_height, sizes->surface_bpp,
>> sizes->fb_width, sizes->fb_height);
>>
>> - pitch = align_pitch(sizes->surface_width, sizes->surface_bpp);
>> + fourcc = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
>> + format = drm_get_format_info(dev, fourcc, DRM_FORMAT_MOD_LINEAR);
>> + /* adreno needs pitch aligned to 32 pixels: */
>> + pitch = drm_format_info_min_pitch(format, 0, ALIGN(sizes->surface_width, 32));
>> + size = ALIGN(pitch * sizes->surface_height, PAGE_SIZE);
> Hmm, why do we need to align the size to the PAGE_SIZE? I might be
> missing a point, but it would be nice to mention it in the commit
> message.
This buffer will be mmap'ed to user space and fbdev's mmap of course
requires page-aligned sizes. Hence the alignment here. Msm's memory
manager should take care of this, but it doesn't hurt to request it
specifically.
On a more general note: while we use this GEM buffer object for backing
the DRM framebuffer, it is better to think of it as fbdev framebuffer
memory.
I'll update the commit description accordingly.
Best regards
Thomas
>
> Other than that, LGTM.
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 5/6] drm/msm: fbdev: Use a DRM client buffer
2026-04-21 12:51 [PATCH 0/6] drm/msm: fbdev: Use client buffers Thomas Zimmermann
` (3 preceding siblings ...)
2026-04-21 12:51 ` [PATCH 4/6] drm/msm: fbdev: Calculate buffer geometry with format helpers Thomas Zimmermann
@ 2026-04-21 12:51 ` Thomas Zimmermann
2026-04-22 0:13 ` Dmitry Baryshkov
2026-04-21 12:51 ` [PATCH 6/6] drm/msm: Make msm_framebuffer_init() an internal interface again Thomas Zimmermann
2026-04-21 16:08 ` [PATCH 0/6] drm/msm: fbdev: Use client buffers Dmitry Baryshkov
6 siblings, 1 reply; 17+ messages in thread
From: Thomas Zimmermann @ 2026-04-21 12:51 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona
Cc: linux-arm-msm, dri-devel, freedreno, Thomas Zimmermann
Replace the internal DRM framebuffer with a DRM client buffer. The
client buffer allocates the DRM framebuffer on a file and also uses
GEM object handles via the regular ADDFB2 interfaces.
Using client-buffer interfaces unifies framebuffer allocation for
DRM clients in user space and msm's internal fbdev emulation. It
also simplifies the clean-up side of the fbdev emulation.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/msm/msm_fbdev.c | 55 +++++++++++++++++++--------------
1 file changed, 32 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 5532c5779f17..f14db46aa51e 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -41,17 +41,15 @@ static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma)
static void msm_fbdev_fb_destroy(struct fb_info *info)
{
struct drm_fb_helper *helper = (struct drm_fb_helper *)info->par;
- struct drm_framebuffer *fb = helper->fb;
- struct drm_gem_object *bo = msm_framebuffer_bo(fb, 0);
+ struct drm_gem_object *bo = msm_framebuffer_bo(helper->fb, 0);
DBG();
drm_fb_helper_fini(helper);
- /* this will free the backing object */
msm_gem_put_vaddr(bo);
- drm_framebuffer_remove(fb);
+ drm_client_buffer_delete(helper->buffer);
drm_client_release(&helper->client);
}
@@ -90,15 +88,16 @@ static const struct drm_fb_helper_funcs msm_fbdev_helper_funcs = {
int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes)
{
- struct drm_device *dev = helper->dev;
+ struct drm_client_dev *client = &helper->client;
+ struct drm_device *dev = client->dev;
+ struct drm_file *file = client->file;
struct msm_drm_private *priv = dev->dev_private;
struct fb_info *fbi = helper->info;
- struct drm_mode_fb_cmd2 mode_cmd = { };
- struct drm_framebuffer *fb = NULL;
const struct drm_format_info *format;
- u32 fourcc, pitch;
+ u32 fourcc, pitch, handle;
u64 size;
struct drm_gem_object *bo;
+ struct drm_client_buffer *buffer;
uint64_t paddr;
int ret;
@@ -127,16 +126,15 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
msm_gem_object_set_name(bo, "stolenfb");
- mode_cmd.pixel_format = fourcc;
- mode_cmd.width = sizes->surface_width;
- mode_cmd.height = sizes->surface_height;
- mode_cmd.pitches[0] = pitch;
-
- fb = msm_framebuffer_init(dev, format, &mode_cmd, &bo);
- if (IS_ERR(fb)) {
- drm_err(dev, "failed to allocate fb\n");
- ret = PTR_ERR(fb);
+ ret = drm_gem_handle_create(file, bo, &handle);
+ if (ret)
goto err_drm_gem_object_put;
+
+ buffer = drm_client_buffer_create(client, sizes->surface_width, sizes->surface_height,
+ fourcc, handle, pitch);
+ if (IS_ERR(buffer)) {
+ ret = PTR_ERR(buffer);
+ goto err_drm_gem_handle_delete;
}
/*
@@ -147,13 +145,14 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
ret = msm_gem_get_and_pin_iova(bo, priv->kms->vm, &paddr);
if (ret) {
drm_err(dev, "failed to get buffer obj iova: %d\n", ret);
- goto err_drm_framebuffer_remove;
+ goto err_drm_client_buffer_delete;
}
DBG("fbi=%p, dev=%p", fbi, dev);
helper->funcs = &msm_fbdev_helper_funcs;
- helper->fb = fb;
+ helper->buffer = buffer;
+ helper->fb = buffer->fb;
fbi->fbops = &msm_fb_ops;
@@ -162,19 +161,29 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
fbi->screen_buffer = msm_gem_get_vaddr(bo);
if (IS_ERR(fbi->screen_buffer)) {
ret = PTR_ERR(fbi->screen_buffer);
- goto err_drm_framebuffer_remove;
+ goto err_msm_gem_put_vaddr;
}
fbi->screen_size = bo->size;
fbi->fix.smem_start = paddr;
fbi->fix.smem_len = bo->size;
DBG("par=%p, %dx%d", fbi->par, fbi->var.xres, fbi->var.yres);
- DBG("allocated %dx%d fb", fb->width, fb->height);
+ DBG("allocated %dx%d fb", buffer->fb->width, buffer->fb->height);
+
+ /* The handle is only needed for creating the framebuffer. */
+ drm_gem_handle_delete(file, handle);
+
+ /* The framebuffer still holds a reference on the GEM object. */
+ drm_gem_object_put(bo);
return 0;
-err_drm_framebuffer_remove:
- drm_framebuffer_remove(fb);
+err_msm_gem_put_vaddr:
+ msm_gem_put_vaddr(bo);
+err_drm_client_buffer_delete:
+ drm_client_buffer_delete(buffer);
+err_drm_gem_handle_delete:
+ drm_gem_handle_delete(file, handle);
err_drm_gem_object_put:
drm_gem_object_put(bo);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 5/6] drm/msm: fbdev: Use a DRM client buffer
2026-04-21 12:51 ` [PATCH 5/6] drm/msm: fbdev: Use a DRM client buffer Thomas Zimmermann
@ 2026-04-22 0:13 ` Dmitry Baryshkov
0 siblings, 0 replies; 17+ messages in thread
From: Dmitry Baryshkov @ 2026-04-22 0:13 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
freedreno
On Tue, Apr 21, 2026 at 02:51:18PM +0200, Thomas Zimmermann wrote:
> Replace the internal DRM framebuffer with a DRM client buffer. The
> client buffer allocates the DRM framebuffer on a file and also uses
> GEM object handles via the regular ADDFB2 interfaces.
>
> Using client-buffer interfaces unifies framebuffer allocation for
> DRM clients in user space and msm's internal fbdev emulation. It
> also simplifies the clean-up side of the fbdev emulation.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/msm/msm_fbdev.c | 55 +++++++++++++++++++--------------
> 1 file changed, 32 insertions(+), 23 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 6/6] drm/msm: Make msm_framebuffer_init() an internal interface again
2026-04-21 12:51 [PATCH 0/6] drm/msm: fbdev: Use client buffers Thomas Zimmermann
` (4 preceding siblings ...)
2026-04-21 12:51 ` [PATCH 5/6] drm/msm: fbdev: Use a DRM client buffer Thomas Zimmermann
@ 2026-04-21 12:51 ` Thomas Zimmermann
2026-04-22 0:13 ` Dmitry Baryshkov
2026-04-21 16:08 ` [PATCH 0/6] drm/msm: fbdev: Use client buffers Dmitry Baryshkov
6 siblings, 1 reply; 17+ messages in thread
From: Thomas Zimmermann @ 2026-04-21 12:51 UTC (permalink / raw)
To: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona
Cc: linux-arm-msm, dri-devel, freedreno, Thomas Zimmermann
The only caller of msm_framebuffer_init() is msm_framebuffer_create()
from the same source file. Declare the former as static.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/msm/msm_drv.h | 4 ----
drivers/gpu/drm/msm/msm_fb.c | 8 ++++----
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 00c50d7437d6..5c12bc4c810a 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -259,10 +259,6 @@ void msm_framebuffer_cleanup(struct drm_framebuffer *fb, bool needed_dirtyfb);
uint32_t msm_framebuffer_iova(struct drm_framebuffer *fb, int plane);
struct drm_gem_object *msm_framebuffer_bo(struct drm_framebuffer *fb, int plane);
const struct msm_format *msm_framebuffer_format(struct drm_framebuffer *fb);
-struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
- const struct drm_format_info *info,
- const struct drm_mode_fb_cmd2 *mode_cmd,
- struct drm_gem_object **bos);
struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
struct drm_file *file, const struct drm_format_info *info,
const struct drm_mode_fb_cmd2 *mode_cmd);
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index dec550e6cf75..60c108d35d2a 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -134,10 +134,10 @@ const struct msm_format *msm_framebuffer_format(struct drm_framebuffer *fb)
return msm_fb->format;
}
-struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
- const struct drm_format_info *info,
- const struct drm_mode_fb_cmd2 *mode_cmd,
- struct drm_gem_object **bos)
+static struct drm_framebuffer *
+msm_framebuffer_init(struct drm_device *dev, const struct drm_format_info *info,
+ const struct drm_mode_fb_cmd2 *mode_cmd,
+ struct drm_gem_object **bos)
{
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 6/6] drm/msm: Make msm_framebuffer_init() an internal interface again
2026-04-21 12:51 ` [PATCH 6/6] drm/msm: Make msm_framebuffer_init() an internal interface again Thomas Zimmermann
@ 2026-04-22 0:13 ` Dmitry Baryshkov
0 siblings, 0 replies; 17+ messages in thread
From: Dmitry Baryshkov @ 2026-04-22 0:13 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
freedreno
On Tue, Apr 21, 2026 at 02:51:19PM +0200, Thomas Zimmermann wrote:
> The only caller of msm_framebuffer_init() is msm_framebuffer_create()
> from the same source file. Declare the former as static.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/msm/msm_drv.h | 4 ----
> drivers/gpu/drm/msm/msm_fb.c | 8 ++++----
> 2 files changed, 4 insertions(+), 8 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/6] drm/msm: fbdev: Use client buffers
2026-04-21 12:51 [PATCH 0/6] drm/msm: fbdev: Use client buffers Thomas Zimmermann
` (5 preceding siblings ...)
2026-04-21 12:51 ` [PATCH 6/6] drm/msm: Make msm_framebuffer_init() an internal interface again Thomas Zimmermann
@ 2026-04-21 16:08 ` Dmitry Baryshkov
2026-04-22 0:14 ` Dmitry Baryshkov
6 siblings, 1 reply; 17+ messages in thread
From: Dmitry Baryshkov @ 2026-04-21 16:08 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
freedreno
On Tue, Apr 21, 2026 at 02:51:13PM +0200, Thomas Zimmermann wrote:
> A client buffer holds the DRM framebuffer for an in-kernel DRM
> client. Until now, msm created an internal ad-hoc framebuffer for
> its fbdev emulation, while by-passing the regular interfaces used by
> user-space compositors.
I assume this was somewhat because we supported using the stolen memory
for FB. Support for it has been dropped when we moved to GPUVM.
Rob, would it be possible to get it back at some point?
Thomas, would the series prevent us from using the stolen memory for FB?
>
> Convert msm's fbdev emulation to use client buffers. Replacing the
> existing code with a client buffer allows for stream-lining msm code
> and later also the fbdev helpers. The new framebuffer will be registered
> against the client's file and will support handles for GEM objects. It
> is then just another framebuffer within the DRM ecosystem.
>
> Patches 1 and 6 change visibility of msm_framebuffer_init() during the
> refactoring. It is the easiest way to refactor the fbdev probe helper.
>
> Patch 2 and 3 inline the fb allocation code into the fbdev-probe helper
> and fix it up a bit.
>
> From there patches 4 and 5 convert fbdev buffer allocation to common
> DRM helpes and client buffers.
>
> If all fbdev emulation helpers can be converted to client buffers, the
> emulation's whole framebuffer handling could possibly be moved into
> shared helpers.
>
> Thomas Zimmermann (6):
> drm/msm: Do not declare msm_framebuffer_init() as static
> drm/msm: fbdev: Inline msm_alloc_stolen_fb()
> drm/msm: fbdev: Fix error reporting
> drm/msm: fbdev: Calculate buffer geometry with format helpers
> drm/msm: fbdev: Use a DRM client buffer
> drm/msm: Make msm_framebuffer_init() an internal interface again
>
> drivers/gpu/drm/msm/msm_drv.h | 9 ---
> drivers/gpu/drm/msm/msm_fb.c | 98 +++++++++------------------------
> drivers/gpu/drm/msm/msm_fbdev.c | 85 +++++++++++++++++++---------
> 3 files changed, 85 insertions(+), 107 deletions(-)
>
> --
> 2.53.0
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH 0/6] drm/msm: fbdev: Use client buffers
2026-04-21 16:08 ` [PATCH 0/6] drm/msm: fbdev: Use client buffers Dmitry Baryshkov
@ 2026-04-22 0:14 ` Dmitry Baryshkov
2026-04-23 8:04 ` Thomas Zimmermann
0 siblings, 1 reply; 17+ messages in thread
From: Dmitry Baryshkov @ 2026-04-22 0:14 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
freedreno
On Tue, Apr 21, 2026 at 07:08:31PM +0300, Dmitry Baryshkov wrote:
> On Tue, Apr 21, 2026 at 02:51:13PM +0200, Thomas Zimmermann wrote:
> > A client buffer holds the DRM framebuffer for an in-kernel DRM
> > client. Until now, msm created an internal ad-hoc framebuffer for
> > its fbdev emulation, while by-passing the regular interfaces used by
> > user-space compositors.
>
> I assume this was somewhat because we supported using the stolen memory
> for FB. Support for it has been dropped when we moved to GPUVM.
>
> Rob, would it be possible to get it back at some point?
>
> Thomas, would the series prevent us from using the stolen memory for FB?
And answering my question, no, we still can continue using stolen memory
for the FB.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/6] drm/msm: fbdev: Use client buffers
2026-04-22 0:14 ` Dmitry Baryshkov
@ 2026-04-23 8:04 ` Thomas Zimmermann
0 siblings, 0 replies; 17+ messages in thread
From: Thomas Zimmermann @ 2026-04-23 8:04 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: robin.clark, lumag, abhinav.kumar, jesszhan0024, sean,
marijn.suijten, airlied, simona, linux-arm-msm, dri-devel,
freedreno
Hi
Am 22.04.26 um 02:14 schrieb Dmitry Baryshkov:
> On Tue, Apr 21, 2026 at 07:08:31PM +0300, Dmitry Baryshkov wrote:
>> On Tue, Apr 21, 2026 at 02:51:13PM +0200, Thomas Zimmermann wrote:
>>> A client buffer holds the DRM framebuffer for an in-kernel DRM
>>> client. Until now, msm created an internal ad-hoc framebuffer for
>>> its fbdev emulation, while by-passing the regular interfaces used by
>>> user-space compositors.
>> I assume this was somewhat because we supported using the stolen memory
>> for FB. Support for it has been dropped when we moved to GPUVM.
>>
>> Rob, would it be possible to get it back at some point?
>>
>> Thomas, would the series prevent us from using the stolen memory for FB?
> And answering my question, no, we still can continue using stolen memory
> for the FB.
Indeed. The idea here is to keep the GEM buffer allocation as it is;
including stolen memory. Once all driver's fbdev emulation uses the
client-buffer interfaces, we might be able to create the framebuffer in
the shared fbdev helpers.
As I mentioned in my reply to patch 4, the GEM buffer object is
something like fbdev framebuffer memory (i.e., video ram). In a later
change, we could allocate all of the stolen memory unconditionally.
Best regards
Thomas
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 17+ messages in thread