| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2012 Russell King |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | 4 | */ |
|---|
| 8 | | -#include <drm/drm_crtc_helper.h> |
|---|
| 5 | + |
|---|
| 6 | +#include <drm/drm_modeset_helper.h> |
|---|
| 9 | 7 | #include <drm/drm_fb_helper.h> |
|---|
| 8 | +#include <drm/drm_fourcc.h> |
|---|
| 10 | 9 | #include <drm/drm_gem_framebuffer_helper.h> |
|---|
| 10 | + |
|---|
| 11 | 11 | #include "armada_drm.h" |
|---|
| 12 | 12 | #include "armada_fb.h" |
|---|
| 13 | 13 | #include "armada_gem.h" |
|---|
| .. | .. |
|---|
| 87 | 87 | struct drm_framebuffer *armada_fb_create(struct drm_device *dev, |
|---|
| 88 | 88 | struct drm_file *dfile, const struct drm_mode_fb_cmd2 *mode) |
|---|
| 89 | 89 | { |
|---|
| 90 | + const struct drm_format_info *info = drm_get_format_info(dev, mode); |
|---|
| 90 | 91 | struct armada_gem_object *obj; |
|---|
| 91 | 92 | struct armada_framebuffer *dfb; |
|---|
| 92 | 93 | int ret; |
|---|
| .. | .. |
|---|
| 97 | 98 | mode->pitches[2]); |
|---|
| 98 | 99 | |
|---|
| 99 | 100 | /* We can only handle a single plane at the moment */ |
|---|
| 100 | | - if (drm_format_num_planes(mode->pixel_format) > 1 && |
|---|
| 101 | + if (info->num_planes > 1 && |
|---|
| 101 | 102 | (mode->handles[0] != mode->handles[1] || |
|---|
| 102 | 103 | mode->handles[0] != mode->handles[2])) { |
|---|
| 103 | 104 | ret = -EINVAL; |
|---|
| .. | .. |
|---|
| 128 | 129 | goto err; |
|---|
| 129 | 130 | } |
|---|
| 130 | 131 | |
|---|
| 131 | | - drm_gem_object_put_unlocked(&obj->obj); |
|---|
| 132 | + drm_gem_object_put(&obj->obj); |
|---|
| 132 | 133 | |
|---|
| 133 | 134 | return &dfb->fb; |
|---|
| 134 | 135 | |
|---|
| 135 | 136 | err_unref: |
|---|
| 136 | | - drm_gem_object_put_unlocked(&obj->obj); |
|---|
| 137 | + drm_gem_object_put(&obj->obj); |
|---|
| 137 | 138 | err: |
|---|
| 138 | 139 | DRM_ERROR("failed to initialize framebuffer: %d\n", ret); |
|---|
| 139 | 140 | return ERR_PTR(ret); |
|---|