From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DA4B3E557D for ; Thu, 23 Apr 2026 09:45:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776937514; cv=none; b=svnI76kxMroABWuukWDskUptMqYkb1kfQKLZ5GzjNeVfl0ZkRRM2yYsqo39fwuPfp0O47CSWx4mCUM86gNHkfh0/Lyy8RrdrTLIgvVgBVq5+JuQzx7FWQZ4Gqm6otfeYZiDUFuFvziJcK/vgriMZalbwNeH0jAXtaOh/HH3PlsI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776937514; c=relaxed/simple; bh=k3VcjuQEqAKfAn1RcUld2sPbauOtX/setk/v6dXZPuY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aVfKBixVu/n7W/JgqAdrctAi9pMA2PvWcA63DKq8E8kWCHhTWJyPDCOR8kdk6LU/gVeImb/92+BCCkb425SBDJdk2jHmYOrY7CbYUWDeF5VyEJ1blF+2Fpa4U8a9urFDE05CsR8ynGHEhQY8MVPm699a3rJcRg2lFfHXByJfLy8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1E3FD5BD03; Thu, 23 Apr 2026 09:45:00 +0000 (UTC) Authentication-Results: smtp-out2.suse.de; none Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D707E593A3; Thu, 23 Apr 2026 09:44:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sPpOMxvq6Wk+QwAAD6G6ig (envelope-from ); Thu, 23 Apr 2026 09:44:59 +0000 From: Thomas Zimmermann To: inki.dae@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@gmail.com, simona@ffwll.ch, dri-devel@lists.freedesktop.org Cc: linux-samsung-soc@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 4/5] drm/exynos: fbdev: Use a DRM client buffer Date: Thu, 23 Apr 2026 11:37:49 +0200 Message-ID: <20260423094452.32665-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260423094452.32665-1-tzimmermann@suse.de> References: <20260423094452.32665-1-tzimmermann@suse.de> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 1E3FD5BD03 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Score: -4.00 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org 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 exynos' internal fbdev emulation. It also simplifies the clean-up side of the fbdev emulation. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 46 ++++++++++++++--------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 9225cf1a83c8..f43ce974c952 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -36,12 +36,10 @@ static int exynos_drm_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) static void exynos_drm_fb_destroy(struct fb_info *info) { struct drm_fb_helper *fb_helper = info->par; - struct drm_framebuffer *fb = fb_helper->fb; drm_fb_helper_fini(fb_helper); - drm_framebuffer_remove(fb); - + drm_client_buffer_delete(fb_helper->buffer); drm_client_release(&fb_helper->client); } @@ -60,14 +58,17 @@ static const struct drm_fb_helper_funcs exynos_drm_fbdev_helper_funcs = { int exynos_drm_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 fb_info *info = helper->info; u32 fourcc, pitch; u64 size; const struct drm_format_info *format; struct exynos_drm_gem *exynos_gem; struct drm_gem_object *obj; - struct drm_mode_fb_cmd2 mode_cmd = { 0 }; + struct drm_client_buffer *buffer; + u32 handle; int ret; DRM_DEV_DEBUG_KMS(dev->dev, @@ -85,19 +86,20 @@ int exynos_drm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper, return PTR_ERR(exynos_gem); obj = &exynos_gem->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; - - helper->fb = exynos_drm_framebuffer_init(dev, format, &mode_cmd, &exynos_gem, 1); - if (IS_ERR(helper->fb)) { - DRM_DEV_ERROR(dev->dev, "failed to create drm framebuffer.\n"); - ret = PTR_ERR(helper->fb); - goto err_destroy_gem; + 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; } + helper->funcs = &exynos_drm_fbdev_helper_funcs; + helper->buffer = buffer; + helper->fb = buffer->fb; info->fbops = &exynos_drm_fb_ops; @@ -108,9 +110,17 @@ int exynos_drm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper, info->screen_size = obj->size; info->fix.smem_len = obj->size; + /* 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(obj); + return 0; -err_destroy_gem: - exynos_drm_gem_destroy(exynos_gem); +err_drm_gem_handle_delete: + drm_gem_handle_delete(file, handle); +err_drm_gem_object_put: + drm_gem_object_put(obj); return ret; } -- 2.53.0