Skip to contentSkip to conversation

drm/gma500: fbdev: Use client buffers

PATCH In review Thomas Zimmermann 2 participants 9 messages Feb 6 – Feb 27

Subsystems (3)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

cover drm/gma500: fbdev: Use client buffers

A client buffer holds the DRM framebuffer for an in-kernel DRM client. So far, gma500 has created an internal ad-hoc framebuffer for its fbdev emulation, while by-passing the regular interfaces used by user-space compositors.

Replacing the existing code with a client buffer allows for stream- lining gma500 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. This is then just another framebuffer within the DRM ecosystem.

As there's still a custom GEM buffer object involved, patch 1 exports an interface to create a client buffer around it.

Patches 2 and 3 update size calculation in gma500's fbdev emulation and makes it use the helpers provided by DRM.

Patch 4 converts the code to client buffers and patch 5 removes the now-unused framebuffer code.

Tested on an Atom N2800 Cedarview system.

Thomas Zimmermann (5):
drm/client: Export drm_client_buffer_create() drm/gma500: fbdev: Set framebuffer size to GEM object size drm/gma500: fbdev: Calculate buffer geometry with format helpers drm/gma500: fbdev: Use a DRM client buffer drm/gma500: Create framebuffers with drm_gem_fb_create()

 drivers/gpu/drm/drm_client.c         |   3 +-
 drivers/gpu/drm/gma500/fbdev.c       | 101 +++++++++++++-------------
 drivers/gpu/drm/gma500/framebuffer.c | 104 +++------------------------
 drivers/gpu/drm/gma500/psb_drv.h     |   6 --
 include/drm/drm_client.h             |   3 +
 5 files changed, 64 insertions(+), 153 deletions(-)
Signature · 1 line
2.52.0
author maintainer
#1 lore raw

PATCH 1/5 drm/client: Export drm_client_buffer_create()

The helper drm_client_buffer_create() will be required by various drivers for fbdev emulation.

---
 drivers/gpu/drm/drm_client.c | 3 ++-
 include/drm/drm_client.h     | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_client.c +2 -1
index a82d741e6630..f36c110b55db 100644
@@ -204,7 +204,7 @@ void drm_client_buffer_delete(struct drm_client_buffer *buffer)
 }
 EXPORT_SYMBOL(drm_client_buffer_delete);
 
-static struct drm_client_buffer *
+struct drm_client_buffer *
 drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height,
 			 u32 format, u32 handle, u32 pitch)
 {
@@ -265,6 +265,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height,
 	kfree(buffer);
 	return ERR_PTR(ret);
 }
+EXPORT_SYMBOL(drm_client_buffer_create);
 
 /**
  * drm_client_buffer_vmap_local - Map DRM client buffer into address space
include/drm/drm_client.h +3 -0
index c972a8a3385b..49a21f3dcb36 100644
@@ -195,6 +195,9 @@ struct drm_client_buffer {
 	struct drm_framebuffer *fb;
 };
 
+struct drm_client_buffer *
+drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height,
+			 u32 format, u32 handle, u32 pitch);
 struct drm_client_buffer *
 drm_client_buffer_create_dumb(struct drm_client_dev *client, u32 width, u32 height, u32 format);
 void drm_client_buffer_delete(struct drm_client_buffer *buffer);
Signature · 1 line
2.52.0
author maintainer
#2 lore raw

PATCH 2/5 drm/gma500: fbdev: Set framebuffer size to GEM object size

In reply to Thomas Zimmermann

Framebuffer emulation sets the size of the available memory to the value that has been requested. As the allocated GEM buffer object acts as full framebuffer memory, set the size to the value of the actually allocated buffer.

---
 drivers/gpu/drm/gma500/fbdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/gma500/fbdev.c +2 -2
index c26926babc2a..f5e60ada6de2 100644
@@ -171,12 +171,12 @@ int psb_fbdev_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
 
 	/* Accessed stolen memory directly */
 	info->screen_base = dev_priv->vram_addr + backing->offset;
