From patchwork Tue May 19 09:03:05 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: 6435141 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2BD1EC0432 for ; Tue, 19 May 2015 09:03:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 461042037E for ; Tue, 19 May 2015 09:03:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80DEC203AF for ; Tue, 19 May 2015 09:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755337AbbESJDF (ORCPT ); Tue, 19 May 2015 05:03:05 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:34802 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755290AbbESJDB (ORCPT ); Tue, 19 May 2015 05:03:01 -0400 Received: by laat2 with SMTP id t2so13095910laa.1 for ; Tue, 19 May 2015 02:03:00 -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:in-reply-to:references; bh=9FfGbFCnhL6L2MgYSd/1WrZ3c1P9HIcFt5aeerMT5es=; b=y++S7LtjrDvEwAYg1JTr1Rv36zEL5ldBeblcx13dPL3VCgAaaO00ph9MK28IvsfYd9 97IK9U6cfBC9BmvLKoAif3cFA0P+ev27qHIOS4cWlx9MJHqQ31beNHCm5U4RQa1A7/0m 8hnRnzJq2yLPs9waklLNvZ93VifxdGSPvKpPQGg8ZaVl1USBFKL+RPltpYhL5Whqvu4N VKbVGigE+lbmy90MiPWVmDN5ctzklGTkpSH65UyiENGGTr/bivcTPV5LqdvoIfnZJdjC ebOY4CkCaJaZDbs9bhqZo0cF5eOQS63tP7bEezZwQVLt585T9Ld03NMYPTUcRIH4oVjk M9jg== X-Received: by 10.152.45.9 with SMTP id i9mr20359656lam.87.1432026180363; Tue, 19 May 2015 02:03:00 -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.59 (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 2/2] qv4l2: gl: Add support for V4L2_PIX_FMT_Y16_BE Date: Tue, 19 May 2015 11:03:05 +0200 Message-Id: <1432026185-12284-2-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1432026185-12284-1-git-send-email-ricardo.ribalda@gmail.com> References: <1432026185-12284-1-git-send-email-ricardo.ribalda@gmail.com> 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 in big endian. Signed-off-by: Ricardo Ribalda Delgado --- This patch needs to be applied after the headers have been updated to support Y16_BE. It is scheduled for 4.2. It has been tested with vivid and an nvidia-glx driver (propietary) utils/qv4l2/capture-win-gl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils/qv4l2/capture-win-gl.cpp b/utils/qv4l2/capture-win-gl.cpp index ee51089b5775..25dec3e79070 100644 --- a/utils/qv4l2/capture-win-gl.cpp +++ b/utils/qv4l2/capture-win-gl.cpp @@ -413,6 +413,7 @@ bool CaptureWinGLEngine::hasNativeFormat(__u32 format) V4L2_PIX_FMT_YUV32, V4L2_PIX_FMT_GREY, V4L2_PIX_FMT_Y16, + V4L2_PIX_FMT_Y16_BE, 0 }; @@ -509,6 +510,7 @@ void CaptureWinGLEngine::changeShader() case V4L2_PIX_FMT_ABGR32: case V4L2_PIX_FMT_GREY: case V4L2_PIX_FMT_Y16: + case V4L2_PIX_FMT_Y16_BE: default: shader_RGB(m_frameFormat); break; @@ -617,6 +619,7 @@ void CaptureWinGLEngine::paintGL() case V4L2_PIX_FMT_GREY: case V4L2_PIX_FMT_Y16: + case V4L2_PIX_FMT_Y16_BE: case V4L2_PIX_FMT_RGB332: case V4L2_PIX_FMT_BGR666: case V4L2_PIX_FMT_RGB555: @@ -1549,6 +1552,7 @@ void CaptureWinGLEngine::shader_RGB(__u32 format) GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL); break; case V4L2_PIX_FMT_Y16: + case V4L2_PIX_FMT_Y16_BE: internalFmt = manualTransform ? GL_LUMINANCE : GL_SLUMINANCE; glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, m_frameWidth, m_frameHeight, 0, GL_LUMINANCE, GL_UNSIGNED_SHORT, NULL); @@ -1654,6 +1658,12 @@ void CaptureWinGLEngine::render_RGB(__u32 format) glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, m_frameHeight, GL_LUMINANCE, GL_UNSIGNED_SHORT, m_frameData); break; + case V4L2_PIX_FMT_Y16_BE: + glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_TRUE); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, m_frameHeight, + GL_LUMINANCE, GL_UNSIGNED_SHORT, m_frameData); + glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); + break; case V4L2_PIX_FMT_RGB555X: case V4L2_PIX_FMT_XRGB555X: