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 60A7647DFE for ; Fri, 27 Oct 2023 17:02:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7C0F168CB3B; Fri, 27 Oct 2023 20:02:48 +0300 (EEST) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3D92368CAE1 for ; Fri, 27 Oct 2023 20:02:42 +0300 (EEST) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-40842752c6eso17888555e9.1 for ; Fri, 27 Oct 2023 10:02:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20230601.gappssmtp.com; s=20230601; t=1698426161; x=1699030961; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=actb08npfyrN0pOVh/NozEFFE4l17FyRdjDGwQk9i5w=; b=l+2ueeaWg7aDAhdEmp3OFo/Fg8Avwd5aqXDB+Htq6pSvfFRQr5HMPiY9EAw/P45FuI mavSgeu6MzwD6UG4cMIlHfK5NzFizObrXX09UsSo+HQ2EAANitu8/kCCP4X3e4XIE6OC xDR/H5yTUwcGuxHuc4gFpBWd/Zog0IkQNpL7EdveF/A0eWG3BMVQlYdT+DlocUKFNXTo dV0NVtTMfRr8EG5Yv6pgdmxszpnMStVw3MPyqeisZrnYYMaD8CP8/fn7Wetlvqdg3fiN r55HTo87u5p+ZsKwyDcBhWa3TudQvzXBUMdwieE2veW16H6dthlB/TDPFOcc4DtmEAde F8Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698426161; x=1699030961; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=actb08npfyrN0pOVh/NozEFFE4l17FyRdjDGwQk9i5w=; b=VrW1QB+ETWA01/Lh2CFfXGvRfEN0bOtUiO84JL9ioSrO67IMsFvEGXybYJjR76HLZ6 7E/o/WlxeqUNK/3tSfaXLFYiud7m9+YJ/0qoCdMsqojjxoWBS4qKc/phkGMtSfyF4YIX 5xOgs+Y7XfleVfvPEyqzAQD5vmcBVZ8EHmRYtMaQYDczsH6DUjbWr6+WaffsfePPUvkY rziFJsHqBlKqn3tBvkC9+NcOBLzByDztCeuhlDi+mzFFpyBdTr6ZmSVhUP/+u6F2Fy8t LvneulXgd+Mc4Rg16ZaQCSZkIcLEmTDEx/AQo27JzLNzm7cTnZDwQPsGFFkF39bHcAHd sFMQ== X-Gm-Message-State: AOJu0YwN7OUjmTtZ1tqna/X8XA7G1Cl65LOaI0PsjNIt5lF2IQGC94IM d0c6eRqaROi12Ajxb4ETz0Hol4TcD8xBriBAtfA= X-Google-Smtp-Source: AGHT+IFYXegCXioKOH6JzGVNyDzXCYV0ILHQMCa2/zSAjfuuHTbnu2fneAfvP//TfR8gb2fwnZ1RTA== X-Received: by 2002:a05:600c:4e91:b0:405:7b92:4558 with SMTP id f17-20020a05600c4e9100b004057b924558mr3071762wmq.38.1698426161324; Fri, 27 Oct 2023 10:02:41 -0700 (PDT) Received: from [192.168.0.15] (cpc92320-cmbg19-2-0-cust383.5-4.cable.virginm.net. [82.13.65.128]) by smtp.gmail.com with ESMTPSA id s10-20020a05600c45ca00b0040772138bb7sm5562498wmo.2.2023.10.27.10.02.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Oct 2023 10:02:41 -0700 (PDT) Message-ID: <8a153ac7-9baa-42e2-97a1-e76002b9ed3f@jkqxz.net> Date: Fri, 27 Oct 2023 18:02:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20231027153701.246497-1-quinkblack@foxmail.com> From: Mark Thompson In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 2/2] avutil/hwcontext_vaapi: return ENOSYS for unsupported operation 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 27/10/2023 16:37, Zhao Zhili wrote: > From: Zhao Zhili > > av_hwframe_transfer_data try with src_ctx first. If the operation > failed with AVERROR(ENOSYS), it will try again with dst_ctx. Return > AVERROR(EINVAL) makes the second step being skipped. > --- > libavutil/hwcontext_vaapi.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c > index 558fed94c6..bb28bcf588 100644 > --- a/libavutil/hwcontext_vaapi.c > +++ b/libavutil/hwcontext_vaapi.c > @@ -217,7 +217,7 @@ static int vaapi_get_image_format(AVHWDeviceContext *hwdev, > return 0; > } > } > - return AVERROR(EINVAL); > + return AVERROR(ENOSYS); > } > > static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev, > @@ -805,19 +805,19 @@ static int vaapi_map_frame(AVHWFramesContext *hwfc, > > if (!ctx->derive_works && (flags & AV_HWFRAME_MAP_DIRECT)) { > // Requested direct mapping but it is not possible. > - return AVERROR(EINVAL); > + return AVERROR(ENOSYS); > } > if (dst->format == AV_PIX_FMT_NONE) > dst->format = hwfc->sw_format; > if (dst->format != hwfc->sw_format && (flags & AV_HWFRAME_MAP_DIRECT)) { > // Requested direct mapping but the formats do not match. > - return AVERROR(EINVAL); > + return AVERROR(ENOSYS); This one seems wrong? The user requested that (say) a YUV surface is directly mapped to an RGB frame. That's an invalid request from the user, not an unsupported feature. If you're changing the return values then this test and the previous one probably want to therefore be in the opposite order as well. > } > > err = vaapi_get_image_format(hwfc->device_ctx, dst->format, &image_format); > if (err < 0) { > // Requested format is not a valid output format. > - return AVERROR(EINVAL); > + return err; > } > > map = av_malloc(sizeof(*map)); > @@ -992,7 +992,7 @@ static int vaapi_map_to_memory(AVHWFramesContext *hwfc, AVFrame *dst, > if (dst->format != AV_PIX_FMT_NONE) { > err = vaapi_get_image_format(hwfc->device_ctx, dst->format, NULL); > if (err < 0) > - return AVERROR(ENOSYS); > + return err; > } > > err = vaapi_map_frame(hwfc, dst, src, flags); - Mark _______________________________________________ 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".