mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 06:08:08 +00:00
20ea6adbf1
Build system: x86_64 Build-tested: bcm2708, bcm2709, bcm2710, bcm2711 Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B Signed-off-by: Marty Jones <mj8263788@gmail.com> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
73 lines
2.2 KiB
Diff
73 lines
2.2 KiB
Diff
From 5e59f19a966fa351cf9b5e59e2dbf2162a8542ce Mon Sep 17 00:00:00 2001
|
|
From: Maxime Ripard <maxime@cerno.tech>
|
|
Date: Thu, 21 Apr 2022 10:59:41 +0200
|
|
Subject: [PATCH] drm/vc4: bo: Split out Dumb buffers fixup
|
|
|
|
The vc4_bo_dumb_create() both fixes up the allocation arguments to match
|
|
the hardware constraints and actually performs the allocation.
|
|
|
|
Since we're going to introduce a new function that uses a different
|
|
allocator, let's split the arguments fixup to a separate function we
|
|
will be able to reuse.
|
|
|
|
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
|
---
|
|
drivers/gpu/drm/vc4/vc4_bo.c | 9 +++------
|
|
drivers/gpu/drm/vc4/vc4_drv.c | 13 +++++++++++++
|
|
drivers/gpu/drm/vc4/vc4_drv.h | 1 +
|
|
3 files changed, 17 insertions(+), 6 deletions(-)
|
|
|
|
--- a/drivers/gpu/drm/vc4/vc4_bo.c
|
|
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
|
|
@@ -477,15 +477,12 @@ int vc4_bo_dumb_create(struct drm_file *
|
|
struct drm_device *dev,
|
|
struct drm_mode_create_dumb *args)
|
|
{
|
|
- int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
|
|
struct vc4_bo *bo = NULL;
|
|
int ret;
|
|
|
|
- if (args->pitch < min_pitch)
|
|
- args->pitch = min_pitch;
|
|
-
|
|
- if (args->size < args->pitch * args->height)
|
|
- args->size = args->pitch * args->height;
|
|
+ ret = vc4_dumb_fixup_args(args);
|
|
+ if (ret)
|
|
+ return ret;
|
|
|
|
bo = vc4_bo_create(dev, args->size, false, VC4_BO_TYPE_DUMB);
|
|
if (IS_ERR(bo))
|
|
--- a/drivers/gpu/drm/vc4/vc4_drv.c
|
|
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
|
|
@@ -65,6 +65,19 @@ void __iomem *vc4_ioremap_regs(struct pl
|
|
return map;
|
|
}
|
|
|
|
+int vc4_dumb_fixup_args(struct drm_mode_create_dumb *args)
|
|
+{
|
|
+ int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
|
|
+
|
|
+ if (args->pitch < min_pitch)
|
|
+ args->pitch = min_pitch;
|
|
+
|
|
+ if (args->size < args->pitch * args->height)
|
|
+ args->size = args->pitch * args->height;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int vc4_get_param_ioctl(struct drm_device *dev, void *data,
|
|
struct drm_file *file_priv)
|
|
{
|
|
--- a/drivers/gpu/drm/vc4/vc4_drv.h
|
|
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
|
|
@@ -917,6 +917,7 @@ static inline void vc4_debugfs_add_regse
|
|
|
|
/* vc4_drv.c */
|
|
void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);
|
|
+int vc4_dumb_fixup_args(struct drm_mode_create_dumb *args);
|
|
|
|
/* vc4_dpi.c */
|
|
extern struct platform_driver vc4_dpi_driver;
|