1/* 2 * Xilinx DRM KMS GEM helper 3 * 4 * Copyright (C) 2015 Xilinx, Inc. 5 * 6 * Author: Hyun Woo Kwon <hyun.kwon@xilinx.com> 7 * 8 * This software is licensed under the terms of the GNU General Public 9 * License version 2, as published by the Free Software Foundation, and 10 * may be copied, distributed, and modified under those terms. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 */ 17 18#include <drm/drmP.h> 19#include <drm/drm_gem_cma_helper.h> 20 21#include "xilinx_drm_drv.h" 22#include "xilinx_drm_gem.h" 23 24/* 25 * xilinx_drm_gem_cma_dumb_create - (struct drm_driver)->dumb_create callback 26 * @file_priv: drm_file object 27 * @drm: DRM object 28 * @args: info for dumb scanout buffer creation 29 * 30 * This function is for dumb_create callback of drm_driver struct. Simply 31 * it wraps around drm_gem_cma_dumb_create() and sets the pitch value 32 * by retrieving the value from the device. 33 * 34 * Return: The return value from drm_gem_cma_dumb_create() 35 */ 36int xilinx_drm_gem_cma_dumb_create(struct drm_file *file_priv, 37 struct drm_device *drm, 38 struct drm_mode_create_dumb *args) 39{ 40 int pitch = DIV_ROUND_UP(args->width * args->bpp, 8); 41 42 args->pitch = ALIGN(pitch, xilinx_drm_get_align(drm)); 43 44 return drm_gem_cma_dumb_create_internal(file_priv, drm, args); 45} 46