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: 27 additions & 2 deletions drivers/gpu/drm/drm_mipi_dbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,41 @@ static void mipi_dbi_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
struct drm_format_conv_state *fmtcnv_state)
{
struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(fb->dev);
unsigned int height = rect->y2 - rect->y1;
unsigned int width = rect->x2 - rect->x1;
const struct drm_format_info *dst_format;
struct mipi_dbi *dbi = &dbidev->dbi;
bool swap = dbi->swap_bytes;
unsigned int height, width;
int ret = 0;
size_t len;
bool full;
void *tr;

/*
* @rect is in framebuffer coordinates, clipped to the plane's src
* rectangle by the damage iterator against that rectangle's exact
* 16.16 fixed-point bounds. @src_x/@src_y are that same origin
* truncated to whole pixels. When the origin has a fractional part,
* that truncation can leave @rect's far edge up to a pixel past
* where a whole-pixel @src_x/@src_y would place the panel's own
* width/height -- and tx_buf is sized for exactly the panel, with no
* slack for that overshoot. Clamp before using @rect for anything.
*
* A damage clip can lie entirely in that one-pixel sliver past the
* panel edge -- the iterator above clips only against the exact
* fixed-point bound, not the whole-pixel one used here -- in which
* case the clamp collapses @rect to zero width or height. Nothing in
* it was ever visible on the panel, so skip the flush rather than
* program an inverted (start past end) address window.
*/
rect->x2 = min_t(int, rect->x2, src_x + dbidev->mode.hdisplay);
rect->y2 = min_t(int, rect->y2, src_y + dbidev->mode.vdisplay);

if (rect->x2 <= rect->x1 || rect->y2 <= rect->y1)
return;

height = rect->y2 - rect->y1;
width = rect->x2 - rect->x1;

full = width == fb->width && height == fb->height;

DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
Expand Down
8 changes: 6 additions & 2 deletions drivers/gpu/drm/sitronix/st7735r.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,13 @@ static int st7735r_probe(struct spi_device *spi)
return ret;

drm->mode_config.min_width = dbidev->mode.hdisplay;
drm->mode_config.max_width = dbidev->mode.hdisplay;
/*
* Allow a framebuffer larger than the panel so a sub-region can be
* displayed via the plane source rectangle (crop / pan, no scaling).
*/
drm->mode_config.max_width = DRM_SHADOW_PLANE_MAX_WIDTH;
drm->mode_config.min_height = dbidev->mode.vdisplay;
drm->mode_config.max_height = dbidev->mode.vdisplay;
drm->mode_config.max_height = DRM_SHADOW_PLANE_MAX_HEIGHT;
drm->mode_config.funcs = &st7735r_mode_config_funcs;
drm->mode_config.preferred_depth = 16;
drm->mode_config.helper_private = &st7735r_mode_config_helper_funcs;
Expand Down
Loading