From nobody Mon Feb 9 23:02:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmx.de ARC-Seal: i=1; a=rsa-sha256; t=1652714777; cv=none; d=zohomail.com; s=zohoarc; b=I2pxDIDKoNLVACf41Ok6xxWlmEoFfddw3d22fnlHmcauJjxfYoju7JUPD/RY8+VlLUI4qmaOWCgwjdAid92v8mQDJeTLY6EaSrG+Anfb2xHeHNRHpdTC8mpGI7Y3CZOsMKPWlPvFXCKLLlnS22c+TY59IQtAy2NShR0rsoEhJ08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652714777; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BDSLiY3UChpRFkJOX+FhXXCbPNXrZ6gT4KvgdET51u8=; b=Uj4fLBRazJPPBfDY1Dt9DvXR/WBEoYZmAroTp0FiyawAANSP8nqYizak98WYv63B9rZ8euckMhGKfKuk5Huo40+/Gynw9vaO2dRTO9j5B9L++2UNyvGwlwBPq9RZ0qhbclTmOuIAviqe5ddVooLHR/8pcGOvI25VMVmwgb7149k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1652714777128515.2960136811306; Mon, 16 May 2022 08:26:17 -0700 (PDT) Received: from localhost ([::1]:55382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqcbv-0001WK-UV for importer@patchew.org; Mon, 16 May 2022 11:26:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqc3r-0005ug-CD for qemu-devel@nongnu.org; Mon, 16 May 2022 10:51:03 -0400 Received: from mout.gmx.net ([212.227.17.20]:36719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqc2o-0008DJ-UX for qemu-devel@nongnu.org; Mon, 16 May 2022 10:50:59 -0400 Received: from p100.fritz.box ([92.116.160.68]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M89Gt-1nul2g2UZn-005MPZ; Mon, 16 May 2022 16:49:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1652712577; bh=IVegvxCpCBUiHv40YkCq8PXPOpJUqz8fBzG9sxfbd+o=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=dSqYBojpY5hWU2KtFX2X5vQn+ypPgW5vZzGsosSSzzg1pNNKXb4X9koueCZ4AT6nK QLwrmjYjittnI9MxYOw/9bTw5R0jHzhmPZBp9zxecdL+KeCmqF8J+RkmNIAhn6wpYR P00DXFItFxihimWZtxeJwupf8EsWVjqUCHo+0sxs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c From: Helge Deller To: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Mark Cave-Ayland , Sven Schnelle , qemu-devel@nongnu.org Cc: Stefano Repici , Helge Deller Subject: [PATCH v3 7/7] artist: Fix X cursor position calculation in X11 Date: Mon, 16 May 2022 16:49:34 +0200 Message-Id: <20220516144934.36273-8-deller@gmx.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220516144934.36273-1-deller@gmx.de> References: <20220516144934.36273-1-deller@gmx.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:5zWOUdqzV3qI0ETHwMRlW97+08Z+bMMUKtLhIWIRJkCf4dbZsjz F4y3cIRdggHG0MDfTi6Cjsw+aQc2KTo/WXgV2SPr9+9iwFgycU07llUJTB1rSpQReFax2vQ h/HQ1XPXqCT4vWd+WZxAOopGs8bOAqxyVnJb5EeWjc6cJRavnHgspK/LdGab0/YwtakQDW7 wPHWjM+hIn3GDgyBoP09Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:oT94sTXmRf0=:eosA0ys6Vfe4K4r7uZVfJX DG37l677L7f1ky13kutsF47ZcaauiZv9ttTQbi5dwK1CKcdwIlgcRn7ZHUUwKGyNz63UDfWYs DMQfEx+pw60BRMXEasNBm4jT7mRa//TcaUoxwUY/UDsu0cdip9oJd48CQlZx6zebCmel1iHue G3bFZCCu6MuUu4Dk67dyjpWqGvy5FBC9bUd4ic2DHYy7OyAETqb6iSqIXZ+VVghf5thVLzryK YydjX4wJTRx8ppMtL+y+zPRfSdU3iDQ9/AoeIvNAbroXWtAA7crHDdS4Rfz0Gqklvqil/0mrZ 4nc09hwv6YrmWlz4dWqlb/tquJc1Pe6rxpjiBIIDxmFsvo1Rewrc3tplohrE5zvZt3gX9pHDb uFDgmcVc9MaNVTBw0S5BOIRgCtgHT2o6UWosJELYKOWL1yW0RbUMzG3qz8hp+Rju5OY312yv0 TLrGsNkjly4xPDoB2jOvV/NXAYyupr1ncmmMONLzxDv8o7M0j6+jPtv58RerL8juOzNRJULIu n2brj/1czREMniAVXJXynmPsu83ViebEZrooeBsoZqK8OtRkCDNk2EyYiYieWfJcuIrBNi3At bUon7TUTy3uQlusWzSSuNK/jQ+nli9UvGEeV42OAcRm4titkjqY9/qpcP0srgY4GJ6x3XoRh/ 6kjrw8V4hrtIKQNskZL28o68pYIdQeA7l8xiEue1BQg1jM4UDzCgfmCNgyCDeHIVGicfiQBsn fuCDYBSoowIAcn5DPosq934SW/5WiU+jiJedkQeb9QeCAVQVYEYw7XFtCO0CPFGCrv2Dk/iaF JKU5nFuToWbWsKHdMCkzdrscS/q4rVbdBCrvsUJGKC27f5aVfERrX5NveySdY5sCJ2ZCLqGHq BDMnBU0Te0LTdaOVKZpYa1GGFfDtcMRqpH5JXOvRuoLKmDh/LROyJvN61Gt+/OamwMYd05x6K aO+XhgTzkhvofoXSXI4gC/XqtueBe3HQxskLNvbcL3kECX+64t+FVWVsHgwPHyJPEg8+XXbdC JFo3W0PBJ4dh+6iOESVGaEbJyUVVEv9tHOTUntsJdm8qPybkWIAvU4nU3I9xJvSKYJ8CgggEn wHJLVL9O/zsDzA= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.227.17.20; envelope-from=deller@gmx.de; helo=mout.gmx.net X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FREEMAIL_FROM=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01, T_SPF_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmx.net) X-ZM-MESSAGEID: 1652714777860100001 Content-Type: text/plain; charset="utf-8" The X cursor postion can be calculated based on the backporch and interleave values. In the emulation we ignore the HP-UX settings for backporch and use instead twice the size of the emulated cursor. With those changes the X-position of the graphics cursor is now finally working correctly on HP-UX 10 and HP-UX 11. Based on coding in Xorg X11R6.6 Signed-off-by: Helge Deller --- hw/display/artist.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/hw/display/artist.c b/hw/display/artist.c index 49dad2b824..eadaef0d46 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -1,7 +1,8 @@ /* * QEMU HP Artist Emulation * - * Copyright (c) 2019 Sven Schnelle + * Copyright (c) 2019-2022 Sven Schnelle + * Copyright (c) 2022 Helge Deller * * This work is licensed under the terms of the GNU GPL, version 2 or late= r. */ @@ -313,19 +314,15 @@ static void artist_rop8(ARTISTState *s, struct vram_b= uffer *buf, static void artist_get_cursor_pos(ARTISTState *s, int *x, int *y) { /* - * Don't know whether these magic offset values are configurable via - * some register. They seem to be the same for all resolutions. - * The cursor values provided in the registers are: - * X-value: -295 (for HP-UX 11) and 338 (for HP-UX 10.20) up to 2265 - * Y-value: 1146 down to 0 * The emulated Artist graphic is like a CRX graphic, and as such * it's usually fixed at 1280x1024 pixels. - * Because of the maximum Y-value of 1146 you can not choose a higher - * vertical resolution on HP-UX (unless you disable the mouse). + * Other resolutions may work, but no guarantee. */ - static int offset =3D 338; - int lx; + unsigned int hbp_times_vi, horizBackPorch; + int16_t xHi, xLo; + const int videoInterleave =3D 4; + const int pipelineDelay =3D 4; /* ignore if uninitialized */ if (s->cursor_pos =3D=3D 0) { @@ -333,16 +330,23 @@ static void artist_get_cursor_pos(ARTISTState *s, int= *x, int *y) return; } - lx =3D artist_get_x(s->cursor_pos); - if (lx < offset) { - offset =3D lx; - } - *x =3D (lx - offset) / 2; + /* + * Calculate X position based on backporch and interleave values. + * Based on code from Xorg X11R6.6 + */ + horizBackPorch =3D ((s->horiz_backporch & 0xff0000) >> 16) + + ((s->horiz_backporch & 0xff00) >> 8) + 2; + hbp_times_vi =3D horizBackPorch * videoInterleave; + xHi =3D s->cursor_pos >> 19; + *x =3D ((xHi + pipelineDelay) * videoInterleave) - hbp_times_vi; + + xLo =3D (s->cursor_pos >> 16) & 0x07; + *x +=3D ((xLo - hbp_times_vi) & (videoInterleave - 1)) + 8 - 1; /* subtract cursor offset from cursor control register */ *x -=3D (s->cursor_cntrl & 0xf0) >> 4; - /* height minus nOffscreenScanlines is stored in cursor control regist= er */ + /* Calculate Y position */ *y =3D s->height - artist_get_y(s->cursor_pos); *y -=3D (s->cursor_cntrl & 0x0f); @@ -1056,6 +1060,8 @@ static void artist_reg_write(void *opaque, hwaddr add= r, uint64_t val, break; case HORIZ_BACKPORCH: + /* overwrite HP-UX settings to fix X cursor position. */ + val =3D (NGLE_MAX_SPRITE_SIZE << 16) + (NGLE_MAX_SPRITE_SIZE << 8); combine_write_reg(addr, val, size, &s->horiz_backporch); break; -- 2.35.3