Home | History | Annotate | Download | only in core
      1 /*
      2 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
      3 *
      4 * Redistribution and use in source and binary forms, with or without
      5 * modification, are permitted provided that the following conditions are
      6 * met:
      7 *  * Redistributions of source code must retain the above copyright
      8 *    notice, this list of conditions and the following disclaimer.
      9 *  * Redistributions in binary form must reproduce the above
     10 *    copyright notice, this list of conditions and the following
     11 *    disclaimer in the documentation and/or other materials provided
     12 *    with the distribution.
     13 *  * Neither the name of The Linux Foundation nor the names of its
     14 *    contributors may be used to endorse or promote products derived
     15 *    from this software without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
     18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
     20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
     21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
     27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28 */
     29 
     30 /*! @file buffer_sync_handler.h
     31   @brief Interface file for platform specific buffer allocator.
     32 
     33   @details SDM will use this interface to wait for buffer sync fd to be signaled/merge
     34   the two buffer sync fds into one.
     35 */
     36 
     37 #ifndef __BUFFER_SYNC_HANDLER_H__
     38 #define __BUFFER_SYNC_HANDLER_H__
     39 
     40 #include "sdm_types.h"
     41 
     42 namespace sdm {
     43 
     44 /*! @brief Buffer sync handler implemented by the client
     45 
     46   @details This class declares prototype for BufferSyncHandler methods which must be
     47   implemented by the client. SDM will use these methods to wait for buffer sync fd to be
     48   signaled/merge two buffer sync fds into one.
     49 
     50   @sa CoreInterface::CreateCore
     51 */
     52 class BufferSyncHandler {
     53  public:
     54   /*! @brief Method to wait for ouput buffer to be released.
     55 
     56     @details This method waits for fd to be signaled by the producer/consumer.
     57     It is responsibility of the caller to close file descriptor.
     58 
     59     @param[in] fd
     60 
     61     @return \link DisplayError \endlink
     62   */
     63 
     64   virtual DisplayError SyncWait(int fd) = 0;
     65 
     66   /*! @brief Method to merge two sync fds into one sync fd
     67 
     68     @details This method merges two buffer sync fds into one sync fd, if a producer/consumer
     69     requires to wait for more than one sync fds. It is responsibility of the caller to close file
     70     descriptor.
     71 
     72     @param[in] fd1
     73     @param[in] fd2
     74     @param[out] merged_fd
     75 
     76     @return \link DisplayError \endlink
     77  */
     78 
     79   virtual DisplayError SyncMerge(int fd1, int fd2, int *merged_fd) = 0;
     80 
     81   /*! @brief Method to detect if sync fd is signaled
     82 
     83     @details This method detects if sync fd is signaled. It is responsibility of the caller to
     84     close file descriptor.
     85 
     86     @param[in] fd
     87 
     88     @return \link Tue if fd has been signaled \endlink
     89  */
     90   virtual bool IsSyncSignaled(int fd) = 0;
     91 
     92  protected:
     93   virtual ~BufferSyncHandler() { }
     94 };
     95 
     96 }  // namespace sdm
     97 
     98 #endif  // __BUFFER_SYNC_HANDLER_H__
     99 
    100