17ec681f3Smrg/*
27ec681f3Smrg * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
37ec681f3Smrg *
47ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a
57ec681f3Smrg * copy of this software and associated documentation files (the "Software"),
67ec681f3Smrg * to deal in the Software without restriction, including without limitation
77ec681f3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87ec681f3Smrg * and/or sell copies of the Software, and to permit persons to whom the
97ec681f3Smrg * Software is furnished to do so, subject to the following conditions:
107ec681f3Smrg *
117ec681f3Smrg * The above copyright notice and this permission notice shall be included
127ec681f3Smrg * in all copies or substantial portions of the Software.
137ec681f3Smrg *
147ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
157ec681f3Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
177ec681f3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
187ec681f3Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
197ec681f3Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
207ec681f3Smrg * OTHER DEALINGS IN THE SOFTWARE.
217ec681f3Smrg */
227ec681f3Smrg
237ec681f3Smrg#ifndef DRI_HELPERS_H
247ec681f3Smrg#define DRI_HELPERS_H
257ec681f3Smrg
267ec681f3Smrg#include "dri_context.h"
277ec681f3Smrg#include "dri_screen.h"
287ec681f3Smrg
297ec681f3Smrg
307ec681f3Smrgstruct dri2_format_mapping {
317ec681f3Smrg   int dri_fourcc;
327ec681f3Smrg   int dri_format; /* image format */
337ec681f3Smrg   int dri_components;
347ec681f3Smrg   enum pipe_format pipe_format;
357ec681f3Smrg   int nplanes;
367ec681f3Smrg   struct {
377ec681f3Smrg      int buffer_index;
387ec681f3Smrg      int width_shift;
397ec681f3Smrg      int height_shift;
407ec681f3Smrg      uint32_t dri_format; /* plane format */
417ec681f3Smrg   } planes[3];
427ec681f3Smrg};
437ec681f3Smrg
447ec681f3Smrgextern const __DRI2fenceExtension dri2FenceExtension;
457ec681f3Smrg
467ec681f3Smrgconst struct dri2_format_mapping *
477ec681f3Smrgdri2_get_mapping_by_fourcc(int fourcc);
487ec681f3Smrg
497ec681f3Smrgconst struct dri2_format_mapping *
507ec681f3Smrgdri2_get_mapping_by_format(int format);
517ec681f3Smrg
527ec681f3Smrgenum pipe_format
537ec681f3Smrgdri2_get_pipe_format_for_dri_format(int format);
547ec681f3Smrg
557ec681f3Smrgboolean
567ec681f3Smrgdri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
577ec681f3Smrg                           int *count);
587ec681f3Smrgboolean
597ec681f3Smrgdri2_yuv_dma_buf_supported(struct dri_screen *screen,
607ec681f3Smrg                           const struct dri2_format_mapping *map);
617ec681f3Smrg
627ec681f3Smrg__DRIimage *
637ec681f3Smrgdri2_lookup_egl_image(struct dri_screen *screen, void *handle);
647ec681f3Smrg
657ec681f3Smrgboolean
667ec681f3Smrgdri2_validate_egl_image(struct dri_screen *screen, void *handle);
677ec681f3Smrg
687ec681f3Smrg__DRIimage *
697ec681f3Smrgdri2_lookup_egl_image_validated(struct dri_screen *screen, void *handle);
707ec681f3Smrg
717ec681f3Smrg__DRIimage *
727ec681f3Smrgdri2_create_image_from_renderbuffer(__DRIcontext *context,
737ec681f3Smrg				    int renderbuffer, void *loaderPrivate);
747ec681f3Smrg
757ec681f3Smrg__DRIimage *
767ec681f3Smrgdri2_create_image_from_renderbuffer2(__DRIcontext *context,
777ec681f3Smrg				     int renderbuffer, void *loaderPrivate,
787ec681f3Smrg                                     unsigned *error);
797ec681f3Smrg
807ec681f3Smrgvoid
817ec681f3Smrgdri2_destroy_image(__DRIimage *img);
827ec681f3Smrg
837ec681f3Smrg__DRIimage *
847ec681f3Smrgdri2_create_from_texture(__DRIcontext *context, int target, unsigned texture,
857ec681f3Smrg                         int depth, int level, unsigned *error,
867ec681f3Smrg                         void *loaderPrivate);
877ec681f3Smrg#endif
887ec681f3Smrg
897ec681f3Smrg/* vim: set sw=3 ts=8 sts=3 expandtab: */
90