drm/tinydrm: Use struct drm_rect
This prepares for the switch to drm_atomic_helper_dirtyfb() in the next patch. The damage helper returns a drm_rect so switch to that everywhere including using a pointer in the dirty functions. This is a non-functional change except for the debug print which looks a bit different. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20190115043643.2364-4-noralf@tronnes.org
This commit is contained in:
parent
255f6fe736
commit
b051b3459b
|
@ -18,6 +18,7 @@
|
||||||
#include <drm/drm_drv.h>
|
#include <drm/drm_drv.h>
|
||||||
#include <drm/drm_fourcc.h>
|
#include <drm/drm_fourcc.h>
|
||||||
#include <drm/drm_print.h>
|
#include <drm/drm_print.h>
|
||||||
|
#include <drm/drm_rect.h>
|
||||||
#include <drm/tinydrm/tinydrm.h>
|
#include <drm/tinydrm/tinydrm.h>
|
||||||
#include <drm/tinydrm/tinydrm-helpers.h>
|
#include <drm/tinydrm/tinydrm-helpers.h>
|
||||||
#include <uapi/drm/drm.h>
|
#include <uapi/drm/drm.h>
|
||||||
|
@ -41,7 +42,7 @@ MODULE_PARM_DESC(spi_max, "Set a lower SPI max transfer size");
|
||||||
* Returns:
|
* Returns:
|
||||||
* true if it's a full clip, false otherwise
|
* true if it's a full clip, false otherwise
|
||||||
*/
|
*/
|
||||||
bool tinydrm_merge_clips(struct drm_clip_rect *dst,
|
bool tinydrm_merge_clips(struct drm_rect *dst,
|
||||||
struct drm_clip_rect *src, unsigned int num_clips,
|
struct drm_clip_rect *src, unsigned int num_clips,
|
||||||
unsigned int flags, u32 max_width, u32 max_height)
|
unsigned int flags, u32 max_width, u32 max_height)
|
||||||
{
|
{
|
||||||
|
@ -63,10 +64,10 @@ bool tinydrm_merge_clips(struct drm_clip_rect *dst,
|
||||||
for (i = 0; i < num_clips; i++) {
|
for (i = 0; i < num_clips; i++) {
|
||||||
if (flags & DRM_MODE_FB_DIRTY_ANNOTATE_COPY)
|
if (flags & DRM_MODE_FB_DIRTY_ANNOTATE_COPY)
|
||||||
i++;
|
i++;
|
||||||
dst->x1 = min(dst->x1, src[i].x1);
|
dst->x1 = min_t(int, dst->x1, src[i].x1);
|
||||||
dst->x2 = max(dst->x2, src[i].x2);
|
dst->x2 = max_t(int, dst->x2, src[i].x2);
|
||||||
dst->y1 = min(dst->y1, src[i].y1);
|
dst->y1 = min_t(int, dst->y1, src[i].y1);
|
||||||
dst->y2 = max(dst->y2, src[i].y2);
|
dst->y2 = max_t(int, dst->y2, src[i].y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst->x2 > max_width || dst->y2 > max_height ||
|
if (dst->x2 > max_width || dst->y2 > max_height ||
|
||||||
|
@ -122,7 +123,7 @@ EXPORT_SYMBOL(tinydrm_fb_dirty);
|
||||||
* @clip: Clip rectangle area to copy
|
* @clip: Clip rectangle area to copy
|
||||||
*/
|
*/
|
||||||
void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
|
void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip)
|
struct drm_rect *clip)
|
||||||
{
|
{
|
||||||
unsigned int cpp = drm_format_plane_cpp(fb->format->format, 0);
|
unsigned int cpp = drm_format_plane_cpp(fb->format->format, 0);
|
||||||
unsigned int pitch = fb->pitches[0];
|
unsigned int pitch = fb->pitches[0];
|
||||||
|
@ -146,7 +147,7 @@ EXPORT_SYMBOL(tinydrm_memcpy);
|
||||||
* @clip: Clip rectangle area to copy
|
* @clip: Clip rectangle area to copy
|
||||||
*/
|
*/
|
||||||
void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb,
|
void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip)
|
struct drm_rect *clip)
|
||||||
{
|
{
|
||||||
size_t len = (clip->x2 - clip->x1) * sizeof(u16);
|
size_t len = (clip->x2 - clip->x1) * sizeof(u16);
|
||||||
unsigned int x, y;
|
unsigned int x, y;
|
||||||
|
@ -186,7 +187,7 @@ EXPORT_SYMBOL(tinydrm_swab16);
|
||||||
*/
|
*/
|
||||||
void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
|
void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
|
||||||
struct drm_framebuffer *fb,
|
struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip, bool swap)
|
struct drm_rect *clip, bool swap)
|
||||||
{
|
{
|
||||||
size_t len = (clip->x2 - clip->x1) * sizeof(u32);
|
size_t len = (clip->x2 - clip->x1) * sizeof(u32);
|
||||||
unsigned int x, y;
|
unsigned int x, y;
|
||||||
|
@ -235,7 +236,7 @@ EXPORT_SYMBOL(tinydrm_xrgb8888_to_rgb565);
|
||||||
* ITU BT.601 is used for the RGB -> luma (brightness) conversion.
|
* ITU BT.601 is used for the RGB -> luma (brightness) conversion.
|
||||||
*/
|
*/
|
||||||
void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
|
void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip)
|
struct drm_rect *clip)
|
||||||
{
|
{
|
||||||
unsigned int len = (clip->x2 - clip->x1) * sizeof(u32);
|
unsigned int len = (clip->x2 - clip->x1) * sizeof(u32);
|
||||||
unsigned int x, y;
|
unsigned int x, y;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <drm/drm_fourcc.h>
|
#include <drm/drm_fourcc.h>
|
||||||
#include <drm/drm_gem_cma_helper.h>
|
#include <drm/drm_gem_cma_helper.h>
|
||||||
#include <drm/drm_gem_framebuffer_helper.h>
|
#include <drm/drm_gem_framebuffer_helper.h>
|
||||||
|
#include <drm/drm_rect.h>
|
||||||
#include <drm/tinydrm/mipi-dbi.h>
|
#include <drm/tinydrm/mipi-dbi.h>
|
||||||
#include <drm/tinydrm/tinydrm-helpers.h>
|
#include <drm/tinydrm/tinydrm-helpers.h>
|
||||||
|
|
||||||
|
@ -84,7 +85,8 @@ static int ili9225_fb_dirty(struct drm_framebuffer *fb,
|
||||||
struct tinydrm_device *tdev = fb->dev->dev_private;
|
struct tinydrm_device *tdev = fb->dev->dev_private;
|
||||||
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
|
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
|
||||||
bool swap = mipi->swap_bytes;
|
bool swap = mipi->swap_bytes;
|
||||||
struct drm_clip_rect clip;
|
struct drm_rect clip;
|
||||||
|
struct drm_rect *rect = &clip;
|
||||||
u16 x_start, y_start;
|
u16 x_start, y_start;
|
||||||
u16 x1, x2, y1, y2;
|
u16 x1, x2, y1, y2;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -97,13 +99,12 @@ static int ili9225_fb_dirty(struct drm_framebuffer *fb,
|
||||||
full = tinydrm_merge_clips(&clip, clips, num_clips, flags,
|
full = tinydrm_merge_clips(&clip, clips, num_clips, flags,
|
||||||
fb->width, fb->height);
|
fb->width, fb->height);
|
||||||
|
|
||||||
DRM_DEBUG("Flushing [FB:%d] x1=%u, x2=%u, y1=%u, y2=%u\n", fb->base.id,
|
DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
|
||||||
clip.x1, clip.x2, clip.y1, clip.y2);
|
|
||||||
|
|
||||||
if (!mipi->dc || !full || swap ||
|
if (!mipi->dc || !full || swap ||
|
||||||
fb->format->format == DRM_FORMAT_XRGB8888) {
|
fb->format->format == DRM_FORMAT_XRGB8888) {
|
||||||
tr = mipi->tx_buf;
|
tr = mipi->tx_buf;
|
||||||
ret = mipi_dbi_buf_copy(mipi->tx_buf, fb, &clip, swap);
|
ret = mipi_dbi_buf_copy(mipi->tx_buf, fb, rect, swap);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
|
@ -112,34 +113,34 @@ static int ili9225_fb_dirty(struct drm_framebuffer *fb,
|
||||||
|
|
||||||
switch (mipi->rotation) {
|
switch (mipi->rotation) {
|
||||||
default:
|
default:
|
||||||
x1 = clip.x1;
|
x1 = rect->x1;
|
||||||
x2 = clip.x2 - 1;
|
x2 = rect->x2 - 1;
|
||||||
y1 = clip.y1;
|
y1 = rect->y1;
|
||||||
y2 = clip.y2 - 1;
|
y2 = rect->y2 - 1;
|
||||||
x_start = x1;
|
x_start = x1;
|
||||||
y_start = y1;
|
y_start = y1;
|
||||||
break;
|
break;
|
||||||
case 90:
|
case 90:
|
||||||
x1 = clip.y1;
|
x1 = rect->y1;
|
||||||
x2 = clip.y2 - 1;
|
x2 = rect->y2 - 1;
|
||||||
y1 = fb->width - clip.x2;
|
y1 = fb->width - rect->x2;
|
||||||
y2 = fb->width - clip.x1 - 1;
|
y2 = fb->width - rect->x1 - 1;
|
||||||
x_start = x1;
|
x_start = x1;
|
||||||
y_start = y2;
|
y_start = y2;
|
||||||
break;
|
break;
|
||||||
case 180:
|
case 180:
|
||||||
x1 = fb->width - clip.x2;
|
x1 = fb->width - rect->x2;
|
||||||
x2 = fb->width - clip.x1 - 1;
|
x2 = fb->width - rect->x1 - 1;
|
||||||
y1 = fb->height - clip.y2;
|
y1 = fb->height - rect->y2;
|
||||||
y2 = fb->height - clip.y1 - 1;
|
y2 = fb->height - rect->y1 - 1;
|
||||||
x_start = x2;
|
x_start = x2;
|
||||||
y_start = y2;
|
y_start = y2;
|
||||||
break;
|
break;
|
||||||
case 270:
|
case 270:
|
||||||
x1 = fb->height - clip.y2;
|
x1 = fb->height - rect->y2;
|
||||||
x2 = fb->height - clip.y1 - 1;
|
x2 = fb->height - rect->y1 - 1;
|
||||||
y1 = clip.x1;
|
y1 = rect->x1;
|
||||||
y2 = clip.x2 - 1;
|
y2 = rect->x2 - 1;
|
||||||
x_start = x2;
|
x_start = x2;
|
||||||
y_start = y1;
|
y_start = y1;
|
||||||
break;
|
break;
|
||||||
|
@ -154,7 +155,7 @@ static int ili9225_fb_dirty(struct drm_framebuffer *fb,
|
||||||
ili9225_command(mipi, ILI9225_RAM_ADDRESS_SET_2, y_start);
|
ili9225_command(mipi, ILI9225_RAM_ADDRESS_SET_2, y_start);
|
||||||
|
|
||||||
ret = mipi_dbi_command_buf(mipi, ILI9225_WRITE_DATA_TO_GRAM, tr,
|
ret = mipi_dbi_command_buf(mipi, ILI9225_WRITE_DATA_TO_GRAM, tr,
|
||||||
(clip.x2 - clip.x1) * (clip.y2 - clip.y1) * 2);
|
(rect->x2 - rect->x1) * (rect->y2 - rect->y1) * 2);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <drm/drm_gem_cma_helper.h>
|
#include <drm/drm_gem_cma_helper.h>
|
||||||
#include <drm/drm_fourcc.h>
|
#include <drm/drm_fourcc.h>
|
||||||
#include <drm/drm_gem_framebuffer_helper.h>
|
#include <drm/drm_gem_framebuffer_helper.h>
|
||||||
|
#include <drm/drm_rect.h>
|
||||||
#include <drm/tinydrm/mipi-dbi.h>
|
#include <drm/tinydrm/mipi-dbi.h>
|
||||||
#include <drm/tinydrm/tinydrm-helpers.h>
|
#include <drm/tinydrm/tinydrm-helpers.h>
|
||||||
#include <uapi/drm/drm.h>
|
#include <uapi/drm/drm.h>
|
||||||
|
@ -172,7 +173,7 @@ EXPORT_SYMBOL(mipi_dbi_command_buf);
|
||||||
* Zero on success, negative error code on failure.
|
* Zero on success, negative error code on failure.
|
||||||
*/
|
*/
|
||||||
int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
|
int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip, bool swap)
|
struct drm_rect *clip, bool swap)
|
||||||
{
|
{
|
||||||
struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
|
struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
|
||||||
struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
|
struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
|
||||||
|
@ -221,7 +222,8 @@ static int mipi_dbi_fb_dirty(struct drm_framebuffer *fb,
|
||||||
struct tinydrm_device *tdev = fb->dev->dev_private;
|
struct tinydrm_device *tdev = fb->dev->dev_private;
|
||||||
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
|
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
|
||||||
bool swap = mipi->swap_bytes;
|
bool swap = mipi->swap_bytes;
|
||||||
struct drm_clip_rect clip;
|
struct drm_rect clip;
|
||||||
|
struct drm_rect *rect = &clip;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
bool full;
|
bool full;
|
||||||
void *tr;
|
void *tr;
|
||||||
|
@ -232,13 +234,12 @@ static int mipi_dbi_fb_dirty(struct drm_framebuffer *fb,
|
||||||
full = tinydrm_merge_clips(&clip, clips, num_clips, flags,
|
full = tinydrm_merge_clips(&clip, clips, num_clips, flags,
|
||||||
fb->width, fb->height);
|
fb->width, fb->height);
|
||||||
|
|
||||||
DRM_DEBUG("Flushing [FB:%d] x1=%u, x2=%u, y1=%u, y2=%u\n", fb->base.id,
|
DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
|
||||||
clip.x1, clip.x2, clip.y1, clip.y2);
|
|
||||||
|
|
||||||
if (!mipi->dc || !full || swap ||
|
if (!mipi->dc || !full || swap ||
|
||||||
fb->format->format == DRM_FORMAT_XRGB8888) {
|
fb->format->format == DRM_FORMAT_XRGB8888) {
|
||||||
tr = mipi->tx_buf;
|
tr = mipi->tx_buf;
|
||||||
ret = mipi_dbi_buf_copy(mipi->tx_buf, fb, &clip, swap);
|
ret = mipi_dbi_buf_copy(mipi->tx_buf, fb, rect, swap);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
|
@ -246,14 +247,14 @@ static int mipi_dbi_fb_dirty(struct drm_framebuffer *fb,
|
||||||
}
|
}
|
||||||
|
|
||||||
mipi_dbi_command(mipi, MIPI_DCS_SET_COLUMN_ADDRESS,
|
mipi_dbi_command(mipi, MIPI_DCS_SET_COLUMN_ADDRESS,
|
||||||
(clip.x1 >> 8) & 0xFF, clip.x1 & 0xFF,
|
(rect->x1 >> 8) & 0xff, rect->x1 & 0xff,
|
||||||
((clip.x2 - 1) >> 8) & 0xFF, (clip.x2 - 1) & 0xFF);
|
((rect->x2 - 1) >> 8) & 0xff, (rect->x2 - 1) & 0xff);
|
||||||
mipi_dbi_command(mipi, MIPI_DCS_SET_PAGE_ADDRESS,
|
mipi_dbi_command(mipi, MIPI_DCS_SET_PAGE_ADDRESS,
|
||||||
(clip.y1 >> 8) & 0xFF, clip.y1 & 0xFF,
|
(rect->y1 >> 8) & 0xff, rect->y1 & 0xff,
|
||||||
((clip.y2 - 1) >> 8) & 0xFF, (clip.y2 - 1) & 0xFF);
|
((rect->y2 - 1) >> 8) & 0xff, (rect->y2 - 1) & 0xff);
|
||||||
|
|
||||||
ret = mipi_dbi_command_buf(mipi, MIPI_DCS_WRITE_MEMORY_START, tr,
|
ret = mipi_dbi_command_buf(mipi, MIPI_DCS_WRITE_MEMORY_START, tr,
|
||||||
(clip.x2 - clip.x1) * (clip.y2 - clip.y1) * 2);
|
(rect->x2 - rect->x1) * (rect->y2 - rect->y1) * 2);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <drm/drm_fb_cma_helper.h>
|
#include <drm/drm_fb_cma_helper.h>
|
||||||
#include <drm/drm_gem_cma_helper.h>
|
#include <drm/drm_gem_cma_helper.h>
|
||||||
#include <drm/drm_gem_framebuffer_helper.h>
|
#include <drm/drm_gem_framebuffer_helper.h>
|
||||||
|
#include <drm/drm_rect.h>
|
||||||
#include <drm/tinydrm/tinydrm.h>
|
#include <drm/tinydrm/tinydrm.h>
|
||||||
#include <drm/tinydrm/tinydrm-helpers.h>
|
#include <drm/tinydrm/tinydrm-helpers.h>
|
||||||
|
|
||||||
|
@ -532,7 +533,7 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb,
|
||||||
struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
|
struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
|
||||||
struct tinydrm_device *tdev = fb->dev->dev_private;
|
struct tinydrm_device *tdev = fb->dev->dev_private;
|
||||||
struct repaper_epd *epd = epd_from_tinydrm(tdev);
|
struct repaper_epd *epd = epd_from_tinydrm(tdev);
|
||||||
struct drm_clip_rect clip;
|
struct drm_rect clip;
|
||||||
u8 *buf = NULL;
|
u8 *buf = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <drm/drm_fb_cma_helper.h>
|
#include <drm/drm_fb_cma_helper.h>
|
||||||
#include <drm/drm_gem_cma_helper.h>
|
#include <drm/drm_gem_cma_helper.h>
|
||||||
#include <drm/drm_gem_framebuffer_helper.h>
|
#include <drm/drm_gem_framebuffer_helper.h>
|
||||||
|
#include <drm/drm_rect.h>
|
||||||
#include <drm/tinydrm/mipi-dbi.h>
|
#include <drm/tinydrm/mipi-dbi.h>
|
||||||
#include <drm/tinydrm/tinydrm-helpers.h>
|
#include <drm/tinydrm/tinydrm-helpers.h>
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ static const u8 st7586_lookup[] = { 0x7, 0x4, 0x2, 0x0 };
|
||||||
|
|
||||||
static void st7586_xrgb8888_to_gray332(u8 *dst, void *vaddr,
|
static void st7586_xrgb8888_to_gray332(u8 *dst, void *vaddr,
|
||||||
struct drm_framebuffer *fb,
|
struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip)
|
struct drm_rect *clip)
|
||||||
{
|
{
|
||||||
size_t len = (clip->x2 - clip->x1) * (clip->y2 - clip->y1);
|
size_t len = (clip->x2 - clip->x1) * (clip->y2 - clip->y1);
|
||||||
unsigned int x, y;
|
unsigned int x, y;
|
||||||
|
@ -88,7 +89,7 @@ static void st7586_xrgb8888_to_gray332(u8 *dst, void *vaddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int st7586_buf_copy(void *dst, struct drm_framebuffer *fb,
|
static int st7586_buf_copy(void *dst, struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip)
|
struct drm_rect *clip)
|
||||||
{
|
{
|
||||||
struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
|
struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
|
||||||
struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
|
struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
|
||||||
|
@ -118,7 +119,8 @@ static int st7586_fb_dirty(struct drm_framebuffer *fb,
|
||||||
{
|
{
|
||||||
struct tinydrm_device *tdev = fb->dev->dev_private;
|
struct tinydrm_device *tdev = fb->dev->dev_private;
|
||||||
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
|
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
|
||||||
struct drm_clip_rect clip;
|
struct drm_rect clip;
|
||||||
|
struct drm_rect *rect = &clip;
|
||||||
int start, end;
|
int start, end;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -129,30 +131,29 @@ static int st7586_fb_dirty(struct drm_framebuffer *fb,
|
||||||
fb->height);
|
fb->height);
|
||||||
|
|
||||||
/* 3 pixels per byte, so grow clip to nearest multiple of 3 */
|
/* 3 pixels per byte, so grow clip to nearest multiple of 3 */
|
||||||
clip.x1 = rounddown(clip.x1, 3);
|
rect->x1 = rounddown(rect->x1, 3);
|
||||||
clip.x2 = roundup(clip.x2, 3);
|
rect->x2 = roundup(rect->x2, 3);
|
||||||
|
|
||||||
DRM_DEBUG("Flushing [FB:%d] x1=%u, x2=%u, y1=%u, y2=%u\n", fb->base.id,
|
DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
|
||||||
clip.x1, clip.x2, clip.y1, clip.y2);
|
|
||||||
|
|
||||||
ret = st7586_buf_copy(mipi->tx_buf, fb, &clip);
|
ret = st7586_buf_copy(mipi->tx_buf, fb, rect);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* Pixels are packed 3 per byte */
|
/* Pixels are packed 3 per byte */
|
||||||
start = clip.x1 / 3;
|
start = rect->x1 / 3;
|
||||||
end = clip.x2 / 3;
|
end = rect->x2 / 3;
|
||||||
|
|
||||||
mipi_dbi_command(mipi, MIPI_DCS_SET_COLUMN_ADDRESS,
|
mipi_dbi_command(mipi, MIPI_DCS_SET_COLUMN_ADDRESS,
|
||||||
(start >> 8) & 0xFF, start & 0xFF,
|
(start >> 8) & 0xFF, start & 0xFF,
|
||||||
(end >> 8) & 0xFF, (end - 1) & 0xFF);
|
(end >> 8) & 0xFF, (end - 1) & 0xFF);
|
||||||
mipi_dbi_command(mipi, MIPI_DCS_SET_PAGE_ADDRESS,
|
mipi_dbi_command(mipi, MIPI_DCS_SET_PAGE_ADDRESS,
|
||||||
(clip.y1 >> 8) & 0xFF, clip.y1 & 0xFF,
|
(rect->y1 >> 8) & 0xFF, rect->y1 & 0xFF,
|
||||||
(clip.y2 >> 8) & 0xFF, (clip.y2 - 1) & 0xFF);
|
(rect->y2 >> 8) & 0xFF, (rect->y2 - 1) & 0xFF);
|
||||||
|
|
||||||
ret = mipi_dbi_command_buf(mipi, MIPI_DCS_WRITE_MEMORY_START,
|
ret = mipi_dbi_command_buf(mipi, MIPI_DCS_WRITE_MEMORY_START,
|
||||||
(u8 *)mipi->tx_buf,
|
(u8 *)mipi->tx_buf,
|
||||||
(end - start) * (clip.y2 - clip.y1));
|
(end - start) * (rect->y2 - rect->y1));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include <drm/tinydrm/tinydrm.h>
|
#include <drm/tinydrm/tinydrm.h>
|
||||||
|
|
||||||
|
struct drm_rect;
|
||||||
struct spi_device;
|
struct spi_device;
|
||||||
struct gpio_desc;
|
struct gpio_desc;
|
||||||
struct regulator;
|
struct regulator;
|
||||||
|
@ -80,7 +81,7 @@ u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len);
|
||||||
int mipi_dbi_command_read(struct mipi_dbi *mipi, u8 cmd, u8 *val);
|
int mipi_dbi_command_read(struct mipi_dbi *mipi, u8 cmd, u8 *val);
|
||||||
int mipi_dbi_command_buf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len);
|
int mipi_dbi_command_buf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len);
|
||||||
int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
|
int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip, bool swap);
|
struct drm_rect *clip, bool swap);
|
||||||
/**
|
/**
|
||||||
* mipi_dbi_command - MIPI DCS command with optional parameter(s)
|
* mipi_dbi_command - MIPI DCS command with optional parameter(s)
|
||||||
* @mipi: MIPI structure
|
* @mipi: MIPI structure
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
struct backlight_device;
|
struct backlight_device;
|
||||||
struct tinydrm_device;
|
struct tinydrm_device;
|
||||||
struct drm_clip_rect;
|
struct drm_clip_rect;
|
||||||
|
struct drm_rect;
|
||||||
struct spi_transfer;
|
struct spi_transfer;
|
||||||
struct spi_message;
|
struct spi_message;
|
||||||
struct spi_device;
|
struct spi_device;
|
||||||
|
@ -33,7 +34,7 @@ static inline bool tinydrm_machine_little_endian(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tinydrm_merge_clips(struct drm_clip_rect *dst,
|
bool tinydrm_merge_clips(struct drm_rect *dst,
|
||||||
struct drm_clip_rect *src, unsigned int num_clips,
|
struct drm_clip_rect *src, unsigned int num_clips,
|
||||||
unsigned int flags, u32 max_width, u32 max_height);
|
unsigned int flags, u32 max_width, u32 max_height);
|
||||||
int tinydrm_fb_dirty(struct drm_framebuffer *fb,
|
int tinydrm_fb_dirty(struct drm_framebuffer *fb,
|
||||||
|
@ -42,14 +43,14 @@ int tinydrm_fb_dirty(struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clips,
|
struct drm_clip_rect *clips,
|
||||||
unsigned int num_clips);
|
unsigned int num_clips);
|
||||||
void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
|
void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip);
|
struct drm_rect *clip);
|
||||||
void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb,
|
void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip);
|
struct drm_rect *clip);
|
||||||
void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
|
void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
|
||||||
struct drm_framebuffer *fb,
|
struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip, bool swap);
|
struct drm_rect *clip, bool swap);
|
||||||
void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
|
void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
|
||||||
struct drm_clip_rect *clip);
|
struct drm_rect *clip);
|
||||||
|
|
||||||
size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len);
|
size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len);
|
||||||
bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw);
|
bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw);
|
||||||
|
|
Loading…
Reference in New Issue