Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRM patches for @cillian64 #6319

Draft
wants to merge 4 commits into
base: rpi-6.6.y
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ static void drm_atomic_crtc_print_state(struct drm_printer *p,
drm_printf(p, "\tactive_changed=%d\n", state->active_changed);
drm_printf(p, "\tconnectors_changed=%d\n", state->connectors_changed);
drm_printf(p, "\tcolor_mgmt_changed=%d\n", state->color_mgmt_changed);
drm_printf(p, "\tplane_mask=%x\n", state->plane_mask);
drm_printf(p, "\tplane_mask=%llx\n", state->plane_mask);
drm_printf(p, "\tconnector_mask=%x\n", state->connector_mask);
drm_printf(p, "\tencoder_mask=%x\n", state->encoder_mask);
drm_printf(p, "\tmode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(&state->mode));
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/drm_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ static int __drm_connector_init(struct drm_device *dev,

drm_object_attach_property(&connector->base,
config->non_desktop_property,
0);
(connector_type != DRM_MODE_CONNECTOR_VIRTUAL &&
connector_type != DRM_MODE_CONNECTOR_WRITEBACK) ? 0 : 1);
drm_object_attach_property(&connector->base,
config->tile_property,
0);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
struct drm_connector *conn __maybe_unused;
struct drm_connector_state *conn_state;
int i, ret;
unsigned plane_mask;
u64 plane_mask;
bool disable_crtcs = false;

retry_disable:
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_mode_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ void drm_mode_config_validate(struct drm_device *dev)
struct drm_encoder *encoder;
struct drm_crtc *crtc;
struct drm_plane *plane;
u32 primary_with_crtc = 0, cursor_with_crtc = 0;
u64 primary_with_crtc = 0, cursor_with_crtc = 0;
unsigned int num_primary = 0;

if (!drm_core_check_feature(dev, DRIVER_MODESET))
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_plane.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
int ret;

/* plane index is used with 32bit bitmasks */
if (WARN_ON(config->num_total_plane >= 32))
if (WARN_ON(config->num_total_plane >= 64))
return -EINVAL;

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ static int ipu_crtc_atomic_check(struct drm_crtc *crtc,
{
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
crtc);
u32 primary_plane_mask = drm_plane_mask(crtc->primary);
u64 primary_plane_mask = drm_plane_mask(crtc->primary);

if (crtc_state->active && (primary_plane_mask & crtc_state->plane_mask) == 0)
return -EINVAL;
Expand Down
32 changes: 31 additions & 1 deletion drivers/gpu/drm/vc4/vc4_plane.c
Original file line number Diff line number Diff line change
Expand Up @@ -2451,12 +2451,27 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev,
}

#define VC4_NUM_OVERLAY_PLANES 16
#define VC4_NUM_TXP_OVERLAY_PLANES 32

int vc4_plane_create_additional_planes(struct drm_device *drm)
{
struct drm_plane *cursor_plane;
struct drm_crtc *crtc;
unsigned int i;
struct drm_crtc *txp_crtc;
uint32_t non_txp_crtc_mask;

drm_for_each_crtc(crtc, drm) {
struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);

if (vc4_crtc->feeds_txp) {
txp_crtc = crtc;
break;
}
}

non_txp_crtc_mask = GENMASK(drm->mode_config.num_crtc - 1, 0) -
drm_crtc_mask(txp_crtc);

/* Set up some arbitrary number of planes. We're not limited
* by a set number of physical registers, just the space in
Expand All @@ -2470,7 +2485,22 @@ int vc4_plane_create_additional_planes(struct drm_device *drm)
for (i = 0; i < VC4_NUM_OVERLAY_PLANES; i++) {
struct drm_plane *plane =
vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY,
GENMASK(drm->mode_config.num_crtc - 1, 0));
non_txp_crtc_mask);

if (IS_ERR(plane))
continue;

/* Create zpos property. Max of all the overlays + 1 primary +
* 1 cursor plane on a crtc.
*/
drm_plane_create_zpos_property(plane, i + 1, 1,
VC4_NUM_OVERLAY_PLANES + 1);
}

for (i = 0; i < VC4_NUM_TXP_OVERLAY_PLANES; i++) {
struct drm_plane *plane =
vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY,
drm_crtc_mask(txp_crtc));

if (IS_ERR(plane))
continue;
Expand Down
2 changes: 1 addition & 1 deletion include/drm/drm_crtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ struct drm_crtc_state {
* @plane_mask: Bitmask of drm_plane_mask(plane) of planes attached to
* this CRTC.
*/
u32 plane_mask;
u64 plane_mask;

/**
* @connector_mask: Bitmask of drm_connector_mask(connector) of
Expand Down
4 changes: 2 additions & 2 deletions include/drm/drm_plane.h
Original file line number Diff line number Diff line change
Expand Up @@ -915,9 +915,9 @@ static inline unsigned int drm_plane_index(const struct drm_plane *plane)
* drm_plane_mask - find the mask of a registered plane
* @plane: plane to find mask for
*/
static inline u32 drm_plane_mask(const struct drm_plane *plane)
static inline u64 drm_plane_mask(const struct drm_plane *plane)
{
return 1 << drm_plane_index(plane);
return 1ULL << drm_plane_index(plane);
}

struct drm_plane * drm_plane_from_index(struct drm_device *dev, int idx);
Expand Down