From: Kristian Høgsberg Date: Fri, 17 Feb 2012 15:45:16 +0000 (-0500) Subject: compositor: Get rid of surface->visual X-Git-Tag: 0.94.90~592 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=101cb6560c79e9013771064987cc1ed89291436d;p=platform%2Fupstream%2Fweston.git compositor: Get rid of surface->visual --- diff --git a/src/compositor-drm.c b/src/compositor-drm.c index de6feb4..a77d91f 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -96,8 +96,11 @@ drm_output_prepare_scanout_surface(struct drm_output *output) es = container_of(c->base.surface_list.next, struct weston_surface, link); - if (es->visual != WESTON_RGB_VISUAL || - es->geometry.x != output->base.x || + /* Need to verify output->region contained in surface opaque + * region. Or maybe just that format doesn't have alpha. */ + return -1; + + if (es->geometry.x != output->base.x || es->geometry.y != output->base.y || es->geometry.width != output->base.current->width || es->geometry.height != output->base.current->height || diff --git a/src/compositor.c b/src/compositor.c index cdf648f..f07b14c 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -190,7 +190,6 @@ weston_surface_create(struct weston_compositor *compositor) surface->surface.resource.client = NULL; surface->compositor = compositor; - surface->visual = WESTON_NONE_VISUAL; surface->image = EGL_NO_IMAGE_KHR; surface->alpha = 255; @@ -218,11 +217,6 @@ static void weston_surface_set_color(struct weston_surface *surface, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - if (alpha == 1) - surface->visual = WESTON_RGB_VISUAL; - else - surface->visual = WESTON_ARGB_VISUAL; - surface->color[0] = red; surface->color[1] = green; surface->color[2] = blue; @@ -380,18 +374,6 @@ weston_surface_update_transform(struct weston_surface *surface) pixman_region32_union(&surface->damage, &surface->damage, &surface->transform.boundingbox); - pixman_region32_fini(&surface->transform.opaque); - if (surface->visual == WESTON_RGB_VISUAL && - surface->transform.enabled == 0) - pixman_region32_init_rect(&surface->transform.opaque, - surface->geometry.x, - surface->geometry.y, - surface->geometry.width, - surface->geometry.height); - else - pixman_region32_init(&surface->transform.opaque); - - if (surface->output) weston_surface_assign_output(surface); @@ -654,15 +636,6 @@ weston_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface) GL_BGRA_EXT, GL_UNSIGNED_BYTE, wl_shm_buffer_get_data(buffer)); - switch (wl_shm_buffer_get_format(buffer)) { - case WL_SHM_FORMAT_ARGB8888: - es->visual = WESTON_ARGB_VISUAL; - break; - case WL_SHM_FORMAT_XRGB8888: - es->visual = WESTON_RGB_VISUAL; - break; - } - surfaces_attached_to = buffer->user_data; wl_list_remove(&es->buffer_link); @@ -676,7 +649,6 @@ weston_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface) ec->image_target_texture_2d(GL_TEXTURE_2D, es->image); - es->visual = WESTON_ARGB_VISUAL; es->pitch = es->geometry.width; } } @@ -757,18 +729,8 @@ weston_surface_draw(struct weston_surface *es, struct weston_output *output) if (!pixman_region32_not_empty(&repaint)) goto out; - switch (es->visual) { - case WESTON_ARGB_VISUAL: - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - break; - case WESTON_RGB_VISUAL: - glDisable(GL_BLEND); - break; - default: - fprintf(stderr, "bogus visual\n"); - break; - } + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); if (ec->current_shader != es->shader) { glUseProgram(es->shader->program); @@ -1154,7 +1116,7 @@ surface_attach(struct wl_client *client, { struct weston_surface *es = resource->data; struct weston_shell *shell = es->compositor->shell; - struct wl_buffer *buffer; + struct wl_buffer *buffer, *prev; if (!buffer_resource && !es->output) return; @@ -1168,7 +1130,6 @@ surface_attach(struct wl_client *client, if (!buffer_resource && es->output) { wl_list_remove(&es->link); - es->visual = WESTON_NONE_VISUAL; es->output = NULL; es->buffer = NULL; return; @@ -1176,11 +1137,12 @@ surface_attach(struct wl_client *client, buffer = buffer_resource->data; buffer->busy_count++; + prev = es->buffer; es->buffer = buffer; wl_list_insert(es->buffer->resource.destroy_listener_list.prev, &es->buffer_destroy_listener.link); - if (es->visual == WESTON_NONE_VISUAL) { + if (prev == NULL) { shell->map(shell, es, buffer->width, buffer->height, sx, sy); } else if (sx != 0 || sy != 0 || es->geometry.width != buffer->width || @@ -1727,7 +1689,6 @@ input_device_attach(struct wl_client *client, if (!buffer_resource && device->sprite->output) { wl_list_remove(&device->sprite->link); - device->sprite->visual = WESTON_NONE_VISUAL; device->sprite->output = NULL; return; } diff --git a/src/compositor.h b/src/compositor.h index e3d0955..efd71e9 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -96,12 +96,6 @@ struct weston_input_device { struct wl_listener touch_focus_resource_listener; }; -enum weston_visual { - WESTON_NONE_VISUAL, - WESTON_ARGB_VISUAL, - WESTON_RGB_VISUAL -}; - struct weston_shader { GLuint program; GLuint vertex_shader, fragment_shader; @@ -250,7 +244,6 @@ struct weston_surface { struct weston_shader *shader; GLfloat color[4]; uint32_t alpha; - uint32_t visual; int overlapped; int pickable;