From patchwork Mon Aug 7 21:17:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 9886207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4494F60364 for ; Mon, 7 Aug 2017 21:17:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35E63286E6 for ; Mon, 7 Aug 2017 21:17:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29E27286F3; Mon, 7 Aug 2017 21:17:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5AA39286E6 for ; Mon, 7 Aug 2017 21:17:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 93AD289F47; Mon, 7 Aug 2017 21:17:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from vern.gendns.com (vern.gendns.com [206.190.152.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0529989F2E for ; Mon, 7 Aug 2017 21:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=LekAW2+KrczCuyt2YzcWjtz37IJczOJbc68VPmoWAxc=; b=AiaIecX4DRsIraq5tALAbP4xV7 p1U1s5I0mhrS7WX16jhAVZ09pFeteIInuj4HtrPT0Clo1sjJZU/P3jYaA91TrjYnylHU35RoEMxtf Vq6FNEcMxvqkgcG7cJRtY++YUQVJP2M3tx/gckfY0y+j+vUxouf2C06HT33dGQIkoQrzLx+USrTw1 cogn6uOw9iGaMIqbZTRe0AJLlGKUh3cbaaQLaUTJbOfutgI5KygtxfNOG/xYdPtznisGKFPicq/2Q meq61Ege8LknDtIIFRcXOwFRycSDCPrSbG3x76lCkdNqj5GakFEPKpGVGjiVfb0h1GEg4dk1xueSn LOc22f2A==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:35598 helo=[192.168.0.113]) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) (envelope-from ) id 1depLr-000xe1-Kh; Mon, 07 Aug 2017 17:14:15 -0400 Subject: Re: [PATCH v1 1/2] uapi: drm: Add fourcc codes needed by Xilinx Video IP To: Philipp Zabel , Jeffrey Mouroux References: <1501872543-28352-1-git-send-email-jmouroux@xilinx.com> <1501872543-28352-2-git-send-email-jmouroux@xilinx.com> <1502118823.2490.33.camel@pengutronix.de> From: David Lechner Message-ID: Date: Mon, 7 Aug 2017 16:17:12 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1502118823.2490.33.camel@pengutronix.de> Content-Language: en-US X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - lists.freedesktop.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Cc: daniel.vetter@intel.com, dri-devel@lists.freedesktop.org, Jeffrey Mouroux X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 08/07/2017 10:13 AM, Philipp Zabel wrote: > Hi Jeffrey, > > On Fri, 2017-08-04 at 11:49 -0700, Jeffrey Mouroux wrote: >> The Xilinx Video Mixer andn Xilinx Video Framebuffer DMA IP >> support video memory formats that are not represented in the >> current DRM fourcc library. This patch adds those missing >> fourcc codes. >> >> Signed-off-by: Jeffrey Mouroux >> --- >> include/uapi/drm/drm_fourcc.h | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h >> index ef20abb..3e80130 100644 >> --- a/include/uapi/drm/drm_fourcc.h >> +++ b/include/uapi/drm/drm_fourcc.h >> @@ -112,6 +112,14 @@ >> #define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ >> >> #define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ >> +#define DRM_FORMAT_AVUY fourcc_code('A', 'V', 'U', 'Y') /* [31:0] A:Cr:Cb:Y 8:8:8:8 little endian */ >> +#define DRM_FORMAT_VUY888 fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y little endian */ >> +#define DRM_FORMAT_XVUY8888 fourcc_code('X', 'V', '2', '4') /* [31:0] x:Cr:Cb:Y 8:8:8:8 little endian */ >> +#define DRM_FORMAT_XVUY2101010 fourcc_code('X', 'V', '3', '0') /* [31:0] x:Cr:Cb:Y 2:10:10:10 little endian */ >> + >> +/* Grey scale */ >> +#define DRM_FORMAT_Y8 fourcc_code('G', 'R', 'E', 'Y') /* 8 Greyscale */ > > That would be useful for me as well. I'm also interested in 8-bit grayscale. I applied these patches then naively tried to add support for DRM_FORMAT_Y8 to a driver I am working on. + DRM_FORMAT_Y8, DRM_FORMAT_XRGB8888, }; @@ -290,7 +326,7 @@ static int st7586_init(struct device *dev, struct mipi_dbi *mipi, if (ret) return ret; - tdev->drm->mode_config.preferred_depth = 32; + tdev->drm->mode_config.preferred_depth = 8; mipi->rotation = rotation; drm_mode_config_reset(tdev->drm); But it just caused a crash. (Note: had to set fb.lockless_register_fb=1 in the kernel command line to get stack trace.) Console: switching to colour frame buffer device 22x16 Unable to handle kernel paging request at virtual address c4bd4158 pgd = c2e0c000 [c4bd4158] *pgd=c2dfd811, *pte=00000000, *ppte=00000000 Internal error: Oops: 7 [#1] PREEMPT ARM Modules linked in: st7586(+) mipi_dbi tinydrm drm_kms_helper syscopyarea sysfill rect sysimgblt fb_sys_fops ofpart drm backlight m25p80 spi_nor ti_ads7950 indust rialio_triggered_buffer mtd da8xx kfifo_buf phy_generic pwm_beeper ohci_da8xx mu sb_hdrc ohci_hcd usbcore pwm_tiehrpwm davinci_wdt phy_da8xx_usb pinctrl_da850_pu pd rtc_omap leds_gpio led_class lego_ev3_battery industrialio tun libcomposite c onfigfs udc_core usb_common autofs4 CPU: 0 PID: 126 Comm: systemd-udevd Tainted: G W 4.13.0-rc2-dlech-e v3+ #486 Hardware name: Generic DA850/OMAP-L138/AM18x task: c3afd4a0 task.stack: c2d36000 PC is at sys_imageblit+0x278/0x4c8 [sysimgblt] LR is at 0xc4bd3f40 pc : [] lr : [] psr: 20000013 sp : c2d37810 ip : 00000000 fp : c2d37864 r10: 00000008 r9 : 00000018 r8 : c4bd3f40 r7 : c2d26a42 r6 : 00000000 r5 : 00000007 r4 : 00000008 r3 : 00000010 r2 : c4bd4158 r1 : 000000b0 r0 : 00000000 Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 0005317f Table: c2e0c000 DAC: 00000051 Process systemd-udevd (pid: 126, stack limit = 0xc2d36190) Stack: (0xc2d37810 to 0xc2d38000) 7800: 000002c8 000000b2 c4bd4158 00000016 7820: 00000000 c2d26a42 c2d378e8 00000010 00000010 c4bd4158 bf1e6154 c2d378e8 7840: c1882000 c1882e94 00000016 00000001 000000ff c3808000 c2d37884 c2d37868 ... 7fe0: bec338a8 bec33898 b6ec8610 b6da04d0 60000010 00000017 00000000 00000000 Backtrace: [] (sys_imageblit [sysimgblt]) from [] (drm_fb_helper_sys_imageblit+0x1c/0x34 [drm_kms_helper]) r10:c3808000 r9:000000ff r8:00000001 r7:00000016 r6:c1882e94 r5:c1882000 r4:c2d378e8 [] (drm_fb_helper_sys_imageblit [drm_kms_helper]) from [] (bit_putcs+0x26c/0x410) r5:c2d269be r4:00000000 [] (bit_putcs) from [] (fbcon_putcs+0xf4/0x12c) r10:00000007 r9:c0266710 r8:0000000e r7:00000016 r6:c1882e68 r5:c3808000 r4:c1882000 [] (fbcon_putcs) from [] (do_update_region+0x174/0x1bc) r10:00000016 r9:0000000e r8:c3808000 r7:c1882e68 r6:00000016 r5:c0260370 r4:c1882e94 [] (do_update_region) from [] (redraw_screen+0x1dc/0x24c) r10:0000003f r9:00000000 r8:c0517e0c r7:00000001 r6:00000001 r5:00000000 r4:c3808000 [] (redraw_screen) from [] (do_bind_con_driver+0x2ac/0x3d4) r8:c0517e0c r7:00000001 r6:c06019c8 r5:00000000 r4:00000014 [] (do_bind_con_driver) from [] (do_take_over_console+0x144/0x1c4) r10:00000001 r9:0000003e r8:00000000 r7:c06019e4 r6:00000000 r5:00000000 r4:c048f8b4 [] (do_take_over_console) from [] (do_fbcon_takeover+0x70/0xd8) r10:c188221c r9:c0601568 r8:c1882000 r7:00000000 r6:c2d37b80 r5:c0601568 r4:c05d2c00 [] (do_fbcon_takeover) from [] (fbcon_event_notify+0x8c4/0x920) r5:ffffffff r4:c05d2c00 [] (fbcon_event_notify) from [] (notifier_call_chain+0x4c/0x8c) r10:c188221c r9:c05d2c80 r8:00000000 r7:00000005 r6:c2d37b80 r5:ffffffff r4:00000000 [] (notifier_call_chain) from [] (__blocking_notifier_call_chain+0x50/0x68) r9:c05d2c80 r8:c188200c r7:ffffffff r6:c2d37b80 r5:c05d2c70 r4:00000005 [] (__blocking_notifier_call_chain) from [] (blocking_notifier_call_chain+0x20/0x28) r7:c059d370 r6:00000000 r5:c1882000 r4:c059d370 [] (blocking_notifier_call_chain) from [] (fb_notifier_call_chain+0x1c/0x24) [] (fb_notifier_call_chain) from [] (register_framebuffer+0x18c/0x2a8) [] (register_framebuffer) from [] (__drm_fb_helper_initial_config_and_unlock+0x20c/0x3ac [drm_kms_helper]) r10:00000001 r9:c18ffbe8 r8:c1882000 r7:00000000 r6:bf1ed66c r5:00000000 r4:c2d9db40 [] (__drm_fb_helper_initial_config_and_unlock [drm_kms_helper]) from [] (drm_fb_helper_initial_config+0x38/0x40 [drm_kms_helper]) r10:3e70d91c r9:00000019 r8:00000008 r7:bf2169f8 r6:c1879400 r5:00000008 r4:c2d9db40 [] (drm_fb_helper_initial_config [drm_kms_helper]) from [] (drm_fbdev_cma_init_with_funcs+0x7c/0x100 [drm_kms_helper]) r5:00000000 r4:c2d9db40 [] (drm_fbdev_cma_init_with_funcs [drm_kms_helper]) from [] (devm_tinydrm_register+0x4c/0xb4 [tinydrm]) r9:00000019 r8:c3acf400 r7:00000008 r6:c3b96010 r5:00000000 r4:c1879400 [] (devm_tinydrm_register [tinydrm]) from [] (st7586_probe+0x164/0x238 [st7586]) r9:00000019 r8:bf216f98 r7:00000000 r6:c3b96010 r5:c3acf400 r4:00000000 [] (st7586_probe [st7586]) from [] (spi_drv_probe+0x74/0xa0) r6:00000000 r5:bf216f88 r4:c3acf400 [] (spi_drv_probe) from [] (driver_probe_device+0x23c/0x300) r5:c0602a4c r4:c3acf400 [] (driver_probe_device) from [] (__driver_attach+0xc0/0xc4) r9:bf216fe0 r8:00000001 r7:00000000 r6:c3acf434 r5:bf216f98 r4:c3acf400 [] (__driver_attach) from [] (bus_for_each_dev+0x74/0xa4) r7:00000000 r6:c02b2d00 r5:bf216f98 r4:00000000 [] (bus_for_each_dev) from [] (driver_attach+0x20/0x28) r6:c05d80d8 r5:c2f47720 r4:bf216f98 [] (driver_attach) from [] (bus_add_driver+0x190/0x218) [] (bus_add_driver) from [] (driver_register+0x80/0x100) r7:00000000 r6:bf219000 r5:00000001 r4:bf216f98 [] (driver_register) from [] (__spi_register_driver+0x50/0x64) r5:00000001 r4:ffffe000 [] (__spi_register_driver) from [] (st7586_spi_driver_init+0x18/0x24 [st7586]) [] (st7586_spi_driver_init [st7586]) from [] (do_one_initcall+0x44/0x180) [] (do_one_initcall) from [] (do_init_module+0x60/0x1b4) r9:bf216fe0 r8:00000001 r7:c18f2700 r6:c2d33060 r5:00000001 r4:bf216fe0 [] (do_init_module) from [] (load_module+0x1d10/0x2168) r6:c18f2708 r5:00000001 r4:c2d37f40 [] (load_module) from [] (SyS_finit_module+0xac/0xc0) r10:00000080 r9:c2d36000 r8:c000a5e4 r7:0000017b r6:b6ed13a0 r5:00000017 r4:00000000 [] (SyS_finit_module) from [] (__sys_trace_return+0x0/0x10) r6:00000000 r5:004665a0 r4:a7d0f000 Code: e3530000 e5921008 151b2030 051b0034 (15920000) systemd-journald[74]: /dev/kmsg buffer overrun, some messages lost. ---[ end trace dff175813c02c6bb ]--- Looking at the code, drm_fb_helper* looks like it assumes that 8bpp means the memory is an indexed color table format. So, there will be some work needed to make drm_fb_helper* grayscale aware. > >> +#define DRM_FORMAT_Y10 fourcc_code('Y', '1', '0', ' ') /* 10 Greyscale */ > > It is not clear to me from the description, how this should be laid out > in memory. Is it padded to 16 bits? Packed? > >> /* >> * 2 plane YCbCr >> @@ -126,6 +134,7 @@ >> #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ >> #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ >> #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ >> +#define DRM_FORMAT_XV15 fourcc_code('X', 'V', '2', '0') /* 2x2 subsampled Cb:Cr plane 2:10:10:10 */ > > Same here. > > regards > Philipp > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel > diff --git a/drivers/gpu/drm/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c index 1b39d3f..f6db7be 100644 --- a/drivers/gpu/drm/tinydrm/st7586.c +++ b/drivers/gpu/drm/tinydrm/st7586.c @@ -56,6 +56,34 @@ static const u8 st7586_lookup[] = { 0x7, 0x4, 0x2, 0x0 }; +static void st7586_gray8_to_gray332(u8 *dst, void *vaddr, + struct drm_framebuffer *fb, + struct drm_clip_rect *clip) +{ ... +} + static void st7586_xrgb8888_to_gray332(u8 *dst, void *vaddr, struct drm_framebuffer *fb, struct drm_clip_rect *clip) @@ -98,7 +126,14 @@ static int st7586_buf_copy(void *dst, struct drm_framebuffer *fb, return ret; } - st7586_xrgb8888_to_gray332(dst, src, fb, clip); + switch(fb->format->format) { + case DRM_FORMAT_Y8: + st7586_gray8_to_gray332(dst, src, fb, clip); + break; + case DRM_FORMAT_XRGB8888: + st7586_xrgb8888_to_gray332(dst, src, fb, clip); + break; + } if (import_attach) ret = dma_buf_end_cpu_access(import_attach->dmabuf, @@ -260,6 +295,7 @@ static void st7586_pipe_disable(struct drm_simple_display_pipe *pipe) } static const u32 st7586_formats[] = {