Skip to content

vc4_fkms: Apply firmware overscan offset to hardware cursor #1960

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

Merged
merged 1 commit into from
Apr 28, 2017
Merged
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
17 changes: 17 additions & 0 deletions drivers/gpu/drm/vc4/vc4_firmware_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct vc4_crtc {
void __iomem *regs;

struct drm_pending_vblank_event *event;
u32 overscan[4];
};

static inline struct vc4_crtc *to_vc4_crtc(struct drm_crtc *crtc)
Expand Down Expand Up @@ -181,6 +182,7 @@ static void vc4_cursor_plane_atomic_update(struct drm_plane *plane,
struct drm_plane_state *old_state)
{
struct vc4_dev *vc4 = to_vc4_dev(plane->dev);
struct vc4_crtc *vc4_crtc = to_vc4_crtc(plane->crtc);
struct drm_plane_state *state = plane->state;
struct drm_framebuffer *fb = state->fb;
struct drm_gem_cma_object *bo = drm_fb_cma_get_gem_obj(fb, 0);
Expand All @@ -202,6 +204,12 @@ static void vc4_cursor_plane_atomic_update(struct drm_plane *plane,
bo->paddr + fb->offsets[0],
fb->pitches[0]);

/* add on the top/left offsets when overscan is active */
if (vc4_crtc) {
packet_state[1] += vc4_crtc->overscan[0];
packet_state[2] += vc4_crtc->overscan[1];
}

ret = rpi_firmware_property(vc4->firmware,
RPI_FIRMWARE_SET_CURSOR_STATE,
&packet_state,
Expand Down Expand Up @@ -645,6 +653,15 @@ static int vc4_fkms_bind(struct device *dev, struct device *master, void *data)
if (ret)
goto err_destroy_connector;

ret = rpi_firmware_property(vc4->firmware,
RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN,
&vc4_crtc->overscan,
sizeof(vc4_crtc->overscan));
if (ret) {
DRM_ERROR("Failed to get overscan state: 0x%08x\n", vc4_crtc->overscan[0]);
memset(&vc4_crtc->overscan, 0, sizeof(vc4_crtc->overscan));
}

platform_set_drvdata(pdev, vc4_crtc);

return 0;
Expand Down