From patchwork Tue Oct 22 08:05:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 11203915 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42886139A for ; Tue, 22 Oct 2019 08:06:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A2282184C for ; Tue, 22 Oct 2019 08:06:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A2282184C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 077D46E439; Tue, 22 Oct 2019 08:06:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1FB006E432 for ; Tue, 22 Oct 2019 08:05:56 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-78-quF3-_HKNCqdkw3peQ_QqA-1; Tue, 22 Oct 2019 04:05:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2D687800D56; Tue, 22 Oct 2019 08:05:50 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-43.ams2.redhat.com [10.36.116.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 711B65C22C; Tue, 22 Oct 2019 08:05:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BFBCF9D76; Tue, 22 Oct 2019 10:05:46 +0200 (CEST) From: Gerd Hoffmann To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/5] drm/virtio: fix byteorder handling in virtio_gpu_cmd_transfer_{from, to}_host_3d functions Date: Tue, 22 Oct 2019 10:05:44 +0200 Message-Id: <20191022080546.19769-4-kraxel@redhat.com> In-Reply-To: <20191022080546.19769-1-kraxel@redhat.com> References: <20191022080546.19769-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: quF3-_HKNCqdkw3peQ_QqA-1 X-Mimecast-Spam-Score: 0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571731554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GtZmqzFgxn1pwN65/xIkar281NrAbaBtoHehY0Fvb0U=; b=MPjpBRL9wGyDWQl+ejjQRXt0MRy4V0g7pJP1DyR1MNaTus7lYdXR+W0FV2jaNymjqppBZR EReESO5JVyx/ISonpwJ3uBjXNeqb0gXaO2KS4tuiZxiN2j2Hp+xFBMUDqkU7gRuPM3LX4t 3Lq7ycdibw+NjQ+j+4EAHHZkZbTrqOA= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , open list , "open list:VIRTIO GPU DRIVER" , Gerd Hoffmann , Gurchetan Singh MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Be consistent with the rest of the code base. No functional change. In theory this change is incompatible on bigendian machines, but in practice 3d acceleration is supported only on little endian machines, so the affected code paths never run on bigendian machines. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_vq.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index 74ad3bc3ebe8..0bf60914ece2 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -987,7 +987,12 @@ void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev, cmd_p->hdr.type = cpu_to_le32(VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D); cmd_p->hdr.ctx_id = cpu_to_le32(ctx_id); cmd_p->resource_id = cpu_to_le32(bo->hw_res_handle); - cmd_p->box = *box; + cmd_p->box.x = cpu_to_le32(box->x); + cmd_p->box.y = cpu_to_le32(box->y); + cmd_p->box.z = cpu_to_le32(box->z); + cmd_p->box.w = cpu_to_le32(box->w); + cmd_p->box.h = cpu_to_le32(box->h); + cmd_p->box.d = cpu_to_le32(box->d); cmd_p->offset = cpu_to_le64(offset); cmd_p->level = cpu_to_le32(level); @@ -1013,7 +1018,12 @@ void virtio_gpu_cmd_transfer_from_host_3d(struct virtio_gpu_device *vgdev, cmd_p->hdr.type = cpu_to_le32(VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D); cmd_p->hdr.ctx_id = cpu_to_le32(ctx_id); cmd_p->resource_id = cpu_to_le32(bo->hw_res_handle); - cmd_p->box = *box; + cmd_p->box.x = cpu_to_le32(box->x); + cmd_p->box.y = cpu_to_le32(box->y); + cmd_p->box.z = cpu_to_le32(box->z); + cmd_p->box.w = cpu_to_le32(box->w); + cmd_p->box.h = cpu_to_le32(box->h); + cmd_p->box.d = cpu_to_le32(box->d); cmd_p->offset = cpu_to_le64(offset); cmd_p->level = cpu_to_le32(level);