Tune layout of struct _SharedSurfaceHeader; Change interface of GetWindowSharedSurfaceFD()

This commit is contained in:
Vincent Wei
2023-08-29 12:50:58 +08:00
parent 50aafa3faa
commit 96ecf5e9b7
4 changed files with 31 additions and 20 deletions
+11 -2
View File
@@ -6067,13 +6067,22 @@ error:
}
#ifdef _MGSCHEMA_COMPOSITING
int GUIAPI GetWindowSharedSurfaceFD (HWND hWnd)
int GUIAPI GetWindowSharedSurfaceFD (HWND hWnd, size_t *map_size, DWORD *flags)
{
MG_CHECK_RET (MG_IS_APP_WINDOW (hWnd), -1);
PMAINWIN pWin = (PMAINWIN)hWnd;
if (pWin->surf->shared_header)
if (pWin->surf->shared_header) {
if (map_size)
*map_size = pWin->surf->shared_header->map_size;
if (flags) {
*flags = MEMDC_FLAG_SWSURFACE;
if (pWin->surf->shared_header->byhw)
*flags |= MEMDC_FLAG_HWSURFACE;
}
return pWin->surf->shared_header->fd;
}
return -1;
}
+13 -12
View File
@@ -139,20 +139,26 @@ typedef struct _DirtyInfo {
* than the creator.
*/
typedef struct _SharedSurfaceHeader {
/* the name of the shared surface; since 5.2.0. */
char name[NAME_MAX + 1];
/* The pid of the creator */
pid_t creator;
/* the size of the whole buffer */
size_t map_size;
/* the offset of pixels data */
off_t pixels_off;
/* The number of semphore for this surface.
The SysV semaphore set id for synchronizing this shared surface:
SHAREDRES_SEMID_SHARED_SURF. */
int sem_num;
/* The pid of the creator */
pid_t creator;
/* The file descriptor in context of the creator. */
int fd;
/* Not zero for hardware surface. */
int byhw;
/* The dirty information */
GAL_DirtyInfo dirty_info;
/* the size of the surface */
int width, height;
/* the pitch of the surface */
@@ -162,13 +168,8 @@ typedef struct _SharedSurfaceHeader {
/* the RGBA masks */
Uint32 Rmask, Gmask, Bmask, Amask;
/* the size of the whole buffer */
size_t map_size;
/* the offset of pixels data */
off_t pixels_off;
/* the name of the shared surface. */
char name[NAME_MAX + 1];
/* The dirty information */
GAL_DirtyInfo dirty_info;
} GAL_SharedSurfaceHeader;
#endif /* IS_COMPOSITING_SCHEMA */