aboutsummaryrefslogtreecommitdiffstats
path: root/android/protocol/fb-updates-proxy.h
blob: e750f1a418d4544510a30be0dd2c7306b8b9d8ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* Copyright (C) 2010 The Android Open Source Project
**
** This software is licensed under the terms of the GNU General Public
** License version 2, as published by the Free Software Foundation, and
** may be copied, distributed, and modified under those terms.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
*/

/*
 * Contains core-side framebuffer service that sends framebuffer updates
 * to the UI connected to the core.
 */

#ifndef _ANDROID_PROTOCOL_FB_UPDATES_PROXY_H
#define _ANDROID_PROTOCOL_FB_UPDATES_PROXY_H

/* Descriptor for a framebuffer core service instance */
typedef struct ProxyFramebuffer ProxyFramebuffer;

/*
 * Creates framebuffer service.
 * Param:
 *  sock - Socket descriptor for the service
 *  protocol - Defines protocol to use when sending FB updates to the UI. The
 *      supported values ar:
 *      -raw Transfers the updating rectangle buffer over the socket.
 *      -shared Used a shared memory to transfer the updating rectangle buffer.
 *  fb - Framebuffer descriptor for this service.
 * Return:
 *  Framebuffer service descriptor.
 */
ProxyFramebuffer* proxyFb_create(int sock, const char* protocol, struct QFrameBuffer* fb);

/*
 * Destroys framebuffer service created with proxyFb_create.
 * Param:
 *  core_fb - Framebuffer service descriptor created with proxyFb_create
 */
void proxyFb_destroy(ProxyFramebuffer* core_fb);

/*
 * Notifies framebuffer client about changes in framebuffer.
 * Param:
 *  core_fb - Framebuffer service descriptor created with proxyFb_create
 *  fb Framebuffer containing pixels.
 *  x, y, w, and h identify the rectangle that has benn changed.
 */
void proxyFb_update(ProxyFramebuffer* core_fb, struct QFrameBuffer* fb,
                   int x, int y, int w, int h);

/*
 * Gets number of bits used to encode a single pixel.
 * Param:
 *  core_fb - Framebuffer service descriptor created with proxyFb_create
 * Return:
 *  Number of bits used to encode a single pixel.
 */
int proxyFb_get_bits_per_pixel(ProxyFramebuffer* core_fb);

#endif /* _ANDROID_PROTOCOL_FB_UPDATES_PROXY_H */