paul@0 | 1 | /* |
paul@0 | 2 | * Common framebuffer server functionality. |
paul@0 | 3 | * |
paul@152 | 4 | * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> |
paul@0 | 5 | * |
paul@0 | 6 | * This program is free software; you can redistribute it and/or |
paul@0 | 7 | * modify it under the terms of the GNU General Public License as |
paul@0 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@0 | 9 | * the License, or (at your option) any later version. |
paul@0 | 10 | * |
paul@0 | 11 | * This program is distributed in the hope that it will be useful, |
paul@0 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@0 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@0 | 14 | * GNU General Public License for more details. |
paul@0 | 15 | * |
paul@0 | 16 | * You should have received a copy of the GNU General Public License |
paul@0 | 17 | * along with this program; if not, write to the Free Software |
paul@0 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@0 | 19 | * Boston, MA 02110-1301, USA |
paul@0 | 20 | */ |
paul@0 | 21 | |
paul@0 | 22 | #pragma once |
paul@0 | 23 | |
paul@0 | 24 | #ifdef __cplusplus |
paul@0 | 25 | |
paul@153 | 26 | #include <l4/devices/fb/framebuffer_interface.h> |
paul@152 | 27 | #include <l4/re/c/dataspace.h> |
paul@0 | 28 | #include <l4/sys/types.h> |
paul@0 | 29 | |
paul@0 | 30 | /* Server object to provide framebuffer data access. */ |
paul@0 | 31 | |
paul@152 | 32 | class Framebuffer_server : public Framebuffer |
paul@0 | 33 | { |
paul@0 | 34 | private: |
paul@152 | 35 | l4re_ds_t _mem; |
paul@152 | 36 | |
paul@152 | 37 | protected: |
paul@152 | 38 | /* Specialised methods for overriding. */ |
paul@152 | 39 | |
paul@152 | 40 | virtual l4_size_t _get_framebuffer_size() = 0; |
paul@152 | 41 | virtual void _get_view_info(l4re_video_view_info_t *view_info) = 0; |
paul@0 | 42 | |
paul@0 | 43 | public: |
paul@0 | 44 | /* Initialise the server with a capability referencing the exported memory. */ |
paul@0 | 45 | |
paul@152 | 46 | explicit Framebuffer_server(l4re_ds_t mem) |
paul@0 | 47 | : _mem(mem) |
paul@0 | 48 | {} |
paul@0 | 49 | |
paul@0 | 50 | /* Operation methods. */ |
paul@0 | 51 | |
paul@152 | 52 | virtual long get_framebuffer(l4_cap_idx_t *mem); |
paul@152 | 53 | virtual long get_framebuffer_size(l4_size_t *size); |
paul@152 | 54 | virtual long get_view_info(l4re_video_view_info_t *view_info); |
paul@0 | 55 | }; |
paul@0 | 56 | |
paul@0 | 57 | #endif |