From patchwork Mon Aug 14 23:22:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 9900401 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 8453C602CA for ; Mon, 14 Aug 2017 23:23:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7702628777 for ; Mon, 14 Aug 2017 23:23:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BBE22877A; Mon, 14 Aug 2017 23:23:01 +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 A586228777 for ; Mon, 14 Aug 2017 23:23:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA2596E256; Mon, 14 Aug 2017 23:22:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7F5A16E256 for ; Mon, 14 Aug 2017 23:22:58 +0000 (UTC) Received: by mail-pg0-x241.google.com with SMTP id 123so12833270pga.5 for ; Mon, 14 Aug 2017 16:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jlekstrand-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=Mx8TQoZJ5YWQEsiIZVCTri1njWQcjU+XxXXrZY18DIU=; b=mVFV9Ne6Byjqf46vZWLSRnAo6rdKKNqdN3A4xhRlLLqordH4D9lRCRPTUbu3X8F7kU FFXnpcy4KT2r8c5IlskDVyk7q9u+tuEUI/fZBCuIDag/Up4BScWQbOg2R98xPsE1WH5e ZRyeWJ0TpeayOHkIB/i4jjGEuBmaAAk31rmhgNoV5GHTM1AH3SZZnhE8mTc0v9dINp5C aWwJKCQrykER+GwVYjfmCps8i3uRYf5Ce2hReWQGn2ZFJbejF9uvG9abbjnIdtT9Tcny 7EhpFghgW9BPhE2hZ56JRXOJJHYFaZ4/mRIddmysNDTW/1MivQfZUI52ii8xmcQGGwwA E+WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Mx8TQoZJ5YWQEsiIZVCTri1njWQcjU+XxXXrZY18DIU=; b=JciU32+cHfuv11L2aIyi1NNKvvKLOi7MOH4fwaguJbOEpo6yZtwJufDIU61aLD95GT 5IC2lUHvsVeYEPCdiR+gR1VmACmP4qe5sHle2eZgIQMJqwgs0aLm6mfkI1RVuZdIvy12 9qU+OFcLGO6qhAoXbez15wug7PUWJu2t9Qa/xzfobZObUPCC3Y1pzRTQrjcAgiMqhILP 17YP6Ki8G0UvWmfxDunGvnujLDeKkPluAlbGfHtqeZGeCj8LQGmdsE+kqvhipFIXPyRm weTj3AV2CV1B3E0VCglwNXvWznxwWf2GJlJIp2wMlDNTZi60T/bVUmpA/p0k3FuOBQgm 2Fhw== X-Gm-Message-State: AHYfb5jFryWnJ8T7t16qwFIt96Gi1y627IfjIjHZnSQQVjyL0VOenGF5 n6nCONDtJ79ijXWSikzDuA== X-Received: by 10.84.134.164 with SMTP id 33mr29055802plh.378.1502752977273; Mon, 14 Aug 2017 16:22:57 -0700 (PDT) Received: from omlet.ak.intel.com (fmdmzpr04-ext.fm.intel.com. [192.55.54.39]) by smtp.gmail.com with ESMTPSA id 74sm24856752pfk.58.2017.08.14.16.22.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Aug 2017 16:22:55 -0700 (PDT) From: Jason Ekstrand X-Google-Original-From: Jason Ekstrand To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm] drm: Pull new modifier uapi into drm_fourcc and drm_mode Date: Mon, 14 Aug 2017 16:22:51 -0700 Message-Id: <1502752971-11887-1-git-send-email-jason.ekstrand@intel.com> X-Mailer: git-send-email 2.5.0.400.gff86faf Cc: Jason Ekstrand , Daniel Stone 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Daniel Stone Reviewed-by: Daniel Stone --- include/drm/drm_fourcc.h | 31 ++++++++++++++++++++++++++++++ include/drm/drm_mode.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index 7586c46..3ad838d 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -185,6 +185,8 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 /* add more to the end as needed */ +#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) + #define fourcc_mod_code(vendor, val) \ ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffffffffffffffULL)) @@ -197,6 +199,15 @@ extern "C" { */ /* + * Invalid Modifier + * + * This modifier can be used as a sentinel to terminate the format modifiers + * list, or to initialize a variable with an invalid modifier. It might also be + * used to report an error back to userspace for certain APIs. + */ +#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) + +/* * Linear Layout * * Just plain linear layout. Note that this is different from no specifying any @@ -253,6 +264,26 @@ extern "C" { #define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3) /* + * Intel color control surface (CCS) for render compression + * + * The framebuffer format must be one of the 8:8:8:8 RGB formats. + * The main surface will be plane index 0 and must be Y/Yf-tiled, + * the CCS will be plane index 1. + * + * Each CCS tile matches a 1024x512 pixel area of the main surface. + * To match certain aspects of the 3D hardware the CCS is + * considered to be made up of normal 128Bx32 Y tiles, Thus + * the CCS pitch must be specified in multiples of 128 bytes. + * + * In reality the CCS tile appears to be a 64Bx64 Y tile, composed + * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks. + * But that fact is not relevant unless the memory is accessed + * directly. + */ +#define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4) +#define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5) + +/* * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks * * Macroblocks are laid in a Z-shape, and each pixel data is following the diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 70571af..0807797 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h @@ -657,6 +657,56 @@ struct drm_mode_atomic { __u64 user_data; }; +struct drm_format_modifier_blob { +#define FORMAT_BLOB_CURRENT 1 + /* Version of this blob format */ + __u32 version; + + /* Flags */ + __u32 flags; + + /* Number of fourcc formats supported */ + __u32 count_formats; + + /* Where in this blob the formats exist (in bytes) */ + __u32 formats_offset; + + /* Number of drm_format_modifiers */ + __u32 count_modifiers; + + /* Where in this blob the modifiers exist (in bytes) */ + __u32 modifiers_offset; + + /* u32 formats[] */ + /* struct drm_format_modifier modifiers[] */ +}; + +struct drm_format_modifier { + /* Bitmask of formats in get_plane format list this info applies to. The + * offset allows a sliding window of which 64 formats (bits). + * + * Some examples: + * In today's world with < 65 formats, and formats 0, and 2 are + * supported + * 0x0000000000000005 + * ^-offset = 0, formats = 5 + * + * If the number formats grew to 128, and formats 98-102 are + * supported with the modifier: + * + * 0x0000003c00000000 0000000000000000 + * ^ + * |__offset = 64, formats = 0x3c00000000 + * + */ + __u64 formats; + __u32 offset; + __u32 pad; + + /* The modifier that applies to the >get_plane format list bitmask. */ + __u64 modifier; +}; + /** * Create a new 'blob' data property, copying length bytes from data pointer, * and returning new blob ID.