From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 62EA94A741 for ; Sun, 5 May 2024 19:02:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E41B868D5DD; Sun, 5 May 2024 22:01:50 +0300 (EEST) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 99B4B68D5B6 for ; Sun, 5 May 2024 22:01:42 +0300 (EEST) Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2dfb4ea2bbfso13959651fa.2 for ; Sun, 05 May 2024 12:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20230601.gappssmtp.com; s=20230601; t=1714935702; x=1715540502; 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=tXdLeqh5EF6v6anu76mUx9Mkvrxx7jt2zR2TATOIVHk=; b=2xMDdK6cykNZrkDFICD4StSxuN1lV8hXWPJaLpRc1pGooN9OHsOkxy2lvB3Umigerd +M4utL2kE0ul9UnxKbTeG9I5IpB1wiHEUFmBjmSO+7TmU6aY/LfR3rOyJwhbZPjCq9/9 xqwhZ4+fcf6+uY4+0C4WKBF72ySzwyoJYy2wen6gG2S1uFhxr77MNYFYDFBtm/RxqGQC 7fDGmJfxNvcldHnI/Yg9PgH5tpL6BZHn4/N4vHioCJQWMaQpqExHYg7nFQGkliL2y3QR og6x1+RCHGTQzNUM09SOqUcD6Hgq7mnQeqy2a9ZNKbleCkWES5AwPqeIfMsaSfrRSl7g Y/IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714935702; x=1715540502; 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=tXdLeqh5EF6v6anu76mUx9Mkvrxx7jt2zR2TATOIVHk=; b=KbzAKCimSVDCns0q+LkWoh3Yq41vcBt5i0Jr4OUF6YiiLXoEuXV/rNn2P5JBuyGknf tbhKOz15laMYbwFy6WK0oBdTw7yxs49kn01bbNVyLPDIjcbOBLEfpmeu94ezx5PD7q8d BghvxvtZy2QgXvZRvIx+wKBND8CxbohCh/B/cvhBF5je3XHWkBCKumjST2rYXK2k0vbB FidswyGQFhvCDiBJNV/dugcLjyOSHaK2cHf1pbmFIM3/FwfG4WfLilKfsCRJ73nJ3Tux +76y1mf3QUST1N5rzI+V5luoP/ZV9yOXmxYYaOxaM5I34is72s63er9Hy+UYiVCCVEON pVhQ== X-Gm-Message-State: AOJu0YzxRSy0/Ac9R+gbow1C54+FtfCpPE5Qipi8oN+m7all16fjqImd ZfMS2lixu2+H4hq/oIXm29zO/EC3xs1ubHuLcGHzFXSscYH9VgHBdC/jiJboxnqshcxPnSXMB59 0 X-Google-Smtp-Source: AGHT+IGnDj1eFjtVkQAc7/7wMnzUS7Mk3HTwgJLZTw6wk+8LXAmKtNiirzsojtmnnIDzW0qPt3cVmg== X-Received: by 2002:a2e:86da:0:b0:2e2:7e28:602e with SMTP id n26-20020a2e86da000000b002e27e28602emr3812285ljj.9.1714935701472; Sun, 05 May 2024 12:01:41 -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 s14-20020adfe00e000000b0034e553f6174sm7292523wrh.98.2024.05.05.12.01.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 12:01:41 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sun, 5 May 2024 20:01:47 +0100 Message-ID: <20240505190154.90781-5-sw@jkqxz.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240505190154.90781-1-sw@jkqxz.net> References: <20240505190154.90781-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 5/5] 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: These only apply to obsolete drivers which do not work with the now-required libva 2.x. --- libavutil/hwcontext_vaapi.c | 123 ++++++++++-------------------------- libavutil/hwcontext_vaapi.h | 15 +++++ 2 files changed, 50 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..acd72eee6d 100644 --- a/libavutil/hwcontext_vaapi.h +++ b/libavutil/hwcontext_vaapi.h @@ -37,18 +37,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 +62,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 +84,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; -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".