Commit 9f446d83 authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Thierry Reding

drm/tegra: dc: Dedicate overlay plane to cursor on older Tegra's

Older Tegra's do not support RGBA format for the cursor, but instead
overlay plane could be used for it. Since there is no much use for the
overlays on a regular desktop and HW-accelerated cursor is much better
than a SW cursor, let's dedicate one overlay plane to the mouse cursor.
Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 5e2e86f1
...@@ -864,11 +864,13 @@ static const u32 tegra124_overlay_formats[] = { ...@@ -864,11 +864,13 @@ static const u32 tegra124_overlay_formats[] = {
static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm,
struct tegra_dc *dc, struct tegra_dc *dc,
unsigned int index) unsigned int index,
bool cursor)
{ {
unsigned long possible_crtcs = tegra_plane_get_possible_crtcs(drm); unsigned long possible_crtcs = tegra_plane_get_possible_crtcs(drm);
struct tegra_plane *plane; struct tegra_plane *plane;
unsigned int num_formats; unsigned int num_formats;
enum drm_plane_type type;
const u32 *formats; const u32 *formats;
int err; int err;
...@@ -883,10 +885,14 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, ...@@ -883,10 +885,14 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm,
num_formats = dc->soc->num_overlay_formats; num_formats = dc->soc->num_overlay_formats;
formats = dc->soc->overlay_formats; formats = dc->soc->overlay_formats;
if (!cursor)
type = DRM_PLANE_TYPE_OVERLAY;
else
type = DRM_PLANE_TYPE_CURSOR;
err = drm_universal_plane_init(drm, &plane->base, possible_crtcs, err = drm_universal_plane_init(drm, &plane->base, possible_crtcs,
&tegra_plane_funcs, formats, &tegra_plane_funcs, formats,
num_formats, NULL, num_formats, NULL, type, NULL);
DRM_PLANE_TYPE_OVERLAY, NULL);
if (err < 0) { if (err < 0) {
kfree(plane); kfree(plane);
return ERR_PTR(err); return ERR_PTR(err);
...@@ -938,6 +944,7 @@ static struct drm_plane *tegra_dc_add_planes(struct drm_device *drm, ...@@ -938,6 +944,7 @@ static struct drm_plane *tegra_dc_add_planes(struct drm_device *drm,
struct tegra_dc *dc) struct tegra_dc *dc)
{ {
struct drm_plane *planes[2], *primary; struct drm_plane *planes[2], *primary;
unsigned int planes_num;
unsigned int i; unsigned int i;
int err; int err;
...@@ -945,8 +952,14 @@ static struct drm_plane *tegra_dc_add_planes(struct drm_device *drm, ...@@ -945,8 +952,14 @@ static struct drm_plane *tegra_dc_add_planes(struct drm_device *drm,
if (IS_ERR(primary)) if (IS_ERR(primary))
return primary; return primary;
for (i = 0; i < 2; i++) { if (dc->soc->supports_cursor)
planes[i] = tegra_dc_overlay_plane_create(drm, dc, 1 + i); planes_num = 2;
else
planes_num = 1;
for (i = 0; i < planes_num; i++) {
planes[i] = tegra_dc_overlay_plane_create(drm, dc, 1 + i,
false);
if (IS_ERR(planes[i])) { if (IS_ERR(planes[i])) {
err = PTR_ERR(planes[i]); err = PTR_ERR(planes[i]);
...@@ -1864,6 +1877,13 @@ static int tegra_dc_init(struct host1x_client *client) ...@@ -1864,6 +1877,13 @@ static int tegra_dc_init(struct host1x_client *client)
err = PTR_ERR(cursor); err = PTR_ERR(cursor);
goto cleanup; goto cleanup;
} }
} else {
/* dedicate one overlay to mouse cursor */
cursor = tegra_dc_overlay_plane_create(drm, dc, 2, true);
if (IS_ERR(cursor)) {
err = PTR_ERR(cursor);
goto cleanup;
}
} }
err = drm_crtc_init_with_planes(drm, &dc->base, primary, cursor, err = drm_crtc_init_with_planes(drm, &dc->base, primary, cursor,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment