-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split out the hardware overlay specifics from omap_plane. To start, the hw overlays are statically assigned to planes. The goal is to eventually assign hw overlays dynamically to planes during plane->atomic_check() based on requested caps (scaling, YUV, etc). And then perform hw overlay re-assignment if required. Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211117141928.771082-5-narmstrong@baylibre.com
- Loading branch information
Benoit Parrot
authored and
Tomi Valkeinen
committed
Dec 8, 2021
1 parent
0b0f728
commit c8fa1e7
Showing
6 changed files
with
148 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ | ||
* Author: Benoit Parrot <bparrot@ti.com> | ||
*/ | ||
|
||
#include <drm/drm_atomic.h> | ||
#include <drm/drm_atomic_helper.h> | ||
#include <drm/drm_plane_helper.h> | ||
|
||
#include "omap_dmm_tiler.h" | ||
#include "omap_drv.h" | ||
|
||
/* | ||
* overlay funcs | ||
*/ | ||
static const char * const overlay_id_to_name[] = { | ||
[OMAP_DSS_GFX] = "gfx", | ||
[OMAP_DSS_VIDEO1] = "vid1", | ||
[OMAP_DSS_VIDEO2] = "vid2", | ||
[OMAP_DSS_VIDEO3] = "vid3", | ||
}; | ||
|
||
static void omap_overlay_destroy(struct omap_hw_overlay *overlay) | ||
{ | ||
kfree(overlay); | ||
} | ||
|
||
static struct omap_hw_overlay *omap_overlay_init(enum omap_plane_id overlay_id, | ||
enum omap_overlay_caps caps) | ||
{ | ||
struct omap_hw_overlay *overlay; | ||
|
||
overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); | ||
if (!overlay) | ||
return ERR_PTR(-ENOMEM); | ||
|
||
overlay->name = overlay_id_to_name[overlay_id]; | ||
overlay->id = overlay_id; | ||
overlay->caps = caps; | ||
|
||
return overlay; | ||
} | ||
|
||
int omap_hwoverlays_init(struct omap_drm_private *priv) | ||
{ | ||
static const enum omap_plane_id hw_plane_ids[] = { | ||
OMAP_DSS_GFX, OMAP_DSS_VIDEO1, | ||
OMAP_DSS_VIDEO2, OMAP_DSS_VIDEO3, | ||
}; | ||
u32 num_overlays = dispc_get_num_ovls(priv->dispc); | ||
enum omap_overlay_caps caps; | ||
int i, ret; | ||
|
||
for (i = 0; i < num_overlays; i++) { | ||
struct omap_hw_overlay *overlay; | ||
|
||
caps = dispc_ovl_get_caps(priv->dispc, hw_plane_ids[i]); | ||
overlay = omap_overlay_init(hw_plane_ids[i], caps); | ||
if (IS_ERR(overlay)) { | ||
ret = PTR_ERR(overlay); | ||
dev_err(priv->dev, "failed to construct overlay for %s (%d)\n", | ||
overlay_id_to_name[i], ret); | ||
omap_hwoverlays_destroy(priv); | ||
return ret; | ||
} | ||
overlay->idx = priv->num_ovls; | ||
priv->overlays[priv->num_ovls++] = overlay; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
void omap_hwoverlays_destroy(struct omap_drm_private *priv) | ||
{ | ||
int i; | ||
|
||
for (i = 0; i < priv->num_ovls; i++) { | ||
omap_overlay_destroy(priv->overlays[i]); | ||
priv->overlays[i] = NULL; | ||
} | ||
|
||
priv->num_ovls = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* | ||
* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ | ||
* Author: Benoit Parrot <bparrot@ti.com> | ||
*/ | ||
|
||
#ifndef __OMAPDRM_OVERLAY_H__ | ||
#define __OMAPDRM_OVERLAY_H__ | ||
|
||
#include <linux/types.h> | ||
|
||
enum drm_plane_type; | ||
|
||
struct drm_device; | ||
struct drm_mode_object; | ||
struct drm_plane; | ||
|
||
/* Used to associate a HW overlay/plane to a plane */ | ||
struct omap_hw_overlay { | ||
unsigned int idx; | ||
|
||
const char *name; | ||
enum omap_plane_id id; | ||
|
||
enum omap_overlay_caps caps; | ||
}; | ||
|
||
int omap_hwoverlays_init(struct omap_drm_private *priv); | ||
void omap_hwoverlays_destroy(struct omap_drm_private *priv); | ||
#endif /* __OMAPDRM_OVERLAY_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters