[Public]

> -----Original Message-----
> From: Thomas Zimmermann <tzimmerm...@suse.de>
> Sent: Friday, May 12, 2023 4:42 AM
> To: dan...@ffwll.ch; airl...@gmail.com; maarten.lankho...@linux.intel.com;
> mrip...@kernel.org; javi...@redhat.com
> Cc: dri-de...@lists.freedesktop.org; linux-arm-ker...@lists.infradead.org;
> linux-samsung-...@vger.kernel.org; intel-...@lists.freedesktop.org; linux-
> arm-...@vger.kernel.org; freedreno@lists.freedesktop.org; amd-
> g...@lists.freedesktop.org; linux-te...@vger.kernel.org; Thomas
> Zimmermann <tzimmerm...@suse.de>; Deucher, Alexander
> <alexander.deuc...@amd.com>; Koenig, Christian
> <christian.koe...@amd.com>; Pan, Xinhui <xinhui....@amd.com>
> Subject: [PATCH 04/11] drm/radeon: Use regular fbdev I/O helpers
> 
> Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers.
> Radeon does not use damage handling, so DRM's fbdev helpers are mere
> wrappers around the fbdev code.
> 
> Add CONFIG_DRM_RADEON_FBDEV_EMULATION to select the necessary
> Kconfig options automatically. Make fbdev emulation depend on the new
> config option.
> 
> By using fbdev helpers directly within each DRM fbdev emulation, we can
> eventually remove DRM's wrapper functions entirely.
> 
> Signed-off-by: Thomas Zimmermann <tzimmerm...@suse.de>
> Cc: Alex Deucher <alexander.deuc...@amd.com>
> Cc: "Christian König" <christian.koe...@amd.com>
> Cc: "Pan, Xinhui" <xinhui....@amd.com>

Feel free to take this through whatever tree makes sense.
Acked-by: Alex Deucher <alexander.deuc...@amd.com>

> ---
>  drivers/gpu/drm/radeon/Kconfig        | 8 ++++++++
>  drivers/gpu/drm/radeon/Makefile       | 2 +-
>  drivers/gpu/drm/radeon/radeon_fbdev.c | 9 ++++-----
> drivers/gpu/drm/radeon/radeon_mode.h  | 2 +-
>  4 files changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/Kconfig
> b/drivers/gpu/drm/radeon/Kconfig index e19d77d58810..66b741d96cc4
> 100644
> --- a/drivers/gpu/drm/radeon/Kconfig
> +++ b/drivers/gpu/drm/radeon/Kconfig
> @@ -8,6 +8,7 @@ config DRM_RADEON
>       select DRM_DISPLAY_DP_HELPER
>       select DRM_DISPLAY_HELPER
>          select DRM_KMS_HELPER
> +     select DRM_RADEON_FBDEV_EMULATION if
> DRM_FBDEV_EMULATION
>       select DRM_SUBALLOC_HELPER
>          select DRM_TTM
>       select DRM_TTM_HELPER
> @@ -39,3 +40,10 @@ config DRM_RADEON_USERPTR
>       help
>         This option selects CONFIG_MMU_NOTIFIER if it isn't already
>         selected to enabled full userptr support.
> +
> +config DRM_RADEON_FBDEV_EMULATION
> +     bool
> +     depends on DRM_RADEON
> +     select FB_CFB_COPYAREA
> +     select FB_CFB_FILLRECT
> +     select FB_CFB_IMAGEBLIT
> diff --git a/drivers/gpu/drm/radeon/Makefile
> b/drivers/gpu/drm/radeon/Makefile index a8734b7d0485..46c1446196a9
> 100644
> --- a/drivers/gpu/drm/radeon/Makefile
> +++ b/drivers/gpu/drm/radeon/Makefile
> @@ -76,7 +76,7 @@ radeon-y += \
>       vce_v1_0.o \
>       vce_v2_0.o
> 
> -radeon-$(CONFIG_DRM_FBDEV_EMULATION) += radeon_fbdev.o
> +radeon-$(CONFIG_DRM_RADEON_FBDEV_EMULATION) +=
> radeon_fbdev.o
>  radeon-$(CONFIG_VGA_SWITCHEROO) += radeon_atpx_handler.o
>  radeon-$(CONFIG_ACPI) += radeon_acpi.o
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_fbdev.c
> b/drivers/gpu/drm/radeon/radeon_fbdev.c
> index fe76e29910ef..dcabe527f9c0 100644
> --- a/drivers/gpu/drm/radeon/radeon_fbdev.c
> +++ b/drivers/gpu/drm/radeon/radeon_fbdev.c
> @@ -24,6 +24,7 @@
>   *     David Airlie
>   */
> 
> +#include <linux/fb.h>
>  #include <linux/pci.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/vga_switcheroo.h>
> @@ -193,11 +194,9 @@ static const struct fb_ops radeon_fbdev_fb_ops = {
>       DRM_FB_HELPER_DEFAULT_OPS,
>       .fb_open = radeon_fbdev_fb_open,
>       .fb_release = radeon_fbdev_fb_release,
> -     .fb_read = drm_fb_helper_cfb_read,
> -     .fb_write = drm_fb_helper_cfb_write,
> -     .fb_fillrect = drm_fb_helper_cfb_fillrect,
> -     .fb_copyarea = drm_fb_helper_cfb_copyarea,
> -     .fb_imageblit = drm_fb_helper_cfb_imageblit,
> +     .fb_fillrect = cfb_fillrect,
> +     .fb_copyarea = cfb_copyarea,
> +     .fb_imageblit = cfb_imageblit,
>       .fb_destroy = radeon_fbdev_fb_destroy,  };
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_mode.h
> b/drivers/gpu/drm/radeon/radeon_mode.h
> index 1decdcec0264..c5a8e25a4c97 100644
> --- a/drivers/gpu/drm/radeon/radeon_mode.h
> +++ b/drivers/gpu/drm/radeon/radeon_mode.h
> @@ -939,7 +939,7 @@ void dce4_program_fmt(struct drm_encoder
> *encoder);  void dce8_program_fmt(struct drm_encoder *encoder);
> 
>  /* fbdev layer */
> -#if defined(CONFIG_DRM_FBDEV_EMULATION)
> +#if defined(CONFIG_DRM_RADEON_FBDEV_EMULATION)
>  void radeon_fbdev_setup(struct radeon_device *rdev);  void
> radeon_fbdev_set_suspend(struct radeon_device *rdev, int state);  bool
> radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo
> *robj);
> --
> 2.40.1

Reply via email to