From patchwork Tue May 19 09:03:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 6435131 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6D6419F1C1 for ; Tue, 19 May 2015 09:03:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D7BD2037E for ; Tue, 19 May 2015 09:03:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 942FA20377 for ; Tue, 19 May 2015 09:03:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755328AbbESJDE (ORCPT ); Tue, 19 May 2015 05:03:04 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:34785 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755253AbbESJDB (ORCPT ); Tue, 19 May 2015 05:03:01 -0400 Received: by laat2 with SMTP id t2so13095378laa.1 for ; Tue, 19 May 2015 02:02:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=eGahhZkBHXiU0yNog1oBU4GhaldJdij+JDeBzTU0kCQ=; b=UI9UlnswJC4uIaE58rZ9ZPhBTNG194hb9OEKOrrW8i/zWg0bjfTBYInug8aotAErRB OiAqOxDYKLxjrQQy8W3qUiD+myLTXFB/0aGk3GemkrqETfeWoG0LLH0EBp9m4J3itzys 0SdHk9rCf4VoS4jztNqAdbb9cqyQ76VagTw5gAgjtb8QjfcSeTZX79iTnaBjnCQSbskE MN5NHSRk9ky+XnUVMbOA8vRsVo5J2B2QPCrU+pJodBHHsdXFvEwzty1DfeiUUCu2Bwpo 1VSaiZA+GoIFVRAxVBYY0oTh0pICbIuONgHc1BWzQMpCxJLSwOHIiHN+ugmJAeNh+faF nSww== X-Received: by 10.152.27.74 with SMTP id r10mr21127235lag.31.1432026179667; Tue, 19 May 2015 02:02:59 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by mx.google.com with ESMTPSA id p7sm3375370lae.47.2015.05.19.02.02.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 May 2015 02:02:59 -0700 (PDT) From: Ricardo Ribalda Delgado To: Hans Verkuil , Peter Seiderer , linux-media@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH 1/2] qv4l2: gl: Add support for V4L2_PIX_FMT_Y16 Date: Tue, 19 May 2015 11:03:04 +0200 Message-Id: <1432026185-12284-1-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.1.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for a 16 bit wide greyscale format. Signed-off-by: Ricardo Ribalda Delgado --- This is the first time that I do something with OpenGL, please take a good review of this patch before merging. It has been tested with vivid and an nvidia-glx driver (propietary) utils/qv4l2/capture-win-gl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils/qv4l2/capture-win-gl.cpp b/utils/qv4l2/capture-win-gl.cpp index c691bfe0c3b9..ee51089b5775 100644 --- a/utils/qv4l2/capture-win-gl.cpp +++ b/utils/qv4l2/capture-win-gl.cpp @@ -412,6 +412,7 @@ bool CaptureWinGLEngine::hasNativeFormat(__u32 format) V4L2_PIX_FMT_YUV565, V4L2_PIX_FMT_YUV32, V4L2_PIX_FMT_GREY, + V4L2_PIX_FMT_Y16, 0 }; @@ -507,6 +508,7 @@ void CaptureWinGLEngine::changeShader() case V4L2_PIX_FMT_ARGB32: case V4L2_PIX_FMT_ABGR32: case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y16: default: shader_RGB(m_frameFormat); break; @@ -614,6 +616,7 @@ void CaptureWinGLEngine::paintGL() break; case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y16: case V4L2_PIX_FMT_RGB332: case V4L2_PIX_FMT_BGR666: case V4L2_PIX_FMT_RGB555: @@ -1545,6 +1548,10 @@ void CaptureWinGLEngine::shader_RGB(__u32 format) glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, m_frameWidth, m_frameHeight, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL); break; + case V4L2_PIX_FMT_Y16: + internalFmt = manualTransform ? GL_LUMINANCE : GL_SLUMINANCE; + glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, m_frameWidth, m_frameHeight, 0, + GL_LUMINANCE, GL_UNSIGNED_SHORT, NULL); case V4L2_PIX_FMT_RGB24: case V4L2_PIX_FMT_BGR24: default: @@ -1643,6 +1650,11 @@ void CaptureWinGLEngine::render_RGB(__u32 format) GL_LUMINANCE, GL_UNSIGNED_BYTE, m_frameData); break; + case V4L2_PIX_FMT_Y16: + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, m_frameHeight, + GL_LUMINANCE, GL_UNSIGNED_SHORT, m_frameData); + break; + case V4L2_PIX_FMT_RGB555X: case V4L2_PIX_FMT_XRGB555X: case V4L2_PIX_FMT_ARGB555X: