From 2ebf47176b7ee1f1a013e76189f2096788d0ad2f Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Thu, 4 Apr 2019 08:06:09 -0700 Subject: [PATCH 01/26] drm/panel: Rocktech jh057n00900: Add terminating newlines to logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These were missing '\n' terminations, add them. Signed-off-by: Joe Perches Reviewed-by: Guido Günther Signed-off-by: Thierry Reding Link: https://patchwork.freedesktop.org/patch/msgid/da6f2344396555034cf2476c8338b0ce1c56e0a7.camel@perches.com --- .../drm/panel/panel-rocktech-jh057n00900.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c index 158a6d548068..d88ea8da2ec2 100644 --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c @@ -123,7 +123,7 @@ static int jh057n_init_sequence(struct jh057n *ctx) ret = mipi_dsi_dcs_exit_sleep_mode(dsi); if (ret < 0) { - DRM_DEV_ERROR(dev, "Failed to exit sleep mode"); + DRM_DEV_ERROR(dev, "Failed to exit sleep mode\n"); return ret; } /* Panel is operational 120 msec after reset */ @@ -132,7 +132,7 @@ static int jh057n_init_sequence(struct jh057n *ctx) if (ret) return ret; - DRM_DEV_DEBUG_DRIVER(dev, "Panel init sequence done"); + DRM_DEV_DEBUG_DRIVER(dev, "Panel init sequence done\n"); return 0; } @@ -172,7 +172,7 @@ static int jh057n_prepare(struct drm_panel *panel) if (ctx->prepared) return 0; - DRM_DEV_DEBUG_DRIVER(ctx->dev, "Resetting the panel."); + DRM_DEV_DEBUG_DRIVER(ctx->dev, "Resetting the panel\n"); gpiod_set_value_cansleep(ctx->reset_gpio, 1); usleep_range(20, 40); gpiod_set_value_cansleep(ctx->reset_gpio, 0); @@ -180,7 +180,8 @@ static int jh057n_prepare(struct drm_panel *panel) ret = jh057n_init_sequence(ctx); if (ret < 0) { - DRM_DEV_ERROR(ctx->dev, "Panel init sequence failed: %d", ret); + DRM_DEV_ERROR(ctx->dev, "Panel init sequence failed: %d\n", + ret); return ret; } @@ -212,7 +213,7 @@ static int jh057n_get_modes(struct drm_panel *panel) mode = drm_mode_duplicate(panel->drm, &default_mode); if (!mode) { - DRM_DEV_ERROR(ctx->dev, "Failed to add mode %ux%u@%u", + DRM_DEV_ERROR(ctx->dev, "Failed to add mode %ux%u@%u\n", default_mode.hdisplay, default_mode.vdisplay, default_mode.vrefresh); return -ENOMEM; @@ -241,7 +242,7 @@ static int allpixelson_set(void *data, u64 val) struct jh057n *ctx = data; struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); - DRM_DEV_DEBUG_DRIVER(ctx->dev, "Setting all pixels on"); + DRM_DEV_DEBUG_DRIVER(ctx->dev, "Setting all pixels on\n"); dsi_generic_write_seq(dsi, ST7703_CMD_ALL_PIXEL_ON); msleep(val * 1000); /* Reset the panel to get video back */ @@ -290,7 +291,7 @@ static int jh057n_probe(struct mipi_dsi_device *dsi) ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(ctx->reset_gpio)) { - DRM_DEV_ERROR(dev, "cannot get reset gpio"); + DRM_DEV_ERROR(dev, "cannot get reset gpio\n"); return PTR_ERR(ctx->reset_gpio); } @@ -315,12 +316,12 @@ static int jh057n_probe(struct mipi_dsi_device *dsi) ret = mipi_dsi_attach(dsi); if (ret < 0) { - DRM_DEV_ERROR(dev, "mipi_dsi_attach failed. Is host ready?"); + DRM_DEV_ERROR(dev, "mipi_dsi_attach failed. Is host ready?\n"); drm_panel_remove(&ctx->panel); return ret; } - DRM_DEV_INFO(dev, "%ux%u@%u %ubpp dsi %udl - ready", + DRM_DEV_INFO(dev, "%ux%u@%u %ubpp dsi %udl - ready\n", default_mode.hdisplay, default_mode.vdisplay, default_mode.vrefresh, mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes); From e31b97ef19df5ec6cba24b1de86eead7dc6fa617 Mon Sep 17 00:00:00 2001 From: kbuild test robot Date: Thu, 4 Apr 2019 05:36:29 +0800 Subject: [PATCH 02/26] drm/vc4: vc4_debugfs_regset32() can be static Fixes: c9be804c8c7a ("drm/vc4: Use common helpers for debugfs setup by the driver components.") Signed-off-by: kbuild test robot Signed-off-by: Eric Anholt Link: https://patchwork.freedesktop.org/patch/msgid/20190403213629.GA31570@lkp-ib03 --- drivers/gpu/drm/vc4/vc4_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c index 69df84bdf904..f9dec08267dc 100644 --- a/drivers/gpu/drm/vc4/vc4_debugfs.c +++ b/drivers/gpu/drm/vc4/vc4_debugfs.c @@ -48,7 +48,7 @@ vc4_debugfs_init(struct drm_minor *minor) return 0; } -int vc4_debugfs_regset32(struct seq_file *m, void *unused) +static int vc4_debugfs_regset32(struct seq_file *m, void *unused) { struct drm_info_node *node = (struct drm_info_node *)m->private; struct debugfs_regset32 *regset = node->info_ent->data; From bc29d3a69d4c1bd1a103e8b3c1ed81b807c1870b Mon Sep 17 00:00:00 2001 From: Wen Yang Date: Thu, 4 Apr 2019 00:04:13 +0800 Subject: [PATCH 03/26] drm/pl111: fix possible object reference leak The call to of_find_matching_node_and_match returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: drivers/gpu/drm/pl111/pl111_versatile.c:333:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:340:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:346:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:354:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:395:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. drivers/gpu/drm/pl111/pl111_versatile.c:402:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 317, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: Eric Anholt (supporter:DRM DRIVER FOR ARM PL111 CLCD) Cc: David Airlie (maintainer:DRM DRIVERS) Cc: Daniel Vetter (maintainer:DRM DRIVERS) Cc: dri-devel@lists.freedesktop.org (open list:DRM DRIVERS) Cc: linux-kernel@vger.kernel.org (open list) Signed-off-by: Eric Anholt Link: https://patchwork.freedesktop.org/patch/msgid/1554307455-40361-6-git-send-email-wen.yang99@zte.com.cn --- drivers/gpu/drm/pl111/pl111_versatile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c index b9baefdba38a..1c318ad32a8c 100644 --- a/drivers/gpu/drm/pl111/pl111_versatile.c +++ b/drivers/gpu/drm/pl111/pl111_versatile.c @@ -330,6 +330,7 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) ret = vexpress_muxfpga_init(); if (ret) { dev_err(dev, "unable to initialize muxfpga driver\n"); + of_node_put(np); return ret; } @@ -337,17 +338,20 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) pdev = of_find_device_by_node(np); if (!pdev) { dev_err(dev, "can't find the sysreg device, deferring\n"); + of_node_put(np); return -EPROBE_DEFER; } map = dev_get_drvdata(&pdev->dev); if (!map) { dev_err(dev, "sysreg has not yet probed\n"); platform_device_put(pdev); + of_node_put(np); return -EPROBE_DEFER; } } else { map = syscon_node_to_regmap(np); } + of_node_put(np); if (IS_ERR(map)) { dev_err(dev, "no Versatile syscon regmap\n"); From 91b350a605136c4c007df928779f81b58146a4f9 Mon Sep 17 00:00:00 2001 From: Sean Paul Date: Wed, 3 Apr 2019 16:56:45 -0400 Subject: [PATCH 04/26] Documentation/gpu/meson: Remove link to meson_canvas.c The file was removed in the below patch and is causing this error: WARNING: kernel-doc '../scripts/kernel-doc -rst -enable-lineno -function Canvas ../drivers/gpu/drm/meson/meson_canvas.c' failed with return code Fixes: 2bf6b5b0e374 ("drm/meson: exclusively use the canvas provider module") Cc: Maxime Jourdan Cc: Neil Armstrong Cc: Kevin Hilman Cc: dri-devel@lists.freedesktop.org Cc: linux-amlogic@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Acked-by: Neil Armstrong Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20190403205652.183496-1-sean@poorly.run --- Documentation/gpu/meson.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Documentation/gpu/meson.rst b/Documentation/gpu/meson.rst index 479f6f51a13b..b9e2f9aa3bd8 100644 --- a/Documentation/gpu/meson.rst +++ b/Documentation/gpu/meson.rst @@ -42,12 +42,6 @@ Video Encoder .. kernel-doc:: drivers/gpu/drm/meson/meson_venc.c :doc: Video Encoder -Video Canvas Management -======================= - -.. kernel-doc:: drivers/gpu/drm/meson/meson_canvas.c - :doc: Canvas - Video Clocks ============ From 7415287e1f3675996a4a6919fe500c30d30951f6 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 5 Apr 2019 11:52:15 +0200 Subject: [PATCH 05/26] drm: move tinydrm format conversion helpers to new drm_format_helper.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also rename them from tinydrm_* to drm_fb_* Pure code motion, no functional change. Signed-off-by: Gerd Hoffmann Reviewed-by: Sam Ravnborg Reviewed-by: Noralf Trønnes Link: http://patchwork.freedesktop.org/patch/msgid/20190405095219.9231-2-kraxel@redhat.com --- drivers/gpu/drm/Makefile | 3 +- drivers/gpu/drm/drm_format_helper.c | 180 ++++++++++++++++++ .../gpu/drm/tinydrm/core/tinydrm-helpers.c | 158 --------------- drivers/gpu/drm/tinydrm/mipi-dbi.c | 7 +- drivers/gpu/drm/tinydrm/repaper.c | 3 +- drivers/gpu/drm/tinydrm/st7586.c | 3 +- include/drm/drm_format_helper.h | 26 +++ include/drm/tinydrm/tinydrm-helpers.h | 10 - 8 files changed, 216 insertions(+), 174 deletions(-) create mode 100644 drivers/gpu/drm/drm_format_helper.c create mode 100644 include/drm/drm_format_helper.h diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 38a97818347c..55d8deb68d45 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -38,7 +38,8 @@ drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_dsc.o drm_probe_helper drm_kms_helper_common.o drm_dp_dual_mode_helper.o \ drm_simple_kms_helper.o drm_modeset_helper.o \ drm_scdc_helper.o drm_gem_framebuffer_helper.o \ - drm_atomic_state_helper.o drm_damage_helper.o + drm_atomic_state_helper.o drm_damage_helper.o \ + drm_format_helper.o drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c new file mode 100644 index 000000000000..62bb4913d6f6 --- /dev/null +++ b/drivers/gpu/drm/drm_format_helper.c @@ -0,0 +1,180 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2016 Noralf Trønnes + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include + +#include +#include +#include +#include + +/** + * drm_fb_memcpy - Copy clip buffer + * @dst: Destination buffer + * @vaddr: Source buffer + * @fb: DRM framebuffer + * @clip: Clip rectangle area to copy + */ +void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip) +{ + unsigned int cpp = drm_format_plane_cpp(fb->format->format, 0); + unsigned int pitch = fb->pitches[0]; + void *src = vaddr + (clip->y1 * pitch) + (clip->x1 * cpp); + size_t len = (clip->x2 - clip->x1) * cpp; + unsigned int y; + + for (y = clip->y1; y < clip->y2; y++) { + memcpy(dst, src, len); + src += pitch; + dst += len; + } +} +EXPORT_SYMBOL(drm_fb_memcpy); + +/** + * drm_fb_swab16 - Swap bytes into clip buffer + * @dst: RGB565 destination buffer + * @vaddr: RGB565 source buffer + * @fb: DRM framebuffer + * @clip: Clip rectangle area to copy + */ +void drm_fb_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip) +{ + size_t len = (clip->x2 - clip->x1) * sizeof(u16); + unsigned int x, y; + u16 *src, *buf; + + /* + * The cma memory is write-combined so reads are uncached. + * Speed up by fetching one line at a time. + */ + buf = kmalloc(len, GFP_KERNEL); + if (!buf) + return; + + for (y = clip->y1; y < clip->y2; y++) { + src = vaddr + (y * fb->pitches[0]); + src += clip->x1; + memcpy(buf, src, len); + src = buf; + for (x = clip->x1; x < clip->x2; x++) + *dst++ = swab16(*src++); + } + + kfree(buf); +} +EXPORT_SYMBOL(drm_fb_swab16); + +/** + * drm_fb_xrgb8888_to_rgb565 - Convert XRGB8888 to RGB565 clip buffer + * @dst: RGB565 destination buffer + * @vaddr: XRGB8888 source buffer + * @fb: DRM framebuffer + * @clip: Clip rectangle area to copy + * @swap: Swap bytes + * + * Drivers can use this function for RGB565 devices that don't natively + * support XRGB8888. + */ +void drm_fb_xrgb8888_to_rgb565(u16 *dst, void *vaddr, + struct drm_framebuffer *fb, + struct drm_rect *clip, bool swap) +{ + size_t len = (clip->x2 - clip->x1) * sizeof(u32); + unsigned int x, y; + u32 *src, *buf; + u16 val16; + + /* + * The cma memory is write-combined so reads are uncached. + * Speed up by fetching one line at a time. + */ + buf = kmalloc(len, GFP_KERNEL); + if (!buf) + return; + + for (y = clip->y1; y < clip->y2; y++) { + src = vaddr + (y * fb->pitches[0]); + src += clip->x1; + memcpy(buf, src, len); + src = buf; + for (x = clip->x1; x < clip->x2; x++) { + val16 = ((*src & 0x00F80000) >> 8) | + ((*src & 0x0000FC00) >> 5) | + ((*src & 0x000000F8) >> 3); + src++; + if (swap) + *dst++ = swab16(val16); + else + *dst++ = val16; + } + } + + kfree(buf); +} +EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb565); + +/** + * drm_fb_xrgb8888_to_gray8 - Convert XRGB8888 to grayscale + * @dst: 8-bit grayscale destination buffer + * @vaddr: XRGB8888 source buffer + * @fb: DRM framebuffer + * @clip: Clip rectangle area to copy + * + * Drm doesn't have native monochrome or grayscale support. + * Such drivers can announce the commonly supported XR24 format to userspace + * and use this function to convert to the native format. + * + * Monochrome drivers will use the most significant bit, + * where 1 means foreground color and 0 background color. + * + * ITU BT.601 is used for the RGB -> luma (brightness) conversion. + */ +void drm_fb_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip) +{ + unsigned int len = (clip->x2 - clip->x1) * sizeof(u32); + unsigned int x, y; + void *buf; + u32 *src; + + if (WARN_ON(fb->format->format != DRM_FORMAT_XRGB8888)) + return; + /* + * The cma memory is write-combined so reads are uncached. + * Speed up by fetching one line at a time. + */ + buf = kmalloc(len, GFP_KERNEL); + if (!buf) + return; + + for (y = clip->y1; y < clip->y2; y++) { + src = vaddr + (y * fb->pitches[0]); + src += clip->x1; + memcpy(buf, src, len); + src = buf; + for (x = clip->x1; x < clip->x2; x++) { + u8 r = (*src & 0x00ff0000) >> 16; + u8 g = (*src & 0x0000ff00) >> 8; + u8 b = *src & 0x000000ff; + + /* ITU BT.601: Y = 0.299 R + 0.587 G + 0.114 B */ + *dst++ = (3 * r + 6 * g + b) / 10; + src++; + } + } + + kfree(buf); +} +EXPORT_SYMBOL(drm_fb_xrgb8888_to_gray8); + diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c index d7b38dfb6438..6d540d93758f 100644 --- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c @@ -26,164 +26,6 @@ static unsigned int spi_max; module_param(spi_max, uint, 0400); MODULE_PARM_DESC(spi_max, "Set a lower SPI max transfer size"); -/** - * tinydrm_memcpy - Copy clip buffer - * @dst: Destination buffer - * @vaddr: Source buffer - * @fb: DRM framebuffer - * @clip: Clip rectangle area to copy - */ -void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, - struct drm_rect *clip) -{ - unsigned int cpp = drm_format_plane_cpp(fb->format->format, 0); - unsigned int pitch = fb->pitches[0]; - void *src = vaddr + (clip->y1 * pitch) + (clip->x1 * cpp); - size_t len = (clip->x2 - clip->x1) * cpp; - unsigned int y; - - for (y = clip->y1; y < clip->y2; y++) { - memcpy(dst, src, len); - src += pitch; - dst += len; - } -} -EXPORT_SYMBOL(tinydrm_memcpy); - -/** - * tinydrm_swab16 - Swap bytes into clip buffer - * @dst: RGB565 destination buffer - * @vaddr: RGB565 source buffer - * @fb: DRM framebuffer - * @clip: Clip rectangle area to copy - */ -void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb, - struct drm_rect *clip) -{ - size_t len = (clip->x2 - clip->x1) * sizeof(u16); - unsigned int x, y; - u16 *src, *buf; - - /* - * The cma memory is write-combined so reads are uncached. - * Speed up by fetching one line at a time. - */ - buf = kmalloc(len, GFP_KERNEL); - if (!buf) - return; - - for (y = clip->y1; y < clip->y2; y++) { - src = vaddr + (y * fb->pitches[0]); - src += clip->x1; - memcpy(buf, src, len); - src = buf; - for (x = clip->x1; x < clip->x2; x++) - *dst++ = swab16(*src++); - } - - kfree(buf); -} -EXPORT_SYMBOL(tinydrm_swab16); - -/** - * tinydrm_xrgb8888_to_rgb565 - Convert XRGB8888 to RGB565 clip buffer - * @dst: RGB565 destination buffer - * @vaddr: XRGB8888 source buffer - * @fb: DRM framebuffer - * @clip: Clip rectangle area to copy - * @swap: Swap bytes - * - * Drivers can use this function for RGB565 devices that don't natively - * support XRGB8888. - */ -void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr, - struct drm_framebuffer *fb, - struct drm_rect *clip, bool swap) -{ - size_t len = (clip->x2 - clip->x1) * sizeof(u32); - unsigned int x, y; - u32 *src, *buf; - u16 val16; - - buf = kmalloc(len, GFP_KERNEL); - if (!buf) - return; - - for (y = clip->y1; y < clip->y2; y++) { - src = vaddr + (y * fb->pitches[0]); - src += clip->x1; - memcpy(buf, src, len); - src = buf; - for (x = clip->x1; x < clip->x2; x++) { - val16 = ((*src & 0x00F80000) >> 8) | - ((*src & 0x0000FC00) >> 5) | - ((*src & 0x000000F8) >> 3); - src++; - if (swap) - *dst++ = swab16(val16); - else - *dst++ = val16; - } - } - - kfree(buf); -} -EXPORT_SYMBOL(tinydrm_xrgb8888_to_rgb565); - -/** - * tinydrm_xrgb8888_to_gray8 - Convert XRGB8888 to grayscale - * @dst: 8-bit grayscale destination buffer - * @vaddr: XRGB8888 source buffer - * @fb: DRM framebuffer - * @clip: Clip rectangle area to copy - * - * Drm doesn't have native monochrome or grayscale support. - * Such drivers can announce the commonly supported XR24 format to userspace - * and use this function to convert to the native format. - * - * Monochrome drivers will use the most significant bit, - * where 1 means foreground color and 0 background color. - * - * ITU BT.601 is used for the RGB -> luma (brightness) conversion. - */ -void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, - struct drm_rect *clip) -{ - unsigned int len = (clip->x2 - clip->x1) * sizeof(u32); - unsigned int x, y; - void *buf; - u32 *src; - - if (WARN_ON(fb->format->format != DRM_FORMAT_XRGB8888)) - return; - /* - * The cma memory is write-combined so reads are uncached. - * Speed up by fetching one line at a time. - */ - buf = kmalloc(len, GFP_KERNEL); - if (!buf) - return; - - for (y = clip->y1; y < clip->y2; y++) { - src = vaddr + (y * fb->pitches[0]); - src += clip->x1; - memcpy(buf, src, len); - src = buf; - for (x = clip->x1; x < clip->x2; x++) { - u8 r = (*src & 0x00ff0000) >> 16; - u8 g = (*src & 0x0000ff00) >> 8; - u8 b = *src & 0x000000ff; - - /* ITU BT.601: Y = 0.299 R + 0.587 G + 0.114 B */ - *dst++ = (3 * r + 6 * g + b) / 10; - src++; - } - } - - kfree(buf); -} -EXPORT_SYMBOL(tinydrm_xrgb8888_to_gray8); - #if IS_ENABLED(CONFIG_SPI) /** diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c index 869c8f56da3b..85761b4abb83 100644 --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -218,12 +219,12 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, switch (fb->format->format) { case DRM_FORMAT_RGB565: if (swap) - tinydrm_swab16(dst, src, fb, clip); + drm_fb_swab16(dst, src, fb, clip); else - tinydrm_memcpy(dst, src, fb, clip); + drm_fb_memcpy(dst, src, fb, clip); break; case DRM_FORMAT_XRGB8888: - tinydrm_xrgb8888_to_rgb565(dst, src, fb, clip, swap); + drm_fb_xrgb8888_to_rgb565(dst, src, fb, clip, swap); break; default: dev_err_once(fb->dev->dev, "Format is not supported: %s\n", diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c index 3f3632457079..a29b8278324b 100644 --- a/drivers/gpu/drm/tinydrm/repaper.c +++ b/drivers/gpu/drm/tinydrm/repaper.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -566,7 +567,7 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb) goto out_free; } - tinydrm_xrgb8888_to_gray8(buf, cma_obj->vaddr, fb, &clip); + drm_fb_xrgb8888_to_gray8(buf, cma_obj->vaddr, fb, &clip); if (import_attach) { ret = dma_buf_end_cpu_access(import_attach->dmabuf, diff --git a/drivers/gpu/drm/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c index d99957bac532..560d7ac0cadc 100644 --- a/drivers/gpu/drm/tinydrm/st7586.c +++ b/drivers/gpu/drm/tinydrm/st7586.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -77,7 +78,7 @@ static void st7586_xrgb8888_to_gray332(u8 *dst, void *vaddr, if (!buf) return; - tinydrm_xrgb8888_to_gray8(buf, vaddr, fb, clip); + drm_fb_xrgb8888_to_gray8(buf, vaddr, fb, clip); src = buf; for (y = clip->y1; y < clip->y2; y++) { diff --git a/include/drm/drm_format_helper.h b/include/drm/drm_format_helper.h new file mode 100644 index 000000000000..5a7ada6b0bef --- /dev/null +++ b/include/drm/drm_format_helper.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2016 Noralf Trønnes + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef __LINUX_DRM_FORMAT_HELPER_H +#define __LINUX_DRM_FORMAT_HELPER_H + +struct drm_framebuffer; +struct drm_rect; + +void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip); +void drm_fb_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip); +void drm_fb_xrgb8888_to_rgb565(u16 *dst, void *vaddr, + struct drm_framebuffer *fb, + struct drm_rect *clip, bool swap); +void drm_fb_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip); + +#endif /* __LINUX_DRM_FORMAT_HELPER_H */ diff --git a/include/drm/tinydrm/tinydrm-helpers.h b/include/drm/tinydrm/tinydrm-helpers.h index ae4a6abc43b5..7d259acb8826 100644 --- a/include/drm/tinydrm/tinydrm-helpers.h +++ b/include/drm/tinydrm/tinydrm-helpers.h @@ -46,16 +46,6 @@ int tinydrm_display_pipe_init(struct drm_device *drm, const struct drm_display_mode *mode, unsigned int rotation); -void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, - struct drm_rect *clip); -void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb, - struct drm_rect *clip); -void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr, - struct drm_framebuffer *fb, - struct drm_rect *clip, bool swap); -void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, - struct drm_rect *clip); - 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); int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz, From 26f024f54ab69a1012214755223d6ed61dd7bc98 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 5 Apr 2019 11:52:16 +0200 Subject: [PATCH 06/26] drm: add drm_fb_memcpy_dstclip() helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is a drm_fb_memcpy() variant which checks the clip rectangle for the destination too. Common code between drm_fb_memcpy() and drm_fb_memcpy_dstclip() was factored out into the drm_fb_memcpy_lines() helper function. Signed-off-by: Gerd Hoffmann Reviewed-by: Noralf Trønnes Link: http://patchwork.freedesktop.org/patch/msgid/20190405095219.9231-3-kraxel@redhat.com --- drivers/gpu/drm/drm_format_helper.c | 51 ++++++++++++++++++++++++----- include/drm/drm_format_helper.h | 2 ++ 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c index 62bb4913d6f6..55a2d629a75f 100644 --- a/drivers/gpu/drm/drm_format_helper.c +++ b/drivers/gpu/drm/drm_format_helper.c @@ -16,30 +16,65 @@ #include #include +static void drm_fb_memcpy_lines(void *dst, unsigned int dst_pitch, + void *src, unsigned int src_pitch, + unsigned int linelength, unsigned int lines) +{ + int line; + + for (line = 0; line < lines; line++) { + memcpy(dst, src, linelength); + src += src_pitch; + dst += dst_pitch; + } +} + /** * drm_fb_memcpy - Copy clip buffer * @dst: Destination buffer * @vaddr: Source buffer * @fb: DRM framebuffer * @clip: Clip rectangle area to copy + * + * This function does not apply clipping on dst, i.e. the destination + * is a small buffer containing the clip rect only. */ void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip) { unsigned int cpp = drm_format_plane_cpp(fb->format->format, 0); - unsigned int pitch = fb->pitches[0]; - void *src = vaddr + (clip->y1 * pitch) + (clip->x1 * cpp); + unsigned int offset = (clip->y1 * fb->pitches[0]) + (clip->x1 * cpp); size_t len = (clip->x2 - clip->x1) * cpp; - unsigned int y; - for (y = clip->y1; y < clip->y2; y++) { - memcpy(dst, src, len); - src += pitch; - dst += len; - } + drm_fb_memcpy_lines(dst, len, + vaddr + offset, fb->pitches[0], + len, clip->y2 - clip->y1); } EXPORT_SYMBOL(drm_fb_memcpy); +/** + * drm_fb_memcpy_dstclip - Copy clip buffer + * @dst: Destination buffer + * @vaddr: Source buffer + * @fb: DRM framebuffer + * @clip: Clip rectangle area to copy + * + * This function applies clipping on dst, i.e. the destination is a + * full framebuffer but only the clip rect content is copied over. + */ +void drm_fb_memcpy_dstclip(void *dst, void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip) +{ + unsigned int cpp = drm_format_plane_cpp(fb->format->format, 0); + unsigned int offset = (clip->y1 * fb->pitches[0]) + (clip->x1 * cpp); + size_t len = (clip->x2 - clip->x1) * cpp; + + drm_fb_memcpy_lines(dst + offset, fb->pitches[0], + vaddr + offset, fb->pitches[0], + len, clip->y2 - clip->y1); +} +EXPORT_SYMBOL(drm_fb_memcpy_dstclip); + /** * drm_fb_swab16 - Swap bytes into clip buffer * @dst: RGB565 destination buffer diff --git a/include/drm/drm_format_helper.h b/include/drm/drm_format_helper.h index 5a7ada6b0bef..c52b7b9a25f0 100644 --- a/include/drm/drm_format_helper.h +++ b/include/drm/drm_format_helper.h @@ -15,6 +15,8 @@ struct drm_rect; void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip); +void drm_fb_memcpy_dstclip(void *dst, void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip); void drm_fb_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip); void drm_fb_xrgb8888_to_rgb565(u16 *dst, void *vaddr, From bcc4442008aca0e1566b7367f51670143d1ea7bf Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 5 Apr 2019 11:52:17 +0200 Subject: [PATCH 07/26] drm: add drm_fb_xrgb8888_to_rgb565_dstclip() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is a drm_fb_xrgb8888_to_rgb565() variant which checks the clip rectangle for the destination too. Common code between drm_fb_xrgb8888_to_rgb565() and drm_fb_xrgb8888_to_rgb565_dstclip() was factored out into the drm_fb_xrgb8888_to_rgb565_lines() helper function. Signed-off-by: Gerd Hoffmann Reviewed-by: Noralf Trønnes Link: http://patchwork.freedesktop.org/patch/msgid/20190405095219.9231-4-kraxel@redhat.com --- drivers/gpu/drm/drm_format_helper.c | 113 ++++++++++++++++++++-------- include/drm/drm_format_helper.h | 5 +- 2 files changed, 86 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c index 55a2d629a75f..246775510c2e 100644 --- a/drivers/gpu/drm/drm_format_helper.c +++ b/drivers/gpu/drm/drm_format_helper.c @@ -110,6 +110,44 @@ void drm_fb_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb, } EXPORT_SYMBOL(drm_fb_swab16); +static void drm_fb_xrgb8888_to_rgb565_lines(void *dst, unsigned int dst_pitch, + void *src, unsigned int src_pitch, + unsigned int src_linelength, + unsigned int lines, + bool swap) +{ + unsigned int linepixels = src_linelength / sizeof(u32); + unsigned int x, y; + u32 *sbuf; + u16 *dbuf, val16; + + /* + * The cma memory is write-combined so reads are uncached. + * Speed up by fetching one line at a time. + */ + sbuf = kmalloc(src_linelength, GFP_KERNEL); + if (!sbuf) + return; + + for (y = 0; y < lines; y++) { + memcpy(sbuf, src, src_linelength); + dbuf = dst; + for (x = 0; x < linepixels; x++) { + val16 = ((sbuf[x] & 0x00F80000) >> 8) | + ((sbuf[x] & 0x0000FC00) >> 5) | + ((sbuf[x] & 0x000000F8) >> 3); + if (swap) + *dbuf++ = swab16(val16); + else + *dbuf++ = val16; + } + src += src_pitch; + dst += dst_pitch; + } + + kfree(sbuf); +} + /** * drm_fb_xrgb8888_to_rgb565 - Convert XRGB8888 to RGB565 clip buffer * @dst: RGB565 destination buffer @@ -120,45 +158,58 @@ EXPORT_SYMBOL(drm_fb_swab16); * * Drivers can use this function for RGB565 devices that don't natively * support XRGB8888. + * + * This function does not apply clipping on dst, i.e. the destination + * is a small buffer containing the clip rect only. */ -void drm_fb_xrgb8888_to_rgb565(u16 *dst, void *vaddr, +void drm_fb_xrgb8888_to_rgb565(void *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip, bool swap) { - size_t len = (clip->x2 - clip->x1) * sizeof(u32); - unsigned int x, y; - u32 *src, *buf; - u16 val16; + unsigned int src_offset = (clip->y1 * fb->pitches[0]) + + (clip->x1 * sizeof(u32)); + size_t src_len = (clip->x2 - clip->x1) * sizeof(u32); + size_t dst_len = (clip->x2 - clip->x1) * sizeof(u16); - /* - * The cma memory is write-combined so reads are uncached. - * Speed up by fetching one line at a time. - */ - buf = kmalloc(len, GFP_KERNEL); - if (!buf) - return; - - for (y = clip->y1; y < clip->y2; y++) { - src = vaddr + (y * fb->pitches[0]); - src += clip->x1; - memcpy(buf, src, len); - src = buf; - for (x = clip->x1; x < clip->x2; x++) { - val16 = ((*src & 0x00F80000) >> 8) | - ((*src & 0x0000FC00) >> 5) | - ((*src & 0x000000F8) >> 3); - src++; - if (swap) - *dst++ = swab16(val16); - else - *dst++ = val16; - } - } - - kfree(buf); + drm_fb_xrgb8888_to_rgb565_lines(dst, dst_len, + vaddr + src_offset, fb->pitches[0], + src_len, clip->y2 - clip->y1, + swap); } EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb565); +/** + * drm_fb_xrgb8888_to_rgb565_dstclip - Convert XRGB8888 to RGB565 clip buffer + * @dst: RGB565 destination buffer + * @dst_pitch: destination buffer pitch + * @vaddr: XRGB8888 source buffer + * @fb: DRM framebuffer + * @clip: Clip rectangle area to copy + * @swap: Swap bytes + * + * Drivers can use this function for RGB565 devices that don't natively + * support XRGB8888. + * + * This function applies clipping on dst, i.e. the destination is a + * full framebuffer but only the clip rect content is copied over. + */ +void drm_fb_xrgb8888_to_rgb565_dstclip(void *dst, unsigned int dst_pitch, + void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip, bool swap) +{ + unsigned int src_offset = (clip->y1 * fb->pitches[0]) + + (clip->x1 * sizeof(u32)); + unsigned int dst_offset = (clip->y1 * dst_pitch) + + (clip->x1 * sizeof(u16)); + size_t src_len = (clip->x2 - clip->x1) * sizeof(u32); + + drm_fb_xrgb8888_to_rgb565_lines(dst + dst_offset, dst_pitch, + vaddr + src_offset, fb->pitches[0], + src_len, clip->y2 - clip->y1, + swap); +} +EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb565_dstclip); + /** * drm_fb_xrgb8888_to_gray8 - Convert XRGB8888 to grayscale * @dst: 8-bit grayscale destination buffer diff --git a/include/drm/drm_format_helper.h b/include/drm/drm_format_helper.h index c52b7b9a25f0..a84d71fa446b 100644 --- a/include/drm/drm_format_helper.h +++ b/include/drm/drm_format_helper.h @@ -19,9 +19,12 @@ void drm_fb_memcpy_dstclip(void *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip); void drm_fb_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip); -void drm_fb_xrgb8888_to_rgb565(u16 *dst, void *vaddr, +void drm_fb_xrgb8888_to_rgb565(void *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip, bool swap); +void drm_fb_xrgb8888_to_rgb565_dstclip(void *dst, unsigned int dst_pitch, + void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip, bool swap); void drm_fb_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip); From ec3de7a43e9cac8a2dc1fce069321cb9538f0b34 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 5 Apr 2019 11:52:18 +0200 Subject: [PATCH 08/26] drm: add drm_fb_xrgb8888_to_rgb888_dstclip() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simliar to drm_fb_xrgb8888_to_rgb565_dstclip() but converts to rgb888 instead of rgb565. Signed-off-by: Gerd Hoffmann Reviewed-by: Noralf Trønnes Link: http://patchwork.freedesktop.org/patch/msgid/20190405095219.9231-5-kraxel@redhat.com --- drivers/gpu/drm/drm_format_helper.c | 60 +++++++++++++++++++++++++++++ include/drm/drm_format_helper.h | 3 ++ 2 files changed, 63 insertions(+) diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c index 246775510c2e..00d716f14173 100644 --- a/drivers/gpu/drm/drm_format_helper.c +++ b/drivers/gpu/drm/drm_format_helper.c @@ -210,6 +210,66 @@ void drm_fb_xrgb8888_to_rgb565_dstclip(void *dst, unsigned int dst_pitch, } EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb565_dstclip); +static void drm_fb_xrgb8888_to_rgb888_lines(void *dst, unsigned int dst_pitch, + void *src, unsigned int src_pitch, + unsigned int src_linelength, + unsigned int lines) +{ + unsigned int linepixels = src_linelength / 3; + unsigned int x, y; + u32 *sbuf; + u8 *dbuf; + + sbuf = kmalloc(src_linelength, GFP_KERNEL); + if (!sbuf) + return; + + for (y = 0; y < lines; y++) { + memcpy(sbuf, src, src_linelength); + dbuf = dst; + for (x = 0; x < linepixels; x++) { + *dbuf++ = (sbuf[x] & 0x000000FF) >> 0; + *dbuf++ = (sbuf[x] & 0x0000FF00) >> 8; + *dbuf++ = (sbuf[x] & 0x00FF0000) >> 16; + } + src += src_pitch; + dst += dst_pitch; + } + + kfree(sbuf); +} + +/** + * drm_fb_xrgb8888_to_rgb888_dstclip - Convert XRGB8888 to RGB888 clip buffer + * @dst: RGB565 destination buffer + * @dst_pitch: destination buffer pitch + * @vaddr: XRGB8888 source buffer + * @fb: DRM framebuffer + * @clip: Clip rectangle area to copy + * @dstclip: Clip destination too. + * + * Drivers can use this function for RGB888 devices that don't natively + * support XRGB8888. + * + * This function applies clipping on dst, i.e. the destination is a + * full framebuffer but only the clip rect content is copied over. + */ +void drm_fb_xrgb8888_to_rgb888_dstclip(void *dst, unsigned int dst_pitch, + void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip) +{ + unsigned int src_offset = (clip->y1 * fb->pitches[0]) + + (clip->x1 * sizeof(u32)); + unsigned int dst_offset = (clip->y1 * dst_pitch) + + (clip->x1 * 3); + size_t src_len = (clip->x2 - clip->x1) * sizeof(u32); + + drm_fb_xrgb8888_to_rgb888_lines(dst + dst_offset, dst_pitch, + vaddr + src_offset, fb->pitches[0], + src_len, clip->y2 - clip->y1); +} +EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb888_dstclip); + /** * drm_fb_xrgb8888_to_gray8 - Convert XRGB8888 to grayscale * @dst: 8-bit grayscale destination buffer diff --git a/include/drm/drm_format_helper.h b/include/drm/drm_format_helper.h index a84d71fa446b..6f84380757ee 100644 --- a/include/drm/drm_format_helper.h +++ b/include/drm/drm_format_helper.h @@ -25,6 +25,9 @@ void drm_fb_xrgb8888_to_rgb565(void *dst, void *vaddr, void drm_fb_xrgb8888_to_rgb565_dstclip(void *dst, unsigned int dst_pitch, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip, bool swap); +void drm_fb_xrgb8888_to_rgb888_dstclip(void *dst, unsigned int dst_pitch, + void *vaddr, struct drm_framebuffer *fb, + struct drm_rect *clip); void drm_fb_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_rect *clip); From ab3e023b1b4c9887c9f0f761b47f3f0516bd3434 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 5 Apr 2019 11:52:19 +0200 Subject: [PATCH 09/26] drm/cirrus: rewrite and modernize driver. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Time to kill some bad sample code people are copying from ;) This is a complete rewrite of the cirrus driver. The cirrus_mode_set() function is pretty much the only function which is carried over largely unmodified. Everything else is upside down. It is a single monster patch. But given that it does some pretty fundamental changes to the drivers workflow and also reduces the code size by roughly 70% I think it'll still be alot easier to review than a longish baby-step patch series. Changes summary: - Given the small amout of video memory (4 MB) the cirrus device has the rewritten driver doesn't try to manage buffers there. Instead it will blit (memcpy) the active framebuffer to video memory. - All gem objects are stored in main memory and are manged using the new shmem helpers. ttm is out. - It supports RG16, RG24 and XR24 formats. XR24 gets converted to RG24 or RG16 at blit time if needed, to avoid the pitch becoming larger than what the cirrus hardware can handle. - The simple display pipeline is used. - The generic fbdev emulation is used. - It's a atomic driver now. - It runs wayland. Signed-off-by: Gerd Hoffmann Acked-by: Daniel Vetter Reviewed-by: Sam Ravnborg Acked-by: Noralf Trønnes Link: http://patchwork.freedesktop.org/patch/msgid/20190405095219.9231-6-kraxel@redhat.com --- drivers/gpu/drm/cirrus/Kconfig | 2 +- drivers/gpu/drm/cirrus/Makefile | 3 - drivers/gpu/drm/cirrus/cirrus.c | 657 ++++++++++++++++++++++++++ drivers/gpu/drm/cirrus/cirrus_drv.c | 161 ------- drivers/gpu/drm/cirrus/cirrus_drv.h | 251 ---------- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 309 ------------ drivers/gpu/drm/cirrus/cirrus_main.c | 328 ------------- drivers/gpu/drm/cirrus/cirrus_mode.c | 617 ------------------------ drivers/gpu/drm/cirrus/cirrus_ttm.c | 343 -------------- 9 files changed, 658 insertions(+), 2013 deletions(-) create mode 100644 drivers/gpu/drm/cirrus/cirrus.c delete mode 100644 drivers/gpu/drm/cirrus/cirrus_drv.c delete mode 100644 drivers/gpu/drm/cirrus/cirrus_drv.h delete mode 100644 drivers/gpu/drm/cirrus/cirrus_fbdev.c delete mode 100644 drivers/gpu/drm/cirrus/cirrus_main.c delete mode 100644 drivers/gpu/drm/cirrus/cirrus_mode.c delete mode 100644 drivers/gpu/drm/cirrus/cirrus_ttm.c diff --git a/drivers/gpu/drm/cirrus/Kconfig b/drivers/gpu/drm/cirrus/Kconfig index fc78c90ee931..dd4f52a0bc1c 100644 --- a/drivers/gpu/drm/cirrus/Kconfig +++ b/drivers/gpu/drm/cirrus/Kconfig @@ -2,7 +2,7 @@ config DRM_CIRRUS_QEMU tristate "Cirrus driver for QEMU emulated device" depends on DRM && PCI && MMU select DRM_KMS_HELPER - select DRM_TTM + select DRM_GEM_SHMEM_HELPER help This is a KMS driver for emulated cirrus device in qemu. It is *NOT* intended for real cirrus devices. This requires diff --git a/drivers/gpu/drm/cirrus/Makefile b/drivers/gpu/drm/cirrus/Makefile index 919c0a336c97..acf8971d37a1 100644 --- a/drivers/gpu/drm/cirrus/Makefile +++ b/drivers/gpu/drm/cirrus/Makefile @@ -1,4 +1 @@ -cirrus-y := cirrus_main.o cirrus_mode.o \ - cirrus_drv.o cirrus_fbdev.o cirrus_ttm.o - obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c new file mode 100644 index 000000000000..5095b8ce52c2 --- /dev/null +++ b/drivers/gpu/drm/cirrus/cirrus.c @@ -0,0 +1,657 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2012-2019 Red Hat + * + * This file is subject to the terms and conditions of the GNU General + * Public License version 2. See the file COPYING in the main + * directory of this archive for more details. + * + * Authors: Matthew Garrett + * Dave Airlie + * Gerd Hoffmann + * + * Portions of this code derived from cirrusfb.c: + * drivers/video/cirrusfb.c - driver for Cirrus Logic chipsets + * + * Copyright 1999-2001 Jeff Garzik + */ + +#include +#include +#include + +#include