Rahul Kaswa
|
gf_surface_create_layer failed, returned 1, memory allocation failed
|
Rahul Kaswa
11/28/2012 5:48 AM
post97543
|
gf_surface_create_layer failed, returned 1, memory allocation failed
hi all,
i am new to QNX graphics and i am facing problem regarding memory allocation failed in
gf_surface_create_layer();
return value = 1, GF_ERR_MEM
code is given below..
#include <stdlib.h>
#include <stdio.h>
#include<gf/gf.h>
int main(int argc, char *argv[]) {
gf_dev_t gdev;
gf_dev_info_t gdev_info;
gf_display_t display;
gf_display_info_t display_info;
gf_layer_t layer;
gf_surface_t surface;
int i=0;
if (gf_dev_attach(&gdev, GF_DEVICE_INDEX(0), &gdev_info) != GF_ERR_OK) {
printf("gf_dev_attach() failed\n");
return (-1);
}
printf("Number of displays: %d\n",gdev_info.ndisplays);
for (i = 0; i < gdev_info.ndisplays; i++ )
{
printf("Display %d: ", i);
if (gf_display_attach(&display, gdev, i, &display_info) == GF_ERR_OK)
{
printf("%dX%d, refresh = %dHz\n", display_info.xres,
display_info.yres, display_info.refresh);
printf("Number of layers: %d\n", display_info.nlayers);
if (gf_layer_attach(&layer, display,0, 1) == GF_ERR_OK )
{
printf("\n\tLayer attached Successfully.");
//printf("\n\t%d", gf_surface_create_layer(&surface, &layer, 1,0, display_info.xres, display_info.yres,
display_info.format , NULL, 0 ));
if(gf_surface_create_layer(&surface, &layer, 0,0, display_info.xres, display_info.yres, GF_FORMAT_PACK_RGB565
, NULL, 0 ) == GF_ERR_OK )
{
printf("\n\tSurface created successfully.");
}
else
printf("\n\tSurface failed.");
}
else
printf("\n\tLayer Failed.");
}
else
printf("gf_display_attach() failed\n");
}
printf("\n\tWelcome to the QNX Momentics IDE\n");
if(gdev)
{
gf_dev_detach(gdev);
}
return EXIT_SUCCESS;
}
|
|
|