From patchwork Mon Feb 22 01:54:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 8370241 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AB35EC0553 for ; Mon, 22 Feb 2016 01:57:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D4D0620361 for ; Mon, 22 Feb 2016 01:57:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E20BD2035D for ; Mon, 22 Feb 2016 01:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752806AbcBVBzE (ORCPT ); Sun, 21 Feb 2016 20:55:04 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:54110 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752383AbcBVBzA (ORCPT ); Sun, 21 Feb 2016 20:55:00 -0500 Received: (from localhost user: 'macro', uid#1010) by eddie.linux-mips.org with ESMTP id S27011662AbcBVBy75g-Kq (ORCPT + 1 other); Mon, 22 Feb 2016 02:54:59 +0100 Date: Mon, 22 Feb 2016 01:54:59 +0000 (GMT) From: "Maciej W. Rozycki" To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Geert Uytterhoeven cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] video: fbdev: pmag-aa-fb: Adapt to current APIs In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Rework the driver to use the current frambuffer and TURBOchannel APIs, including proper resource management and using the new framework for hardware cursor support. NB two Bt431 cursor generators are included onboard, both responding at the same TURBOchannel bus addresses and with their host data buses wired to byte lanes #0 and #1 respectively of the 32-bit bus. Therefore both can be accessed simultaneously with 16-bit data transfers. Cursor outputs of the chip wired to lane #0 drive the respective overlay select inputs of the Bt455 RAMDAC, whereas cursor outputs of the chip wired to lane #1 drive the respective P3 pixel select inputs of the RAMDAC. So 5 (out of 17) Bt455 color registers are usable with this board: palette entries #0 and #1 for frame buffer pixel data driven while neither cursor generator is active, palette entries #8 and #9 for frame buffer pixel data driven while cursor generator #1 is active only and the overlay entry while cursor generator #0 is active. Signed-off-by: Maciej W. Rozycki --- linux-pmag-aa-fb.patch -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-20160211-4maxp64/drivers/video/fbdev/bt431.h =================================================================== --- linux-20160211-4maxp64.orig/drivers/video/fbdev/bt431.h +++ linux-20160211-4maxp64/drivers/video/fbdev/bt431.h @@ -2,6 +2,7 @@ * linux/drivers/video/bt431.h * * Copyright 2003 Thiemo Seufer + * Copyright 2016 Maciej W. Rozycki * * This file is subject to the terms and conditions of the GNU General * Public License. See the file COPYING in the main directory of this @@ -9,6 +10,8 @@ */ #include +#define BT431_CURSOR_SIZE 64 + /* * Bt431 cursor generator registers, 32-bit aligned. * Two twin Bt431 are used on the DECstation's PMAG-AA. @@ -196,28 +199,30 @@ static inline void bt431_position_cursor bt431_write_reg_inc(regs, (y >> 8) & 0x0f); /* BT431_REG_CYHI */ } -static inline void bt431_set_font(struct bt431_regs *regs, u8 fgc, - u16 width, u16 height) +static inline void bt431_set_cursor(struct bt431_regs *regs, + const char *data, const char *mask, + u16 rop, u16 width, u16 height) { + u16 x, y; int i; - u16 fgp = fgc ? 0xffff : 0x0000; - u16 bgp = fgc ? 0x0000 : 0xffff; + i = 0; + width = DIV_ROUND_UP(width, 8); bt431_select_reg(regs, BT431_REG_CRAM_BASE); - for (i = BT431_REG_CRAM_BASE; i <= BT431_REG_CRAM_END; i++) { - u16 value; - - if (height << 6 <= i << 3) - value = bgp; - else if (width <= i % 8 << 3) - value = bgp; - else if (((width >> 3) & 0xffff) > i % 8) - value = fgp; - else - value = fgp & ~(bgp << (width % 8 << 1)); + for (y = 0; y < BT431_CURSOR_SIZE; y++) + for (x = 0; x < BT431_CURSOR_SIZE / 8; x++) { + u16 val = 0; - bt431_write_cmap_inc(regs, value); - } + if (y < height && x < width) { + val = mask[i]; + if (rop == ROP_XOR) + val = (val << 8) | (val ^ data[i]); + else + val = (val << 8) | (val & data[i]); + i++; + } + bt431_write_cmap_inc(regs, val); + } } static inline void bt431_init_cursor(struct bt431_regs *regs) Index: linux-20160211-4maxp64/drivers/video/fbdev/pmag-aa-fb.c =================================================================== --- linux-20160211-4maxp64.orig/drivers/video/fbdev/pmag-aa-fb.c +++ linux-20160211-4maxp64/drivers/video/fbdev/pmag-aa-fb.c @@ -8,6 +8,7 @@ * and Harald Koerfgen , which itself is derived from * "HP300 Topcat framebuffer support (derived from macfb of all things) * Phil Blundell 1998" + * Copyright (c) 2016 Maciej W. Rozycki * * This file is subject to the terms and conditions of the GNU General * Public License. See the file COPYING in the main directory of this @@ -21,37 +22,29 @@ * * 2003-09-21 Thiemo Seufer * Hardware cursor support. + * + * 2016-02-21 Maciej W. Rozycki + * Version 0.03: Rewritten for the new FB and TC APIs. */ -#include -#include + +#include #include -#include -#include -#include -#include -#include #include -#include - -#include -#include -#include - -#include