Skip to content
Merged
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
29 changes: 28 additions & 1 deletion drivers/gpu/drm/apple/apple_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,13 +999,40 @@ static int apple_atomic_check(struct drm_device *dev,
return 0;
}

/*
* A firmware interface that caches scanout (dcp_caches_scanout(): the M4 idle
* cache) keeps presenting a copy of a frame that has stopped flipping, so a
* client that draws into the scanout buffer without a flip (fbcon, a DIRTYFB
* caller) is not seen. Give such devices framebuffers with the dirty hook:
* the damage becomes a commit, and the fbdev emulation takes its shadowed,
* deferred-I/O path. Interfaces that scan the buffer out already show that
* drawing; they keep the plain framebuffers, with no shadow copy and no
* commit per console update.
*/
static struct drm_framebuffer *apple_fb_create(struct drm_device *dev,
struct drm_file *file,
const struct drm_format_info *info,
const struct drm_mode_fb_cmd2 *mode_cmd)
{
struct drm_crtc *crtc;

drm_for_each_crtc(crtc, dev) {
/* The T8132 external CRTCs are not apple_crtcs. */
if (!t8132_ext_crtc(crtc) &&
dcp_caches_scanout(to_apple_crtc(crtc)->dcp))
return drm_gem_fb_create_with_dirty(dev, file, info, mode_cmd);
}

return drm_gem_fb_create(dev, file, info, mode_cmd);
}

static const struct drm_mode_config_funcs apple_mode_config_funcs = {
.atomic_state_alloc = apple_atomic_state_alloc,
.atomic_state_clear = apple_atomic_state_clear,
.atomic_state_free = apple_atomic_state_free,
.atomic_check = apple_atomic_check,
.atomic_commit = apple_atomic_commit,
.fb_create = drm_gem_fb_create,
.fb_create = apple_fb_create,
};

static void apple_atomic_commit_tail(struct drm_atomic_commit *state)
Expand Down
14 changes: 14 additions & 0 deletions drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4546,6 +4546,20 @@ bool dcp_fw_compat_is_desktop(struct platform_device *pdev)
return dcp->fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP;
}

/*
* Whether @pdev's firmware interface may keep presenting a cached copy of the
* last swapped frame instead of scanning out the framebuffer (the M4 IOMFB
* backend's idle cache, see iomfb_m4_idle_cache_work()). Drawing into the
* scanout buffer without a swap is then not seen until the next swap. The
* other interfaces scan the buffer out, so such drawing shows as it is made.
*/
bool dcp_caches_scanout(struct platform_device *pdev)
{
struct apple_dcp *dcp = platform_get_drvdata(pdev);

return iomfb_is_m4(dcp);
}

/*
* Whether @pdev's internal panel can show PQ content as EDR: the panel has
* EDR headroom (the ADT's EDRPotentialHeadroom, see dcp_panel_read_adt()),
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/apple/dcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ int dcp_get_connector_type(struct platform_device *pdev);
bool dcp_fw_compat_is_12_x(struct platform_device *pdev);
bool dcp_fw_compat_is_14_7(struct platform_device *pdev);
bool dcp_fw_compat_is_desktop(struct platform_device *pdev);
bool dcp_caches_scanout(struct platform_device *pdev);
bool dcp_panel_edr(struct platform_device *pdev);
bool dcp_ext_color_props_supported(struct platform_device *pdev);
unsigned int dcp_gamma_lut_size(struct platform_device *pdev);
Expand Down
Loading