From patchwork Tue Sep 3 01:02:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 14869 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 90D9844A04C for ; Tue, 3 Sep 2019 04:05:28 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ADF74687FEA; Tue, 3 Sep 2019 04:03:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DF9DB687FEF for ; Tue, 3 Sep 2019 04:03:29 +0300 (EEST) Received: by mail-ot1-f68.google.com with SMTP id o101so15044162ota.8 for ; Mon, 02 Sep 2019 18:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tmm1-net.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lpl4eFjdfRIkDtFj9+STfQVfdlFudUcAbw5Eo93Bn50=; b=db2yYqKrPq9d1fa0U4sVGOKcW/boUROLjbeSo9cQcRpndmTnS6v5RNjMU+NroRB/Yu szcj3uBRlnz2NosTbAqs3wfV4X0o/CjfwCqpZyW3ibZTcGlZc3X/xc5R2CWer2LW//lM vFxVZ7Vv3zeF/lZIJE+piUp8Z6iMSmaFvPh+WFYw3VVpdbZyPpsA9QU35tft7zn6CWhn B4lpzLWdbV0BVsPB9+Yt61FCIQsQVLvG9oElq0SP6HkJqwrcCAQDDbd5aPfsPnikv2TG 7E0Gbq45Uw3hNFHHTV5c1JMKqRNcGKv9QysBM0pePTrMTF7lWnyQNBK0nCPKaFAZ3S1w JInA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=lpl4eFjdfRIkDtFj9+STfQVfdlFudUcAbw5Eo93Bn50=; b=Fk0WFGMYYLX5696MQa3ZOzQpqO4zA92oV2RhwQDtNK216/NnHmBPsopLcgIvAnnr0k rBjDMC0IDmHyWb5aaN5g4jHgU++mCQl8uEclVC5ZJzcEavz3ugy5p9roXZBmt9n4XihY uYP3krEQV9IUMRmBIdyYLnCR/LFD7K07mWpqHAYakAfl3yebalPqxvdamtvLxcYvic09 0lBBhzTQ6vZnEMOx+OgDmEtJzgyHCmSprvFHTyxsbOrhDRjrmgv+cdGxSX83ppc8NMZi mY8tzBlOzXv7UOwVb6H8ef6RHQp9TtqfK4HM6RHMFBFf/Of/NRwN1zDAPzcrO3/sIsUX ro2g== X-Gm-Message-State: APjAAAXjUHzIYrg07HVoVaJSb0sYpCQRAEKPVEXSIpWIPtAyepmYjLwO mGFI0KBLuSuzoWi9QlZxW2ko9wXnN+s= X-Google-Smtp-Source: APXvYqwgaGo1eIUtoIax1o/wm3CxTHV1nsiwJ0UsWH9EQg33IigygUJwYEQcCPz7J1ALT5F42lhUkg== X-Received: by 2002:a9d:2f09:: with SMTP id h9mr13312474otb.21.1567472608331; Mon, 02 Sep 2019 18:03:28 -0700 (PDT) Received: from tmm1-imac.lan (ip184-189-221-177.sb.sd.cox.net. [184.189.221.177]) by smtp.gmail.com with ESMTPSA id a21sm4299633oie.9.2019.09.02.18.03.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Sep 2019 18:03:27 -0700 (PDT) From: Aman Gupta To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Sep 2019 18:02:30 -0700 Message-Id: <20190903010230.96236-26-ffmpeg@tmm1.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190903010230.96236-1-ffmpeg@tmm1.net> References: <20190903010230.96236-1-ffmpeg@tmm1.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 25/25] hwcontext_drm: do not require drm device X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Jonas Karlman , Aman Gupta , Aman Gupta , lorusak@gmail.com, jorge.ramirez.ortiz@gmail.com Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Jonas Karlman This allows the cli to create a dummy drm hwcontext that can be shared between the v4l2 decoder/scaler/encoder. This is especially useful on older RPI3 where /dev/dri devices are not available in the default configuration. Signed-off-by: Jonas Karlman Signed-off-by: Aman Gupta --- libavutil/hwcontext_drm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavutil/hwcontext_drm.c b/libavutil/hwcontext_drm.c index 32cbde82eb..aa4794c5e6 100644 --- a/libavutil/hwcontext_drm.c +++ b/libavutil/hwcontext_drm.c @@ -43,6 +43,11 @@ static int drm_device_create(AVHWDeviceContext *hwdev, const char *device, AVDRMDeviceContext *hwctx = hwdev->hwctx; drmVersionPtr version; + if (device == NULL) { + hwctx->fd = -1; + return 0; + } + hwctx->fd = open(device, O_RDWR); if (hwctx->fd < 0) return AVERROR(errno);