Release 4.17 drivers/gpu/drm/exynos/exynos_drm_fb.c
/* exynos_drm_fb.c
*
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
* Authors:
* Inki Dae <inki.dae@samsung.com>
* Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <drm/drmP.h>
#include <drm/drm_crtc.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <uapi/drm/exynos_drm.h>
#include "exynos_drm_drv.h"
#include "exynos_drm_fb.h"
#include "exynos_drm_fbdev.h"
#include "exynos_drm_iommu.h"
#include "exynos_drm_crtc.h"
static int check_fb_gem_memory_type(struct drm_device *drm_dev,
struct exynos_drm_gem *exynos_gem)
{
unsigned int flags;
/*
* if exynos drm driver supports iommu then framebuffer can use
* all the buffer types.
*/
if (is_drm_iommu_supported(drm_dev))
return 0;
flags = exynos_gem->flags;
/*
* Physically non-contiguous memory type for framebuffer is not
* supported without IOMMU.
*/
if (IS_NONCONTIG_BUFFER(flags)) {
DRM_ERROR("Non-contiguous GEM memory is not supported.\n");
return -EINVAL;
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Inki Dae | 54 | 91.53% | 1 | 33.33% |
Joonyoung Shim | 3 | 5.08% | 1 | 33.33% |
Shuah Khan | 2 | 3.39% | 1 | 33.33% |
Total | 59 | 100.00% | 3 | 100.00% |
static const struct drm_framebuffer_funcs exynos_drm_fb_funcs = {
.destroy = drm_gem_fb_destroy,
.create_handle = drm_gem_fb_create_handle,
};
struct drm_framebuffer *
exynos_drm_framebuffer_init(struct drm_device *dev,
const struct drm_mode_fb_cmd2 *mode_cmd,
struct exynos_drm_gem **exynos_gem,
int count)
{
struct drm_framebuffer *fb;
int i;
int ret;
fb = kzalloc(sizeof(*fb), GFP_KERNEL);
if (!fb)
return ERR_PTR(-ENOMEM);
for (i = 0; i < count; i++) {
ret = check_fb_gem_memory_type(dev, exynos_gem[i]);
if (ret < 0)
goto err;
fb->obj[i] = &exynos_gem[i]->base;
}
drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
ret = drm_framebuffer_init(dev, fb, &exynos_drm_fb_funcs);
if (ret < 0) {
DRM_ERROR("failed to initialize framebuffer\n");
goto err;
}
return fb;
err:
kfree(fb);
return ERR_PTR(ret);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Joonyoung Shim | 77 | 46.11% | 5 | 41.67% |
Inki Dae | 72 | 43.11% | 2 | 16.67% |
Daniel Stone | 12 | 7.19% | 2 | 16.67% |
Ville Syrjälä | 3 | 1.80% | 2 | 16.67% |
Daniel Vetter | 3 | 1.80% | 1 | 8.33% |
Total | 167 | 100.00% | 12 | 100.00% |
static struct drm_framebuffer *
exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
const struct drm_mode_fb_cmd2 *mode_cmd)
{
const struct drm_format_info *info = drm_get_format_info(dev, mode_cmd);
struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER];
struct drm_gem_object *obj;
struct drm_framebuffer *fb;
int i;
int ret;
for (i = 0; i < info->num_planes; i++) {
unsigned int height = (i == 0) ? mode_cmd->height :
DIV_ROUND_UP(mode_cmd->height, info->vsub);
unsigned long size = height * mode_cmd->pitches[i] +
mode_cmd->offsets[i];
obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[i]);
if (!obj) {
DRM_ERROR("failed to lookup gem object\n");
ret = -ENOENT;
goto err;
}
exynos_gem[i] = to_exynos_gem(obj);
if (size > exynos_gem[i]->size) {
i++;
ret = -EINVAL;
goto err;
}
}
fb = exynos_drm_framebuffer_init(dev, mode_cmd, exynos_gem, i);
if (IS_ERR(fb)) {
ret = PTR_ERR(fb);
goto err;
}
return fb;
err:
while (i--)
drm_gem_object_unreference_unlocked(&exynos_gem[i]->base);
return ERR_PTR(ret);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Marek Szyprowski | 84 | 33.60% | 1 | 7.69% |
Seung-Woo Kim | 47 | 18.80% | 1 | 7.69% |
Joonyoung Shim | 45 | 18.00% | 5 | 38.46% |
YoungJun Cho | 25 | 10.00% | 1 | 7.69% |
Inki Dae | 24 | 9.60% | 3 | 23.08% |
Daniel Vetter | 24 | 9.60% | 1 | 7.69% |
Ville Syrjälä | 1 | 0.40% | 1 | 7.69% |
Total | 250 | 100.00% | 13 | 100.00% |
dma_addr_t exynos_drm_fb_dma_addr(struct drm_framebuffer *fb, int index)
{
struct exynos_drm_gem *exynos_gem;
if (WARN_ON_ONCE(index >= MAX_FB_BUFFER))
return 0;
exynos_gem = to_exynos_gem(fb->obj[index]);
return exynos_gem->dma_addr + fb->offsets[index];
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Stone | 19 | 35.19% | 1 | 16.67% |
Seung-Woo Kim | 14 | 25.93% | 1 | 16.67% |
Inki Dae | 13 | 24.07% | 2 | 33.33% |
Marek Szyprowski | 4 | 7.41% | 1 | 16.67% |
Christoph Hellwig | 4 | 7.41% | 1 | 16.67% |
Total | 54 | 100.00% | 6 | 100.00% |
static struct drm_mode_config_helper_funcs exynos_drm_mode_config_helpers = {
.atomic_commit_tail = drm_atomic_helper_commit_tail_rpm,
};
static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
.fb_create = exynos_user_fb_create,
.output_poll_changed = drm_fb_helper_output_poll_changed,
.atomic_check = exynos_atomic_check,
.atomic_commit = drm_atomic_helper_commit,
};
void exynos_drm_mode_config_init(struct drm_device *dev)
{
dev->mode_config.min_width = 0;
dev->mode_config.min_height = 0;
/*
* set max width and height as default value(4096x4096).
* this value would be used to check framebuffer size limitation
* at drm_mode_addfb().
*/
dev->mode_config.max_width = 4096;
dev->mode_config.max_height = 4096;
dev->mode_config.funcs = &exynos_drm_mode_config_funcs;
dev->mode_config.helper_private = &exynos_drm_mode_config_helpers;
dev->mode_config.allow_fb_modifiers = true;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Inki Dae | 61 | 88.41% | 2 | 66.67% |
Tobias Jakobi | 8 | 11.59% | 1 | 33.33% |
Total | 69 | 100.00% | 3 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Inki Dae | 280 | 40.17% | 7 | 18.42% |
Joonyoung Shim | 126 | 18.08% | 7 | 18.42% |
Marek Szyprowski | 88 | 12.63% | 2 | 5.26% |
Seung-Woo Kim | 70 | 10.04% | 2 | 5.26% |
Daniel Stone | 36 | 5.16% | 3 | 7.89% |
Daniel Vetter | 27 | 3.87% | 1 | 2.63% |
YoungJun Cho | 25 | 3.59% | 1 | 2.63% |
Gustavo Fernando Padovan | 14 | 2.01% | 2 | 5.26% |
Tobias Jakobi | 8 | 1.15% | 1 | 2.63% |
Ville Syrjälä | 6 | 0.86% | 4 | 10.53% |
David Howells | 4 | 0.57% | 1 | 2.63% |
Christoph Hellwig | 4 | 0.57% | 1 | 2.63% |
Andrzej Hajda | 3 | 0.43% | 1 | 2.63% |
Shuah Khan | 2 | 0.29% | 1 | 2.63% |
Sean Paul | 1 | 0.14% | 1 | 2.63% |
Maxime Ripard | 1 | 0.14% | 1 | 2.63% |
Laurent Pinchart | 1 | 0.14% | 1 | 2.63% |
Noralf Trönnes | 1 | 0.14% | 1 | 2.63% |
Total | 697 | 100.00% | 38 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.