mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
drm/tegra: Compute dumb-buffer sizes with drm_mode_size_dumb()
Call drm_mode_size_dumb() to compute dumb-buffer scanline pitch and buffer size. Align the pitch according to hardware requirements. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Thierry Reding <treding@nvidia.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Mikko Perttunen <mperttunen@nvidia.com> Link: https://lore.kernel.org/r/20250821081918.79786-21-tzimmermann@suse.de
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_dumb_buffers.h>
|
||||
#include <drm/drm_prime.h>
|
||||
|
||||
#include "drm.h"
|
||||
@@ -542,12 +543,13 @@ void tegra_bo_free_object(struct drm_gem_object *gem)
|
||||
int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
|
||||
struct drm_mode_create_dumb *args)
|
||||
{
|
||||
unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
|
||||
struct tegra_drm *tegra = drm->dev_private;
|
||||
struct tegra_bo *bo;
|
||||
int ret;
|
||||
|
||||
args->pitch = round_up(min_pitch, tegra->pitch_align);
|
||||
args->size = args->pitch * args->height;
|
||||
ret = drm_mode_size_dumb(drm, args, tegra->pitch_align, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
bo = tegra_bo_create_with_handle(file, drm, args->size, 0,
|
||||
&args->handle);
|
||||
|
||||
Reference in New Issue
Block a user