Skip to content

Commit

Permalink
gpu: drm: apple: Support opaque pixel formats
Browse files Browse the repository at this point in the history
Opaque pixel formats such as XRGB8888 or YUV formats require flag in
struct dcp_surface to be set to be displayed properly.
Fixes display issues with fbcon after the handover from simpledrm on
j314c with 16:10 modes (notch hiding).

Signed-off-by: Janne Grunau <j@jannau.net>
  • Loading branch information
jannau authored and marcan committed Nov 1, 2022
1 parent 0ddc192 commit 09cee10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/apple/iomfb.c
Expand Up @@ -1438,6 +1438,7 @@ void dcp_flush(struct drm_crtc *crtc, struct drm_atomic_state *state)
for_each_oldnew_plane_in_state(state, plane, old_state, new_state, plane_idx) {
struct drm_framebuffer *fb = new_state->fb;
struct drm_rect src_rect;
bool opaque = false;

/* skip planes not for this crtc */
if (old_state->crtc != crtc && new_state->crtc != crtc)
Expand Down Expand Up @@ -1477,6 +1478,9 @@ void dcp_flush(struct drm_crtc *crtc, struct drm_atomic_state *state)
req->surf_null[l] = false;
has_surface = 1;

if (fb->format->has_alpha ||
new_state->plane->type == DRM_PLANE_TYPE_PRIMARY)
opaque = true;
drm_rect_fp_to_int(&src_rect, &new_state->src);

req->swap.src_rect[l] = drm_to_dcp_rect(&src_rect);
Expand All @@ -1485,6 +1489,7 @@ void dcp_flush(struct drm_crtc *crtc, struct drm_atomic_state *state)
req->surf_iova[l] = drm_fb_dma_get_gem_addr(fb, new_state, 0);

req->surf[l] = (struct dcp_surface){
.opaque = opaque,
.format = drm_format_to_dcp(fb->format->format),
.xfer_func = 13,
.colorspace = 1,
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/apple/iomfb.h
Expand Up @@ -142,7 +142,7 @@ struct dcp_component_types {
struct dcp_surface {
u8 is_tiled;
u8 unk_1;
u8 unk_2;
u8 opaque; /** ignore alpha, also required YUV overlays */
u32 plane_cnt;
u32 plane_cnt2;
u32 format; /* DCP fourcc */
Expand Down

0 comments on commit 09cee10

Please sign in to comment.