disp: msm: sde: update framedata event handling

This change updates framedata event and ubwc stats API to
align with userspace handling and expectations.

This change adds the empty irq event handler required to register
the frame data event.

This change also adds handling to the crtc event notify to provide
the payload pointer directly, required for the buffer object,
ensuring pointers are not mismatched while sending drm events.

This change also updates the ubwc roi plane property to process the
uapi defined roi.

Change-Id: I209f2b7418a0ec33aa0488119eb3fdb8ae94e8ba
Signed-off-by: Nilaan Gunabalachandran <quic_ngunabal@quicinc.com>
This commit is contained in:
Nilaan Gunabalachandran
2021-08-03 15:50:50 -04:00
parent 46849f2f19
commit 137938ab7e
2 changed files with 48 additions and 24 deletions

View File

@@ -4116,27 +4116,34 @@ static void _sde_plane_set_excl_rect_v1(struct sde_plane *psde,
}
static void _sde_plane_set_ubwc_stats_roi(struct sde_plane *psde,
struct sde_plane_state *pstate, uint64_t roi)
struct sde_plane_state *pstate, void __user *usr_ptr)
{
uint16_t y0, y1;
struct sde_drm_ubwc_stats_roi roi = {0};
if (!psde || !pstate) {
SDE_ERROR("invalid argument(s)\n");
return;
}
y0 = roi & 0xFFFF;
y1 = (roi >> 0x10) & 0xFFFF;
if (y0 > psde->pipe_cfg.src_rect.h || y1 > psde->pipe_cfg.src_rect.h) {
SDE_ERROR_PLANE(psde, "invalid ubwc roi y0 0x%x, y1 0x%x, src height 0x%x",
y0, y1, psde->pipe_cfg.src_rect.h);
y0 = 0;
y1 = 0;
if (!usr_ptr) {
SDE_DEBUG_PLANE(psde, "ubwc roi disabled");
goto end;
}
pstate->ubwc_stats_roi.y_coord0 = y0;
pstate->ubwc_stats_roi.y_coord1 = y1;
if (copy_from_user(&roi, usr_ptr, sizeof(roi))) {
SDE_ERROR_PLANE(psde, "failed to copy ubwc stats roi");
return;
}
if (roi.y_coord0 > psde->pipe_cfg.src_rect.h || roi.y_coord1 > psde->pipe_cfg.src_rect.h) {
SDE_ERROR_PLANE(psde, "invalid ubwc roi y0 0x%x, y1 0x%x, src height 0x%x",
roi.y_coord0, roi.y_coord1, psde->pipe_cfg.src_rect.h);
memset(&roi, 0, sizeof(roi));
}
end:
SDE_EVT32(psde, roi.y_coord0, roi.y_coord1);
memcpy(&pstate->ubwc_stats_roi, &roi, sizeof(struct sde_drm_ubwc_stats_roi));
}
static int sde_plane_atomic_set_property(struct drm_plane *plane,
@@ -4181,7 +4188,8 @@ static int sde_plane_atomic_set_property(struct drm_plane *plane,
(void *)(uintptr_t)val);
break;
case PLANE_PROP_UBWC_STATS_ROI:
_sde_plane_set_ubwc_stats_roi(psde, pstate, val);
_sde_plane_set_ubwc_stats_roi(psde, pstate,
(void __user *)(uintptr_t)val);
break;
default:
/* nothing to do */