X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fstate_trackers%2Fegl%2Fgdi%2Fnative_gdi.c;h=d3fec719a21fadf91a815a32f1d18a041911c2e4;hb=41f5d2e8acbe3d6393f8012813609215534b5678;hp=d259e6edc8914f04944d98f841985a3f4dac3c72;hpb=b2ddb93ff3b8c88682634ccdef247967e31fab84;p=mesa.git diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c index d259e6edc89..d3fec719a21 100644 --- a/src/gallium/state_trackers/egl/gdi/native_gdi.c +++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c @@ -41,7 +41,7 @@ struct gdi_display { struct native_display base; HDC hDC; - struct native_event_handler *event_handler; + const struct native_event_handler *event_handler; struct native_config *configs; int num_configs; @@ -161,16 +161,14 @@ gdi_surface_swap_buffers(struct native_surface *nsurf) static boolean gdi_surface_present(struct native_surface *nsurf, - enum native_attachment natt, - boolean preserve, - uint swap_interval) + const native_present_control *ctrl) { boolean ret; - if (preserve || swap_interval) + if (ctrl->preserve || ctrl->swap_interval) return FALSE; - switch (natt) { + switch (ctrl->natt) { case NATIVE_ATTACHMENT_FRONT_LEFT: ret = gdi_surface_flush_frontbuffer(nsurf); break; @@ -285,7 +283,7 @@ fill_color_formats(struct native_display *ndpy, enum pipe_format formats[8]) for (i = 0; i < Elements(candidates); i++) { if (screen->is_format_supported(screen, candidates[i], - PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET, 0)) + PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET)) formats[count++] = candidates[i]; } @@ -319,7 +317,6 @@ gdi_display_get_configs(struct native_display *ndpy, int *num_configs) nconf->color_format = formats[i]; nconf->window_bit = TRUE; - nconf->slow_config = TRUE; } gdpy->num_configs = count; @@ -364,40 +361,44 @@ gdi_display_destroy(struct native_display *ndpy) if (gdpy->configs) FREE(gdpy->configs); - gdpy->base.screen->destroy(gdpy->base.screen); + ndpy_uninit(ndpy); FREE(gdpy); } -static struct native_display * -gdi_create_display(HDC hDC, struct native_event_handler *event_handler, - void *user_data) +static boolean +gdi_display_init_screen(struct native_display *ndpy) { - struct gdi_display *gdpy; + struct gdi_display *gdpy = gdi_display(ndpy); struct sw_winsys *winsys; - gdpy = CALLOC_STRUCT(gdi_display); - if (!gdpy) - return NULL; - - gdpy->hDC = hDC; - gdpy->event_handler = event_handler; - gdpy->base.user_data = user_data; - winsys = gdi_create_sw_winsys(); - if (!winsys) { - FREE(gdpy); - return NULL; - } + if (!winsys) + return FALSE; gdpy->base.screen = gdpy->event_handler->new_sw_screen(&gdpy->base, winsys); if (!gdpy->base.screen) { if (winsys->destroy) winsys->destroy(winsys); - FREE(gdpy); - return NULL; + return FALSE; } + return TRUE; +} + +static struct native_display * +gdi_create_display(HDC hDC, const struct native_event_handler *event_handler) +{ + struct gdi_display *gdpy; + + gdpy = CALLOC_STRUCT(gdi_display); + if (!gdpy) + return NULL; + + gdpy->hDC = hDC; + gdpy->event_handler = event_handler; + + gdpy->base.init_screen = gdi_display_init_screen; gdpy->base.destroy = gdi_display_destroy; gdpy->base.get_param = gdi_display_get_param; @@ -407,11 +408,12 @@ gdi_create_display(HDC hDC, struct native_event_handler *event_handler, return &gdpy->base; } +static const struct native_event_handler *gdi_event_handler; + static struct native_display * -native_create_display(void *dpy, struct native_event_handler *event_handler, - void *user_data) +native_create_display(void *dpy, boolean use_sw) { - return gdi_create_display((HDC) dpy, event_handler, user_data); + return gdi_create_display((HDC) dpy, gdi_event_handler); } static const struct native_platform gdi_platform = { @@ -420,7 +422,8 @@ static const struct native_platform gdi_platform = { }; const struct native_platform * -native_get_gdi_platform(void) +native_get_gdi_platform(const struct native_event_handler *event_handler) { + gdi_event_handler = event_handler; return &gdi_platform; }