mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-02 06:56:41 +07:00
Merge tag 'topic/drm-misc-2016-08-12' of git://anongit.freedesktop.org/drm-intel into drm-next
- more fence destaging and cleanup (Gustavo&Sumit) - DRIVER_LEGACY to untangle from DRIVER_MODESET - drm_mm refactor (Chris) - fbdev-less compile fies - clipped plane src/dst rects (Ville) - + a few mediatek patches that build on top of that (Bibby+Daniel) - small stuff all over really * tag 'topic/drm-misc-2016-08-12' of git://anongit.freedesktop.org/drm-intel: (43 commits) dma-buf/fence: kerneldoc: remove spurious section header dma-buf/fence: kerneldoc: remove unused struct members Revert "gpu: drm: omapdrm: dss-of: add missing of_node_put after calling of_parse_phandle" drm: Protect fb_defio in drivers with CONFIG_KMS_FBDEV_EMULATION drm/radeon|amgpu: Make fbdev emulation optional drm/vmwgfx: select CONFIG_FB drm: Remove superflous linux/fb.h includes drm/fb-helper: Add a dummy remove_conflicting_framebuffers dma-buf/sync_file: only enable fence signalling on poll() Documentation: add doc for sync_file_get_fence() dma-buf/sync_file: add sync_file_get_fence() dma-buf/sync_file: refactor fence storage in struct sync_file dma-buf/fence-array: add fence_is_array() drm/dp_helper: Rate limit timeout errors from drm_dp_i2c_do_msg() drm/dp_helper: Print first error received on failure in drm_dp_dpcd_access() drm: Add ratelimited versions of the DRM_DEBUG* macros drm: Make sure drm_vblank_no_hw_counter isn't abused drm/mediatek: Fix mtk_atomic_complete for runtime_pm drm/mediatek: plane: Use FB's format's cpp to compute x offset drm/mediatek: plane: Merge mtk_plane_enable into mtk_plane_atomic_update ...
This commit is contained in:
commit
f8725ad1da
@ -53,9 +53,12 @@ u32 driver_features;
|
||||
DRIVER_USE_AGP
|
||||
Driver uses AGP interface, the DRM core will manage AGP resources.
|
||||
|
||||
DRIVER_REQUIRE_AGP
|
||||
Driver needs AGP interface to function. AGP initialization failure
|
||||
will become a fatal error.
|
||||
DRIVER_LEGACY
|
||||
Denote a legacy driver using shadow attach. Don't use.
|
||||
|
||||
DRIVER_KMS_LEGACY_CONTEXT
|
||||
Used only by nouveau for backwards compatibility with existing userspace.
|
||||
Don't use.
|
||||
|
||||
DRIVER_PCI_DMA
|
||||
Driver is capable of PCI DMA, mapping of PCI DMA buffers to
|
||||
|
@ -64,6 +64,20 @@ The sync_file fd now can be sent to userspace.
|
||||
If the creation process fail, or the sync_file needs to be released by any
|
||||
other reason fput(sync_file->file) should be used.
|
||||
|
||||
Receiving Sync Files from Userspace
|
||||
-----------------------------------
|
||||
|
||||
When userspace needs to send an in-fence to the driver it passes file descriptor
|
||||
of the Sync File to the kernel. The kernel can then retrieve the fences
|
||||
from it.
|
||||
|
||||
Interface:
|
||||
struct fence *sync_file_get_fence(int fd);
|
||||
|
||||
|
||||
The returned reference is owned by the caller and must be disposed of
|
||||
afterwards using fence_put(). In case of error, a NULL is returned instead.
|
||||
|
||||
References:
|
||||
[1] struct sync_file in include/linux/sync_file.h
|
||||
[2] All interfaces mentioned above defined in include/linux/sync_file.h
|
||||
|
@ -99,6 +99,7 @@ const struct fence_ops fence_array_ops = {
|
||||
.wait = fence_default_wait,
|
||||
.release = fence_array_release,
|
||||
};
|
||||
EXPORT_SYMBOL(fence_array_ops);
|
||||
|
||||
/**
|
||||
* fence_array_create - Create a custom fence array
|
||||
|
@ -28,11 +28,11 @@
|
||||
|
||||
static const struct file_operations sync_file_fops;
|
||||
|
||||
static struct sync_file *sync_file_alloc(int size)
|
||||
static struct sync_file *sync_file_alloc(void)
|
||||
{
|
||||
struct sync_file *sync_file;
|
||||
|
||||
sync_file = kzalloc(size, GFP_KERNEL);
|
||||
sync_file = kzalloc(sizeof(*sync_file), GFP_KERNEL);
|
||||
if (!sync_file)
|
||||
return NULL;
|
||||
|
||||
@ -45,6 +45,8 @@ static struct sync_file *sync_file_alloc(int size)
|
||||
|
||||
init_waitqueue_head(&sync_file->wq);
|
||||
|
||||
INIT_LIST_HEAD(&sync_file->cb.node);
|
||||
|
||||
return sync_file;
|
||||
|
||||
err:
|
||||
@ -54,14 +56,11 @@ static struct sync_file *sync_file_alloc(int size)
|
||||
|
||||
static void fence_check_cb_func(struct fence *f, struct fence_cb *cb)
|
||||
{
|
||||
struct sync_file_cb *check;
|
||||
struct sync_file *sync_file;
|
||||
|
||||
check = container_of(cb, struct sync_file_cb, cb);
|
||||
sync_file = check->sync_file;
|
||||
sync_file = container_of(cb, struct sync_file, cb);
|
||||
|
||||
if (atomic_dec_and_test(&sync_file->status))
|
||||
wake_up_all(&sync_file->wq);
|
||||
wake_up_all(&sync_file->wq);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,23 +75,17 @@ struct sync_file *sync_file_create(struct fence *fence)
|
||||
{
|
||||
struct sync_file *sync_file;
|
||||
|
||||
sync_file = sync_file_alloc(offsetof(struct sync_file, cbs[1]));
|
||||
sync_file = sync_file_alloc();
|
||||
if (!sync_file)
|
||||
return NULL;
|
||||
|
||||
sync_file->num_fences = 1;
|
||||
atomic_set(&sync_file->status, 1);
|
||||
sync_file->fence = fence;
|
||||
|
||||
snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%llu-%d",
|
||||
fence->ops->get_driver_name(fence),
|
||||
fence->ops->get_timeline_name(fence), fence->context,
|
||||
fence->seqno);
|
||||
|
||||
sync_file->cbs[0].fence = fence;
|
||||
sync_file->cbs[0].sync_file = sync_file;
|
||||
if (fence_add_callback(fence, &sync_file->cbs[0].cb,
|
||||
fence_check_cb_func))
|
||||
atomic_dec(&sync_file->status);
|
||||
|
||||
return sync_file;
|
||||
}
|
||||
EXPORT_SYMBOL(sync_file_create);
|
||||
@ -121,14 +114,72 @@ static struct sync_file *sync_file_fdget(int fd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void sync_file_add_pt(struct sync_file *sync_file, int *i,
|
||||
struct fence *fence)
|
||||
/**
|
||||
* sync_file_get_fence - get the fence related to the sync_file fd
|
||||
* @fd: sync_file fd to get the fence from
|
||||
*
|
||||
* Ensures @fd references a valid sync_file and returns a fence that
|
||||
* represents all fence in the sync_file. On error NULL is returned.
|
||||
*/
|
||||
struct fence *sync_file_get_fence(int fd)
|
||||
{
|
||||
sync_file->cbs[*i].fence = fence;
|
||||
sync_file->cbs[*i].sync_file = sync_file;
|
||||
struct sync_file *sync_file;
|
||||
struct fence *fence;
|
||||
|
||||
if (!fence_add_callback(fence, &sync_file->cbs[*i].cb,
|
||||
fence_check_cb_func)) {
|
||||
sync_file = sync_file_fdget(fd);
|
||||
if (!sync_file)
|
||||
return NULL;
|
||||
|
||||
fence = fence_get(sync_file->fence);
|
||||
fput(sync_file->file);
|
||||
|
||||
return fence;
|
||||
}
|
||||
EXPORT_SYMBOL(sync_file_get_fence);
|
||||
|
||||
static int sync_file_set_fence(struct sync_file *sync_file,
|
||||
struct fence **fences, int num_fences)
|
||||
{
|
||||
struct fence_array *array;
|
||||
|
||||
/*
|
||||
* The reference for the fences in the new sync_file and held
|
||||
* in add_fence() during the merge procedure, so for num_fences == 1
|
||||
* we already own a new reference to the fence. For num_fence > 1
|
||||
* we own the reference of the fence_array creation.
|
||||
*/
|
||||
if (num_fences == 1) {
|
||||
sync_file->fence = fences[0];
|
||||
} else {
|
||||
array = fence_array_create(num_fences, fences,
|
||||
fence_context_alloc(1), 1, false);
|
||||
if (!array)
|
||||
return -ENOMEM;
|
||||
|
||||
sync_file->fence = &array->base;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct fence **get_fences(struct sync_file *sync_file, int *num_fences)
|
||||
{
|
||||
if (fence_is_array(sync_file->fence)) {
|
||||
struct fence_array *array = to_fence_array(sync_file->fence);
|
||||
|
||||
*num_fences = array->num_fences;
|
||||
return array->fences;
|
||||
}
|
||||
|
||||
*num_fences = 1;
|
||||
return &sync_file->fence;
|
||||
}
|
||||
|
||||
static void add_fence(struct fence **fences, int *i, struct fence *fence)
|
||||
{
|
||||
fences[*i] = fence;
|
||||
|
||||
if (!fence_is_signaled(fence)) {
|
||||
fence_get(fence);
|
||||
(*i)++;
|
||||
}
|
||||
@ -147,16 +198,24 @@ static void sync_file_add_pt(struct sync_file *sync_file, int *i,
|
||||
static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
|
||||
struct sync_file *b)
|
||||
{
|
||||
int num_fences = a->num_fences + b->num_fences;
|
||||
struct sync_file *sync_file;
|
||||
int i, i_a, i_b;
|
||||
unsigned long size = offsetof(struct sync_file, cbs[num_fences]);
|
||||
struct fence **fences, **nfences, **a_fences, **b_fences;
|
||||
int i, i_a, i_b, num_fences, a_num_fences, b_num_fences;
|
||||
|
||||
sync_file = sync_file_alloc(size);
|
||||
sync_file = sync_file_alloc();
|
||||
if (!sync_file)
|
||||
return NULL;
|
||||
|
||||
atomic_set(&sync_file->status, num_fences);
|
||||
a_fences = get_fences(a, &a_num_fences);
|
||||
b_fences = get_fences(b, &b_num_fences);
|
||||
if (a_num_fences > INT_MAX - b_num_fences)
|
||||
return NULL;
|
||||
|
||||
num_fences = a_num_fences + b_num_fences;
|
||||
|
||||
fences = kcalloc(num_fences, sizeof(*fences), GFP_KERNEL);
|
||||
if (!fences)
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* Assume sync_file a and b are both ordered and have no
|
||||
@ -165,55 +224,71 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
|
||||
* If a sync_file can only be created with sync_file_merge
|
||||
* and sync_file_create, this is a reasonable assumption.
|
||||
*/
|
||||
for (i = i_a = i_b = 0; i_a < a->num_fences && i_b < b->num_fences; ) {
|
||||
struct fence *pt_a = a->cbs[i_a].fence;
|
||||
struct fence *pt_b = b->cbs[i_b].fence;
|
||||
for (i = i_a = i_b = 0; i_a < a_num_fences && i_b < b_num_fences; ) {
|
||||
struct fence *pt_a = a_fences[i_a];
|
||||
struct fence *pt_b = b_fences[i_b];
|
||||
|
||||
if (pt_a->context < pt_b->context) {
|
||||
sync_file_add_pt(sync_file, &i, pt_a);
|
||||
add_fence(fences, &i, pt_a);
|
||||
|
||||
i_a++;
|
||||
} else if (pt_a->context > pt_b->context) {
|
||||
sync_file_add_pt(sync_file, &i, pt_b);
|
||||
add_fence(fences, &i, pt_b);
|
||||
|
||||
i_b++;
|
||||
} else {
|
||||
if (pt_a->seqno - pt_b->seqno <= INT_MAX)
|
||||
sync_file_add_pt(sync_file, &i, pt_a);
|
||||
add_fence(fences, &i, pt_a);
|
||||
else
|
||||
sync_file_add_pt(sync_file, &i, pt_b);
|
||||
add_fence(fences, &i, pt_b);
|
||||
|
||||
i_a++;
|
||||
i_b++;
|
||||
}
|
||||
}
|
||||
|
||||
for (; i_a < a->num_fences; i_a++)
|
||||
sync_file_add_pt(sync_file, &i, a->cbs[i_a].fence);
|
||||
for (; i_a < a_num_fences; i_a++)
|
||||
add_fence(fences, &i, a_fences[i_a]);
|
||||
|
||||
for (; i_b < b->num_fences; i_b++)
|
||||
sync_file_add_pt(sync_file, &i, b->cbs[i_b].fence);
|
||||
for (; i_b < b_num_fences; i_b++)
|
||||
add_fence(fences, &i, b_fences[i_b]);
|
||||
|
||||
if (num_fences > i)
|
||||
atomic_sub(num_fences - i, &sync_file->status);
|
||||
sync_file->num_fences = i;
|
||||
if (i == 0) {
|
||||
add_fence(fences, &i, a_fences[0]);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (num_fences > i) {
|
||||
nfences = krealloc(fences, i * sizeof(*fences),
|
||||
GFP_KERNEL);
|
||||
if (!nfences)
|
||||
goto err;
|
||||
|
||||
fences = nfences;
|
||||
}
|
||||
|
||||
if (sync_file_set_fence(sync_file, fences, i) < 0) {
|
||||
kfree(fences);
|
||||
goto err;
|
||||
}
|
||||
|
||||
strlcpy(sync_file->name, name, sizeof(sync_file->name));
|
||||
return sync_file;
|
||||
|
||||
err:
|
||||
fput(sync_file->file);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
static void sync_file_free(struct kref *kref)
|
||||
{
|
||||
struct sync_file *sync_file = container_of(kref, struct sync_file,
|
||||
kref);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sync_file->num_fences; ++i) {
|
||||
fence_remove_callback(sync_file->cbs[i].fence,
|
||||
&sync_file->cbs[i].cb);
|
||||
fence_put(sync_file->cbs[i].fence);
|
||||
}
|
||||
|
||||
if (test_bit(POLL_ENABLED, &sync_file->fence->flags))
|
||||
fence_remove_callback(sync_file->fence, &sync_file->cb);
|
||||
fence_put(sync_file->fence);
|
||||
kfree(sync_file);
|
||||
}
|
||||
|
||||
@ -228,17 +303,16 @@ static int sync_file_release(struct inode *inode, struct file *file)
|
||||
static unsigned int sync_file_poll(struct file *file, poll_table *wait)
|
||||
{
|
||||
struct sync_file *sync_file = file->private_data;
|
||||
int status;
|
||||
|
||||
poll_wait(file, &sync_file->wq, wait);
|
||||
|
||||
status = atomic_read(&sync_file->status);
|
||||
if (!test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) {
|
||||
if (fence_add_callback(sync_file->fence, &sync_file->cb,
|
||||
fence_check_cb_func) < 0)
|
||||
wake_up_all(&sync_file->wq);
|
||||
}
|
||||
|
||||
if (!status)
|
||||
return POLLIN;
|
||||
if (status < 0)
|
||||
return POLLERR;
|
||||
return 0;
|
||||
return fence_is_signaled(sync_file->fence) ? POLLIN : 0;
|
||||
}
|
||||
|
||||
static long sync_file_ioctl_merge(struct sync_file *sync_file,
|
||||
@ -315,8 +389,9 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
|
||||
{
|
||||
struct sync_file_info info;
|
||||
struct sync_fence_info *fence_info = NULL;
|
||||
struct fence **fences;
|
||||
__u32 size;
|
||||
int ret, i;
|
||||
int num_fences, ret, i;
|
||||
|
||||
if (copy_from_user(&info, (void __user *)arg, sizeof(info)))
|
||||
return -EFAULT;
|
||||
@ -324,6 +399,8 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
|
||||
if (info.flags || info.pad)
|
||||
return -EINVAL;
|
||||
|
||||
fences = get_fences(sync_file, &num_fences);
|
||||
|
||||
/*
|
||||
* Passing num_fences = 0 means that userspace doesn't want to
|
||||
* retrieve any sync_fence_info. If num_fences = 0 we skip filling
|
||||
@ -333,16 +410,16 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
|
||||
if (!info.num_fences)
|
||||
goto no_fences;
|
||||
|
||||
if (info.num_fences < sync_file->num_fences)
|
||||
if (info.num_fences < num_fences)
|
||||
return -EINVAL;
|
||||
|
||||
size = sync_file->num_fences * sizeof(*fence_info);
|
||||
size = num_fences * sizeof(*fence_info);
|
||||
fence_info = kzalloc(size, GFP_KERNEL);
|
||||
if (!fence_info)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < sync_file->num_fences; ++i)
|
||||
sync_fill_fence_info(sync_file->cbs[i].fence, &fence_info[i]);
|
||||
for (i = 0; i < num_fences; i++)
|
||||
sync_fill_fence_info(fences[i], &fence_info[i]);
|
||||
|
||||
if (copy_to_user(u64_to_user_ptr(info.sync_fence_info), fence_info,
|
||||
size)) {
|
||||
@ -352,11 +429,8 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
|
||||
|
||||
no_fences:
|
||||
strlcpy(info.name, sync_file->name, sizeof(info.name));
|
||||
info.status = atomic_read(&sync_file->status);
|
||||
if (info.status >= 0)
|
||||
info.status = !info.status;
|
||||
|
||||
info.num_fences = sync_file->num_fences;
|
||||
info.status = fence_is_signaled(sync_file->fence);
|
||||
info.num_fences = num_fences;
|
||||
|
||||
if (copy_to_user((void __user *)arg, &info, sizeof(info)))
|
||||
ret = -EFAULT;
|
||||
|
@ -129,12 +129,8 @@ config DRM_R128
|
||||
config DRM_RADEON
|
||||
tristate "ATI Radeon"
|
||||
depends on DRM && PCI
|
||||
select FB_CFB_FILLRECT
|
||||
select FB_CFB_COPYAREA
|
||||
select FB_CFB_IMAGEBLIT
|
||||
select FW_LOADER
|
||||
select DRM_KMS_HELPER
|
||||
select DRM_KMS_FB_HELPER
|
||||
select DRM_TTM
|
||||
select POWER_SUPPLY
|
||||
select HWMON
|
||||
@ -153,12 +149,8 @@ source "drivers/gpu/drm/radeon/Kconfig"
|
||||
config DRM_AMDGPU
|
||||
tristate "AMD GPU"
|
||||
depends on DRM && PCI
|
||||
select FB_CFB_FILLRECT
|
||||
select FB_CFB_COPYAREA
|
||||
select FB_CFB_IMAGEBLIT
|
||||
select FW_LOADER
|
||||
select DRM_KMS_HELPER
|
||||
select DRM_KMS_FB_HELPER
|
||||
select DRM_TTM
|
||||
select POWER_SUPPLY
|
||||
select HWMON
|
||||
|
@ -341,7 +341,7 @@ static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev)
|
||||
#ifdef CONFIG_X86
|
||||
primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
|
||||
#endif
|
||||
remove_conflicting_framebuffers(ap, "amdgpudrmfb", primary);
|
||||
drm_fb_helper_remove_conflicting_framebuffers(ap, "amdgpudrmfb", primary);
|
||||
kfree(ap);
|
||||
|
||||
return 0;
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include <drm/drmP.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
#include "linux/delay.h"
|
||||
|
||||
#include "hwmgr.h"
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
#include <asm/div64.h>
|
||||
#include "linux/delay.h"
|
||||
#include "pp_acpi.h"
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include "ppatomctrl.h"
|
||||
#include "atombios.h"
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
#include "linux/delay.h"
|
||||
#include "pp_acpi.h"
|
||||
#include "hwmgr.h"
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include "tonga_processpptables.h"
|
||||
#include "ppatomctrl.h"
|
||||
|
@ -49,6 +49,6 @@ void malidp_de_planes_destroy(struct drm_device *drm);
|
||||
int malidp_crtc_init(struct drm_device *drm);
|
||||
|
||||
/* often used combination of rotational bits */
|
||||
#define MALIDP_ROTATED_MASK (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))
|
||||
#define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270)
|
||||
|
||||
#endif /* __MALIDP_DRV_H__ */
|
||||
|
@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
|
||||
return -EINVAL;
|
||||
|
||||
/* packed RGB888 / BGR888 can't be rotated or flipped */
|
||||
if (state->rotation != BIT(DRM_ROTATE_0) &&
|
||||
if (state->rotation != DRM_ROTATE_0 &&
|
||||
(state->fb->pixel_format == DRM_FORMAT_RGB888 ||
|
||||
state->fb->pixel_format == DRM_FORMAT_BGR888))
|
||||
return -EINVAL;
|
||||
@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
|
||||
/* setup the rotation and axis flip bits */
|
||||
if (plane->state->rotation & DRM_ROTATE_MASK)
|
||||
val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
|
||||
if (plane->state->rotation & BIT(DRM_REFLECT_X))
|
||||
if (plane->state->rotation & DRM_REFLECT_X)
|
||||
val |= LAYER_V_FLIP;
|
||||
if (plane->state->rotation & BIT(DRM_REFLECT_Y))
|
||||
if (plane->state->rotation & DRM_REFLECT_Y)
|
||||
val |= LAYER_H_FLIP;
|
||||
|
||||
/* set the 'enable layer' bit */
|
||||
@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm)
|
||||
goto cleanup;
|
||||
|
||||
if (!drm->mode_config.rotation_property) {
|
||||
unsigned long flags = BIT(DRM_ROTATE_0) |
|
||||
BIT(DRM_ROTATE_90) |
|
||||
BIT(DRM_ROTATE_180) |
|
||||
BIT(DRM_ROTATE_270) |
|
||||
BIT(DRM_REFLECT_X) |
|
||||
BIT(DRM_REFLECT_Y);
|
||||
unsigned long flags = DRM_ROTATE_0 |
|
||||
DRM_ROTATE_90 |
|
||||
DRM_ROTATE_180 |
|
||||
DRM_ROTATE_270 |
|
||||
DRM_REFLECT_X |
|
||||
DRM_REFLECT_Y;
|
||||
drm->mode_config.rotation_property =
|
||||
drm_mode_create_rotation_property(drm, flags);
|
||||
}
|
||||
@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm)
|
||||
if (drm->mode_config.rotation_property && (id != DE_SMART))
|
||||
drm_object_attach_property(&plane->base.base,
|
||||
drm->mode_config.rotation_property,
|
||||
BIT(DRM_ROTATE_0));
|
||||
DRM_ROTATE_0);
|
||||
|
||||
drm_plane_helper_add(&plane->base,
|
||||
&malidp_de_plane_helper_funcs);
|
||||
|
@ -7,7 +7,6 @@
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#include <linux/errno.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
|
@ -121,7 +121,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
|
||||
int ret;
|
||||
|
||||
ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
|
||||
BIT(DRM_ROTATE_0),
|
||||
DRM_ROTATE_0,
|
||||
0, INT_MAX, true, false, &visible);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <linux/tty.h>
|
||||
#include <linux/sysrq.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
|
||||
|
@ -393,7 +393,7 @@ static void atmel_hlcdc_plane_update_format(struct atmel_hlcdc_plane *plane,
|
||||
|
||||
if ((state->base.fb->pixel_format == DRM_FORMAT_YUV422 ||
|
||||
state->base.fb->pixel_format == DRM_FORMAT_NV61) &&
|
||||
(state->base.rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))))
|
||||
(state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)))
|
||||
cfg |= ATMEL_HLCDC_YUV422ROT;
|
||||
|
||||
atmel_hlcdc_layer_update_cfg(&plane->layer,
|
||||
@ -628,7 +628,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
|
||||
/*
|
||||
* Swap width and size in case of 90 or 270 degrees rotation
|
||||
*/
|
||||
if (state->base.rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
|
||||
if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
|
||||
tmp = state->crtc_w;
|
||||
state->crtc_w = state->crtc_h;
|
||||
state->crtc_h = tmp;
|
||||
@ -677,7 +677,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
|
||||
return -EINVAL;
|
||||
|
||||
switch (state->base.rotation & DRM_ROTATE_MASK) {
|
||||
case BIT(DRM_ROTATE_90):
|
||||
case DRM_ROTATE_90:
|
||||
offset = ((y_offset + state->src_y + patched_src_w - 1) /
|
||||
ydiv) * fb->pitches[i];
|
||||
offset += ((x_offset + state->src_x) / xdiv) *
|
||||
@ -686,7 +686,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
|
||||
fb->pitches[i];
|
||||
state->pstride[i] = -fb->pitches[i] - state->bpp[i];
|
||||
break;
|
||||
case BIT(DRM_ROTATE_180):
|
||||
case DRM_ROTATE_180:
|
||||
offset = ((y_offset + state->src_y + patched_src_h - 1) /
|
||||
ydiv) * fb->pitches[i];
|
||||
offset += ((x_offset + state->src_x + patched_src_w - 1) /
|
||||
@ -695,7 +695,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
|
||||
state->bpp[i]) - fb->pitches[i];
|
||||
state->pstride[i] = -2 * state->bpp[i];
|
||||
break;
|
||||
case BIT(DRM_ROTATE_270):
|
||||
case DRM_ROTATE_270:
|
||||
offset = ((y_offset + state->src_y) / ydiv) *
|
||||
fb->pitches[i];
|
||||
offset += ((x_offset + state->src_x + patched_src_h - 1) /
|
||||
@ -705,7 +705,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
|
||||
(2 * state->bpp[i]);
|
||||
state->pstride[i] = fb->pitches[i] - state->bpp[i];
|
||||
break;
|
||||
case BIT(DRM_ROTATE_0):
|
||||
case DRM_ROTATE_0:
|
||||
default:
|
||||
offset = ((y_offset + state->src_y) / ydiv) *
|
||||
fb->pitches[i];
|
||||
@ -905,7 +905,7 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
|
||||
if (desc->layout.xstride && desc->layout.pstride)
|
||||
drm_object_attach_property(&plane->base.base,
|
||||
plane->base.dev->mode_config.rotation_property,
|
||||
BIT(DRM_ROTATE_0));
|
||||
DRM_ROTATE_0);
|
||||
|
||||
if (desc->layout.csc) {
|
||||
/*
|
||||
@ -1056,10 +1056,10 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev)
|
||||
|
||||
dev->mode_config.rotation_property =
|
||||
drm_mode_create_rotation_property(dev,
|
||||
BIT(DRM_ROTATE_0) |
|
||||
BIT(DRM_ROTATE_90) |
|
||||
BIT(DRM_ROTATE_180) |
|
||||
BIT(DRM_ROTATE_270));
|
||||
DRM_ROTATE_0 |
|
||||
DRM_ROTATE_90 |
|
||||
DRM_ROTATE_180 |
|
||||
DRM_ROTATE_270);
|
||||
if (!dev->mode_config.rotation_property)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/console.h>
|
||||
|
||||
#include <drm/drmP.h>
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
|
||||
#include "bochs.h"
|
||||
|
||||
@ -153,7 +154,7 @@ static int bochs_kick_out_firmware_fb(struct pci_dev *pdev)
|
||||
|
||||
ap->ranges[0].base = pci_resource_start(pdev, 0);
|
||||
ap->ranges[0].size = pci_resource_len(pdev, 0);
|
||||
remove_conflicting_framebuffers(ap, "bochsdrmfb", false);
|
||||
drm_fb_helper_remove_conflicting_framebuffers(ap, "bochsdrmfb", false);
|
||||
kfree(ap);
|
||||
|
||||
return 0;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/i2c.h>
|
||||
|
@ -57,7 +57,7 @@ static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev)
|
||||
#ifdef CONFIG_X86
|
||||
primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
|
||||
#endif
|
||||
remove_conflicting_framebuffers(ap, "cirrusdrmfb", primary);
|
||||
drm_fb_helper_remove_conflicting_framebuffers(ap, "cirrusdrmfb", primary);
|
||||
kfree(ap);
|
||||
|
||||
return 0;
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include "cirrus_drv.h"
|
||||
|
||||
static void cirrus_dirty_update(struct cirrus_fbdev *afbdev,
|
||||
|
@ -430,9 +430,7 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
|
||||
* intact so it can still be used. It is safe to call this if AGP is disabled or
|
||||
* was already removed.
|
||||
*
|
||||
* If DRIVER_MODESET is active, nothing is done to protect the modesetting
|
||||
* resources from getting destroyed. Drivers are responsible of cleaning them up
|
||||
* during device shutdown.
|
||||
* Cleanup is only done for drivers who have DRIVER_LEGACY set.
|
||||
*/
|
||||
void drm_legacy_agp_clear(struct drm_device *dev)
|
||||
{
|
||||
@ -440,7 +438,7 @@ void drm_legacy_agp_clear(struct drm_device *dev)
|
||||
|
||||
if (!dev->agp)
|
||||
return;
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
|
||||
|
@ -1635,6 +1635,9 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,
|
||||
|
||||
funcs = plane->helper_private;
|
||||
|
||||
if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc))
|
||||
continue;
|
||||
|
||||
if (funcs->prepare_fb) {
|
||||
ret = funcs->prepare_fb(plane, plane_state);
|
||||
if (ret)
|
||||
@ -1651,11 +1654,13 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,
|
||||
if (j >= i)
|
||||
continue;
|
||||
|
||||
if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc))
|
||||
continue;
|
||||
|
||||
funcs = plane->helper_private;
|
||||
|
||||
if (funcs->cleanup_fb)
|
||||
funcs->cleanup_fb(plane, plane_state);
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1898,6 +1903,9 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev,
|
||||
for_each_plane_in_state(old_state, plane, plane_state, i) {
|
||||
const struct drm_plane_helper_funcs *funcs;
|
||||
|
||||
if (!drm_atomic_helper_framebuffer_changed(dev, old_state, plane_state->crtc))
|
||||
continue;
|
||||
|
||||
funcs = plane->helper_private;
|
||||
|
||||
if (funcs->cleanup_fb)
|
||||
@ -2358,7 +2366,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
|
||||
primary_state->crtc_h = vdisplay;
|
||||
primary_state->src_x = set->x << 16;
|
||||
primary_state->src_y = set->y << 16;
|
||||
if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
|
||||
if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
|
||||
primary_state->src_w = vdisplay << 16;
|
||||
primary_state->src_h = hdisplay << 16;
|
||||
} else {
|
||||
@ -3043,7 +3051,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)
|
||||
|
||||
if (plane->state) {
|
||||
plane->state->plane = plane;
|
||||
plane->state->rotation = BIT(DRM_ROTATE_0);
|
||||
plane->state->rotation = DRM_ROTATE_0;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
|
||||
|
@ -251,7 +251,7 @@ void drm_master_release(struct drm_file *file_priv)
|
||||
if (!drm_is_current_master(file_priv))
|
||||
goto out;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||
if (drm_core_check_feature(dev, DRIVER_LEGACY)) {
|
||||
/*
|
||||
* Since the master is disappearing, so is the
|
||||
* possibility to lock.
|
||||
|
@ -397,7 +397,7 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
|
||||
return -EPERM;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
err = drm_addmap_core(dev, map->offset, map->size, map->type,
|
||||
@ -443,7 +443,7 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
|
||||
int i;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
idx = map->offset;
|
||||
@ -545,7 +545,7 @@ EXPORT_SYMBOL(drm_legacy_rmmap_locked);
|
||||
void drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map)
|
||||
{
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
@ -558,7 +558,7 @@ void drm_legacy_master_rmmaps(struct drm_device *dev, struct drm_master *master)
|
||||
{
|
||||
struct drm_map_list *r_list, *list_temp;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
@ -595,7 +595,7 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
|
||||
int ret;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
@ -1220,7 +1220,7 @@ int drm_legacy_addbufs(struct drm_device *dev, void *data,
|
||||
struct drm_buf_desc *request = data;
|
||||
int ret;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
@ -1266,7 +1266,7 @@ int drm_legacy_infobufs(struct drm_device *dev, void *data,
|
||||
int i;
|
||||
int count;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
@ -1347,7 +1347,7 @@ int drm_legacy_markbufs(struct drm_device *dev, void *data,
|
||||
int order;
|
||||
struct drm_buf_entry *entry;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
@ -1395,7 +1395,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
|
||||
int idx;
|
||||
struct drm_buf *buf;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
@ -1450,7 +1450,7 @@ int drm_legacy_mapbufs(struct drm_device *dev, void *data,
|
||||
struct drm_buf_map *request = data;
|
||||
int i;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
@ -1530,7 +1530,7 @@ int drm_legacy_mapbufs(struct drm_device *dev, void *data,
|
||||
int drm_legacy_dma_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv)
|
||||
{
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
if (dev->driver->dma_ioctl)
|
||||
|
@ -54,7 +54,7 @@ struct drm_ctx_list {
|
||||
void drm_legacy_ctxbitmap_free(struct drm_device * dev, int ctx_handle)
|
||||
{
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
@ -92,7 +92,7 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * dev)
|
||||
void drm_legacy_ctxbitmap_init(struct drm_device * dev)
|
||||
{
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
idr_init(&dev->ctx_idr);
|
||||
@ -109,7 +109,7 @@ void drm_legacy_ctxbitmap_init(struct drm_device * dev)
|
||||
void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev)
|
||||
{
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
@ -131,7 +131,7 @@ void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file)
|
||||
struct drm_ctx_list *pos, *tmp;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
mutex_lock(&dev->ctxlist_mutex);
|
||||
@ -177,7 +177,7 @@ int drm_legacy_getsareactx(struct drm_device *dev, void *data,
|
||||
struct drm_map_list *_entry;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
@ -225,7 +225,7 @@ int drm_legacy_setsareactx(struct drm_device *dev, void *data,
|
||||
struct drm_map_list *r_list = NULL;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
@ -329,7 +329,7 @@ int drm_legacy_resctx(struct drm_device *dev, void *data,
|
||||
int i;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
if (res->count >= DRM_RESERVED_CONTEXTS) {
|
||||
@ -363,7 +363,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
|
||||
struct drm_ctx *ctx = data;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
ctx->handle = drm_legacy_ctxbitmap_next(dev);
|
||||
@ -410,7 +410,7 @@ int drm_legacy_getctx(struct drm_device *dev, void *data,
|
||||
struct drm_ctx *ctx = data;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
/* This is 0, because we don't handle any context flags */
|
||||
@ -436,7 +436,7 @@ int drm_legacy_switchctx(struct drm_device *dev, void *data,
|
||||
struct drm_ctx *ctx = data;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
DRM_DEBUG("%d\n", ctx->handle);
|
||||
@ -460,7 +460,7 @@ int drm_legacy_newctx(struct drm_device *dev, void *data,
|
||||
struct drm_ctx *ctx = data;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
DRM_DEBUG("%d\n", ctx->handle);
|
||||
@ -486,7 +486,7 @@ int drm_legacy_rmctx(struct drm_device *dev, void *data,
|
||||
struct drm_ctx *ctx = data;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
DRM_DEBUG("%d\n", ctx->handle);
|
||||
|
@ -2802,8 +2802,8 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
|
||||
drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay);
|
||||
|
||||
if (crtc->state &&
|
||||
crtc->primary->state->rotation & (BIT(DRM_ROTATE_90) |
|
||||
BIT(DRM_ROTATE_270)))
|
||||
crtc->primary->state->rotation & (DRM_ROTATE_90 |
|
||||
DRM_ROTATE_270))
|
||||
swap(hdisplay, vdisplay);
|
||||
|
||||
return check_src_coords(x << 16, y << 16,
|
||||
@ -5644,9 +5644,9 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
|
||||
* Eg. if the hardware supports everything except DRM_REFLECT_X
|
||||
* one could call this function like this:
|
||||
*
|
||||
* drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
|
||||
* BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
|
||||
* BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
|
||||
* drm_rotation_simplify(rotation, DRM_ROTATE_0 |
|
||||
* DRM_ROTATE_90 | DRM_ROTATE_180 |
|
||||
* DRM_ROTATE_270 | DRM_REFLECT_Y);
|
||||
*
|
||||
* to eliminate the DRM_ROTATE_X flag. Depending on what kind of
|
||||
* transforms the hardware supports, this function may not
|
||||
@ -5657,7 +5657,7 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
|
||||
unsigned int supported_rotations)
|
||||
{
|
||||
if (rotation & ~supported_rotations) {
|
||||
rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
|
||||
rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y;
|
||||
rotation = (rotation & DRM_REFLECT_MASK) |
|
||||
BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
|
||||
}
|
||||
@ -5786,12 +5786,12 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
|
||||
unsigned int supported_rotations)
|
||||
{
|
||||
static const struct drm_prop_enum_list props[] = {
|
||||
{ DRM_ROTATE_0, "rotate-0" },
|
||||
{ DRM_ROTATE_90, "rotate-90" },
|
||||
{ DRM_ROTATE_180, "rotate-180" },
|
||||
{ DRM_ROTATE_270, "rotate-270" },
|
||||
{ DRM_REFLECT_X, "reflect-x" },
|
||||
{ DRM_REFLECT_Y, "reflect-y" },
|
||||
{ __builtin_ffs(DRM_ROTATE_0) - 1, "rotate-0" },
|
||||
{ __builtin_ffs(DRM_ROTATE_90) - 1, "rotate-90" },
|
||||
{ __builtin_ffs(DRM_ROTATE_180) - 1, "rotate-180" },
|
||||
{ __builtin_ffs(DRM_ROTATE_270) - 1, "rotate-270" },
|
||||
{ __builtin_ffs(DRM_REFLECT_X) - 1, "reflect-x" },
|
||||
{ __builtin_ffs(DRM_REFLECT_Y) - 1, "reflect-y" },
|
||||
};
|
||||
|
||||
return drm_property_create_bitmask(dev, 0, "rotation",
|
||||
|
@ -50,9 +50,8 @@ int drm_legacy_dma_setup(struct drm_device *dev)
|
||||
int i;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) ||
|
||||
drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return 0;
|
||||
}
|
||||
|
||||
dev->buf_use = 0;
|
||||
atomic_set(&dev->buf_alloc, 0);
|
||||
@ -81,9 +80,8 @@ void drm_legacy_dma_takedown(struct drm_device *dev)
|
||||
int i, j;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) ||
|
||||
drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dma)
|
||||
return;
|
||||
|
@ -223,7 +223,7 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
|
||||
err = ret;
|
||||
}
|
||||
|
||||
DRM_DEBUG_KMS("too many retries, giving up\n");
|
||||
DRM_DEBUG_KMS("Too many retries, giving up. First error: %d\n", err);
|
||||
ret = err;
|
||||
|
||||
unlock:
|
||||
@ -574,7 +574,17 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
|
||||
if (ret == -EBUSY)
|
||||
continue;
|
||||
|
||||
DRM_DEBUG_KMS("transaction failed: %d\n", ret);
|
||||
/*
|
||||
* While timeouts can be errors, they're usually normal
|
||||
* behavior (for instance, when a driver tries to
|
||||
* communicate with a non-existant DisplayPort device).
|
||||
* Avoid spamming the kernel log with timeout errors.
|
||||
*/
|
||||
if (ret == -ETIMEDOUT)
|
||||
DRM_DEBUG_KMS_RATELIMITED("transaction timed out\n");
|
||||
else
|
||||
DRM_DEBUG_KMS("transaction failed: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ static struct drm_minor **drm_minor_get_slot(struct drm_device *dev,
|
||||
unsigned int type)
|
||||
{
|
||||
switch (type) {
|
||||
case DRM_MINOR_LEGACY:
|
||||
case DRM_MINOR_PRIMARY:
|
||||
return &dev->primary;
|
||||
case DRM_MINOR_RENDER:
|
||||
return &dev->render;
|
||||
@ -512,7 +512,7 @@ int drm_dev_init(struct drm_device *dev,
|
||||
goto err_minors;
|
||||
}
|
||||
|
||||
ret = drm_minor_alloc(dev, DRM_MINOR_LEGACY);
|
||||
ret = drm_minor_alloc(dev, DRM_MINOR_PRIMARY);
|
||||
if (ret)
|
||||
goto err_minors;
|
||||
|
||||
@ -545,7 +545,7 @@ int drm_dev_init(struct drm_device *dev,
|
||||
drm_legacy_ctxbitmap_cleanup(dev);
|
||||
drm_ht_remove(&dev->map_hash);
|
||||
err_minors:
|
||||
drm_minor_free(dev, DRM_MINOR_LEGACY);
|
||||
drm_minor_free(dev, DRM_MINOR_PRIMARY);
|
||||
drm_minor_free(dev, DRM_MINOR_RENDER);
|
||||
drm_minor_free(dev, DRM_MINOR_CONTROL);
|
||||
drm_fs_inode_free(dev->anon_inode);
|
||||
@ -608,7 +608,7 @@ static void drm_dev_release(struct kref *ref)
|
||||
drm_ht_remove(&dev->map_hash);
|
||||
drm_fs_inode_free(dev->anon_inode);
|
||||
|
||||
drm_minor_free(dev, DRM_MINOR_LEGACY);
|
||||
drm_minor_free(dev, DRM_MINOR_PRIMARY);
|
||||
drm_minor_free(dev, DRM_MINOR_RENDER);
|
||||
drm_minor_free(dev, DRM_MINOR_CONTROL);
|
||||
|
||||
@ -684,7 +684,7 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
|
||||
if (ret)
|
||||
goto err_minors;
|
||||
|
||||
ret = drm_minor_register(dev, DRM_MINOR_LEGACY);
|
||||
ret = drm_minor_register(dev, DRM_MINOR_PRIMARY);
|
||||
if (ret)
|
||||
goto err_minors;
|
||||
|
||||
@ -701,7 +701,7 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
|
||||
goto out_unlock;
|
||||
|
||||
err_minors:
|
||||
drm_minor_unregister(dev, DRM_MINOR_LEGACY);
|
||||
drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
|
||||
drm_minor_unregister(dev, DRM_MINOR_RENDER);
|
||||
drm_minor_unregister(dev, DRM_MINOR_CONTROL);
|
||||
out_unlock:
|
||||
@ -741,7 +741,7 @@ void drm_dev_unregister(struct drm_device *dev)
|
||||
list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
|
||||
drm_legacy_rmmap(dev, r_list->map);
|
||||
|
||||
drm_minor_unregister(dev, DRM_MINOR_LEGACY);
|
||||
drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
|
||||
drm_minor_unregister(dev, DRM_MINOR_RENDER);
|
||||
drm_minor_unregister(dev, DRM_MINOR_CONTROL);
|
||||
}
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sysrq.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/module.h>
|
||||
#include <drm/drmP.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
@ -335,7 +334,7 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
plane_state->rotation = BIT(DRM_ROTATE_0);
|
||||
plane_state->rotation = DRM_ROTATE_0;
|
||||
|
||||
plane->old_fb = plane->fb;
|
||||
plane_mask |= 1 << drm_plane_index(plane);
|
||||
@ -395,7 +394,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
|
||||
if (dev->mode_config.rotation_property) {
|
||||
drm_mode_plane_set_obj_prop(plane,
|
||||
dev->mode_config.rotation_property,
|
||||
BIT(DRM_ROTATE_0));
|
||||
DRM_ROTATE_0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ static int drm_setup(struct drm_device * dev)
|
||||
int ret;
|
||||
|
||||
if (dev->driver->firstopen &&
|
||||
!drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||
drm_core_check_feature(dev, DRIVER_LEGACY)) {
|
||||
ret = dev->driver->firstopen(dev);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
@ -346,7 +346,7 @@ void drm_lastclose(struct drm_device * dev)
|
||||
dev->driver->lastclose(dev);
|
||||
DRM_DEBUG("driver lastclose completed\n");
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
drm_legacy_dev_reinit(dev);
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ int drm_release(struct inode *inode, struct file *filp)
|
||||
(long)old_encode_dev(file_priv->minor->kdev->devt),
|
||||
dev->open_count);
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
drm_legacy_lock_release(dev, filp);
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
|
@ -714,9 +714,9 @@ long drm_ioctl(struct file *filp,
|
||||
if (ksize > in_size)
|
||||
memset(kdata + in_size, 0, ksize - in_size);
|
||||
|
||||
/* Enforce sane locking for kms driver ioctls. Core ioctls are
|
||||
/* Enforce sane locking for modern driver ioctls. Core ioctls are
|
||||
* too messy still. */
|
||||
if ((drm_core_check_feature(dev, DRIVER_MODESET) && is_driver_ioctl) ||
|
||||
if ((!drm_core_check_feature(dev, DRIVER_LEGACY) && is_driver_ioctl) ||
|
||||
(ioctl->flags & DRM_UNLOCKED))
|
||||
retcode = func(dev, kdata, file_priv);
|
||||
else {
|
||||
|
@ -482,7 +482,7 @@ int drm_irq_install(struct drm_device *dev, int irq)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
vga_client_register(dev->pdev, (void *)dev, drm_irq_vgaarb_nokms, NULL);
|
||||
|
||||
/* After installing handler */
|
||||
@ -491,7 +491,7 @@ int drm_irq_install(struct drm_device *dev, int irq)
|
||||
|
||||
if (ret < 0) {
|
||||
dev->irq_enabled = false;
|
||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
vga_client_register(dev->pdev, NULL, NULL, NULL);
|
||||
free_irq(irq, dev);
|
||||
} else {
|
||||
@ -557,7 +557,7 @@ int drm_irq_uninstall(struct drm_device *dev)
|
||||
|
||||
DRM_DEBUG("irq=%d\n", dev->irq);
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
vga_client_register(dev->pdev, NULL, NULL, NULL);
|
||||
|
||||
if (dev->driver->irq_uninstall)
|
||||
@ -592,7 +592,7 @@ int drm_control(struct drm_device *dev, void *data,
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
|
||||
return 0;
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return 0;
|
||||
/* UMS was only ever supported on pci devices. */
|
||||
if (WARN_ON(!dev->pdev))
|
||||
@ -1295,7 +1295,7 @@ void drm_vblank_off(struct drm_device *dev, unsigned int pipe)
|
||||
if (e->pipe != pipe)
|
||||
continue;
|
||||
DRM_DEBUG("Sending premature vblank event on disable: "
|
||||
"wanted %d, current %d\n",
|
||||
"wanted %u, current %u\n",
|
||||
e->event.sequence, seq);
|
||||
list_del(&e->base.link);
|
||||
drm_vblank_put(dev, pipe);
|
||||
@ -1519,7 +1519,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,
|
||||
return 0;
|
||||
|
||||
/* KMS drivers handle this internally */
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return 0;
|
||||
|
||||
pipe = modeset->crtc;
|
||||
@ -1585,7 +1585,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe,
|
||||
|
||||
seq = drm_vblank_count_and_time(dev, pipe, &now);
|
||||
|
||||
DRM_DEBUG("event on vblank count %d, current %d, crtc %u\n",
|
||||
DRM_DEBUG("event on vblank count %u, current %u, crtc %u\n",
|
||||
vblwait->request.sequence, seq, pipe);
|
||||
|
||||
trace_drm_vblank_event_queued(current->pid, pipe,
|
||||
@ -1693,7 +1693,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
|
||||
return drm_queue_vblank_event(dev, pipe, vblwait, file_priv);
|
||||
}
|
||||
|
||||
DRM_DEBUG("waiting on vblank count %d, crtc %u\n",
|
||||
DRM_DEBUG("waiting on vblank count %u, crtc %u\n",
|
||||
vblwait->request.sequence, pipe);
|
||||
DRM_WAIT_ON(ret, vblank->queue, 3 * HZ,
|
||||
(((drm_vblank_count(dev, pipe) -
|
||||
@ -1708,7 +1708,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
|
||||
vblwait->reply.tval_sec = now.tv_sec;
|
||||
vblwait->reply.tval_usec = now.tv_usec;
|
||||
|
||||
DRM_DEBUG("returning %d to client\n",
|
||||
DRM_DEBUG("returning %u to client\n",
|
||||
vblwait->reply.sequence);
|
||||
} else {
|
||||
DRM_DEBUG("vblank wait interrupted by signal\n");
|
||||
@ -1735,7 +1735,7 @@ static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
|
||||
if ((seq - e->event.sequence) > (1<<23))
|
||||
continue;
|
||||
|
||||
DRM_DEBUG("vblank event on %d, current %d\n",
|
||||
DRM_DEBUG("vblank event on %u, current %u\n",
|
||||
e->event.sequence, seq);
|
||||
|
||||
list_del(&e->base.link);
|
||||
@ -1826,6 +1826,7 @@ EXPORT_SYMBOL(drm_crtc_handle_vblank);
|
||||
*/
|
||||
u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe)
|
||||
{
|
||||
WARN_ON_ONCE(dev->max_vblank_count != 0);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_vblank_no_hw_counter);
|
||||
|
@ -163,7 +163,7 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
|
||||
struct drm_master *master = file_priv->master;
|
||||
int ret = 0;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
++file_priv->lock_count;
|
||||
@ -252,7 +252,7 @@ int drm_legacy_unlock(struct drm_device *dev, void *data, struct drm_file *file_
|
||||
struct drm_lock *lock = data;
|
||||
struct drm_master *master = file_priv->master;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
if (lock->context == DRM_KERNEL_CONTEXT) {
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/interval_tree_generic.h>
|
||||
|
||||
/**
|
||||
* DOC: Overview
|
||||
@ -103,6 +104,72 @@ static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_
|
||||
u64 end,
|
||||
enum drm_mm_search_flags flags);
|
||||
|
||||
#define START(node) ((node)->start)
|
||||
#define LAST(node) ((node)->start + (node)->size - 1)
|
||||
|
||||
INTERVAL_TREE_DEFINE(struct drm_mm_node, rb,
|
||||
u64, __subtree_last,
|
||||
START, LAST, static inline, drm_mm_interval_tree)
|
||||
|
||||
struct drm_mm_node *
|
||||
drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last)
|
||||
{
|
||||
return drm_mm_interval_tree_iter_first(&mm->interval_tree,
|
||||
start, last);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_mm_interval_first);
|
||||
|
||||
struct drm_mm_node *
|
||||
drm_mm_interval_next(struct drm_mm_node *node, u64 start, u64 last)
|
||||
{
|
||||
return drm_mm_interval_tree_iter_next(node, start, last);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_mm_interval_next);
|
||||
|
||||
static void drm_mm_interval_tree_add_node(struct drm_mm_node *hole_node,
|
||||
struct drm_mm_node *node)
|
||||
{
|
||||
struct drm_mm *mm = hole_node->mm;
|
||||
struct rb_node **link, *rb;
|
||||
struct drm_mm_node *parent;
|
||||
|
||||
node->__subtree_last = LAST(node);
|
||||
|
||||
if (hole_node->allocated) {
|
||||
rb = &hole_node->rb;
|
||||
while (rb) {
|
||||
parent = rb_entry(rb, struct drm_mm_node, rb);
|
||||
if (parent->__subtree_last >= node->__subtree_last)
|
||||
break;
|
||||
|
||||
parent->__subtree_last = node->__subtree_last;
|
||||
rb = rb_parent(rb);
|
||||
}
|
||||
|
||||
rb = &hole_node->rb;
|
||||
link = &hole_node->rb.rb_right;
|
||||
} else {
|
||||
rb = NULL;
|
||||
link = &mm->interval_tree.rb_node;
|
||||
}
|
||||
|
||||
while (*link) {
|
||||
rb = *link;
|
||||
parent = rb_entry(rb, struct drm_mm_node, rb);
|
||||
if (parent->__subtree_last < node->__subtree_last)
|
||||
parent->__subtree_last = node->__subtree_last;
|
||||
if (node->start < parent->start)
|
||||
link = &parent->rb.rb_left;
|
||||
else
|
||||
link = &parent->rb.rb_right;
|
||||
}
|
||||
|
||||
rb_link_node(&node->rb, rb, link);
|
||||
rb_insert_augmented(&node->rb,
|
||||
&mm->interval_tree,
|
||||
&drm_mm_interval_tree_augment);
|
||||
}
|
||||
|
||||
static void drm_mm_insert_helper(struct drm_mm_node *hole_node,
|
||||
struct drm_mm_node *node,
|
||||
u64 size, unsigned alignment,
|
||||
@ -150,9 +217,10 @@ static void drm_mm_insert_helper(struct drm_mm_node *hole_node,
|
||||
node->color = color;
|
||||
node->allocated = 1;
|
||||
|
||||
INIT_LIST_HEAD(&node->hole_stack);
|
||||
list_add(&node->node_list, &hole_node->node_list);
|
||||
|
||||
drm_mm_interval_tree_add_node(hole_node, node);
|
||||
|
||||
BUG_ON(node->start + node->size > adj_end);
|
||||
|
||||
node->hole_follows = 0;
|
||||
@ -178,41 +246,54 @@ static void drm_mm_insert_helper(struct drm_mm_node *hole_node,
|
||||
*/
|
||||
int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node)
|
||||
{
|
||||
u64 end = node->start + node->size;
|
||||
struct drm_mm_node *hole;
|
||||
u64 end;
|
||||
u64 hole_start;
|
||||
u64 hole_end;
|
||||
u64 hole_start, hole_end;
|
||||
|
||||
BUG_ON(node == NULL);
|
||||
if (WARN_ON(node->size == 0))
|
||||
return -EINVAL;
|
||||
|
||||
end = node->start + node->size;
|
||||
|
||||
/* Find the relevant hole to add our node to */
|
||||
drm_mm_for_each_hole(hole, mm, hole_start, hole_end) {
|
||||
if (hole_start > node->start || hole_end < end)
|
||||
continue;
|
||||
|
||||
node->mm = mm;
|
||||
node->allocated = 1;
|
||||
|
||||
INIT_LIST_HEAD(&node->hole_stack);
|
||||
list_add(&node->node_list, &hole->node_list);
|
||||
|
||||
if (node->start == hole_start) {
|
||||
hole->hole_follows = 0;
|
||||
list_del_init(&hole->hole_stack);
|
||||
}
|
||||
|
||||
node->hole_follows = 0;
|
||||
if (end != hole_end) {
|
||||
list_add(&node->hole_stack, &mm->hole_stack);
|
||||
node->hole_follows = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
hole = drm_mm_interval_tree_iter_first(&mm->interval_tree,
|
||||
node->start, ~(u64)0);
|
||||
if (hole) {
|
||||
if (hole->start < end)
|
||||
return -ENOSPC;
|
||||
} else {
|
||||
hole = list_entry(&mm->head_node.node_list,
|
||||
typeof(*hole), node_list);
|
||||
}
|
||||
|
||||
return -ENOSPC;
|
||||
hole = list_last_entry(&hole->node_list, typeof(*hole), node_list);
|
||||
if (!hole->hole_follows)
|
||||
return -ENOSPC;
|
||||
|
||||
hole_start = __drm_mm_hole_node_start(hole);
|
||||
hole_end = __drm_mm_hole_node_end(hole);
|
||||
if (hole_start > node->start || hole_end < end)
|
||||
return -ENOSPC;
|
||||
|
||||
node->mm = mm;
|
||||
node->allocated = 1;
|
||||
|
||||
list_add(&node->node_list, &hole->node_list);
|
||||
|
||||
drm_mm_interval_tree_add_node(hole, node);
|
||||
|
||||
if (node->start == hole_start) {
|
||||
hole->hole_follows = 0;
|
||||
list_del(&hole->hole_stack);
|
||||
}
|
||||
|
||||
node->hole_follows = 0;
|
||||
if (end != hole_end) {
|
||||
list_add(&node->hole_stack, &mm->hole_stack);
|
||||
node->hole_follows = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_mm_reserve_node);
|
||||
|
||||
@ -239,6 +320,9 @@ int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node,
|
||||
{
|
||||
struct drm_mm_node *hole_node;
|
||||
|
||||
if (WARN_ON(size == 0))
|
||||
return -EINVAL;
|
||||
|
||||
hole_node = drm_mm_search_free_generic(mm, size, alignment,
|
||||
color, sflags);
|
||||
if (!hole_node)
|
||||
@ -299,9 +383,10 @@ static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node,
|
||||
node->color = color;
|
||||
node->allocated = 1;
|
||||
|
||||
INIT_LIST_HEAD(&node->hole_stack);
|
||||
list_add(&node->node_list, &hole_node->node_list);
|
||||
|
||||
drm_mm_interval_tree_add_node(hole_node, node);
|
||||
|
||||
BUG_ON(node->start < start);
|
||||
BUG_ON(node->start < adj_start);
|
||||
BUG_ON(node->start + node->size > adj_end);
|
||||
@ -340,6 +425,9 @@ int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *n
|
||||
{
|
||||
struct drm_mm_node *hole_node;
|
||||
|
||||
if (WARN_ON(size == 0))
|
||||
return -EINVAL;
|
||||
|
||||
hole_node = drm_mm_search_free_in_range_generic(mm,
|
||||
size, alignment, color,
|
||||
start, end, sflags);
|
||||
@ -390,6 +478,7 @@ void drm_mm_remove_node(struct drm_mm_node *node)
|
||||
} else
|
||||
list_move(&prev_node->hole_stack, &mm->hole_stack);
|
||||
|
||||
drm_mm_interval_tree_remove(node, &mm->interval_tree);
|
||||
list_del(&node->node_list);
|
||||
node->allocated = 0;
|
||||
}
|
||||
@ -516,11 +605,13 @@ void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new)
|
||||
{
|
||||
list_replace(&old->node_list, &new->node_list);
|
||||
list_replace(&old->hole_stack, &new->hole_stack);
|
||||
rb_replace_node(&old->rb, &new->rb, &old->mm->interval_tree);
|
||||
new->hole_follows = old->hole_follows;
|
||||
new->mm = old->mm;
|
||||
new->start = old->start;
|
||||
new->size = old->size;
|
||||
new->color = old->color;
|
||||
new->__subtree_last = old->__subtree_last;
|
||||
|
||||
old->allocated = 0;
|
||||
new->allocated = 1;
|
||||
@ -748,7 +839,6 @@ void drm_mm_init(struct drm_mm * mm, u64 start, u64 size)
|
||||
|
||||
/* Clever trick to avoid a special case in the free hole tracking. */
|
||||
INIT_LIST_HEAD(&mm->head_node.node_list);
|
||||
INIT_LIST_HEAD(&mm->head_node.hole_stack);
|
||||
mm->head_node.hole_follows = 1;
|
||||
mm->head_node.scanned_block = 0;
|
||||
mm->head_node.scanned_prev_free = 0;
|
||||
@ -758,6 +848,8 @@ void drm_mm_init(struct drm_mm * mm, u64 start, u64 size)
|
||||
mm->head_node.size = start - mm->head_node.start;
|
||||
list_add_tail(&mm->head_node.hole_stack, &mm->hole_stack);
|
||||
|
||||
mm->interval_tree = RB_ROOT;
|
||||
|
||||
mm->color_adjust = NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_mm_init);
|
||||
|
@ -175,7 +175,7 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
|
||||
{
|
||||
struct drm_irq_busid *p = data;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
/* UMS was only ever support on PCI devices. */
|
||||
@ -263,7 +263,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
|
||||
|
||||
/* No locking needed since shadow-attach is single-threaded since it may
|
||||
* only be called from the per-driver module init hook. */
|
||||
if (!drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list);
|
||||
|
||||
return 0;
|
||||
@ -299,7 +299,7 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
if (driver->driver_features & DRIVER_MODESET)
|
||||
if (!(driver->driver_features & DRIVER_LEGACY))
|
||||
return pci_register_driver(pdriver);
|
||||
|
||||
/* If not using KMS, fall back to stealth mode manual scanning. */
|
||||
@ -421,7 +421,7 @@ void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
|
||||
struct drm_device *dev, *tmp;
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
if (driver->driver_features & DRIVER_MODESET) {
|
||||
if (!(driver->driver_features & DRIVER_LEGACY)) {
|
||||
pci_unregister_driver(pdriver);
|
||||
} else {
|
||||
list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list,
|
||||
|
@ -107,6 +107,104 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_plane_helper_check_state() - Check plane state for validity
|
||||
* @state: plane state to check
|
||||
* @clip: integer clipping coordinates
|
||||
* @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
|
||||
* @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
|
||||
* @can_position: is it legal to position the plane such that it
|
||||
* doesn't cover the entire crtc? This will generally
|
||||
* only be false for primary planes.
|
||||
* @can_update_disabled: can the plane be updated while the crtc
|
||||
* is disabled?
|
||||
*
|
||||
* Checks that a desired plane update is valid, and updates various
|
||||
* bits of derived state (clipped coordinates etc.). Drivers that provide
|
||||
* their own plane handling rather than helper-provided implementations may
|
||||
* still wish to call this function to avoid duplication of error checking
|
||||
* code.
|
||||
*
|
||||
* RETURNS:
|
||||
* Zero if update appears valid, error code on failure
|
||||
*/
|
||||
int drm_plane_helper_check_state(struct drm_plane_state *state,
|
||||
const struct drm_rect *clip,
|
||||
int min_scale,
|
||||
int max_scale,
|
||||
bool can_position,
|
||||
bool can_update_disabled)
|
||||
{
|
||||
struct drm_crtc *crtc = state->crtc;
|
||||
struct drm_framebuffer *fb = state->fb;
|
||||
struct drm_rect *src = &state->src;
|
||||
struct drm_rect *dst = &state->dst;
|
||||
unsigned int rotation = state->rotation;
|
||||
int hscale, vscale;
|
||||
|
||||
src->x1 = state->src_x;
|
||||
src->y1 = state->src_y;
|
||||
src->x2 = state->src_x + state->src_w;
|
||||
src->y2 = state->src_y + state->src_h;
|
||||
|
||||
dst->x1 = state->crtc_x;
|
||||
dst->y1 = state->crtc_y;
|
||||
dst->x2 = state->crtc_x + state->crtc_w;
|
||||
dst->y2 = state->crtc_y + state->crtc_h;
|
||||
|
||||
if (!fb) {
|
||||
state->visible = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* crtc should only be NULL when disabling (i.e., !fb) */
|
||||
if (WARN_ON(!crtc)) {
|
||||
state->visible = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!crtc->enabled && !can_update_disabled) {
|
||||
DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
|
||||
|
||||
/* Check scaling */
|
||||
hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
|
||||
vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
|
||||
if (hscale < 0 || vscale < 0) {
|
||||
DRM_DEBUG_KMS("Invalid scaling of plane\n");
|
||||
drm_rect_debug_print("src: ", &state->src, true);
|
||||
drm_rect_debug_print("dst: ", &state->dst, false);
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
|
||||
|
||||
drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
|
||||
|
||||
if (!state->visible)
|
||||
/*
|
||||
* Plane isn't visible; some drivers can handle this
|
||||
* so we just return success here. Drivers that can't
|
||||
* (including those that use the primary plane helper's
|
||||
* update function) will return an error from their
|
||||
* update_plane handler.
|
||||
*/
|
||||
return 0;
|
||||
|
||||
if (!can_position && !drm_rect_equals(dst, clip)) {
|
||||
DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
|
||||
drm_rect_debug_print("dst: ", dst, false);
|
||||
drm_rect_debug_print("clip: ", clip, false);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_plane_helper_check_state);
|
||||
|
||||
/**
|
||||
* drm_plane_helper_check_update() - Check plane update for validity
|
||||
* @plane: plane object to update
|
||||
@ -138,7 +236,7 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
|
||||
struct drm_crtc *crtc,
|
||||
struct drm_framebuffer *fb,
|
||||
struct drm_rect *src,
|
||||
struct drm_rect *dest,
|
||||
struct drm_rect *dst,
|
||||
const struct drm_rect *clip,
|
||||
unsigned int rotation,
|
||||
int min_scale,
|
||||
@ -147,56 +245,33 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
|
||||
bool can_update_disabled,
|
||||
bool *visible)
|
||||
{
|
||||
int hscale, vscale;
|
||||
struct drm_plane_state state = {
|
||||
.plane = plane,
|
||||
.crtc = crtc,
|
||||
.fb = fb,
|
||||
.src_x = src->x1,
|
||||
.src_y = src->y1,
|
||||
.src_w = drm_rect_width(src),
|
||||
.src_h = drm_rect_height(src),
|
||||
.crtc_x = dst->x1,
|
||||
.crtc_y = dst->y1,
|
||||
.crtc_w = drm_rect_width(dst),
|
||||
.crtc_h = drm_rect_height(dst),
|
||||
.rotation = rotation,
|
||||
.visible = *visible,
|
||||
};
|
||||
int ret;
|
||||
|
||||
if (!fb) {
|
||||
*visible = false;
|
||||
return 0;
|
||||
}
|
||||
ret = drm_plane_helper_check_state(&state, clip,
|
||||
min_scale, max_scale,
|
||||
can_position,
|
||||
can_update_disabled);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* crtc should only be NULL when disabling (i.e., !fb) */
|
||||
if (WARN_ON(!crtc)) {
|
||||
*visible = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!crtc->enabled && !can_update_disabled) {
|
||||
DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
|
||||
|
||||
/* Check scaling */
|
||||
hscale = drm_rect_calc_hscale(src, dest, min_scale, max_scale);
|
||||
vscale = drm_rect_calc_vscale(src, dest, min_scale, max_scale);
|
||||
if (hscale < 0 || vscale < 0) {
|
||||
DRM_DEBUG_KMS("Invalid scaling of plane\n");
|
||||
drm_rect_debug_print("src: ", src, true);
|
||||
drm_rect_debug_print("dst: ", dest, false);
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
*visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale);
|
||||
|
||||
drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
|
||||
|
||||
if (!*visible)
|
||||
/*
|
||||
* Plane isn't visible; some drivers can handle this
|
||||
* so we just return success here. Drivers that can't
|
||||
* (including those that use the primary plane helper's
|
||||
* update function) will return an error from their
|
||||
* update_plane handler.
|
||||
*/
|
||||
return 0;
|
||||
|
||||
if (!can_position && !drm_rect_equals(dest, clip)) {
|
||||
DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
|
||||
drm_rect_debug_print("dst: ", dest, false);
|
||||
drm_rect_debug_print("clip: ", clip, false);
|
||||
return -EINVAL;
|
||||
}
|
||||
*src = state.src;
|
||||
*dst = state.dst;
|
||||
*visible = state.visible;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -274,7 +349,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
|
||||
|
||||
ret = drm_plane_helper_check_update(plane, crtc, fb,
|
||||
&src, &dest, &clip,
|
||||
BIT(DRM_ROTATE_0),
|
||||
DRM_ROTATE_0,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
false, false, &visible);
|
||||
|
@ -100,7 +100,7 @@ static int drm_calc_scale(int src, int dst)
|
||||
{
|
||||
int scale = 0;
|
||||
|
||||
if (src < 0 || dst < 0)
|
||||
if (WARN_ON(src < 0 || dst < 0))
|
||||
return -EINVAL;
|
||||
|
||||
if (dst == 0)
|
||||
@ -317,38 +317,38 @@ void drm_rect_rotate(struct drm_rect *r,
|
||||
{
|
||||
struct drm_rect tmp;
|
||||
|
||||
if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
|
||||
if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
|
||||
tmp = *r;
|
||||
|
||||
if (rotation & BIT(DRM_REFLECT_X)) {
|
||||
if (rotation & DRM_REFLECT_X) {
|
||||
r->x1 = width - tmp.x2;
|
||||
r->x2 = width - tmp.x1;
|
||||
}
|
||||
|
||||
if (rotation & BIT(DRM_REFLECT_Y)) {
|
||||
if (rotation & DRM_REFLECT_Y) {
|
||||
r->y1 = height - tmp.y2;
|
||||
r->y2 = height - tmp.y1;
|
||||
}
|
||||
}
|
||||
|
||||
switch (rotation & DRM_ROTATE_MASK) {
|
||||
case BIT(DRM_ROTATE_0):
|
||||
case DRM_ROTATE_0:
|
||||
break;
|
||||
case BIT(DRM_ROTATE_90):
|
||||
case DRM_ROTATE_90:
|
||||
tmp = *r;
|
||||
r->x1 = tmp.y1;
|
||||
r->x2 = tmp.y2;
|
||||
r->y1 = width - tmp.x2;
|
||||
r->y2 = width - tmp.x1;
|
||||
break;
|
||||
case BIT(DRM_ROTATE_180):
|
||||
case DRM_ROTATE_180:
|
||||
tmp = *r;
|
||||
r->x1 = width - tmp.x2;
|
||||
r->x2 = width - tmp.x1;
|
||||
r->y1 = height - tmp.y2;
|
||||
r->y2 = height - tmp.y1;
|
||||
break;
|
||||
case BIT(DRM_ROTATE_270):
|
||||
case DRM_ROTATE_270:
|
||||
tmp = *r;
|
||||
r->x1 = height - tmp.y2;
|
||||
r->x2 = height - tmp.y1;
|
||||
@ -392,23 +392,23 @@ void drm_rect_rotate_inv(struct drm_rect *r,
|
||||
struct drm_rect tmp;
|
||||
|
||||
switch (rotation & DRM_ROTATE_MASK) {
|
||||
case BIT(DRM_ROTATE_0):
|
||||
case DRM_ROTATE_0:
|
||||
break;
|
||||
case BIT(DRM_ROTATE_90):
|
||||
case DRM_ROTATE_90:
|
||||
tmp = *r;
|
||||
r->x1 = width - tmp.y2;
|
||||
r->x2 = width - tmp.y1;
|
||||
r->y1 = tmp.x1;
|
||||
r->y2 = tmp.x2;
|
||||
break;
|
||||
case BIT(DRM_ROTATE_180):
|
||||
case DRM_ROTATE_180:
|
||||
tmp = *r;
|
||||
r->x1 = width - tmp.x2;
|
||||
r->x2 = width - tmp.x1;
|
||||
r->y1 = height - tmp.y2;
|
||||
r->y2 = height - tmp.y1;
|
||||
break;
|
||||
case BIT(DRM_ROTATE_270):
|
||||
case DRM_ROTATE_270:
|
||||
tmp = *r;
|
||||
r->x1 = tmp.y1;
|
||||
r->x2 = tmp.y2;
|
||||
@ -419,15 +419,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
|
||||
break;
|
||||
}
|
||||
|
||||
if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
|
||||
if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
|
||||
tmp = *r;
|
||||
|
||||
if (rotation & BIT(DRM_REFLECT_X)) {
|
||||
if (rotation & DRM_REFLECT_X) {
|
||||
r->x1 = width - tmp.x2;
|
||||
r->x2 = width - tmp.x1;
|
||||
}
|
||||
|
||||
if (rotation & BIT(DRM_REFLECT_Y)) {
|
||||
if (rotation & DRM_REFLECT_Y) {
|
||||
r->y1 = height - tmp.y2;
|
||||
r->y2 = height - tmp.y1;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ static void drm_sg_cleanup(struct drm_sg_mem * entry)
|
||||
void drm_legacy_sg_cleanup(struct drm_device *dev)
|
||||
{
|
||||
if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg &&
|
||||
!drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||
drm_core_check_feature(dev, DRIVER_LEGACY)) {
|
||||
drm_sg_cleanup(dev->sg);
|
||||
dev->sg = NULL;
|
||||
}
|
||||
@ -88,7 +88,7 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_SG))
|
||||
@ -201,7 +201,7 @@ int drm_legacy_sg_free(struct drm_device *dev, void *data,
|
||||
struct drm_scatter_gather *request = data;
|
||||
struct drm_sg_mem *entry;
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EINVAL;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_SG))
|
||||
|
@ -73,22 +73,9 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
|
||||
static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
|
||||
struct drm_plane_state *plane_state)
|
||||
{
|
||||
struct drm_rect src = {
|
||||
.x1 = plane_state->src_x,
|
||||
.y1 = plane_state->src_y,
|
||||
.x2 = plane_state->src_x + plane_state->src_w,
|
||||
.y2 = plane_state->src_y + plane_state->src_h,
|
||||
};
|
||||
struct drm_rect dest = {
|
||||
.x1 = plane_state->crtc_x,
|
||||
.y1 = plane_state->crtc_y,
|
||||
.x2 = plane_state->crtc_x + plane_state->crtc_w,
|
||||
.y2 = plane_state->crtc_y + plane_state->crtc_h,
|
||||
};
|
||||
struct drm_rect clip = { 0 };
|
||||
struct drm_simple_display_pipe *pipe;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
bool visible;
|
||||
int ret;
|
||||
|
||||
pipe = container_of(plane, struct drm_simple_display_pipe, plane);
|
||||
@ -102,17 +89,15 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
|
||||
|
||||
clip.x2 = crtc_state->adjusted_mode.hdisplay;
|
||||
clip.y2 = crtc_state->adjusted_mode.vdisplay;
|
||||
ret = drm_plane_helper_check_update(plane, &pipe->crtc,
|
||||
plane_state->fb,
|
||||
&src, &dest, &clip,
|
||||
plane_state->rotation,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
false, true, &visible);
|
||||
|
||||
ret = drm_plane_helper_check_state(plane_state, &clip,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
false, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!visible)
|
||||
if (!plane_state->visible)
|
||||
return -EINVAL;
|
||||
|
||||
if (!pipe->funcs || !pipe->funcs->check)
|
||||
|
@ -86,7 +86,6 @@ void drm_vma_offset_manager_init(struct drm_vma_offset_manager *mgr,
|
||||
unsigned long page_offset, unsigned long size)
|
||||
{
|
||||
rwlock_init(&mgr->vm_lock);
|
||||
mgr->vm_addr_space_rb = RB_ROOT;
|
||||
drm_mm_init(&mgr->vm_addr_space_mm, page_offset, size);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_vma_offset_manager_init);
|
||||
@ -145,16 +144,16 @@ struct drm_vma_offset_node *drm_vma_offset_lookup_locked(struct drm_vma_offset_m
|
||||
unsigned long start,
|
||||
unsigned long pages)
|
||||
{
|
||||
struct drm_vma_offset_node *node, *best;
|
||||
struct drm_mm_node *node, *best;
|
||||
struct rb_node *iter;
|
||||
unsigned long offset;
|
||||
|
||||
iter = mgr->vm_addr_space_rb.rb_node;
|
||||
iter = mgr->vm_addr_space_mm.interval_tree.rb_node;
|
||||
best = NULL;
|
||||
|
||||
while (likely(iter)) {
|
||||
node = rb_entry(iter, struct drm_vma_offset_node, vm_rb);
|
||||
offset = node->vm_node.start;
|
||||
node = rb_entry(iter, struct drm_mm_node, rb);
|
||||
offset = node->start;
|
||||
if (start >= offset) {
|
||||
iter = iter->rb_right;
|
||||
best = node;
|
||||
@ -167,39 +166,18 @@ struct drm_vma_offset_node *drm_vma_offset_lookup_locked(struct drm_vma_offset_m
|
||||
|
||||
/* verify that the node spans the requested area */
|
||||
if (best) {
|
||||
offset = best->vm_node.start + best->vm_node.size;
|
||||
offset = best->start + best->size;
|
||||
if (offset < start + pages)
|
||||
best = NULL;
|
||||
}
|
||||
|
||||
return best;
|
||||
if (!best)
|
||||
return NULL;
|
||||
|
||||
return container_of(best, struct drm_vma_offset_node, vm_node);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_vma_offset_lookup_locked);
|
||||
|
||||
/* internal helper to link @node into the rb-tree */
|
||||
static void _drm_vma_offset_add_rb(struct drm_vma_offset_manager *mgr,
|
||||
struct drm_vma_offset_node *node)
|
||||
{
|
||||
struct rb_node **iter = &mgr->vm_addr_space_rb.rb_node;
|
||||
struct rb_node *parent = NULL;
|
||||
struct drm_vma_offset_node *iter_node;
|
||||
|
||||
while (likely(*iter)) {
|
||||
parent = *iter;
|
||||
iter_node = rb_entry(*iter, struct drm_vma_offset_node, vm_rb);
|
||||
|
||||
if (node->vm_node.start < iter_node->vm_node.start)
|
||||
iter = &(*iter)->rb_left;
|
||||
else if (node->vm_node.start > iter_node->vm_node.start)
|
||||
iter = &(*iter)->rb_right;
|
||||
else
|
||||
BUG();
|
||||
}
|
||||
|
||||
rb_link_node(&node->vm_rb, parent, iter);
|
||||
rb_insert_color(&node->vm_rb, &mgr->vm_addr_space_rb);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_vma_offset_add() - Add offset node to manager
|
||||
* @mgr: Manager object
|
||||
@ -240,8 +218,6 @@ int drm_vma_offset_add(struct drm_vma_offset_manager *mgr,
|
||||
if (ret)
|
||||
goto out_unlock;
|
||||
|
||||
_drm_vma_offset_add_rb(mgr, node);
|
||||
|
||||
out_unlock:
|
||||
write_unlock(&mgr->vm_lock);
|
||||
return ret;
|
||||
@ -265,7 +241,6 @@ void drm_vma_offset_remove(struct drm_vma_offset_manager *mgr,
|
||||
write_lock(&mgr->vm_lock);
|
||||
|
||||
if (drm_mm_node_allocated(&node->vm_node)) {
|
||||
rb_erase(&node->vm_rb, &mgr->vm_addr_space_rb);
|
||||
drm_mm_remove_node(&node->vm_node);
|
||||
memset(&node->vm_node, 0, sizeof(node->vm_node));
|
||||
}
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <linux/tty.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/console.h>
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <linux/tty.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/console.h>
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/fb.h>
|
||||
#include <drm/drmP.h>
|
||||
#include "psb_intel_drv.h"
|
||||
|
||||
|
@ -56,9 +56,7 @@ static const struct file_operations i810_driver_fops = {
|
||||
};
|
||||
|
||||
static struct drm_driver driver = {
|
||||
.driver_features =
|
||||
DRIVER_USE_AGP |
|
||||
DRIVER_HAVE_DMA,
|
||||
.driver_features = DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_LEGACY,
|
||||
.dev_priv_size = sizeof(drm_i810_buf_priv_t),
|
||||
.load = i810_driver_load,
|
||||
.lastclose = i810_driver_lastclose,
|
||||
|
@ -3089,12 +3089,12 @@ static const char *plane_rotation(unsigned int rotation)
|
||||
*/
|
||||
snprintf(buf, sizeof(buf),
|
||||
"%s%s%s%s%s%s(0x%08x)",
|
||||
(rotation & BIT(DRM_ROTATE_0)) ? "0 " : "",
|
||||
(rotation & BIT(DRM_ROTATE_90)) ? "90 " : "",
|
||||
(rotation & BIT(DRM_ROTATE_180)) ? "180 " : "",
|
||||
(rotation & BIT(DRM_ROTATE_270)) ? "270 " : "",
|
||||
(rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "",
|
||||
(rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "",
|
||||
(rotation & DRM_ROTATE_0) ? "0 " : "",
|
||||
(rotation & DRM_ROTATE_90) ? "90 " : "",
|
||||
(rotation & DRM_ROTATE_180) ? "180 " : "",
|
||||
(rotation & DRM_ROTATE_270) ? "270 " : "",
|
||||
(rotation & DRM_REFLECT_X) ? "FLIPX " : "",
|
||||
(rotation & DRM_REFLECT_Y) ? "FLIPY " : "",
|
||||
rotation);
|
||||
|
||||
return buf;
|
||||
|
@ -706,7 +706,7 @@ static int i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
|
||||
primary =
|
||||
pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
|
||||
|
||||
ret = remove_conflicting_framebuffers(ap, "inteldrmfb", primary);
|
||||
ret = drm_fb_helper_remove_conflicting_framebuffers(ap, "inteldrmfb", primary);
|
||||
|
||||
kfree(ap);
|
||||
|
||||
|
@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane)
|
||||
return NULL;
|
||||
|
||||
state->base.plane = plane;
|
||||
state->base.rotation = BIT(DRM_ROTATE_0);
|
||||
state->base.rotation = DRM_ROTATE_0;
|
||||
state->ckey.flags = I915_SET_COLORKEY_NONE;
|
||||
|
||||
return state;
|
||||
@ -134,20 +134,6 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
|
||||
|
||||
crtc_state = to_intel_crtc_state(drm_crtc_state);
|
||||
|
||||
/*
|
||||
* The original src/dest coordinates are stored in state->base, but
|
||||
* we want to keep another copy internal to our driver that we can
|
||||
* clip/modify ourselves.
|
||||
*/
|
||||
intel_state->src.x1 = state->src_x;
|
||||
intel_state->src.y1 = state->src_y;
|
||||
intel_state->src.x2 = state->src_x + state->src_w;
|
||||
intel_state->src.y2 = state->src_y + state->src_h;
|
||||
intel_state->dst.x1 = state->crtc_x;
|
||||
intel_state->dst.y1 = state->crtc_y;
|
||||
intel_state->dst.x2 = state->crtc_x + state->crtc_w;
|
||||
intel_state->dst.y2 = state->crtc_y + state->crtc_h;
|
||||
|
||||
/* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */
|
||||
intel_state->clip.x1 = 0;
|
||||
intel_state->clip.y1 = 0;
|
||||
@ -180,7 +166,7 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
|
||||
}
|
||||
}
|
||||
|
||||
intel_state->visible = false;
|
||||
intel_state->base.visible = false;
|
||||
ret = intel_plane->check_plane(plane, crtc_state, intel_state);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -196,7 +182,7 @@ static void intel_plane_atomic_update(struct drm_plane *plane,
|
||||
to_intel_plane_state(plane->state);
|
||||
struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc;
|
||||
|
||||
if (intel_state->visible)
|
||||
if (intel_state->base.visible)
|
||||
intel_plane->update_plane(plane,
|
||||
to_intel_crtc_state(crtc->state),
|
||||
intel_state);
|
||||
|
@ -2565,7 +2565,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
|
||||
* simplest solution is to just disable the primary plane now and
|
||||
* pretend the BIOS never had it enabled.
|
||||
*/
|
||||
to_intel_plane_state(plane_state)->visible = false;
|
||||
to_intel_plane_state(plane_state)->base.visible = false;
|
||||
crtc_state->plane_mask &= ~(1 << drm_plane_index(primary));
|
||||
intel_pre_disable_primary_noatomic(&intel_crtc->base);
|
||||
intel_plane->disable_plane(primary, &intel_crtc->base);
|
||||
@ -2583,14 +2583,14 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
|
||||
plane_state->crtc_w = fb->width;
|
||||
plane_state->crtc_h = fb->height;
|
||||
|
||||
intel_state->src.x1 = plane_state->src_x;
|
||||
intel_state->src.y1 = plane_state->src_y;
|
||||
intel_state->src.x2 = plane_state->src_x + plane_state->src_w;
|
||||
intel_state->src.y2 = plane_state->src_y + plane_state->src_h;
|
||||
intel_state->dst.x1 = plane_state->crtc_x;
|
||||
intel_state->dst.y1 = plane_state->crtc_y;
|
||||
intel_state->dst.x2 = plane_state->crtc_x + plane_state->crtc_w;
|
||||
intel_state->dst.y2 = plane_state->crtc_y + plane_state->crtc_h;
|
||||
intel_state->base.src.x1 = plane_state->src_x;
|
||||
intel_state->base.src.y1 = plane_state->src_y;
|
||||
intel_state->base.src.x2 = plane_state->src_x + plane_state->src_w;
|
||||
intel_state->base.src.y2 = plane_state->src_y + plane_state->src_h;
|
||||
intel_state->base.dst.x1 = plane_state->crtc_x;
|
||||
intel_state->base.dst.y1 = plane_state->crtc_y;
|
||||
intel_state->base.dst.x2 = plane_state->crtc_x + plane_state->crtc_w;
|
||||
intel_state->base.dst.y2 = plane_state->crtc_y + plane_state->crtc_h;
|
||||
|
||||
obj = intel_fb_obj(fb);
|
||||
if (obj->tiling_mode != I915_TILING_NONE)
|
||||
@ -2618,8 +2618,8 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
|
||||
i915_reg_t reg = DSPCNTR(plane);
|
||||
unsigned int rotation = plane_state->base.rotation;
|
||||
int cpp = drm_format_plane_cpp(fb->pixel_format, 0);
|
||||
int x = plane_state->src.x1 >> 16;
|
||||
int y = plane_state->src.y1 >> 16;
|
||||
int x = plane_state->base.src.x1 >> 16;
|
||||
int y = plane_state->base.src.y1 >> 16;
|
||||
|
||||
dspcntr = DISPPLANE_GAMMA_ENABLE;
|
||||
|
||||
@ -2688,7 +2688,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
|
||||
intel_crtc->dspaddr_offset = linear_offset;
|
||||
}
|
||||
|
||||
if (rotation == BIT(DRM_ROTATE_180)) {
|
||||
if (rotation == DRM_ROTATE_180) {
|
||||
dspcntr |= DISPPLANE_ROTATE_180;
|
||||
|
||||
x += (crtc_state->pipe_src_w - 1);
|
||||
@ -2748,8 +2748,8 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
|
||||
i915_reg_t reg = DSPCNTR(plane);
|
||||
unsigned int rotation = plane_state->base.rotation;
|
||||
int cpp = drm_format_plane_cpp(fb->pixel_format, 0);
|
||||
int x = plane_state->src.x1 >> 16;
|
||||
int y = plane_state->src.y1 >> 16;
|
||||
int x = plane_state->base.src.x1 >> 16;
|
||||
int y = plane_state->base.src.y1 >> 16;
|
||||
|
||||
dspcntr = DISPPLANE_GAMMA_ENABLE;
|
||||
dspcntr |= DISPLAY_PLANE_ENABLE;
|
||||
@ -2791,7 +2791,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
|
||||
intel_compute_tile_offset(&x, &y, fb, 0,
|
||||
fb->pitches[0], rotation);
|
||||
linear_offset -= intel_crtc->dspaddr_offset;
|
||||
if (rotation == BIT(DRM_ROTATE_180)) {
|
||||
if (rotation == DRM_ROTATE_180) {
|
||||
dspcntr |= DISPPLANE_ROTATE_180;
|
||||
|
||||
if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
|
||||
@ -2952,17 +2952,17 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
|
||||
u32 skl_plane_ctl_rotation(unsigned int rotation)
|
||||
{
|
||||
switch (rotation) {
|
||||
case BIT(DRM_ROTATE_0):
|
||||
case DRM_ROTATE_0:
|
||||
break;
|
||||
/*
|
||||
* DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
|
||||
* while i915 HW rotation is clockwise, thats why this swapping.
|
||||
*/
|
||||
case BIT(DRM_ROTATE_90):
|
||||
case DRM_ROTATE_90:
|
||||
return PLANE_CTL_ROTATE_270;
|
||||
case BIT(DRM_ROTATE_180):
|
||||
case DRM_ROTATE_180:
|
||||
return PLANE_CTL_ROTATE_180;
|
||||
case BIT(DRM_ROTATE_270):
|
||||
case DRM_ROTATE_270:
|
||||
return PLANE_CTL_ROTATE_90;
|
||||
default:
|
||||
MISSING_CASE(rotation);
|
||||
@ -2987,14 +2987,14 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
|
||||
int x_offset, y_offset;
|
||||
u32 surf_addr;
|
||||
int scaler_id = plane_state->scaler_id;
|
||||
int src_x = plane_state->src.x1 >> 16;
|
||||
int src_y = plane_state->src.y1 >> 16;
|
||||
int src_w = drm_rect_width(&plane_state->src) >> 16;
|
||||
int src_h = drm_rect_height(&plane_state->src) >> 16;
|
||||
int dst_x = plane_state->dst.x1;
|
||||
int dst_y = plane_state->dst.y1;
|
||||
int dst_w = drm_rect_width(&plane_state->dst);
|
||||
int dst_h = drm_rect_height(&plane_state->dst);
|
||||
int src_x = plane_state->base.src.x1 >> 16;
|
||||
int src_y = plane_state->base.src.y1 >> 16;
|
||||
int src_w = drm_rect_width(&plane_state->base.src) >> 16;
|
||||
int src_h = drm_rect_height(&plane_state->base.src) >> 16;
|
||||
int dst_x = plane_state->base.dst.x1;
|
||||
int dst_y = plane_state->base.dst.y1;
|
||||
int dst_w = drm_rect_width(&plane_state->base.dst);
|
||||
int dst_h = drm_rect_height(&plane_state->base.dst);
|
||||
|
||||
plane_ctl = PLANE_CTL_ENABLE |
|
||||
PLANE_CTL_PIPE_GAMMA_ENABLE |
|
||||
@ -3009,7 +3009,7 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
|
||||
fb->pixel_format);
|
||||
surf_addr = intel_plane_obj_offset(to_intel_plane(plane), obj, 0);
|
||||
|
||||
WARN_ON(drm_rect_width(&plane_state->src) == 0);
|
||||
WARN_ON(drm_rect_width(&plane_state->base.src) == 0);
|
||||
|
||||
if (intel_rotation_90_or_270(rotation)) {
|
||||
int cpp = drm_format_plane_cpp(fb->pixel_format, 0);
|
||||
@ -3098,7 +3098,7 @@ static void intel_update_primary_planes(struct drm_device *dev)
|
||||
drm_modeset_lock_crtc(crtc, &plane->base);
|
||||
plane_state = to_intel_plane_state(plane->base.state);
|
||||
|
||||
if (plane_state->visible)
|
||||
if (plane_state->base.visible)
|
||||
plane->update_plane(&plane->base,
|
||||
to_intel_crtc_state(crtc->state),
|
||||
plane_state);
|
||||
@ -4248,7 +4248,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
|
||||
intel_crtc->pipe, SKL_CRTC_INDEX);
|
||||
|
||||
return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
|
||||
&state->scaler_state.scaler_id, BIT(DRM_ROTATE_0),
|
||||
&state->scaler_state.scaler_id, DRM_ROTATE_0,
|
||||
state->pipe_src_w, state->pipe_src_h,
|
||||
adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
|
||||
}
|
||||
@ -4273,7 +4273,7 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
|
||||
struct drm_framebuffer *fb = plane_state->base.fb;
|
||||
int ret;
|
||||
|
||||
bool force_detach = !fb || !plane_state->visible;
|
||||
bool force_detach = !fb || !plane_state->base.visible;
|
||||
|
||||
DRM_DEBUG_KMS("Updating scaler for [PLANE:%d:%s] scaler_user index %u.%u\n",
|
||||
intel_plane->base.base.id, intel_plane->base.name,
|
||||
@ -4283,10 +4283,10 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
|
||||
drm_plane_index(&intel_plane->base),
|
||||
&plane_state->scaler_id,
|
||||
plane_state->base.rotation,
|
||||
drm_rect_width(&plane_state->src) >> 16,
|
||||
drm_rect_height(&plane_state->src) >> 16,
|
||||
drm_rect_width(&plane_state->dst),
|
||||
drm_rect_height(&plane_state->dst));
|
||||
drm_rect_width(&plane_state->base.src) >> 16,
|
||||
drm_rect_height(&plane_state->base.src) >> 16,
|
||||
drm_rect_width(&plane_state->base.dst),
|
||||
drm_rect_height(&plane_state->base.dst));
|
||||
|
||||
if (ret || plane_state->scaler_id < 0)
|
||||
return ret;
|
||||
@ -4584,9 +4584,9 @@ static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state)
|
||||
|
||||
intel_fbc_post_update(crtc);
|
||||
|
||||
if (primary_state->visible &&
|
||||
if (primary_state->base.visible &&
|
||||
(needs_modeset(&pipe_config->base) ||
|
||||
!old_primary_state->visible))
|
||||
!old_primary_state->base.visible))
|
||||
intel_post_enable_primary(&crtc->base);
|
||||
}
|
||||
}
|
||||
@ -4612,8 +4612,8 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state)
|
||||
|
||||
intel_fbc_pre_update(crtc, pipe_config, primary_state);
|
||||
|
||||
if (old_primary_state->visible &&
|
||||
(modeset || !primary_state->visible))
|
||||
if (old_primary_state->base.visible &&
|
||||
(modeset || !primary_state->base.visible))
|
||||
intel_pre_disable_primary(&crtc->base);
|
||||
}
|
||||
|
||||
@ -6290,13 +6290,13 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)
|
||||
if (!intel_crtc->active)
|
||||
return;
|
||||
|
||||
if (to_intel_plane_state(crtc->primary->state)->visible) {
|
||||
if (to_intel_plane_state(crtc->primary->state)->base.visible) {
|
||||
WARN_ON(intel_crtc->flip_work);
|
||||
|
||||
intel_pre_disable_primary_noatomic(crtc);
|
||||
|
||||
intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc->primary));
|
||||
to_intel_plane_state(crtc->primary->state)->visible = false;
|
||||
to_intel_plane_state(crtc->primary->state)->base.visible = false;
|
||||
}
|
||||
|
||||
dev_priv->display.crtc_disable(crtc);
|
||||
@ -10170,7 +10170,7 @@ static void i845_update_cursor(struct drm_crtc *crtc, u32 base,
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
uint32_t cntl = 0, size = 0;
|
||||
|
||||
if (plane_state && plane_state->visible) {
|
||||
if (plane_state && plane_state->base.visible) {
|
||||
unsigned int width = plane_state->base.crtc_w;
|
||||
unsigned int height = plane_state->base.crtc_h;
|
||||
unsigned int stride = roundup_pow_of_two(width) * 4;
|
||||
@ -10234,7 +10234,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base,
|
||||
int pipe = intel_crtc->pipe;
|
||||
uint32_t cntl = 0;
|
||||
|
||||
if (plane_state && plane_state->visible) {
|
||||
if (plane_state && plane_state->base.visible) {
|
||||
cntl = MCURSOR_GAMMA_ENABLE;
|
||||
switch (plane_state->base.crtc_w) {
|
||||
case 64:
|
||||
@ -10255,7 +10255,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base,
|
||||
if (HAS_DDI(dev))
|
||||
cntl |= CURSOR_PIPE_CSC_ENABLE;
|
||||
|
||||
if (plane_state->base.rotation == BIT(DRM_ROTATE_180))
|
||||
if (plane_state->base.rotation == DRM_ROTATE_180)
|
||||
cntl |= CURSOR_ROTATE_180;
|
||||
}
|
||||
|
||||
@ -10301,7 +10301,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
|
||||
|
||||
/* ILK+ do this automagically */
|
||||
if (HAS_GMCH_DISPLAY(dev) &&
|
||||
plane_state->base.rotation == BIT(DRM_ROTATE_180)) {
|
||||
plane_state->base.rotation == DRM_ROTATE_180) {
|
||||
base += (plane_state->base.crtc_h *
|
||||
plane_state->base.crtc_w - 1) * 4;
|
||||
}
|
||||
@ -11818,7 +11818,7 @@ static bool intel_wm_need_update(struct drm_plane *plane,
|
||||
struct intel_plane_state *cur = to_intel_plane_state(plane->state);
|
||||
|
||||
/* Update watermarks on tiling or size changes. */
|
||||
if (new->visible != cur->visible)
|
||||
if (new->base.visible != cur->base.visible)
|
||||
return true;
|
||||
|
||||
if (!cur->base.fb || !new->base.fb)
|
||||
@ -11826,10 +11826,10 @@ static bool intel_wm_need_update(struct drm_plane *plane,
|
||||
|
||||
if (cur->base.fb->modifier[0] != new->base.fb->modifier[0] ||
|
||||
cur->base.rotation != new->base.rotation ||
|
||||
drm_rect_width(&new->src) != drm_rect_width(&cur->src) ||
|
||||
drm_rect_height(&new->src) != drm_rect_height(&cur->src) ||
|
||||
drm_rect_width(&new->dst) != drm_rect_width(&cur->dst) ||
|
||||
drm_rect_height(&new->dst) != drm_rect_height(&cur->dst))
|
||||
drm_rect_width(&new->base.src) != drm_rect_width(&cur->base.src) ||
|
||||
drm_rect_height(&new->base.src) != drm_rect_height(&cur->base.src) ||
|
||||
drm_rect_width(&new->base.dst) != drm_rect_width(&cur->base.dst) ||
|
||||
drm_rect_height(&new->base.dst) != drm_rect_height(&cur->base.dst))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -11837,10 +11837,10 @@ static bool intel_wm_need_update(struct drm_plane *plane,
|
||||
|
||||
static bool needs_scaling(struct intel_plane_state *state)
|
||||
{
|
||||
int src_w = drm_rect_width(&state->src) >> 16;
|
||||
int src_h = drm_rect_height(&state->src) >> 16;
|
||||
int dst_w = drm_rect_width(&state->dst);
|
||||
int dst_h = drm_rect_height(&state->dst);
|
||||
int src_w = drm_rect_width(&state->base.src) >> 16;
|
||||
int src_h = drm_rect_height(&state->base.src) >> 16;
|
||||
int dst_w = drm_rect_width(&state->base.dst);
|
||||
int dst_h = drm_rect_height(&state->base.dst);
|
||||
|
||||
return (src_w != dst_w || src_h != dst_h);
|
||||
}
|
||||
@ -11871,8 +11871,8 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
|
||||
return ret;
|
||||
}
|
||||
|
||||
was_visible = old_plane_state->visible;
|
||||
visible = to_intel_plane_state(plane_state)->visible;
|
||||
was_visible = old_plane_state->base.visible;
|
||||
visible = to_intel_plane_state(plane_state)->base.visible;
|
||||
|
||||
if (!was_crtc_enabled && WARN_ON(was_visible))
|
||||
was_visible = false;
|
||||
@ -11888,7 +11888,7 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
|
||||
* only combine the results from all planes in the current place?
|
||||
*/
|
||||
if (!is_crtc_enabled)
|
||||
to_intel_plane_state(plane_state)->visible = visible = false;
|
||||
to_intel_plane_state(plane_state)->base.visible = visible = false;
|
||||
|
||||
if (!was_visible && !visible)
|
||||
return 0;
|
||||
@ -12283,12 +12283,13 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
|
||||
drm_get_format_name(fb->pixel_format));
|
||||
DRM_DEBUG_KMS("\tscaler:%d src %dx%d+%d+%d dst %dx%d+%d+%d\n",
|
||||
state->scaler_id,
|
||||
state->src.x1 >> 16, state->src.y1 >> 16,
|
||||
drm_rect_width(&state->src) >> 16,
|
||||
drm_rect_height(&state->src) >> 16,
|
||||
state->dst.x1, state->dst.y1,
|
||||
drm_rect_width(&state->dst),
|
||||
drm_rect_height(&state->dst));
|
||||
state->base.src.x1 >> 16,
|
||||
state->base.src.y1 >> 16,
|
||||
drm_rect_width(&state->base.src) >> 16,
|
||||
drm_rect_height(&state->base.src) >> 16,
|
||||
state->base.dst.x1, state->base.dst.y1,
|
||||
drm_rect_width(&state->base.dst),
|
||||
drm_rect_height(&state->base.dst));
|
||||
}
|
||||
}
|
||||
|
||||
@ -14109,7 +14110,6 @@ intel_check_primary_plane(struct drm_plane *plane,
|
||||
struct intel_plane_state *state)
|
||||
{
|
||||
struct drm_crtc *crtc = state->base.crtc;
|
||||
struct drm_framebuffer *fb = state->base.fb;
|
||||
int min_scale = DRM_PLANE_HELPER_NO_SCALING;
|
||||
int max_scale = DRM_PLANE_HELPER_NO_SCALING;
|
||||
bool can_position = false;
|
||||
@ -14123,12 +14123,10 @@ intel_check_primary_plane(struct drm_plane *plane,
|
||||
can_position = true;
|
||||
}
|
||||
|
||||
return drm_plane_helper_check_update(plane, crtc, fb, &state->src,
|
||||
&state->dst, &state->clip,
|
||||
state->base.rotation,
|
||||
min_scale, max_scale,
|
||||
can_position, true,
|
||||
&state->visible);
|
||||
return drm_plane_helper_check_state(&state->base,
|
||||
&state->clip,
|
||||
min_scale, max_scale,
|
||||
can_position, true);
|
||||
}
|
||||
|
||||
static void intel_begin_crtc_commit(struct drm_crtc *crtc,
|
||||
@ -14288,11 +14286,11 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
|
||||
void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane)
|
||||
{
|
||||
if (!dev->mode_config.rotation_property) {
|
||||
unsigned long flags = BIT(DRM_ROTATE_0) |
|
||||
BIT(DRM_ROTATE_180);
|
||||
unsigned long flags = DRM_ROTATE_0 |
|
||||
DRM_ROTATE_180;
|
||||
|
||||
if (INTEL_INFO(dev)->gen >= 9)
|
||||
flags |= BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270);
|
||||
flags |= DRM_ROTATE_90 | DRM_ROTATE_270;
|
||||
|
||||
dev->mode_config.rotation_property =
|
||||
drm_mode_create_rotation_property(dev, flags);
|
||||
@ -14308,19 +14306,17 @@ intel_check_cursor_plane(struct drm_plane *plane,
|
||||
struct intel_crtc_state *crtc_state,
|
||||
struct intel_plane_state *state)
|
||||
{
|
||||
struct drm_crtc *crtc = crtc_state->base.crtc;
|
||||
struct drm_framebuffer *fb = state->base.fb;
|
||||
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
|
||||
enum pipe pipe = to_intel_plane(plane)->pipe;
|
||||
unsigned stride;
|
||||
int ret;
|
||||
|
||||
ret = drm_plane_helper_check_update(plane, crtc, fb, &state->src,
|
||||
&state->dst, &state->clip,
|
||||
state->base.rotation,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
true, true, &state->visible);
|
||||
ret = drm_plane_helper_check_state(&state->base,
|
||||
&state->clip,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
true, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -14357,7 +14353,7 @@ intel_check_cursor_plane(struct drm_plane *plane,
|
||||
* Refuse the put the cursor into that compromised position.
|
||||
*/
|
||||
if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C &&
|
||||
state->visible && state->base.crtc_x < 0) {
|
||||
state->base.visible && state->base.crtc_x < 0) {
|
||||
DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -14435,8 +14431,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
|
||||
if (!dev->mode_config.rotation_property)
|
||||
dev->mode_config.rotation_property =
|
||||
drm_mode_create_rotation_property(dev,
|
||||
BIT(DRM_ROTATE_0) |
|
||||
BIT(DRM_ROTATE_180));
|
||||
DRM_ROTATE_0 |
|
||||
DRM_ROTATE_180);
|
||||
if (dev->mode_config.rotation_property)
|
||||
drm_object_attach_property(&cursor->base.base,
|
||||
dev->mode_config.rotation_property,
|
||||
@ -15807,7 +15803,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
|
||||
* Temporarily change the plane mapping and disable everything
|
||||
* ... */
|
||||
plane = crtc->plane;
|
||||
to_intel_plane_state(crtc->base.primary->state)->visible = true;
|
||||
to_intel_plane_state(crtc->base.primary->state)->base.visible = true;
|
||||
crtc->plane = !plane;
|
||||
intel_crtc_disable_noatomic(&crtc->base);
|
||||
crtc->plane = plane;
|
||||
@ -15934,10 +15930,10 @@ static void readout_plane_state(struct intel_crtc *crtc)
|
||||
struct intel_plane_state *plane_state =
|
||||
to_intel_plane_state(primary->state);
|
||||
|
||||
plane_state->visible = crtc->active &&
|
||||
plane_state->base.visible = crtc->active &&
|
||||
primary_get_hw_state(to_intel_plane(primary));
|
||||
|
||||
if (plane_state->visible)
|
||||
if (plane_state->base.visible)
|
||||
crtc->base.state->plane_mask |= 1 << drm_plane_index(primary);
|
||||
}
|
||||
|
||||
|
@ -338,10 +338,7 @@ struct intel_atomic_state {
|
||||
|
||||
struct intel_plane_state {
|
||||
struct drm_plane_state base;
|
||||
struct drm_rect src;
|
||||
struct drm_rect dst;
|
||||
struct drm_rect clip;
|
||||
bool visible;
|
||||
|
||||
/*
|
||||
* scaler_id
|
||||
@ -1258,7 +1255,7 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
|
||||
static inline bool
|
||||
intel_rotation_90_or_270(unsigned int rotation)
|
||||
{
|
||||
return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
|
||||
return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
|
||||
}
|
||||
|
||||
void intel_create_rotation_property(struct drm_device *dev,
|
||||
|
@ -494,7 +494,7 @@ static bool multiple_pipes_ok(struct intel_crtc *crtc,
|
||||
if (!no_fbc_on_multiple_pipes(dev_priv))
|
||||
return true;
|
||||
|
||||
if (plane_state->visible)
|
||||
if (plane_state->base.visible)
|
||||
fbc->visible_pipes_mask |= (1 << pipe);
|
||||
else
|
||||
fbc->visible_pipes_mask &= ~(1 << pipe);
|
||||
@ -725,9 +725,9 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
|
||||
ilk_pipe_pixel_rate(crtc_state);
|
||||
|
||||
cache->plane.rotation = plane_state->base.rotation;
|
||||
cache->plane.src_w = drm_rect_width(&plane_state->src) >> 16;
|
||||
cache->plane.src_h = drm_rect_height(&plane_state->src) >> 16;
|
||||
cache->plane.visible = plane_state->visible;
|
||||
cache->plane.src_w = drm_rect_width(&plane_state->base.src) >> 16;
|
||||
cache->plane.src_h = drm_rect_height(&plane_state->base.src) >> 16;
|
||||
cache->plane.visible = plane_state->base.visible;
|
||||
|
||||
if (!cache->plane.visible)
|
||||
return;
|
||||
@ -775,7 +775,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
|
||||
return false;
|
||||
}
|
||||
if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) &&
|
||||
cache->plane.rotation != BIT(DRM_ROTATE_0)) {
|
||||
cache->plane.rotation != DRM_ROTATE_0) {
|
||||
fbc->no_fbc_reason = "rotation unsupported";
|
||||
return false;
|
||||
}
|
||||
@ -1050,7 +1050,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
|
||||
struct intel_plane_state *intel_plane_state =
|
||||
to_intel_plane_state(plane_state);
|
||||
|
||||
if (!intel_plane_state->visible)
|
||||
if (!intel_plane_state->base.visible)
|
||||
continue;
|
||||
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, j) {
|
||||
@ -1212,7 +1212,7 @@ void intel_fbc_init_pipe_state(struct drm_i915_private *dev_priv)
|
||||
|
||||
for_each_intel_crtc(&dev_priv->drm, crtc)
|
||||
if (intel_crtc_active(&crtc->base) &&
|
||||
to_intel_plane_state(crtc->base.primary->state)->visible)
|
||||
to_intel_plane_state(crtc->base.primary->state)->base.visible)
|
||||
dev_priv->fbc.visible_pipes_mask |= (1 << crtc->pipe);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <linux/tty.h>
|
||||
#include <linux/sysrq.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/vga_switcheroo.h>
|
||||
|
||||
@ -223,7 +222,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
|
||||
* This also validates that any existing fb inherited from the
|
||||
* BIOS is suitable for own access.
|
||||
*/
|
||||
ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
|
||||
ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
|
||||
if (ret)
|
||||
goto out_unlock;
|
||||
|
||||
@ -289,7 +288,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
|
||||
out_destroy_fbi:
|
||||
drm_fb_helper_release_fbi(helper);
|
||||
out_unpin:
|
||||
intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
|
||||
intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
|
||||
out_unlock:
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
return ret;
|
||||
@ -554,7 +553,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
|
||||
|
||||
if (ifbdev->fb) {
|
||||
mutex_lock(&ifbdev->helper.dev->struct_mutex);
|
||||
intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
|
||||
intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
|
||||
mutex_unlock(&ifbdev->helper.dev->struct_mutex);
|
||||
|
||||
drm_framebuffer_remove(&ifbdev->fb->base);
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/fb.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drmP.h>
|
||||
#include "intel_drv.h"
|
||||
|
@ -960,7 +960,7 @@ static uint16_t vlv_compute_wm_level(struct intel_plane *plane,
|
||||
if (dev_priv->wm.pri_latency[level] == 0)
|
||||
return USHRT_MAX;
|
||||
|
||||
if (!state->visible)
|
||||
if (!state->base.visible)
|
||||
return 0;
|
||||
|
||||
cpp = drm_format_plane_cpp(state->base.fb->pixel_format, 0);
|
||||
@ -1002,7 +1002,7 @@ static void vlv_compute_fifo(struct intel_crtc *crtc)
|
||||
if (plane->base.type == DRM_PLANE_TYPE_CURSOR)
|
||||
continue;
|
||||
|
||||
if (state->visible) {
|
||||
if (state->base.visible) {
|
||||
wm_state->num_active_planes++;
|
||||
total_rate += drm_format_plane_cpp(state->base.fb->pixel_format, 0);
|
||||
}
|
||||
@ -1018,7 +1018,7 @@ static void vlv_compute_fifo(struct intel_crtc *crtc)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!state->visible) {
|
||||
if (!state->base.visible) {
|
||||
plane->wm.fifo_size = 0;
|
||||
continue;
|
||||
}
|
||||
@ -1118,7 +1118,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)
|
||||
struct intel_plane_state *state =
|
||||
to_intel_plane_state(plane->base.state);
|
||||
|
||||
if (!state->visible)
|
||||
if (!state->base.visible)
|
||||
continue;
|
||||
|
||||
/* normal watermarks */
|
||||
@ -1767,7 +1767,7 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate,
|
||||
drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0;
|
||||
uint32_t method1, method2;
|
||||
|
||||
if (!cstate->base.active || !pstate->visible)
|
||||
if (!cstate->base.active || !pstate->base.visible)
|
||||
return 0;
|
||||
|
||||
method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value);
|
||||
@ -1777,7 +1777,7 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate,
|
||||
|
||||
method2 = ilk_wm_method2(ilk_pipe_pixel_rate(cstate),
|
||||
cstate->base.adjusted_mode.crtc_htotal,
|
||||
drm_rect_width(&pstate->dst),
|
||||
drm_rect_width(&pstate->base.dst),
|
||||
cpp, mem_value);
|
||||
|
||||
return min(method1, method2);
|
||||
@ -1795,13 +1795,13 @@ static uint32_t ilk_compute_spr_wm(const struct intel_crtc_state *cstate,
|
||||
drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0;
|
||||
uint32_t method1, method2;
|
||||
|
||||
if (!cstate->base.active || !pstate->visible)
|
||||
if (!cstate->base.active || !pstate->base.visible)
|
||||
return 0;
|
||||
|
||||
method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value);
|
||||
method2 = ilk_wm_method2(ilk_pipe_pixel_rate(cstate),
|
||||
cstate->base.adjusted_mode.crtc_htotal,
|
||||
drm_rect_width(&pstate->dst),
|
||||
drm_rect_width(&pstate->base.dst),
|
||||
cpp, mem_value);
|
||||
return min(method1, method2);
|
||||
}
|
||||
@ -1820,7 +1820,7 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate,
|
||||
* this is necessary to avoid flickering.
|
||||
*/
|
||||
int cpp = 4;
|
||||
int width = pstate->visible ? pstate->base.crtc_w : 64;
|
||||
int width = pstate->base.visible ? pstate->base.crtc_w : 64;
|
||||
|
||||
if (!cstate->base.active)
|
||||
return 0;
|
||||
@ -1838,10 +1838,10 @@ static uint32_t ilk_compute_fbc_wm(const struct intel_crtc_state *cstate,
|
||||
int cpp = pstate->base.fb ?
|
||||
drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0;
|
||||
|
||||
if (!cstate->base.active || !pstate->visible)
|
||||
if (!cstate->base.active || !pstate->base.visible)
|
||||
return 0;
|
||||
|
||||
return ilk_wm_fbc(pri_val, drm_rect_width(&pstate->dst), cpp);
|
||||
return ilk_wm_fbc(pri_val, drm_rect_width(&pstate->base.dst), cpp);
|
||||
}
|
||||
|
||||
static unsigned int ilk_display_fifo_size(const struct drm_device *dev)
|
||||
@ -2358,10 +2358,10 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)
|
||||
|
||||
pipe_wm->pipe_enabled = cstate->base.active;
|
||||
if (sprstate) {
|
||||
pipe_wm->sprites_enabled = sprstate->visible;
|
||||
pipe_wm->sprites_scaled = sprstate->visible &&
|
||||
(drm_rect_width(&sprstate->dst) != drm_rect_width(&sprstate->src) >> 16 ||
|
||||
drm_rect_height(&sprstate->dst) != drm_rect_height(&sprstate->src) >> 16);
|
||||
pipe_wm->sprites_enabled = sprstate->base.visible;
|
||||
pipe_wm->sprites_scaled = sprstate->base.visible &&
|
||||
(drm_rect_width(&sprstate->base.dst) != drm_rect_width(&sprstate->base.src) >> 16 ||
|
||||
drm_rect_height(&sprstate->base.dst) != drm_rect_height(&sprstate->base.src) >> 16);
|
||||
}
|
||||
|
||||
usable_level = max_level;
|
||||
@ -2996,14 +2996,14 @@ skl_plane_downscale_amount(const struct intel_plane_state *pstate)
|
||||
uint32_t downscale_h, downscale_w;
|
||||
uint32_t src_w, src_h, dst_w, dst_h;
|
||||
|
||||
if (WARN_ON(!pstate->visible))
|
||||
if (WARN_ON(!pstate->base.visible))
|
||||
return DRM_PLANE_HELPER_NO_SCALING;
|
||||
|
||||
/* n.b., src is 16.16 fixed point, dst is whole integer */
|
||||
src_w = drm_rect_width(&pstate->src);
|
||||
src_h = drm_rect_height(&pstate->src);
|
||||
dst_w = drm_rect_width(&pstate->dst);
|
||||
dst_h = drm_rect_height(&pstate->dst);
|
||||
src_w = drm_rect_width(&pstate->base.src);
|
||||
src_h = drm_rect_height(&pstate->base.src);
|
||||
dst_w = drm_rect_width(&pstate->base.dst);
|
||||
dst_h = drm_rect_height(&pstate->base.dst);
|
||||
if (intel_rotation_90_or_270(pstate->base.rotation))
|
||||
swap(dst_w, dst_h);
|
||||
|
||||
@ -3025,15 +3025,15 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
|
||||
uint32_t width = 0, height = 0;
|
||||
unsigned format = fb ? fb->pixel_format : DRM_FORMAT_XRGB8888;
|
||||
|
||||
if (!intel_pstate->visible)
|
||||
if (!intel_pstate->base.visible)
|
||||
return 0;
|
||||
if (pstate->plane->type == DRM_PLANE_TYPE_CURSOR)
|
||||
return 0;
|
||||
if (y && format != DRM_FORMAT_NV12)
|
||||
return 0;
|
||||
|
||||
width = drm_rect_width(&intel_pstate->src) >> 16;
|
||||
height = drm_rect_height(&intel_pstate->src) >> 16;
|
||||
width = drm_rect_width(&intel_pstate->base.src) >> 16;
|
||||
height = drm_rect_height(&intel_pstate->base.src) >> 16;
|
||||
|
||||
if (intel_rotation_90_or_270(pstate->rotation))
|
||||
swap(width, height);
|
||||
@ -3134,8 +3134,8 @@ skl_ddb_min_alloc(const struct drm_plane_state *pstate,
|
||||
fb->modifier[0] != I915_FORMAT_MOD_Yf_TILED)
|
||||
return 8;
|
||||
|
||||
src_w = drm_rect_width(&intel_pstate->src) >> 16;
|
||||
src_h = drm_rect_height(&intel_pstate->src) >> 16;
|
||||
src_w = drm_rect_width(&intel_pstate->base.src) >> 16;
|
||||
src_h = drm_rect_height(&intel_pstate->base.src) >> 16;
|
||||
|
||||
if (intel_rotation_90_or_270(pstate->rotation))
|
||||
swap(src_w, src_h);
|
||||
@ -3226,7 +3226,7 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
|
||||
if (intel_plane->pipe != pipe)
|
||||
continue;
|
||||
|
||||
if (!to_intel_plane_state(pstate)->visible) {
|
||||
if (!to_intel_plane_state(pstate)->base.visible) {
|
||||
minimum[id] = 0;
|
||||
y_minimum[id] = 0;
|
||||
continue;
|
||||
@ -3363,7 +3363,7 @@ static uint32_t skl_adjusted_plane_pixel_rate(const struct intel_crtc_state *cst
|
||||
uint64_t pixel_rate;
|
||||
|
||||
/* Shouldn't reach here on disabled planes... */
|
||||
if (WARN_ON(!pstate->visible))
|
||||
if (WARN_ON(!pstate->base.visible))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
@ -3399,13 +3399,13 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
|
||||
uint32_t width = 0, height = 0;
|
||||
uint32_t plane_pixel_rate;
|
||||
|
||||
if (latency == 0 || !cstate->base.active || !intel_pstate->visible) {
|
||||
if (latency == 0 || !cstate->base.active || !intel_pstate->base.visible) {
|
||||
*enabled = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
width = drm_rect_width(&intel_pstate->src) >> 16;
|
||||
height = drm_rect_height(&intel_pstate->src) >> 16;
|
||||
width = drm_rect_width(&intel_pstate->base.src) >> 16;
|
||||
height = drm_rect_height(&intel_pstate->base.src) >> 16;
|
||||
|
||||
if (intel_rotation_90_or_270(pstate->rotation))
|
||||
swap(width, height);
|
||||
|
@ -211,14 +211,14 @@ skl_update_plane(struct drm_plane *drm_plane,
|
||||
u32 tile_height, plane_offset, plane_size;
|
||||
unsigned int rotation = plane_state->base.rotation;
|
||||
int x_offset, y_offset;
|
||||
int crtc_x = plane_state->dst.x1;
|
||||
int crtc_y = plane_state->dst.y1;
|
||||
uint32_t crtc_w = drm_rect_width(&plane_state->dst);
|
||||
uint32_t crtc_h = drm_rect_height(&plane_state->dst);
|
||||
uint32_t x = plane_state->src.x1 >> 16;
|
||||
uint32_t y = plane_state->src.y1 >> 16;
|
||||
uint32_t src_w = drm_rect_width(&plane_state->src) >> 16;
|
||||
uint32_t src_h = drm_rect_height(&plane_state->src) >> 16;
|
||||
int crtc_x = plane_state->base.dst.x1;
|
||||
int crtc_y = plane_state->base.dst.y1;
|
||||
uint32_t crtc_w = drm_rect_width(&plane_state->base.dst);
|
||||
uint32_t crtc_h = drm_rect_height(&plane_state->base.dst);
|
||||
uint32_t x = plane_state->base.src.x1 >> 16;
|
||||
uint32_t y = plane_state->base.src.y1 >> 16;
|
||||
uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
|
||||
uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
|
||||
|
||||
plane_ctl = PLANE_CTL_ENABLE |
|
||||
PLANE_CTL_PIPE_GAMMA_ENABLE |
|
||||
@ -370,14 +370,14 @@ vlv_update_plane(struct drm_plane *dplane,
|
||||
unsigned int rotation = dplane->state->rotation;
|
||||
int cpp = drm_format_plane_cpp(fb->pixel_format, 0);
|
||||
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
|
||||
int crtc_x = plane_state->dst.x1;
|
||||
int crtc_y = plane_state->dst.y1;
|
||||
uint32_t crtc_w = drm_rect_width(&plane_state->dst);
|
||||
uint32_t crtc_h = drm_rect_height(&plane_state->dst);
|
||||
uint32_t x = plane_state->src.x1 >> 16;
|
||||
uint32_t y = plane_state->src.y1 >> 16;
|
||||
uint32_t src_w = drm_rect_width(&plane_state->src) >> 16;
|
||||
uint32_t src_h = drm_rect_height(&plane_state->src) >> 16;
|
||||
int crtc_x = plane_state->base.dst.x1;
|
||||
int crtc_y = plane_state->base.dst.y1;
|
||||
uint32_t crtc_w = drm_rect_width(&plane_state->base.dst);
|
||||
uint32_t crtc_h = drm_rect_height(&plane_state->base.dst);
|
||||
uint32_t x = plane_state->base.src.x1 >> 16;
|
||||
uint32_t y = plane_state->base.src.y1 >> 16;
|
||||
uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
|
||||
uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
|
||||
|
||||
sprctl = SP_ENABLE;
|
||||
|
||||
@ -444,7 +444,7 @@ vlv_update_plane(struct drm_plane *dplane,
|
||||
fb->pitches[0], rotation);
|
||||
linear_offset -= sprsurf_offset;
|
||||
|
||||
if (rotation == BIT(DRM_ROTATE_180)) {
|
||||
if (rotation == DRM_ROTATE_180) {
|
||||
sprctl |= SP_ROTATE_180;
|
||||
|
||||
x += src_w;
|
||||
@ -512,14 +512,14 @@ ivb_update_plane(struct drm_plane *plane,
|
||||
unsigned int rotation = plane_state->base.rotation;
|
||||
int cpp = drm_format_plane_cpp(fb->pixel_format, 0);
|
||||
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
|
||||
int crtc_x = plane_state->dst.x1;
|
||||
int crtc_y = plane_state->dst.y1;
|
||||
uint32_t crtc_w = drm_rect_width(&plane_state->dst);
|
||||
uint32_t crtc_h = drm_rect_height(&plane_state->dst);
|
||||
uint32_t x = plane_state->src.x1 >> 16;
|
||||
uint32_t y = plane_state->src.y1 >> 16;
|
||||
uint32_t src_w = drm_rect_width(&plane_state->src) >> 16;
|
||||
uint32_t src_h = drm_rect_height(&plane_state->src) >> 16;
|
||||
int crtc_x = plane_state->base.dst.x1;
|
||||
int crtc_y = plane_state->base.dst.y1;
|
||||
uint32_t crtc_w = drm_rect_width(&plane_state->base.dst);
|
||||
uint32_t crtc_h = drm_rect_height(&plane_state->base.dst);
|
||||
uint32_t x = plane_state->base.src.x1 >> 16;
|
||||
uint32_t y = plane_state->base.src.y1 >> 16;
|
||||
uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
|
||||
uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
|
||||
|
||||
sprctl = SPRITE_ENABLE;
|
||||
|
||||
@ -577,7 +577,7 @@ ivb_update_plane(struct drm_plane *plane,
|
||||
fb->pitches[0], rotation);
|
||||
linear_offset -= sprsurf_offset;
|
||||
|
||||
if (rotation == BIT(DRM_ROTATE_180)) {
|
||||
if (rotation == DRM_ROTATE_180) {
|
||||
sprctl |= SPRITE_ROTATE_180;
|
||||
|
||||
/* HSW and BDW does this automagically in hardware */
|
||||
@ -653,14 +653,14 @@ ilk_update_plane(struct drm_plane *plane,
|
||||
unsigned int rotation = plane_state->base.rotation;
|
||||
int cpp = drm_format_plane_cpp(fb->pixel_format, 0);
|
||||
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
|
||||
int crtc_x = plane_state->dst.x1;
|
||||
int crtc_y = plane_state->dst.y1;
|
||||
uint32_t crtc_w = drm_rect_width(&plane_state->dst);
|
||||
uint32_t crtc_h = drm_rect_height(&plane_state->dst);
|
||||
uint32_t x = plane_state->src.x1 >> 16;
|
||||
uint32_t y = plane_state->src.y1 >> 16;
|
||||
uint32_t src_w = drm_rect_width(&plane_state->src) >> 16;
|
||||
uint32_t src_h = drm_rect_height(&plane_state->src) >> 16;
|
||||
int crtc_x = plane_state->base.dst.x1;
|
||||
int crtc_y = plane_state->base.dst.y1;
|
||||
uint32_t crtc_w = drm_rect_width(&plane_state->base.dst);
|
||||
uint32_t crtc_h = drm_rect_height(&plane_state->base.dst);
|
||||
uint32_t x = plane_state->base.src.x1 >> 16;
|
||||
uint32_t y = plane_state->base.src.y1 >> 16;
|
||||
uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
|
||||
uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
|
||||
|
||||
dvscntr = DVS_ENABLE;
|
||||
|
||||
@ -714,7 +714,7 @@ ilk_update_plane(struct drm_plane *plane,
|
||||
fb->pitches[0], rotation);
|
||||
linear_offset -= dvssurf_offset;
|
||||
|
||||
if (rotation == BIT(DRM_ROTATE_180)) {
|
||||
if (rotation == DRM_ROTATE_180) {
|
||||
dvscntr |= DVS_ROTATE_180;
|
||||
|
||||
x += src_w;
|
||||
@ -778,15 +778,25 @@ intel_check_sprite_plane(struct drm_plane *plane,
|
||||
int crtc_x, crtc_y;
|
||||
unsigned int crtc_w, crtc_h;
|
||||
uint32_t src_x, src_y, src_w, src_h;
|
||||
struct drm_rect *src = &state->src;
|
||||
struct drm_rect *dst = &state->dst;
|
||||
struct drm_rect *src = &state->base.src;
|
||||
struct drm_rect *dst = &state->base.dst;
|
||||
const struct drm_rect *clip = &state->clip;
|
||||
int hscale, vscale;
|
||||
int max_scale, min_scale;
|
||||
bool can_scale;
|
||||
|
||||
src->x1 = state->base.src_x;
|
||||
src->y1 = state->base.src_y;
|
||||
src->x2 = state->base.src_x + state->base.src_w;
|
||||
src->y2 = state->base.src_y + state->base.src_h;
|
||||
|
||||
dst->x1 = state->base.crtc_x;
|
||||
dst->y1 = state->base.crtc_y;
|
||||
dst->x2 = state->base.crtc_x + state->base.crtc_w;
|
||||
dst->y2 = state->base.crtc_y + state->base.crtc_h;
|
||||
|
||||
if (!fb) {
|
||||
state->visible = false;
|
||||
state->base.visible = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -834,14 +844,14 @@ intel_check_sprite_plane(struct drm_plane *plane,
|
||||
vscale = drm_rect_calc_vscale_relaxed(src, dst, min_scale, max_scale);
|
||||
BUG_ON(vscale < 0);
|
||||
|
||||
state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
|
||||
state->base.visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
|
||||
|
||||
crtc_x = dst->x1;
|
||||
crtc_y = dst->y1;
|
||||
crtc_w = drm_rect_width(dst);
|
||||
crtc_h = drm_rect_height(dst);
|
||||
|
||||
if (state->visible) {
|
||||
if (state->base.visible) {
|
||||
/* check again in case clipping clamped the results */
|
||||
hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
|
||||
if (hscale < 0) {
|
||||
@ -898,12 +908,12 @@ intel_check_sprite_plane(struct drm_plane *plane,
|
||||
crtc_w &= ~1;
|
||||
|
||||
if (crtc_w == 0)
|
||||
state->visible = false;
|
||||
state->base.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check size restrictions when scaling */
|
||||
if (state->visible && (src_w != crtc_w || src_h != crtc_h)) {
|
||||
if (state->base.visible && (src_w != crtc_w || src_h != crtc_h)) {
|
||||
unsigned int width_bytes;
|
||||
int cpp = drm_format_plane_cpp(fb->pixel_format, 0);
|
||||
|
||||
@ -912,10 +922,10 @@ intel_check_sprite_plane(struct drm_plane *plane,
|
||||
/* FIXME interlacing min height is 6 */
|
||||
|
||||
if (crtc_w < 3 || crtc_h < 3)
|
||||
state->visible = false;
|
||||
state->base.visible = false;
|
||||
|
||||
if (src_w < 3 || src_h < 3)
|
||||
state->visible = false;
|
||||
state->base.visible = false;
|
||||
|
||||
width_bytes = ((src_x * cpp) & 63) + src_w * cpp;
|
||||
|
||||
@ -926,7 +936,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
|
||||
}
|
||||
}
|
||||
|
||||
if (state->visible) {
|
||||
if (state->base.visible) {
|
||||
src->x1 = src_x << 16;
|
||||
src->x2 = (src_x + src_w) << 16;
|
||||
src->y1 = src_y << 16;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <linux/component.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/reservation.h>
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <drm/drm_atomic.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/errno.h>
|
||||
#include <drm/drm_gem_cma_helper.h>
|
||||
|
@ -31,7 +31,7 @@
|
||||
* struct mtk_drm_crtc - MediaTek specific crtc structure.
|
||||
* @base: crtc object.
|
||||
* @enabled: records whether crtc_enable succeeded
|
||||
* @planes: array of 4 mtk_drm_plane structures, one for each overlay plane
|
||||
* @planes: array of 4 drm_plane structures, one for each overlay plane
|
||||
* @pending_planes: whether any plane has pending changes to be applied
|
||||
* @config_regs: memory mapped mmsys configuration register space
|
||||
* @mutex: handle to one of the ten disp_mutex streams
|
||||
@ -45,7 +45,7 @@ struct mtk_drm_crtc {
|
||||
bool pending_needs_vblank;
|
||||
struct drm_pending_vblank_event *event;
|
||||
|
||||
struct mtk_drm_plane planes[OVL_LAYER_NR];
|
||||
struct drm_plane planes[OVL_LAYER_NR];
|
||||
bool pending_planes;
|
||||
|
||||
void __iomem *config_regs;
|
||||
@ -112,8 +112,7 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)
|
||||
struct mtk_crtc_state *state;
|
||||
|
||||
if (crtc->state) {
|
||||
if (crtc->state->mode_blob)
|
||||
drm_property_unreference_blob(crtc->state->mode_blob);
|
||||
__drm_atomic_helper_crtc_destroy_state(crtc->state);
|
||||
|
||||
state = to_mtk_crtc_state(crtc->state);
|
||||
memset(state, 0, sizeof(*state));
|
||||
@ -287,7 +286,7 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)
|
||||
|
||||
/* Initially configure all planes */
|
||||
for (i = 0; i < OVL_LAYER_NR; i++) {
|
||||
struct drm_plane *plane = &mtk_crtc->planes[i].base;
|
||||
struct drm_plane *plane = &mtk_crtc->planes[i];
|
||||
struct mtk_plane_state *plane_state;
|
||||
|
||||
plane_state = to_mtk_plane_state(plane->state);
|
||||
@ -366,7 +365,7 @@ static void mtk_drm_crtc_disable(struct drm_crtc *crtc)
|
||||
|
||||
/* Set all pending plane state to disabled */
|
||||
for (i = 0; i < OVL_LAYER_NR; i++) {
|
||||
struct drm_plane *plane = &mtk_crtc->planes[i].base;
|
||||
struct drm_plane *plane = &mtk_crtc->planes[i];
|
||||
struct mtk_plane_state *plane_state;
|
||||
|
||||
plane_state = to_mtk_plane_state(plane->state);
|
||||
@ -412,7 +411,7 @@ static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
|
||||
if (mtk_crtc->event)
|
||||
mtk_crtc->pending_needs_vblank = true;
|
||||
for (i = 0; i < OVL_LAYER_NR; i++) {
|
||||
struct drm_plane *plane = &mtk_crtc->planes[i].base;
|
||||
struct drm_plane *plane = &mtk_crtc->planes[i];
|
||||
struct mtk_plane_state *plane_state;
|
||||
|
||||
plane_state = to_mtk_plane_state(plane->state);
|
||||
@ -490,7 +489,7 @@ void mtk_crtc_ddp_irq(struct drm_crtc *crtc, struct mtk_ddp_comp *ovl)
|
||||
|
||||
if (mtk_crtc->pending_planes) {
|
||||
for (i = 0; i < OVL_LAYER_NR; i++) {
|
||||
struct drm_plane *plane = &mtk_crtc->planes[i].base;
|
||||
struct drm_plane *plane = &mtk_crtc->planes[i];
|
||||
struct mtk_plane_state *plane_state;
|
||||
|
||||
plane_state = to_mtk_plane_state(plane->state);
|
||||
@ -578,13 +577,13 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
|
||||
(zpos == 1) ? DRM_PLANE_TYPE_CURSOR :
|
||||
DRM_PLANE_TYPE_OVERLAY;
|
||||
ret = mtk_plane_init(drm_dev, &mtk_crtc->planes[zpos],
|
||||
BIT(pipe), type, zpos);
|
||||
BIT(pipe), type);
|
||||
if (ret)
|
||||
goto unprepare;
|
||||
}
|
||||
|
||||
ret = mtk_drm_crtc_init(drm_dev, mtk_crtc, &mtk_crtc->planes[0].base,
|
||||
&mtk_crtc->planes[1].base, pipe);
|
||||
ret = mtk_drm_crtc_init(drm_dev, mtk_crtc, &mtk_crtc->planes[0],
|
||||
&mtk_crtc->planes[1], pipe);
|
||||
if (ret < 0)
|
||||
goto unprepare;
|
||||
drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE);
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe);
|
||||
void mtk_drm_crtc_disable_vblank(struct drm_device *drm, unsigned int pipe);
|
||||
void mtk_drm_crtc_check_flush(struct drm_crtc *crtc);
|
||||
void mtk_drm_crtc_commit(struct drm_crtc *crtc);
|
||||
void mtk_crtc_ddp_irq(struct drm_crtc *crtc, struct mtk_ddp_comp *ovl);
|
||||
int mtk_drm_crtc_create(struct drm_device *drm_dev,
|
||||
|
@ -61,10 +61,25 @@ static void mtk_atomic_complete(struct mtk_drm_private *private,
|
||||
|
||||
mtk_atomic_wait_for_fences(state);
|
||||
|
||||
/*
|
||||
* Mediatek drm supports runtime PM, so plane registers cannot be
|
||||
* written when their crtc is disabled.
|
||||
*
|
||||
* The comment for drm_atomic_helper_commit states:
|
||||
* For drivers supporting runtime PM the recommended sequence is
|
||||
*
|
||||
* drm_atomic_helper_commit_modeset_disables(dev, state);
|
||||
* drm_atomic_helper_commit_modeset_enables(dev, state);
|
||||
* drm_atomic_helper_commit_planes(dev, state, true);
|
||||
*
|
||||
* See the kerneldoc entries for these three functions for more details.
|
||||
*/
|
||||
drm_atomic_helper_commit_modeset_disables(drm, state);
|
||||
drm_atomic_helper_commit_planes(drm, state, false);
|
||||
drm_atomic_helper_commit_modeset_enables(drm, state);
|
||||
drm_atomic_helper_commit_planes(drm, state, true);
|
||||
|
||||
drm_atomic_helper_wait_for_vblanks(drm, state);
|
||||
|
||||
drm_atomic_helper_cleanup_planes(drm, state);
|
||||
drm_atomic_state_free(state);
|
||||
}
|
||||
|
@ -30,57 +30,12 @@ static const u32 formats[] = {
|
||||
DRM_FORMAT_RGB565,
|
||||
};
|
||||
|
||||
static void mtk_plane_enable(struct mtk_drm_plane *mtk_plane, bool enable,
|
||||
dma_addr_t addr, struct drm_rect *dest)
|
||||
{
|
||||
struct drm_plane *plane = &mtk_plane->base;
|
||||
struct mtk_plane_state *state = to_mtk_plane_state(plane->state);
|
||||
unsigned int pitch, format;
|
||||
int x, y;
|
||||
|
||||
if (WARN_ON(!plane->state || (enable && !plane->state->fb)))
|
||||
return;
|
||||
|
||||
if (plane->state->fb) {
|
||||
pitch = plane->state->fb->pitches[0];
|
||||
format = plane->state->fb->pixel_format;
|
||||
} else {
|
||||
pitch = 0;
|
||||
format = DRM_FORMAT_RGBA8888;
|
||||
}
|
||||
|
||||
x = plane->state->crtc_x;
|
||||
y = plane->state->crtc_y;
|
||||
|
||||
if (x < 0) {
|
||||
addr -= x * 4;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
if (y < 0) {
|
||||
addr -= y * pitch;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
state->pending.enable = enable;
|
||||
state->pending.pitch = pitch;
|
||||
state->pending.format = format;
|
||||
state->pending.addr = addr;
|
||||
state->pending.x = x;
|
||||
state->pending.y = y;
|
||||
state->pending.width = dest->x2 - dest->x1;
|
||||
state->pending.height = dest->y2 - dest->y1;
|
||||
wmb(); /* Make sure the above parameters are set before update */
|
||||
state->pending.dirty = true;
|
||||
}
|
||||
|
||||
static void mtk_plane_reset(struct drm_plane *plane)
|
||||
{
|
||||
struct mtk_plane_state *state;
|
||||
|
||||
if (plane->state) {
|
||||
if (plane->state->fb)
|
||||
drm_framebuffer_unreference(plane->state->fb);
|
||||
__drm_atomic_helper_plane_destroy_state(plane->state);
|
||||
|
||||
state = to_mtk_plane_state(plane->state);
|
||||
memset(state, 0, sizeof(*state));
|
||||
@ -134,20 +89,6 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
|
||||
{
|
||||
struct drm_framebuffer *fb = state->fb;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
bool visible;
|
||||
struct drm_rect dest = {
|
||||
.x1 = state->crtc_x,
|
||||
.y1 = state->crtc_y,
|
||||
.x2 = state->crtc_x + state->crtc_w,
|
||||
.y2 = state->crtc_y + state->crtc_h,
|
||||
};
|
||||
struct drm_rect src = {
|
||||
/* 16.16 fixed point */
|
||||
.x1 = state->src_x,
|
||||
.y1 = state->src_y,
|
||||
.x2 = state->src_x + state->src_w,
|
||||
.y2 = state->src_y + state->src_h,
|
||||
};
|
||||
struct drm_rect clip = { 0, };
|
||||
|
||||
if (!fb)
|
||||
@ -168,40 +109,45 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
|
||||
clip.x2 = crtc_state->mode.hdisplay;
|
||||
clip.y2 = crtc_state->mode.vdisplay;
|
||||
|
||||
return drm_plane_helper_check_update(plane, state->crtc, fb,
|
||||
&src, &dest, &clip,
|
||||
state->rotation,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
true, true, &visible);
|
||||
return drm_plane_helper_check_state(state, &clip,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
DRM_PLANE_HELPER_NO_SCALING,
|
||||
true, true);
|
||||
}
|
||||
|
||||
static void mtk_plane_atomic_update(struct drm_plane *plane,
|
||||
struct drm_plane_state *old_state)
|
||||
{
|
||||
struct mtk_plane_state *state = to_mtk_plane_state(plane->state);
|
||||
struct drm_crtc *crtc = state->base.crtc;
|
||||
struct drm_crtc *crtc = plane->state->crtc;
|
||||
struct drm_framebuffer *fb = plane->state->fb;
|
||||
struct drm_gem_object *gem;
|
||||
struct mtk_drm_gem_obj *mtk_gem;
|
||||
struct mtk_drm_plane *mtk_plane = to_mtk_plane(plane);
|
||||
struct drm_rect dest = {
|
||||
.x1 = state->base.crtc_x,
|
||||
.y1 = state->base.crtc_y,
|
||||
.x2 = state->base.crtc_x + state->base.crtc_w,
|
||||
.y2 = state->base.crtc_y + state->base.crtc_h,
|
||||
};
|
||||
struct drm_rect clip = { 0, };
|
||||
unsigned int pitch, format;
|
||||
dma_addr_t addr;
|
||||
|
||||
if (!crtc)
|
||||
if (!crtc || WARN_ON(!fb))
|
||||
return;
|
||||
|
||||
clip.x2 = state->base.crtc->state->mode.hdisplay;
|
||||
clip.y2 = state->base.crtc->state->mode.vdisplay;
|
||||
drm_rect_intersect(&dest, &clip);
|
||||
|
||||
gem = mtk_fb_get_gem_obj(state->base.fb);
|
||||
gem = mtk_fb_get_gem_obj(fb);
|
||||
mtk_gem = to_mtk_gem_obj(gem);
|
||||
mtk_plane_enable(mtk_plane, true, mtk_gem->dma_addr, &dest);
|
||||
addr = mtk_gem->dma_addr;
|
||||
pitch = fb->pitches[0];
|
||||
format = fb->pixel_format;
|
||||
|
||||
addr += (plane->state->src.x1 >> 16) * drm_format_plane_cpp(format, 0);
|
||||
addr += (plane->state->src.y1 >> 16) * pitch;
|
||||
|
||||
state->pending.enable = true;
|
||||
state->pending.pitch = pitch;
|
||||
state->pending.format = format;
|
||||
state->pending.addr = addr;
|
||||
state->pending.x = plane->state->dst.x1;
|
||||
state->pending.y = plane->state->dst.y1;
|
||||
state->pending.width = drm_rect_width(&plane->state->dst);
|
||||
state->pending.height = drm_rect_height(&plane->state->dst);
|
||||
wmb(); /* Make sure the above parameters are set before update */
|
||||
state->pending.dirty = true;
|
||||
}
|
||||
|
||||
static void mtk_plane_atomic_disable(struct drm_plane *plane,
|
||||
@ -220,13 +166,12 @@ static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = {
|
||||
.atomic_disable = mtk_plane_atomic_disable,
|
||||
};
|
||||
|
||||
int mtk_plane_init(struct drm_device *dev, struct mtk_drm_plane *mtk_plane,
|
||||
unsigned long possible_crtcs, enum drm_plane_type type,
|
||||
unsigned int zpos)
|
||||
int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
|
||||
unsigned long possible_crtcs, enum drm_plane_type type)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = drm_universal_plane_init(dev, &mtk_plane->base, possible_crtcs,
|
||||
err = drm_universal_plane_init(dev, plane, possible_crtcs,
|
||||
&mtk_plane_funcs, formats,
|
||||
ARRAY_SIZE(formats), type, NULL);
|
||||
if (err) {
|
||||
@ -234,8 +179,7 @@ int mtk_plane_init(struct drm_device *dev, struct mtk_drm_plane *mtk_plane,
|
||||
return err;
|
||||
}
|
||||
|
||||
drm_plane_helper_add(&mtk_plane->base, &mtk_plane_helper_funcs);
|
||||
mtk_plane->idx = zpos;
|
||||
drm_plane_helper_add(plane, &mtk_plane_helper_funcs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,11 +18,6 @@
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
struct mtk_drm_plane {
|
||||
struct drm_plane base;
|
||||
unsigned int idx;
|
||||
};
|
||||
|
||||
struct mtk_plane_pending_state {
|
||||
bool config;
|
||||
bool enable;
|
||||
@ -41,19 +36,13 @@ struct mtk_plane_state {
|
||||
struct mtk_plane_pending_state pending;
|
||||
};
|
||||
|
||||
static inline struct mtk_drm_plane *to_mtk_plane(struct drm_plane *plane)
|
||||
{
|
||||
return container_of(plane, struct mtk_drm_plane, base);
|
||||
}
|
||||
|
||||
static inline struct mtk_plane_state *
|
||||
to_mtk_plane_state(struct drm_plane_state *state)
|
||||
{
|
||||
return container_of(state, struct mtk_plane_state, base);
|
||||
}
|
||||
|
||||
int mtk_plane_init(struct drm_device *dev, struct mtk_drm_plane *mtk_plane,
|
||||
unsigned long possible_crtcs, enum drm_plane_type type,
|
||||
unsigned int zpos);
|
||||
int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
|
||||
unsigned long possible_crtcs, enum drm_plane_type type);
|
||||
|
||||
#endif
|
||||
|
@ -58,7 +58,7 @@ static const struct file_operations mga_driver_fops = {
|
||||
|
||||
static struct drm_driver driver = {
|
||||
.driver_features =
|
||||
DRIVER_USE_AGP | DRIVER_PCI_DMA |
|
||||
DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_LEGACY |
|
||||
DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
|
||||
.dev_priv_size = sizeof(drm_mga_buf_priv_t),
|
||||
.load = mga_driver_load,
|
||||
|
@ -56,7 +56,7 @@ static void mgag200_kick_out_firmware_fb(struct pci_dev *pdev)
|
||||
#ifdef CONFIG_X86
|
||||
primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
|
||||
#endif
|
||||
remove_conflicting_framebuffers(ap, "mgag200drmfb", primary);
|
||||
drm_fb_helper_remove_conflicting_framebuffers(ap, "mgag200drmfb", primary);
|
||||
kfree(ap);
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,6 @@
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include "mgag200_drv.h"
|
||||
|
||||
static void mga_dirty_update(struct mga_fbdev *mfbdev,
|
||||
|
@ -135,7 +135,7 @@ static int mga_vram_init(struct mga_device *mdev)
|
||||
aper->ranges[0].base = mdev->mc.vram_base;
|
||||
aper->ranges[0].size = mdev->mc.vram_window;
|
||||
|
||||
remove_conflicting_framebuffers(aper, "mgafb", true);
|
||||
drm_fb_helper_remove_conflicting_framebuffers(aper, "mgafb", true);
|
||||
kfree(aper);
|
||||
|
||||
if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window,
|
||||
|
@ -78,7 +78,7 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev,
|
||||
if (!dev->mode_config.rotation_property)
|
||||
dev->mode_config.rotation_property =
|
||||
drm_mode_create_rotation_property(dev,
|
||||
BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
|
||||
DRM_REFLECT_X | DRM_REFLECT_Y);
|
||||
|
||||
if (dev->mode_config.rotation_property)
|
||||
drm_object_attach_property(&plane->base,
|
||||
@ -309,8 +309,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hflip = !!(state->rotation & BIT(DRM_REFLECT_X));
|
||||
vflip = !!(state->rotation & BIT(DRM_REFLECT_Y));
|
||||
hflip = !!(state->rotation & DRM_REFLECT_X);
|
||||
vflip = !!(state->rotation & DRM_REFLECT_Y);
|
||||
if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) ||
|
||||
(hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) {
|
||||
dev_err(plane->dev->dev,
|
||||
@ -743,8 +743,8 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
|
||||
config |= get_scale_config(format, src_h, crtc_h, false);
|
||||
DBG("scale config = %x", config);
|
||||
|
||||
hflip = !!(pstate->rotation & BIT(DRM_REFLECT_X));
|
||||
vflip = !!(pstate->rotation & BIT(DRM_REFLECT_Y));
|
||||
hflip = !!(pstate->rotation & DRM_REFLECT_X);
|
||||
vflip = !!(pstate->rotation & DRM_REFLECT_Y);
|
||||
|
||||
spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
|
||||
|
||||
|
@ -351,7 +351,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
|
||||
boot = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
|
||||
#endif
|
||||
if (nouveau_modeset != 2)
|
||||
remove_conflicting_framebuffers(aper, "nouveaufb", boot);
|
||||
drm_fb_helper_remove_conflicting_framebuffers(aper, "nouveaufb", boot);
|
||||
kfree(aper);
|
||||
|
||||
ret = nvkm_device_pci_new(pdev, nouveau_config, nouveau_debug,
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <linux/tty.h>
|
||||
#include <linux/sysrq.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/screen_info.h>
|
||||
#include <linux/vga_switcheroo.h>
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/of_gpio.h>
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
|
@ -125,16 +125,15 @@ u32 dss_of_port_get_port_number(struct device_node *port)
|
||||
|
||||
static struct device_node *omapdss_of_get_remote_port(const struct device_node *node)
|
||||
{
|
||||
struct device_node *np, *np_parent;
|
||||
struct device_node *np;
|
||||
|
||||
np = of_parse_phandle(node, "remote-endpoint", 0);
|
||||
if (!np)
|
||||
return NULL;
|
||||
|
||||
np_parent = of_get_next_parent(np);
|
||||
of_node_put(np);
|
||||
np = of_get_next_parent(np);
|
||||
|
||||
return np_parent;
|
||||
return np;
|
||||
}
|
||||
|
||||
struct device_node *
|
||||
|
@ -295,9 +295,9 @@ static int omap_modeset_init_properties(struct drm_device *dev)
|
||||
if (priv->has_dmm) {
|
||||
dev->mode_config.rotation_property =
|
||||
drm_mode_create_rotation_property(dev,
|
||||
BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) |
|
||||
BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) |
|
||||
BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
|
||||
DRM_ROTATE_0 | DRM_ROTATE_90 |
|
||||
DRM_ROTATE_180 | DRM_ROTATE_270 |
|
||||
DRM_REFLECT_X | DRM_REFLECT_Y);
|
||||
if (!dev->mode_config.rotation_property)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -179,24 +179,24 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
|
||||
(uint32_t)win->rotation);
|
||||
/* fallthru to default to no rotation */
|
||||
case 0:
|
||||
case BIT(DRM_ROTATE_0):
|
||||
case DRM_ROTATE_0:
|
||||
orient = 0;
|
||||
break;
|
||||
case BIT(DRM_ROTATE_90):
|
||||
case DRM_ROTATE_90:
|
||||
orient = MASK_XY_FLIP | MASK_X_INVERT;
|
||||
break;
|
||||
case BIT(DRM_ROTATE_180):
|
||||
case DRM_ROTATE_180:
|
||||
orient = MASK_X_INVERT | MASK_Y_INVERT;
|
||||
break;
|
||||
case BIT(DRM_ROTATE_270):
|
||||
case DRM_ROTATE_270:
|
||||
orient = MASK_XY_FLIP | MASK_Y_INVERT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (win->rotation & BIT(DRM_REFLECT_X))
|
||||
if (win->rotation & DRM_REFLECT_X)
|
||||
orient ^= MASK_X_INVERT;
|
||||
|
||||
if (win->rotation & BIT(DRM_REFLECT_Y))
|
||||
if (win->rotation & DRM_REFLECT_Y)
|
||||
orient ^= MASK_Y_INVERT;
|
||||
|
||||
/* adjust x,y offset for flip/invert: */
|
||||
@ -213,7 +213,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
|
||||
} else {
|
||||
switch (win->rotation & DRM_ROTATE_MASK) {
|
||||
case 0:
|
||||
case BIT(DRM_ROTATE_0):
|
||||
case DRM_ROTATE_0:
|
||||
/* OK */
|
||||
break;
|
||||
|
||||
|
@ -109,8 +109,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
|
||||
win.src_y = state->src_y >> 16;
|
||||
|
||||
switch (state->rotation & DRM_ROTATE_MASK) {
|
||||
case BIT(DRM_ROTATE_90):
|
||||
case BIT(DRM_ROTATE_270):
|
||||
case DRM_ROTATE_90:
|
||||
case DRM_ROTATE_270:
|
||||
win.src_w = state->src_h >> 16;
|
||||
win.src_h = state->src_w >> 16;
|
||||
break;
|
||||
@ -149,7 +149,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
|
||||
struct omap_plane_state *omap_state = to_omap_plane_state(plane->state);
|
||||
struct omap_plane *omap_plane = to_omap_plane(plane);
|
||||
|
||||
plane->state->rotation = BIT(DRM_ROTATE_0);
|
||||
plane->state->rotation = DRM_ROTATE_0;
|
||||
omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
|
||||
? 0 : omap_plane->id;
|
||||
|
||||
@ -178,7 +178,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
|
||||
return -EINVAL;
|
||||
|
||||
if (state->fb) {
|
||||
if (state->rotation != BIT(DRM_ROTATE_0) &&
|
||||
if (state->rotation != DRM_ROTATE_0 &&
|
||||
!omap_framebuffer_supports_rotation(state->fb))
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -269,7 +269,7 @@ static void omap_plane_reset(struct drm_plane *plane)
|
||||
*/
|
||||
omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
|
||||
? 0 : omap_plane->id;
|
||||
omap_state->base.rotation = BIT(DRM_ROTATE_0);
|
||||
omap_state->base.rotation = DRM_ROTATE_0;
|
||||
|
||||
plane->state = &omap_state->base;
|
||||
plane->state->plane = plane;
|
||||
|
@ -24,7 +24,6 @@
|
||||
* David Airlie
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include "drmP.h"
|
||||
#include "drm/drm.h"
|
||||
@ -73,10 +72,12 @@ static void qxl_fb_image_init(struct qxl_fb_image *qxl_fb_image,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
||||
static struct fb_deferred_io qxl_defio = {
|
||||
.delay = QXL_DIRTY_DELAY,
|
||||
.deferred_io = drm_fb_helper_deferred_io,
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct fb_ops qxlfb_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
@ -313,8 +314,10 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
|
||||
goto out_destroy_fbi;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
||||
info->fbdefio = &qxl_defio;
|
||||
fb_deferred_io_init(info);
|
||||
#endif
|
||||
|
||||
qdev->fbdev_info = info;
|
||||
qdev->fbdev_qfb = &qfbdev->qfb;
|
||||
|
@ -56,7 +56,7 @@ static const struct file_operations r128_driver_fops = {
|
||||
|
||||
static struct drm_driver driver = {
|
||||
.driver_features =
|
||||
DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG |
|
||||
DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_LEGACY |
|
||||
DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
|
||||
.dev_priv_size = sizeof(drm_r128_buf_priv_t),
|
||||
.load = r128_driver_load,
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/vga_switcheroo.h>
|
||||
#include <drm/drm_gem.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
|
||||
#include "drm_crtc_helper.h"
|
||||
#include "radeon_kfd.h"
|
||||
@ -324,7 +325,7 @@ static int radeon_kick_out_firmware_fb(struct pci_dev *pdev)
|
||||
#ifdef CONFIG_X86
|
||||
primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
|
||||
#endif
|
||||
remove_conflicting_framebuffers(ap, "radeondrmfb", primary);
|
||||
drm_fb_helper_remove_conflicting_framebuffers(ap, "radeondrmfb", primary);
|
||||
kfree(ap);
|
||||
|
||||
return 0;
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include <drm/drmP.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
@ -383,7 +382,7 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
|
||||
void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state)
|
||||
{
|
||||
if (rdev->mode_info.rfbdev)
|
||||
fb_set_suspend(rdev->mode_info.rfbdev->helper.fbdev, state);
|
||||
drm_fb_helper_set_suspend(&rdev->mode_info.rfbdev->helper, state);
|
||||
}
|
||||
|
||||
bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)
|
||||
|
@ -87,8 +87,6 @@
|
||||
struct vop_plane_state {
|
||||
struct drm_plane_state base;
|
||||
int format;
|
||||
struct drm_rect src;
|
||||
struct drm_rect dest;
|
||||
dma_addr_t yrgb_mst;
|
||||
bool enable;
|
||||
};
|
||||
@ -593,10 +591,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
|
||||
struct vop_win *vop_win = to_vop_win(plane);
|
||||
struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
|
||||
const struct vop_win_data *win = vop_win->data;
|
||||
bool visible;
|
||||
int ret;
|
||||
struct drm_rect *dest = &vop_plane_state->dest;
|
||||
struct drm_rect *src = &vop_plane_state->src;
|
||||
struct drm_rect clip;
|
||||
int min_scale = win->phy->scl ? FRAC_16_16(1, 8) :
|
||||
DRM_PLANE_HELPER_NO_SCALING;
|
||||
@ -610,30 +605,18 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
|
||||
if (WARN_ON(!crtc_state))
|
||||
return -EINVAL;
|
||||
|
||||
src->x1 = state->src_x;
|
||||
src->y1 = state->src_y;
|
||||
src->x2 = state->src_x + state->src_w;
|
||||
src->y2 = state->src_y + state->src_h;
|
||||
dest->x1 = state->crtc_x;
|
||||
dest->y1 = state->crtc_y;
|
||||
dest->x2 = state->crtc_x + state->crtc_w;
|
||||
dest->y2 = state->crtc_y + state->crtc_h;
|
||||
|
||||
clip.x1 = 0;
|
||||
clip.y1 = 0;
|
||||
clip.x2 = crtc_state->adjusted_mode.hdisplay;
|
||||
clip.y2 = crtc_state->adjusted_mode.vdisplay;
|
||||
|
||||
ret = drm_plane_helper_check_update(plane, crtc, state->fb,
|
||||
src, dest, &clip,
|
||||
state->rotation,
|
||||
min_scale,
|
||||
max_scale,
|
||||
true, true, &visible);
|
||||
ret = drm_plane_helper_check_state(state, &clip,
|
||||
min_scale, max_scale,
|
||||
true, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!visible)
|
||||
if (!state->visible)
|
||||
goto out_disable;
|
||||
|
||||
vop_plane_state->format = vop_convert_format(fb->pixel_format);
|
||||
@ -644,7 +627,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
|
||||
* Src.x1 can be odd when do clip, but yuv plane start point
|
||||
* need align with 2 pixel.
|
||||
*/
|
||||
if (is_yuv_support(fb->pixel_format) && ((src->x1 >> 16) % 2))
|
||||
if (is_yuv_support(fb->pixel_format) && ((state->src.x1 >> 16) % 2))
|
||||
return -EINVAL;
|
||||
|
||||
vop_plane_state->enable = true;
|
||||
@ -694,8 +677,8 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
|
||||
unsigned int actual_w, actual_h;
|
||||
unsigned int dsp_stx, dsp_sty;
|
||||
uint32_t act_info, dsp_info, dsp_st;
|
||||
struct drm_rect *src = &vop_plane_state->src;
|
||||
struct drm_rect *dest = &vop_plane_state->dest;
|
||||
struct drm_rect *src = &state->src;
|
||||
struct drm_rect *dest = &state->dst;
|
||||
struct drm_gem_object *obj, *uv_obj;
|
||||
struct rockchip_gem_object *rk_obj, *rk_uv_obj;
|
||||
unsigned long offset;
|
||||
|
@ -50,7 +50,7 @@ static const struct file_operations savage_driver_fops = {
|
||||
|
||||
static struct drm_driver driver = {
|
||||
.driver_features =
|
||||
DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_PCI_DMA,
|
||||
DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_PCI_DMA | DRIVER_LEGACY,
|
||||
.dev_priv_size = sizeof(drm_savage_buf_priv_t),
|
||||
.load = savage_driver_load,
|
||||
.firstopen = savage_driver_firstopen,
|
||||
|
@ -102,7 +102,7 @@ static void sis_driver_postclose(struct drm_device *dev, struct drm_file *file)
|
||||
}
|
||||
|
||||
static struct drm_driver driver = {
|
||||
.driver_features = DRIVER_USE_AGP,
|
||||
.driver_features = DRIVER_USE_AGP | DRIVER_LEGACY,
|
||||
.load = sis_driver_load,
|
||||
.unload = sis_driver_unload,
|
||||
.open = sis_driver_open,
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_fb_cma_helper.h>
|
||||
#include <drm/drm_gem_cma_helper.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
|
||||
#include "sun4i_crtc.h"
|
||||
#include "sun4i_drv.h"
|
||||
@ -109,7 +110,7 @@ static void sun4i_remove_framebuffers(void)
|
||||
ap->ranges[0].base = 0;
|
||||
ap->ranges[0].size = ~0;
|
||||
|
||||
remove_conflicting_framebuffers(ap, "sun4i-drm-fb", false);
|
||||
drm_fb_helper_remove_conflicting_framebuffers(ap, "sun4i-drm-fb", false);
|
||||
kfree(ap);
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ static const struct file_operations tdfx_driver_fops = {
|
||||
};
|
||||
|
||||
static struct drm_driver driver = {
|
||||
.driver_features = DRIVER_LEGACY,
|
||||
.set_busid = drm_pci_set_busid,
|
||||
.fops = &tdfx_driver_fops,
|
||||
.name = DRIVER_NAME,
|
||||
|
@ -203,6 +203,7 @@ static int udl_fb_open(struct fb_info *info, int user)
|
||||
|
||||
ufbdev->fb_count++;
|
||||
|
||||
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
||||
if (fb_defio && (info->fbdefio == NULL)) {
|
||||
/* enable defio at last moment if not disabled by client */
|
||||
|
||||
@ -218,6 +219,7 @@ static int udl_fb_open(struct fb_info *info, int user)
|
||||
info->fbdefio = fbdefio;
|
||||
fb_deferred_io_init(info);
|
||||
}
|
||||
#endif
|
||||
|
||||
pr_notice("open /dev/fb%d user=%d fb_info=%p count=%d\n",
|
||||
info->node, user, info, ufbdev->fb_count);
|
||||
@ -235,12 +237,14 @@ static int udl_fb_release(struct fb_info *info, int user)
|
||||
|
||||
ufbdev->fb_count--;
|
||||
|
||||
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
||||
if ((ufbdev->fb_count == 0) && (info->fbdefio)) {
|
||||
fb_deferred_io_cleanup(info);
|
||||
kfree(info->fbdefio);
|
||||
info->fbdefio = NULL;
|
||||
info->fbops->fb_mmap = udl_fb_mmap;
|
||||
}
|
||||
#endif
|
||||
|
||||
pr_warn("released /dev/fb%d user=%d count=%d\n",
|
||||
info->node, user, ufbdev->fb_count);
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include "drm_fb_cma_helper.h"
|
||||
#include <drm/drm_fb_helper.h>
|
||||
|
||||
#include "uapi/drm/vc4_drm.h"
|
||||
#include "vc4_drv.h"
|
||||
@ -214,7 +215,7 @@ static void vc4_kick_out_firmware_fb(void)
|
||||
ap->ranges[0].base = 0;
|
||||
ap->ranges[0].size = ~0;
|
||||
|
||||
remove_conflicting_framebuffers(ap, "vc4drmfb", false);
|
||||
drm_fb_helper_remove_conflicting_framebuffers(ap, "vc4drmfb", false);
|
||||
kfree(ap);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ static const struct file_operations via_driver_fops = {
|
||||
|
||||
static struct drm_driver driver = {
|
||||
.driver_features =
|
||||
DRIVER_USE_AGP | DRIVER_HAVE_IRQ |
|
||||
DRIVER_USE_AGP | DRIVER_HAVE_IRQ | DRIVER_LEGACY |
|
||||
DRIVER_IRQ_SHARED,
|
||||
.load = via_driver_load,
|
||||
.unload = via_driver_unload,
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/pci.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
|
||||
#include "virtgpu_drv.h"
|
||||
|
||||
@ -42,7 +43,7 @@ static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev)
|
||||
primary = pci_dev->resource[PCI_ROM_RESOURCE].flags
|
||||
& IORESOURCE_ROM_SHADOW;
|
||||
|
||||
remove_conflicting_framebuffers(ap, "virtiodrmfb", primary);
|
||||
drm_fb_helper_remove_conflicting_framebuffers(ap, "virtiodrmfb", primary);
|
||||
|
||||
kfree(ap);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ config DRM_VMWGFX
|
||||
select FB_CFB_COPYAREA
|
||||
select FB_CFB_IMAGEBLIT
|
||||
select DRM_TTM
|
||||
select FB
|
||||
# Only needed for the transitional use of drm_crtc_init - can be removed
|
||||
# again once vmwgfx sets up the primary plane itself.
|
||||
select DRM_KMS_HELPER
|
||||
|
@ -135,10 +135,16 @@ static void sync_print_sync_file(struct seq_file *s,
|
||||
int i;
|
||||
|
||||
seq_printf(s, "[%p] %s: %s\n", sync_file, sync_file->name,
|
||||
sync_status_str(atomic_read(&sync_file->status)));
|
||||
sync_status_str(!fence_is_signaled(sync_file->fence)));
|
||||
|
||||
for (i = 0; i < sync_file->num_fences; ++i)
|
||||
sync_print_fence(s, sync_file->cbs[i].fence, true);
|
||||
if (fence_is_array(sync_file->fence)) {
|
||||
struct fence_array *array = to_fence_array(sync_file->fence);
|
||||
|
||||
for (i = 0; i < array->num_fences; ++i)
|
||||
sync_print_fence(s, array->fences[i], true);
|
||||
} else {
|
||||
sync_print_fence(s, sync_file->fence, true);
|
||||
}
|
||||
}
|
||||
|
||||
static int sync_debugfs_show(struct seq_file *s, void *unused)
|
||||
|
@ -146,6 +146,7 @@ void drm_err(const char *format, ...);
|
||||
|
||||
/* driver capabilities and requirements mask */
|
||||
#define DRIVER_USE_AGP 0x1
|
||||
#define DRIVER_LEGACY 0x2
|
||||
#define DRIVER_PCI_DMA 0x8
|
||||
#define DRIVER_SG 0x10
|
||||
#define DRIVER_HAVE_DMA 0x20
|
||||
@ -231,6 +232,36 @@ void drm_err(const char *format, ...);
|
||||
drm_ut_debug_printk(__func__, fmt, ##args); \
|
||||
} while (0)
|
||||
|
||||
#define _DRM_DEFINE_DEBUG_RATELIMITED(level, fmt, args...) \
|
||||
do { \
|
||||
if (unlikely(drm_debug & DRM_UT_ ## level)) { \
|
||||
static DEFINE_RATELIMIT_STATE( \
|
||||
_rs, \
|
||||
DEFAULT_RATELIMIT_INTERVAL, \
|
||||
DEFAULT_RATELIMIT_BURST); \
|
||||
\
|
||||
if (__ratelimit(&_rs)) { \
|
||||
drm_ut_debug_printk(__func__, fmt, \
|
||||
##args); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
|
||||
*
|
||||
* \param fmt printf() like format string.
|
||||
* \param arg arguments
|
||||
*/
|
||||
#define DRM_DEBUG_RATELIMITED(fmt, args...) \
|
||||
_DRM_DEFINE_DEBUG_RATELIMITED(CORE, fmt, ##args)
|
||||
#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...) \
|
||||
_DRM_DEFINE_DEBUG_RATELIMITED(DRIVER, fmt, ##args)
|
||||
#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...) \
|
||||
_DRM_DEFINE_DEBUG_RATELIMITED(KMS, fmt, ##args)
|
||||
#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \
|
||||
_DRM_DEFINE_DEBUG_RATELIMITED(PRIME, fmt, ##args)
|
||||
|
||||
/*@}*/
|
||||
|
||||
/***********************************************************************/
|
||||
@ -642,7 +673,7 @@ struct drm_driver {
|
||||
};
|
||||
|
||||
enum drm_minor_type {
|
||||
DRM_MINOR_LEGACY,
|
||||
DRM_MINOR_PRIMARY,
|
||||
DRM_MINOR_CONTROL,
|
||||
DRM_MINOR_RENDER,
|
||||
DRM_MINOR_CNT,
|
||||
@ -856,7 +887,7 @@ static inline bool drm_is_control_client(const struct drm_file *file_priv)
|
||||
|
||||
static inline bool drm_is_primary_client(const struct drm_file *file_priv)
|
||||
{
|
||||
return file_priv->minor->type == DRM_MINOR_LEGACY;
|
||||
return file_priv->minor->type == DRM_MINOR_PRIMARY;
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <uapi/drm/drm_mode.h>
|
||||
#include <uapi/drm/drm_fourcc.h>
|
||||
#include <drm/drm_modeset_lock.h>
|
||||
#include <drm/drm_rect.h>
|
||||
|
||||
struct drm_device;
|
||||
struct drm_mode_set;
|
||||
@ -83,14 +84,15 @@ static inline uint64_t I642U64(int64_t val)
|
||||
* specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and
|
||||
* DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
|
||||
*/
|
||||
#define DRM_ROTATE_MASK 0x0f
|
||||
#define DRM_ROTATE_0 0
|
||||
#define DRM_ROTATE_90 1
|
||||
#define DRM_ROTATE_180 2
|
||||
#define DRM_ROTATE_270 3
|
||||
#define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)
|
||||
#define DRM_REFLECT_X 4
|
||||
#define DRM_REFLECT_Y 5
|
||||
#define DRM_ROTATE_0 BIT(0)
|
||||
#define DRM_ROTATE_90 BIT(1)
|
||||
#define DRM_ROTATE_180 BIT(2)
|
||||
#define DRM_ROTATE_270 BIT(3)
|
||||
#define DRM_ROTATE_MASK (DRM_ROTATE_0 | DRM_ROTATE_90 | \
|
||||
DRM_ROTATE_180 | DRM_ROTATE_270)
|
||||
#define DRM_REFLECT_X BIT(4)
|
||||
#define DRM_REFLECT_Y BIT(5)
|
||||
#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y)
|
||||
|
||||
enum drm_connector_force {
|
||||
DRM_FORCE_UNSPECIFIED,
|
||||
@ -1414,6 +1416,9 @@ struct drm_connector {
|
||||
* @zpos: priority of the given plane on crtc (optional)
|
||||
* @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
|
||||
* where N is the number of active planes for given crtc
|
||||
* @src: clipped source coordinates of the plane (in 16.16)
|
||||
* @dst: clipped destination coordinates of the plane
|
||||
* @visible: visibility of the plane
|
||||
* @state: backpointer to global drm_atomic_state
|
||||
*/
|
||||
struct drm_plane_state {
|
||||
@ -1438,6 +1443,15 @@ struct drm_plane_state {
|
||||
unsigned int zpos;
|
||||
unsigned int normalized_zpos;
|
||||
|
||||
/* Clipped coordinates */
|
||||
struct drm_rect src, dst;
|
||||
|
||||
/*
|
||||
* Is the plane actually visible? Can be false even
|
||||
* if fb!=NULL and crtc!=NULL, due to clipping.
|
||||
*/
|
||||
bool visible;
|
||||
|
||||
struct drm_atomic_state *state;
|
||||
};
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
struct drm_fb_helper;
|
||||
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <linux/kgdb.h>
|
||||
|
||||
enum mode_set_atomic {
|
||||
@ -282,6 +283,12 @@ drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn,
|
||||
int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector);
|
||||
int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
|
||||
struct drm_connector *connector);
|
||||
static inline int
|
||||
drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a,
|
||||
const char *name, bool primary)
|
||||
{
|
||||
return remove_conflicting_framebuffers(a, name, primary);
|
||||
}
|
||||
#else
|
||||
static inline int drm_fb_helper_modinit(void)
|
||||
{
|
||||
@ -475,5 +482,12 @@ drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a,
|
||||
const char *name, bool primary)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -37,6 +37,7 @@
|
||||
* Generic range manager structs
|
||||
*/
|
||||
#include <linux/bug.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/spinlock.h>
|
||||
@ -61,6 +62,7 @@ enum drm_mm_allocator_flags {
|
||||
struct drm_mm_node {
|
||||
struct list_head node_list;
|
||||
struct list_head hole_stack;
|
||||
struct rb_node rb;
|
||||
unsigned hole_follows : 1;
|
||||
unsigned scanned_block : 1;
|
||||
unsigned scanned_prev_free : 1;
|
||||
@ -70,6 +72,7 @@ struct drm_mm_node {
|
||||
unsigned long color;
|
||||
u64 start;
|
||||
u64 size;
|
||||
u64 __subtree_last;
|
||||
struct drm_mm *mm;
|
||||
};
|
||||
|
||||
@ -79,6 +82,9 @@ struct drm_mm {
|
||||
/* head_node.node_list is the list of all memory nodes, ordered
|
||||
* according to the (increasing) start address of the memory node. */
|
||||
struct drm_mm_node head_node;
|
||||
/* Keep an interval_tree for fast lookup of drm_mm_nodes by address. */
|
||||
struct rb_root interval_tree;
|
||||
|
||||
unsigned int scan_check_range : 1;
|
||||
unsigned scan_alignment;
|
||||
unsigned long scan_color;
|
||||
@ -295,6 +301,12 @@ void drm_mm_init(struct drm_mm *mm,
|
||||
void drm_mm_takedown(struct drm_mm *mm);
|
||||
bool drm_mm_clean(struct drm_mm *mm);
|
||||
|
||||
struct drm_mm_node *
|
||||
drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last);
|
||||
|
||||
struct drm_mm_node *
|
||||
drm_mm_interval_next(struct drm_mm_node *node, u64 start, u64 last);
|
||||
|
||||
void drm_mm_init_scan(struct drm_mm *mm,
|
||||
u64 size,
|
||||
unsigned alignment,
|
||||
|
@ -40,6 +40,11 @@
|
||||
int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
|
||||
const struct drm_crtc_funcs *funcs);
|
||||
|
||||
int drm_plane_helper_check_state(struct drm_plane_state *state,
|
||||
const struct drm_rect *clip,
|
||||
int min_scale, int max_scale,
|
||||
bool can_position,
|
||||
bool can_update_disabled);
|
||||
int drm_plane_helper_check_update(struct drm_plane *plane,
|
||||
struct drm_crtc *crtc,
|
||||
struct drm_framebuffer *fb,
|
||||
|
@ -40,13 +40,11 @@ struct drm_vma_offset_file {
|
||||
struct drm_vma_offset_node {
|
||||
rwlock_t vm_lock;
|
||||
struct drm_mm_node vm_node;
|
||||
struct rb_node vm_rb;
|
||||
struct rb_root vm_files;
|
||||
};
|
||||
|
||||
struct drm_vma_offset_manager {
|
||||
rwlock_t vm_lock;
|
||||
struct rb_root vm_addr_space_rb;
|
||||
struct drm_mm vm_addr_space_mm;
|
||||
};
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user