From patchwork Tue Nov 5 02:23:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 3138791 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9D5C2BEEB2 for ; Tue, 5 Nov 2013 02:26:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 688E1200F7 for ; Tue, 5 Nov 2013 02:26:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 70D14200DB for ; Tue, 5 Nov 2013 02:26:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC5C9EF46A for ; Mon, 4 Nov 2013 18:26:37 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from keithp.com (home.keithp.com [63.227.221.253]) by gabe.freedesktop.org (Postfix) with ESMTP id 31B40EF532 for ; Mon, 4 Nov 2013 18:23:57 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id EA7DD1488003; Mon, 4 Nov 2013 18:23:56 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from keithp.com ([127.0.0.1]) by localhost (keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id EYQUV0eDgtrd; Mon, 4 Nov 2013 18:23:52 -0800 (PST) Received: by keithp.com (Postfix, from userid 1033) id 8AB52148800B; Mon, 4 Nov 2013 18:23:32 -0800 (PST) Received: from miki.keithp.com (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id ADA73148C005; Mon, 4 Nov 2013 18:23:32 -0800 (PST) Received: by miki.keithp.com (Postfix, from userid 1001) id BEEC125AC; Mon, 4 Nov 2013 18:23:29 -0800 (PST) From: Keith Packard To: mesa3d-dev@lists.freedesktop.org Subject: [PATCH 6/8] dri/i915, dri/i965: Use driGLFormatToImageFormat and driImageFormatToGLFormat Date: Mon, 4 Nov 2013 18:23:26 -0800 Message-Id: <1383618208-21310-7-git-send-email-keithp@keithp.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1383618208-21310-1-git-send-email-keithp@keithp.com> References: <1383618208-21310-1-git-send-email-keithp@keithp.com> Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Remove private versions of these functions Signed-off-by: Keith Packard Reviewed-by: Kristian Høgsberg --- src/mesa/drivers/dri/i915/intel_screen.c | 53 ++------------------------- src/mesa/drivers/dri/i965/intel_screen.c | 63 ++------------------------------ 2 files changed, 8 insertions(+), 108 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 085e894..12113c7 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -244,32 +244,8 @@ intel_allocate_image(int dri_format, void *loaderPrivate) image->dri_format = dri_format; image->offset = 0; - switch (dri_format) { - case __DRI_IMAGE_FORMAT_RGB565: - image->format = MESA_FORMAT_RGB565; - break; - case __DRI_IMAGE_FORMAT_XRGB8888: - image->format = MESA_FORMAT_XRGB8888; - break; - case __DRI_IMAGE_FORMAT_ARGB8888: - image->format = MESA_FORMAT_ARGB8888; - break; - case __DRI_IMAGE_FORMAT_ABGR8888: - image->format = MESA_FORMAT_RGBA8888_REV; - break; - case __DRI_IMAGE_FORMAT_XBGR8888: - image->format = MESA_FORMAT_RGBX8888_REV; - break; - case __DRI_IMAGE_FORMAT_R8: - image->format = MESA_FORMAT_R8; - break; - case __DRI_IMAGE_FORMAT_GR88: - image->format = MESA_FORMAT_GR88; - break; - case __DRI_IMAGE_FORMAT_NONE: - image->format = MESA_FORMAT_NONE; - break; - default: + image->format = driImageFormatToGLFormat(dri_format); + if (image->format == 0) { free(image); return NULL; } @@ -318,27 +294,6 @@ intel_setup_image_from_dimensions(__DRIimage *image) image->tile_y = 0; } -static inline uint32_t -intel_dri_format(GLuint format) -{ - switch (format) { - case MESA_FORMAT_RGB565: - return __DRI_IMAGE_FORMAT_RGB565; - case MESA_FORMAT_XRGB8888: - return __DRI_IMAGE_FORMAT_XRGB8888; - case MESA_FORMAT_ARGB8888: - return __DRI_IMAGE_FORMAT_ARGB8888; - case MESA_FORMAT_RGBA8888_REV: - return __DRI_IMAGE_FORMAT_ABGR8888; - case MESA_FORMAT_R8: - return __DRI_IMAGE_FORMAT_R8; - case MESA_FORMAT_RG88: - return __DRI_IMAGE_FORMAT_GR88; - } - - return MESA_FORMAT_NONE; -} - static __DRIimage * intel_create_image_from_name(__DRIscreen *screen, int width, int height, int format, @@ -396,7 +351,7 @@ intel_create_image_from_renderbuffer(__DRIcontext *context, image->data = loaderPrivate; intel_region_reference(&image->region, irb->mt->region); intel_setup_image_from_dimensions(image); - image->dri_format = intel_dri_format(image->format); + image->dri_format = driGLFormatToImageFormat(image->format); rb->NeedsFinishRenderTexture = true; return image; @@ -450,7 +405,7 @@ intel_create_image_from_texture(__DRIcontext *context, int target, image->format = obj->Image[face][level]->TexFormat; image->data = loaderPrivate; intel_setup_image_from_mipmap_tree(intel, image, iobj->mt, level, zoffset); - image->dri_format = intel_dri_format(image->format); + image->dri_format = driGLFormatToImageFormat(image->format); if (image->dri_format == MESA_FORMAT_NONE) { *error = __DRI_IMAGE_ERROR_BAD_PARAMETER; free(image); diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index b89b1a5..f9339c1 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -298,38 +298,8 @@ intel_allocate_image(int dri_format, void *loaderPrivate) image->dri_format = dri_format; image->offset = 0; - switch (dri_format) { - case __DRI_IMAGE_FORMAT_RGB565: - image->format = MESA_FORMAT_RGB565; - break; - case __DRI_IMAGE_FORMAT_XRGB8888: - image->format = MESA_FORMAT_XRGB8888; - break; - case __DRI_IMAGE_FORMAT_ARGB2101010: - image->format = MESA_FORMAT_ARGB2101010; - break; - case __DRI_IMAGE_FORMAT_XRGB2101010: - image->format = MESA_FORMAT_XRGB2101010_UNORM; - break; - case __DRI_IMAGE_FORMAT_ARGB8888: - image->format = MESA_FORMAT_ARGB8888; - break; - case __DRI_IMAGE_FORMAT_ABGR8888: - image->format = MESA_FORMAT_RGBA8888_REV; - break; - case __DRI_IMAGE_FORMAT_XBGR8888: - image->format = MESA_FORMAT_RGBX8888_REV; - break; - case __DRI_IMAGE_FORMAT_R8: - image->format = MESA_FORMAT_R8; - break; - case __DRI_IMAGE_FORMAT_GR88: - image->format = MESA_FORMAT_GR88; - break; - case __DRI_IMAGE_FORMAT_NONE: - image->format = MESA_FORMAT_NONE; - break; - default: + image->format = driImageFormatToGLFormat(dri_format); + if (image->format == 0) { free(image); return NULL; } @@ -381,31 +351,6 @@ intel_setup_image_from_dimensions(__DRIimage *image) image->has_depthstencil = false; } -static inline uint32_t -intel_dri_format(GLuint format) -{ - switch (format) { - case MESA_FORMAT_RGB565: - return __DRI_IMAGE_FORMAT_RGB565; - case MESA_FORMAT_XRGB8888: - return __DRI_IMAGE_FORMAT_XRGB8888; - case MESA_FORMAT_ARGB8888: - return __DRI_IMAGE_FORMAT_ARGB8888; - case MESA_FORMAT_RGBA8888_REV: - return __DRI_IMAGE_FORMAT_ABGR8888; - case MESA_FORMAT_R8: - return __DRI_IMAGE_FORMAT_R8; - case MESA_FORMAT_RG88: - return __DRI_IMAGE_FORMAT_GR88; - case MESA_FORMAT_XRGB2101010_UNORM: - return __DRI_IMAGE_FORMAT_XRGB2101010; - case MESA_FORMAT_ARGB2101010: - return __DRI_IMAGE_FORMAT_ARGB2101010; - } - - return MESA_FORMAT_NONE; -} - static __DRIimage * intel_create_image_from_name(__DRIscreen *screen, int width, int height, int format, @@ -464,7 +409,7 @@ intel_create_image_from_renderbuffer(__DRIcontext *context, image->data = loaderPrivate; intel_region_reference(&image->region, irb->mt->region); intel_setup_image_from_dimensions(image); - image->dri_format = intel_dri_format(image->format); + image->dri_format = driGLFormatToImageFormat(image->format); image->has_depthstencil = irb->mt->stencil_mt? true : false; rb->NeedsFinishRenderTexture = true; @@ -519,7 +464,7 @@ intel_create_image_from_texture(__DRIcontext *context, int target, image->format = obj->Image[face][level]->TexFormat; image->data = loaderPrivate; intel_setup_image_from_mipmap_tree(brw, image, iobj->mt, level, zoffset); - image->dri_format = intel_dri_format(image->format); + image->dri_format = driGLFormatToImageFormat(image->format); image->has_depthstencil = iobj->mt->stencil_mt? true : false; if (image->dri_format == MESA_FORMAT_NONE) { *error = __DRI_IMAGE_ERROR_BAD_PARAMETER;