-	info->screen_size = size;
+	info->screen_size = obj->size;
 
 	drm_fb_helper_fill_info(info, fb_helper, sizes);
 
 	info->fix.smem_start = dev_priv->stolen_base + backing->offset;
-	info->fix.smem_len = size;
+	info->fix.smem_len = obj->size;
 	info->fix.ywrapstep = 0;
 	info->fix.ypanstep = 0;
 	info->fix.mmio_start = pci_resource_start(pdev, 0);
Signature · 1 line
2.52.0
author maintainer
#3 lore raw

PATCH 3/5 drm/gma500: fbdev: Calculate buffer geometry with format helpers

In reply to Thomas Zimmermann

Replace the geometry and size calculation in gma500's fbdev emulation with DRM format helpers. This consists of 4CC lookup from the fbdev parameters, format loockup, pitch calculation and size calculation. Then allocate the GEM buffer object for the framebuffer memory from the calculated size.

As before, fallback to 16-bit colors if the stolen memory is insufficient for 32-bit colors. But look at the result from psb_gem_create() instead of guessing before the allocation. The new method is more reliable when others allocate from stolen video memory (e.g., cursors).

Set up mode_cmd with the calculated values just before allocating the framebuffer. This code will later be replaced with a DRM client buffer.

---
 drivers/gpu/drm/gma500/fbdev.c | 60 ++++++++++++++++------------------
 1 file changed, 28 insertions(+), 32 deletions(-)
drivers/gpu/drm/gma500/fbdev.c +28 -32
index f5e60ada6de2..a93c3d2fe0ff 100644
@@ -109,56 +109,52 @@ int psb_fbdev_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
 	struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
 	struct pci_dev *pdev = to_pci_dev(dev->dev);
 	struct fb_info *info = fb_helper->info;
+	u32 fourcc, pitch;
+	u64 size;
+	const struct drm_format_info *format;
 	struct drm_framebuffer *fb;
 	struct drm_mode_fb_cmd2 mode_cmd = { };
-	int size;
 	int ret;
 	struct psb_gem_object *backing;
 	struct drm_gem_object *obj;
-	u32 bpp, depth;
 
 	/* No 24-bit packed mode */
 	if (sizes->surface_bpp == 24) {
 		sizes->surface_bpp = 32;
 		sizes->surface_depth = 24;
 	}
-	bpp = sizes->surface_bpp;
-	depth = sizes->surface_depth;
 
-	/*
-	 * If the mode does not fit in 32 bit then switch to 16 bit to get
-	 * a console on full resolution. The X mode setting server will
-	 * allocate its own 32-bit GEM framebuffer.
-	 */
-	size = ALIGN(sizes->surface_width * DIV_ROUND_UP(bpp, 8), 64) *
-		     sizes->surface_height;
-	size = ALIGN(size, PAGE_SIZE);
+try_psb_gem_create:
+	fourcc = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
+	format = drm_get_format_info(dev, fourcc, DRM_FORMAT_MOD_LINEAR);
+	pitch = ALIGN(drm_format_info_min_pitch(format, 0, sizes->surface_width), SZ_64);
+	size = ALIGN(pitch * sizes->surface_height, PAGE_SIZE);
 
-	if (size > dev_priv->vram_stolen_size) {
-		sizes->surface_bpp = 16;
-		sizes->surface_depth = 16;
+	/* Allocate the framebuffer in the GTT with stolen page backing */
+	backing = psb_gem_create(dev, size, "fb", true, PAGE_SIZE);
+	if (IS_ERR(backing)) {
+		ret = PTR_ERR(backing);
+		if (ret == -EBUSY && sizes->surface_bpp > 16) {
+			/*
+			 * If the mode does not fit in 32 bit then switch to 16 bit to
+			 * get a console on full resolution. User-space compositors will
+			 * allocate their own 32-bit framebuffers.
+			 */
+			sizes->surface_bpp = 16;
+			sizes->surface_depth = 16;
+			goto try_psb_gem_create;
+		}
+		return ret;
 	}
-	bpp = sizes->surface_bpp;
-	depth = sizes->surface_depth;
+	obj = &backing->base;
 
 	mode_cmd.width = sizes->surface_width;
 	mode_cmd.height = sizes->surface_height;
-	mode_cmd.pitches[0] = ALIGN(mode_cmd.width * DIV_ROUND_UP(bpp, 8), 64);
-	mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth);
-
-	size = mode_cmd.pitches[0] * mode_cmd.height;
-	size = ALIGN(size, PAGE_SIZE);
-
-	/* Allocate the framebuffer in the GTT with stolen page backing */
-	backing = psb_gem_create(dev, size, "fb", true, PAGE_SIZE);
-	if (IS_ERR(backing))
-		return PTR_ERR(backing);
-	obj = &backing->base;
+	mode_cmd.pixel_format = fourcc;
+	mode_cmd.pitches[0] = pitch;
+	mode_cmd.modifier[0] = DRM_FORMAT_MOD_LINEAR;
 
-	fb = psb_framebuffer_create(dev,
-				    drm_get_format_info(dev, mode_cmd.pixel_format,
-							mode_cmd.modifier[0]),
-				    &mode_cmd, obj);
+	fb = psb_framebuffer_create(dev, format, &mode_cmd, obj);
 	if (IS_ERR(fb)) {
 		ret = PTR_ERR(fb);
 		goto err_drm_gem_object_put;
Signature · 1 line
2.52.0
author maintainer
#4 lore raw

PATCH 4/5 drm/gma500: fbdev: Use a DRM client buffer

In reply to 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. This unifies framebuffer allocation for clients in user space and gma500's internal fbdev emulation.

Also simplify the clean-up side of the fbdev emulation.

Later patches will allow for streamlining gma500's framebuffer code and DRM's fbdev emulation in general.

---
 drivers/gpu/drm/gma500/fbdev.c | 49 ++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 23 deletions(-)
drivers/gpu/drm/gma500/fbdev.c +26 -23
index a93c3d2fe0ff..d1e93588234f 100644
@@ -72,17 +72,10 @@ static int psb_fbdev_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 static void psb_fbdev_fb_destroy(struct fb_info *info)
 {
 	struct drm_fb_helper *fb_helper = info->par;
-	struct drm_framebuffer *fb = fb_helper->fb;
-	struct drm_gem_object *obj = fb->obj[0];
 
 	drm_fb_helper_fini(fb_helper);
 
-	drm_framebuffer_unregister_private(fb);
-	drm_framebuffer_cleanup(fb);
-	kfree(fb);
-
-	drm_gem_object_put(obj);
-
+	drm_client_buffer_delete(fb_helper->buffer);
 	drm_client_release(&fb_helper->client);
 }
 
@@ -105,18 +98,20 @@ static const struct drm_fb_helper_funcs psb_fbdev_fb_helper_funcs = {
 int psb_fbdev_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
 				 struct drm_fb_helper_surface_size *sizes)
 {
-	struct drm_device *dev = fb_helper->dev;
+	struct drm_client_dev *client = &fb_helper->client;
+	struct drm_device *dev = client->dev;
+	struct drm_file *file = client->file;
 	struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
 	struct pci_dev *pdev = to_pci_dev(dev->dev);
 	struct fb_info *info = fb_helper->info;
 	u32 fourcc, pitch;
 	u64 size;
 	const struct drm_format_info *format;
-	struct drm_framebuffer *fb;
-	struct drm_mode_fb_cmd2 mode_cmd = { };
-	int ret;
+	struct drm_client_buffer *buffer;
 	struct psb_gem_object *backing;
 	struct drm_gem_object *obj;
+	u32 handle;
+	int ret;
 
 	/* No 24-bit packed mode */
 	if (sizes->surface_bpp == 24) {
@@ -148,20 +143,20 @@ int psb_fbdev_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
 	}
 	obj = &backing->base;
 
-	mode_cmd.width = sizes->surface_width;
-	mode_cmd.height = sizes->surface_height;
-	mode_cmd.pixel_format = fourcc;
-	mode_cmd.pitches[0] = pitch;
-	mode_cmd.modifier[0] = DRM_FORMAT_MOD_LINEAR;
-
-	fb = psb_framebuffer_create(dev, format, &mode_cmd, obj);
-	if (IS_ERR(fb)) {
-		ret = PTR_ERR(fb);
+	ret = drm_gem_handle_create(file, obj, &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;
 	}
 
 	fb_helper->funcs = &psb_fbdev_fb_helper_funcs;
-	fb_helper->fb = fb;
+	fb_helper->buffer = buffer;
+	fb_helper->fb = buffer->fb;
 
 	info->fbops = &psb_fbdev_fb_ops;
 
@@ -182,10 +177,18 @@ int psb_fbdev_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
 
 	/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
 
-	dev_dbg(dev->dev, "allocated %dx%d fb\n", fb->width, fb->height);
+	dev_dbg(dev->dev, "allocated %dx%d fb\n", 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 references on the GEM object. */
+	drm_gem_object_put(obj);
 
 	return 0;
 
+err_drm_gem_handle_delete:
+	drm_gem_handle_delete(file, handle);
 err_drm_gem_object_put:
 	drm_gem_object_put(obj);
 	return ret;
Signature · 1 line
2.52.0
author maintainer
#5 lore raw

PATCH 5/5 drm/gma500: Create framebuffers with drm_gem_fb_create()

In reply to Thomas Zimmermann

Replace gma500's internal framebuffer creation with DRM's standard helper drm_gem_fb_create(). The result is equivalent. Only keep the existing tests for color depth and pitch alignment.

---
 drivers/gpu/drm/gma500/framebuffer.c | 104 +++------------------------
 drivers/gpu/drm/gma500/psb_drv.h     |   6 --
 2 files changed, 9 insertions(+), 101 deletions(-)
drivers/gpu/drm/gma500/framebuffer.c +9 -95
index e69b537ded6b..37a9f666c0f2 100644
@@ -12,111 +12,25 @@
 #include "framebuffer.h"
 #include "psb_drv.h"
 
-static const struct drm_framebuffer_funcs psb_fb_funcs = {
-	.destroy = drm_gem_fb_destroy,
-	.create_handle = drm_gem_fb_create_handle,
-};
-
-/**
- *	psb_framebuffer_init	-	initialize a framebuffer
- *	@dev: our DRM device
- *	@fb: framebuffer to set up
- *	@mode_cmd: mode description
- *	@obj: backing object
- *
- *	Configure and fill in the boilerplate for our frame buffer. Return
- *	0 on success or an error code if we fail.
- */
-static int psb_framebuffer_init(struct drm_device *dev,
-					struct drm_framebuffer *fb,
-					const struct drm_format_info *info,
-					const struct drm_mode_fb_cmd2 *mode_cmd,
-					struct drm_gem_object *obj)
+static struct drm_framebuffer *
+psb_user_framebuffer_create(struct drm_device *dev, struct drm_file *filp,
+			    const struct drm_format_info *info,
+			    const struct drm_mode_fb_cmd2 *cmd)
 {
-	int ret;
-
 	/*
 	 * Reject unknown formats, YUV formats, and formats with more than
 	 * 4 bytes per pixel.
 	 */
 	if (!info->depth || info->cpp[0] > 4)
-		return -EINVAL;
-
-	if (mode_cmd->pitches[0] & 63)
-		return -EINVAL;
-
-	drm_helper_mode_fill_fb_struct(dev, fb, info, mode_cmd);
-	fb->obj[0] = obj;
-	ret = drm_framebuffer_init(dev, fb, &psb_fb_funcs);
-	if (ret) {
-		dev_err(dev->dev, "framebuffer init failed: %d\n", ret);
-		return ret;
-	}
-	return 0;
-}
-
-/**
- *	psb_framebuffer_create	-	create a framebuffer backed by gt
- *	@dev: our DRM device
- *	@info: pixel format information
- *	@mode_cmd: the description of the requested mode
- *	@obj: the backing object
- *
- *	Create a framebuffer object backed by the gt, and fill in the
- *	boilerplate required
- *
- *	TODO: review object references
- */
-struct drm_framebuffer *psb_framebuffer_create(struct drm_device *dev,
-					       const struct drm_format_info *info,
-					       const struct drm_mode_fb_cmd2 *mode_cmd,
-					       struct drm_gem_object *obj)
-{
-	struct drm_framebuffer *fb;
-	int ret;
-
-	fb = kzalloc(sizeof(*fb), GFP_KERNEL);
-	if (!fb)
-		return ERR_PTR(-ENOMEM);
-
-	ret = psb_framebuffer_init(dev, fb, info, mode_cmd, obj);
-	if (ret) {
-		kfree(fb);
-		return ERR_PTR(ret);
-	}
-	return fb;
-}
-
-/**
- *	psb_user_framebuffer_create	-	create framebuffer
- *	@dev: our DRM device
- *	@filp: client file
- *	@cmd: mode request
- *
- *	Create a new framebuffer backed by a userspace GEM object
- */
-static struct drm_framebuffer *psb_user_framebuffer_create
-			(struct drm_device *dev, struct drm_file *filp,
-			 const struct drm_format_info *info,
-			 const struct drm_mode_fb_cmd2 *cmd)
-{
-	struct drm_gem_object *obj;
-	struct drm_framebuffer *fb;
+		return ERR_PTR(-EINVAL);
 
 	/*
-	 *	Find the GEM object and thus the gtt range object that is
-	 *	to back this space
+	 * Pitch must be aligned to 64 bytes.
 	 */
-	obj = drm_gem_object_lookup(filp, cmd->handles[0]);
-	if (obj == NULL)
-		return ERR_PTR(-ENOENT);
-
-	/* Let the core code do all the work */
-	fb = psb_framebuffer_create(dev, info, cmd, obj);
-	if (IS_ERR(fb))
-		drm_gem_object_put(obj);
+	if (cmd->pitches[0] & 63)
+		return ERR_PTR(-EINVAL);
 
-	return fb;
+	return drm_gem_fb_create(dev, filp, info, cmd);
 }
 
 static const struct drm_mode_config_funcs psb_mode_funcs = {
drivers/gpu/drm/gma500/psb_drv.h +0 -6
index 0b27112ec46f..db197b865b90 100644
@@ -592,12 +592,6 @@ struct psb_ops {
 extern void psb_modeset_init(struct drm_device *dev);
 extern void psb_modeset_cleanup(struct drm_device *dev);
 
-/* framebuffer */
-struct drm_framebuffer *psb_framebuffer_create(struct drm_device *dev,
-					       const struct drm_format_info *info,
-					       const struct drm_mode_fb_cmd2 *mode_cmd,
-					       struct drm_gem_object *obj);
-
 /* fbdev */
 #if defined(CONFIG_DRM_FBDEV_EMULATION)
 int psb_fbdev_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
Signature · 1 line
2.52.0
author maintainer
#6 lore raw
In reply to Thomas Zimmermann

ping for a review

Am 06.02.26 um 14:21 schrieb Thomas Zimmermann:

Quoted 36 lines

A client buffer holds the DRM framebuffer for an in-kernel DRM client. So far, gma500 has created an internal ad-hoc framebuffer for its fbdev emulation, while by-passing the regular interfaces used by user-space compositors.

Replacing the existing code with a client buffer allows for stream- lining gma500 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. This is then just another framebuffer within the DRM ecosystem.

As there's still a custom GEM buffer object involved, patch 1 exports an interface to create a client buffer around it.

Patches 2 and 3 update size calculation in gma500's fbdev emulation and makes it use the helpers provided by DRM.

Patch 4 converts the code to client buffers and patch 5 removes the now-unused framebuffer code.

Tested on an Atom N2800 Cedarview system.

Thomas Zimmermann (5):
drm/client: Export drm_client_buffer_create() drm/gma500: fbdev: Set framebuffer size to GEM object size drm/gma500: fbdev: Calculate buffer geometry with format helpers drm/gma500: fbdev: Use a DRM client buffer drm/gma500: Create framebuffers with drm_gem_fb_create()

  drivers/gpu/drm/drm_client.c         |   3 +-
  drivers/gpu/drm/gma500/fbdev.c       | 101 +++++++++++++-------------
  drivers/gpu/drm/gma500/framebuffer.c | 104 +++------------------------
  drivers/gpu/drm/gma500/psb_drv.h     |   6 --
  include/drm/drm_client.h             |   3 +
  5 files changed, 64 insertions(+), 153 deletions(-)
Signature · 6 lines
--
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)
maintainer
#7 lore raw
Quoted 2 lines · Thomas Zimmermann

ping for a review

Hi Thomas,
Sorry, I'm very busy at the moment. I hope to get to this some time during this week.

-Patrik

Quoted 48 lines

Am 06.02.26 um 14:21 schrieb Thomas Zimmermann:

Quoted 29 lines

A client buffer holds the DRM framebuffer for an in-kernel DRM client. So far, gma500 has created an internal ad-hoc framebuffer for its fbdev emulation, while by-passing the regular interfaces used by user-space compositors.

Replacing the existing code with a client buffer allows for stream- lining gma500 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. This is then just another framebuffer within the DRM ecosystem.

As there's still a custom GEM buffer object involved, patch 1 exports an interface to create a client buffer around it.

Patches 2 and 3 update size calculation in gma500's fbdev emulation and makes it use the helpers provided by DRM.

Patch 4 converts the code to client buffers and patch 5 removes the now-unused framebuffer code.

Tested on an Atom N2800 Cedarview system.

Thomas Zimmermann (5):
drm/client: Export drm_client_buffer_create() drm/gma500: fbdev: Set framebuffer size to GEM object size drm/gma500: fbdev: Calculate buffer geometry with format helpers drm/gma500: fbdev: Use a DRM client buffer drm/gma500: Create framebuffers with drm_gem_fb_create()

Quoted 7 lines
  drivers/gpu/drm/drm_client.c         |   3 +-
  drivers/gpu/drm/gma500/fbdev.c       | 101 +++++++++++++-------------
  drivers/gpu/drm/gma500/framebuffer.c | 104 +++------------------------
  drivers/gpu/drm/gma500/psb_drv.h     |   6 --
  include/drm/drm_client.h             |   3 +
  5 files changed, 64 insertions(+), 153 deletions(-)

--
--
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)

maintainer Acked-by
#8 lore raw
Quoted 8 lines · Patrik Jakobsson
Quoted 2 lines · Thomas Zimmermann

ping for a review

Hi Thomas,
Sorry, I'm very busy at the moment. I hope to get to this some time during this week.

Looks good. For the entire series:

Please push this to drm-misc-next

Thanks!

Quoted 51 lines

-Patrik

Quoted 48 lines

Am 06.02.26 um 14:21 schrieb Thomas Zimmermann:

Quoted 29 lines

A client buffer holds the DRM framebuffer for an in-kernel DRM client. So far, gma500 has created an internal ad-hoc framebuffer for its fbdev emulation, while by-passing the regular interfaces used by user-space compositors.

Replacing the existing code with a client buffer allows for stream- lining gma500 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. This is then just another framebuffer within the DRM ecosystem.

As there's still a custom GEM buffer object involved, patch 1 exports an interface to create a client buffer around it.

Patches 2 and 3 update size calculation in gma500's fbdev emulation and makes it use the helpers provided by DRM.

Patch 4 converts the code to client buffers and patch 5 removes the now-unused framebuffer code.

Tested on an Atom N2800 Cedarview system.

Thomas Zimmermann (5):
drm/client: Export drm_client_buffer_create() drm/gma500: fbdev: Set framebuffer size to GEM object size drm/gma500: fbdev: Calculate buffer geometry with format helpers drm/gma500: fbdev: Use a DRM client buffer drm/gma500: Create framebuffers with drm_gem_fb_create()

Quoted 7 lines
  drivers/gpu/drm/drm_client.c         |   3 +-
  drivers/gpu/drm/gma500/fbdev.c       | 101 +++++++++++++-------------
  drivers/gpu/drm/gma500/framebuffer.c | 104 +++------------------------
  drivers/gpu/drm/gma500/psb_drv.h     |   6 --
  include/drm/drm_client.h             |   3 +
  5 files changed, 64 insertions(+), 153 deletions(-)

--
--
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)