From patchwork Wed Jun 5 20:13:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 49602 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9185:0:b0:460:55fa:d5ed with SMTP id s5csp5297vqg; Wed, 5 Jun 2024 13:13:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVe0WYwOM9rJS1nJkgONdZl7c0tokj5fNM/k6C6Qi2RDk424gTKxCzmu2Hn/kbt2gw+o1JZnVFD64kE7u97qN6BkeSIppaX0VnqNw== X-Google-Smtp-Source: AGHT+IGDQbfuz02f0tyuJYlEn3MhIPd0qBRqv5J4GP4Yx/PWCvAzccSLAxMlrYHUuhwjs8hj0p50 X-Received: by 2002:a17:907:2918:b0:a62:49ae:cd7b with SMTP id a640c23a62f3a-a6c762bcc38mr50157666b.24.1717618381562; Wed, 05 Jun 2024 13:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717618381; cv=none; d=google.com; s=arc-20160816; b=zUI1CRbtgDMjTfOzEeWUM9h6Rzb+IbhU5CcbTfwHxmWtyXxIM0r2W3wH58MOf8hAXI V/Gtxp431ZBpfr8LHg1gXswmtvZY0O5h+KW59t4BDfpLwqGY2Fz+PdChAmjaJ1WoiZBs 9+m8dITfqFL98uvcsav3KNHE5YHjxfQVIGlLWmX0Ci45o9ZmtaUGknJtUcpCltWLpEJs 6VunBhbgv0XVZcLwmvetCqAEUSoXYPGyJHFM2ZUxH1ej9iEeVcTEJ1PwjUK44ECTO0cy 2pTwftvommUMjx1QXHXuQmNiyCpkbicRxNAaddi+87QIzU1sxCfTx9563u0FLDddo3XW ooJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=WSSVS4Z2//nrwR1nd0uOB1pOtHDtCowL173ioU7Pt54=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=jcmF35cX4fakv/iA+97c4QAyh+1TMWvtsj1xr0rnpSCimgglndecRAMo6WD/ZsJvdf MTqM7meIggsfG4k0cMqvRjQBpKgpxoEMdDZA/jpnu6rVOvzlOL/nOfBQgdl7bhK0SLvj Exik09NSIPPLekTbvyBdrqzaIkaWXlN0qQZz1AvwUR77OSWspeJeByuEYuyT2PJqtVhe j/J5Cx7lApJLNi6XKx8T5cLcBBRWSSkGhcYvwkOO15w8jBQGj6do5C2YL0Atd2QwJE6t BsnEnUamg1qOp+VSopXc4mzLaTXZC7YuyRDTizxVLM0AulhPA3JwMtgr1UhXDY3f6IA3 aTfA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20230601.gappssmtp.com header.s=20230601 header.b=k7Kocoeu; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a6b603ed909si79848366b.922.2024.06.05.13.13.01; Wed, 05 Jun 2024 13:13:01 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20230601.gappssmtp.com header.s=20230601 header.b=k7Kocoeu; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EEB0E68D6F3; Wed, 5 Jun 2024 23:12:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3C57A68D4EF for ; Wed, 5 Jun 2024 23:12:44 +0300 (EEST) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4213b94b7e7so1033615e9.0 for ; Wed, 05 Jun 2024 13:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20230601.gappssmtp.com; s=20230601; t=1717618363; x=1718223163; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4Y7gsEo/G6c52ERgQd4NaOjZ2TFijUsMTQ9fh06gdTQ=; b=k7KocoeuZ2zc930QnC0fUc0TsHLqdG8xFsVPWC2whU7lfSvvnBoc9LKC4xxbBqRJP0 /UWyHPu7R18iWapFSx1k0gMoSFXtzKKNxXN7lGQdsLi+ZS1JtGLuPxtLNOCiP9pmBlZ2 QS6LZbnT7QqRi0z8+wV3gMrQ/y3r22NSLv85NnfefEEqzjUn/Gcg5JsHN2maxj6stl3A vLr7BKtPJZuQtGJiIJO08vE3BayIgKUKBD6GHZpMU83RpKjwwlTggruA4XMwjFIFcO7E JzoZaaOvMok4rU3QkY2hvbpDFLnjtVQ1+ljaqM3j9sl6zfMcU8E1WOholKFDh3oMrQDO WYTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717618363; x=1718223163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4Y7gsEo/G6c52ERgQd4NaOjZ2TFijUsMTQ9fh06gdTQ=; b=Y0euEGkB3dBWFcduCzobXWJ5u0efl7d+vPCpxIc6ObAj0xrc8gbq5d3uDVoeM/cS6x GmQczcNhTSVRWoMtXhGyjW0ic1vDw1MyRmG8pdSBInh1LWjbpDIecY7/D2TFwTcPJtXo 530qXueUQGrGfhSUFDYZL2tYWBgNjXok2d/u9g3ylgeLue9GODos78LAbRqvmYhegTeO NXQQEA+DJVyhc0HRiXF6pDKQzI45lr/IO8ykxAKui3WQQI4V/X3H9sc/gWO0Axy18xI9 mB/J9678HAs8MgGGC2YTEMw8e7gc/tbafU75rsVIPGbLitG5qYSJburxgHJ0gvf9W3VR LC1g== X-Gm-Message-State: AOJu0YxBYN+ovX4Jb1YfmWpV1I2L9K58kEhxNmtQRLkk7y9CNoTnE4Tn NU4Nu+pBEBnZUWLLf17UEUdl8kPrRrjz1/oKvkmtYkh4o4SvSO81ZeCl67WAoTfjjH5FuQPMMH4 f X-Received: by 2002:a05:6000:12cc:b0:354:d382:dcb9 with SMTP id ffacd0b85a97d-35ef0d84994mr588219f8f.15.1717618363530; Wed, 05 Jun 2024 13:12:43 -0700 (PDT) Received: from localhost.localdomain (cpc92302-cmbg19-2-0-cust1183.5-4.cable.virginm.net. [82.1.212.160]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42158101c07sm33361825e9.7.2024.06.05.13.12.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 13:12:43 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Jun 2024 21:13:04 +0100 Message-ID: <20240605201310.2343779-2-sw@jkqxz.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605201310.2343779-1-sw@jkqxz.net> References: <20240605201310.2343779-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 2/2] hwcontext_vaapi: Deprecate quirks X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: d0RwrfKr2e4P These only apply to obsolete drivers which do not work with the now-required libva 2.x. --- Fixed checkheaders. libavutil/hwcontext_vaapi.c | 123 ++++++++++-------------------------- libavutil/hwcontext_vaapi.h | 17 +++++ 2 files changed, 52 insertions(+), 88 deletions(-) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index caff43d1ae..8591fb88ac 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -243,8 +243,7 @@ static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev, unsigned int fourcc; int err, i, j, attr_count, pix_fmt_count; - if (config && - !(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) { + if (config) { attr_count = 0; vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id, 0, &attr_count); @@ -367,23 +366,6 @@ fail: return err; } -static const struct { - const char *friendly_name; - const char *match_string; - unsigned int quirks; -} vaapi_driver_quirks_table[] = { - { - "Intel iHD", - "ubit", - AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE, - }, - { - "VDPAU wrapper", - "Splitted-Desktop Systems VDPAU backend for VA-API", - AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES, - }, -}; - static int vaapi_device_init(AVHWDeviceContext *hwdev) { VAAPIDeviceContext *ctx = hwdev->hwctx; @@ -436,36 +418,6 @@ static int vaapi_device_init(AVHWDeviceContext *hwdev) if (vendor_string) av_log(hwdev, AV_LOG_VERBOSE, "VAAPI driver: %s.\n", vendor_string); - if (hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_USER_SET) { - av_log(hwdev, AV_LOG_VERBOSE, "Using quirks set by user (%#x).\n", - hwctx->driver_quirks); - } else { - // Detect the driver in use and set quirk flags if necessary. - hwctx->driver_quirks = 0; - if (vendor_string) { - for (i = 0; i < FF_ARRAY_ELEMS(vaapi_driver_quirks_table); i++) { - if (strstr(vendor_string, - vaapi_driver_quirks_table[i].match_string)) { - av_log(hwdev, AV_LOG_VERBOSE, "Matched driver string " - "as known nonstandard driver \"%s\", setting " - "quirks (%#x).\n", - vaapi_driver_quirks_table[i].friendly_name, - vaapi_driver_quirks_table[i].quirks); - hwctx->driver_quirks |= - vaapi_driver_quirks_table[i].quirks; - break; - } - } - if (!(i < FF_ARRAY_ELEMS(vaapi_driver_quirks_table))) { - av_log(hwdev, AV_LOG_VERBOSE, "Driver not found in known " - "nonstandard list, using standard behaviour.\n"); - } - } else { - av_log(hwdev, AV_LOG_VERBOSE, "Driver has no vendor string, " - "assuming standard behaviour.\n"); - } - } - av_free(image_list); return 0; fail: @@ -562,48 +514,43 @@ static int vaapi_frames_init(AVHWFramesContext *hwfc) } if (!hwfc->pool) { - if (!(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) { - int need_memory_type = !(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE); - int need_pixel_format = 1; - for (i = 0; i < avfc->nb_attributes; i++) { - if (avfc->attributes[i].type == VASurfaceAttribMemoryType) - need_memory_type = 0; - if (avfc->attributes[i].type == VASurfaceAttribPixelFormat) - need_pixel_format = 0; - } - ctx->nb_attributes = - avfc->nb_attributes + need_memory_type + need_pixel_format; + int need_memory_type = 1; + int need_pixel_format = 1; + for (i = 0; i < avfc->nb_attributes; i++) { + if (avfc->attributes[i].type == VASurfaceAttribMemoryType) + need_memory_type = 0; + if (avfc->attributes[i].type == VASurfaceAttribPixelFormat) + need_pixel_format = 0; + } + ctx->nb_attributes = + avfc->nb_attributes + need_memory_type + need_pixel_format; - ctx->attributes = av_malloc(ctx->nb_attributes * - sizeof(*ctx->attributes)); - if (!ctx->attributes) { - err = AVERROR(ENOMEM); - goto fail; - } + ctx->attributes = av_malloc(ctx->nb_attributes * + sizeof(*ctx->attributes)); + if (!ctx->attributes) { + err = AVERROR(ENOMEM); + goto fail; + } - for (i = 0; i < avfc->nb_attributes; i++) - ctx->attributes[i] = avfc->attributes[i]; - if (need_memory_type) { - ctx->attributes[i++] = (VASurfaceAttrib) { - .type = VASurfaceAttribMemoryType, - .flags = VA_SURFACE_ATTRIB_SETTABLE, - .value.type = VAGenericValueTypeInteger, - .value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA, - }; - } - if (need_pixel_format) { - ctx->attributes[i++] = (VASurfaceAttrib) { - .type = VASurfaceAttribPixelFormat, - .flags = VA_SURFACE_ATTRIB_SETTABLE, - .value.type = VAGenericValueTypeInteger, - .value.value.i = desc->fourcc, - }; - } - av_assert0(i == ctx->nb_attributes); - } else { - ctx->attributes = NULL; - ctx->nb_attributes = 0; + for (i = 0; i < avfc->nb_attributes; i++) + ctx->attributes[i] = avfc->attributes[i]; + if (need_memory_type) { + ctx->attributes[i++] = (VASurfaceAttrib) { + .type = VASurfaceAttribMemoryType, + .flags = VA_SURFACE_ATTRIB_SETTABLE, + .value.type = VAGenericValueTypeInteger, + .value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA, + }; + } + if (need_pixel_format) { + ctx->attributes[i++] = (VASurfaceAttrib) { + .type = VASurfaceAttribPixelFormat, + .flags = VA_SURFACE_ATTRIB_SETTABLE, + .value.type = VAGenericValueTypeInteger, + .value.value.i = desc->fourcc, + }; } + av_assert0(i == ctx->nb_attributes); ctx->rt_format = desc->rt_format; diff --git a/libavutil/hwcontext_vaapi.h b/libavutil/hwcontext_vaapi.h index 0b2e071cb3..91d13d1f16 100644 --- a/libavutil/hwcontext_vaapi.h +++ b/libavutil/hwcontext_vaapi.h @@ -21,6 +21,8 @@ #include +#include "attributes.h" + /** * @file * API-specific header for AV_HWDEVICE_TYPE_VAAPI. @@ -37,18 +39,24 @@ enum { /** * The quirks field has been set by the user and should not be detected * automatically by av_hwdevice_ctx_init(). + * + * @deprecated Driver quirks are no longer used. */ AV_VAAPI_DRIVER_QUIRK_USER_SET = (1 << 0), /** * The driver does not destroy parameter buffers when they are used by * vaRenderPicture(). Additional code will be required to destroy them * separately afterwards. + * + * @deprecated Driver quirks are no longer used. */ AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS = (1 << 1), /** * The driver does not support the VASurfaceAttribMemoryType attribute, * so the surface allocation code will not try to use it. + * + * @deprecated Driver quirks are no longer used. */ AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2), @@ -56,6 +64,8 @@ enum { * The driver does not support surface attributes at all. * The surface allocation code will never pass them to surface allocation, * and the results of the vaQuerySurfaceAttributes() call will be faked. + * + * @deprecated Driver quirks are no longer used. */ AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = (1 << 3), }; @@ -76,7 +86,14 @@ typedef struct AVVAAPIDeviceContext { * AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user * may need to refer to this field when performing any later * operations using VAAPI with the same VADisplay. + * + * @deprecated This was used with libva before the 2.x to support + * various drivers which had behaviour not fully + * matching the specification. Since libva 2.x this is + * no longer used; setting this field has no effect and + * new code must ignore it. */ + attribute_deprecated unsigned int driver_quirks; } AVVAAPIDeviceContext;