diff options
Diffstat (limited to 'src/x11')
-rw-r--r-- | src/x11/psb_coverlay.c | 4 | ||||
-rw-r--r-- | src/x11/psb_ctexture.c | 161 | ||||
-rw-r--r-- | src/x11/psb_x11.c | 79 | ||||
-rw-r--r-- | src/x11/psb_x11.h | 4 | ||||
-rw-r--r-- | src/x11/psb_xrandr.c | 12 | ||||
-rw-r--r-- | src/x11/psb_xrandr.h | 4 | ||||
-rw-r--r-- | src/x11/psb_xvva.c | 4 |
7 files changed, 189 insertions, 79 deletions
diff --git a/src/x11/psb_coverlay.c b/src/x11/psb_coverlay.c index 8c01277..7fd1b3e 100644 --- a/src/x11/psb_coverlay.c +++ b/src/x11/psb_coverlay.c @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. diff --git a/src/x11/psb_ctexture.c b/src/x11/psb_ctexture.c index 718c3fc..a206acb 100644 --- a/src/x11/psb_ctexture.c +++ b/src/x11/psb_ctexture.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2011 Intel Corporation. All Rights Reserved. - * Copyright (c) Imagination Technologies Limited, UK + * Copyright (c) Imagination Technologies Limited, UK * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the @@ -9,11 +9,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -71,6 +71,12 @@ static VAStatus psb_extend_dri_init(VADriverContextP ctx, unsigned int destx, un if (!output->extend_drawable) { psb__error_message("%s: Failed to create drawable for extend display # %d\n", __func__, output->extend_drawable); } + + if (texture_priv->extend_dri_drawable) { + free_drawable(ctx, texture_priv->extend_dri_drawable); + texture_priv->extend_dri_drawable = NULL; + } + texture_priv->extend_dri_drawable = dri_get_drawable(ctx, output->extend_drawable); if (!texture_priv->extend_dri_drawable) { psb__error_message("%s(): Failed to get extend_dri_drawable\n", __func__); @@ -83,7 +89,7 @@ static VAStatus psb_extend_dri_init(VADriverContextP ctx, unsigned int destx, un return VA_STATUS_ERROR_UNKNOWN; } - ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, (PVR2D_HANDLE)extend_dri_buffer->dri2.name, &dri2_bb_export_meminfo); + ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, (PVR2D_HANDLE)extend_dri_buffer->dri2.name, &dri2_bb_export_meminfo); if (ret != PVR2D_OK) { psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret); return VA_STATUS_ERROR_UNKNOWN; @@ -92,7 +98,7 @@ static VAStatus psb_extend_dri_init(VADriverContextP ctx, unsigned int destx, un memcpy(&texture_priv->extend_dri2_bb_export, dri2_bb_export_meminfo->pBase, sizeof(PVRDRI2BackBuffersExport)); for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) { - ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, texture_priv->extend_dri2_bb_export.hBuffers[i], &texture_priv->extend_blt_meminfo[i]); + ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, texture_priv->extend_dri2_bb_export.hBuffers[i], &texture_priv->extend_blt_meminfo[i]); if (ret != PVR2D_OK) { psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret); return VA_STATUS_ERROR_UNKNOWN; @@ -104,23 +110,53 @@ static VAStatus psb_extend_dri_init(VADriverContextP ctx, unsigned int destx, un return VA_STATUS_SUCCESS; } -static VAStatus psb_dri_init(VADriverContextP ctx, Drawable draw) +/* reset buffer to prevent non-video area distorting when rendering into part of a drawable */ +static void psb_dri_reset_mem(VADriverContextP ctx) { INIT_DRIVER_DATA; - INIT_OUTPUT_PRIV; - int i, ret; + unsigned int i, size; + struct dri_drawable *tmp_drawable; + struct psb_texture_s *texture_priv = &driver_data->ctexture_priv; - union dri_buffer *dri_buffer; + tmp_drawable = (struct dri_drawable *)texture_priv->dri_drawable; + size = tmp_drawable->width * tmp_drawable->height * 4; - PPVR2DMEMINFO dri2_bb_export_meminfo; + if (!tmp_drawable->is_window) { + memset(texture_priv->blt_meminfo_pixmap->pBase, 0x0, size); + return; + } else { + if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS) + for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) + memset(texture_priv->blt_meminfo[i]->pBase, 0x0, size); + if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN) + for (i = 0; i < DRI2_FLIP_BUFFERS_NUM; i++) + memset(texture_priv->blt_meminfo[i]->pBase, 0x0, size); + } + + return; +} +static VAStatus psb_dri_init(VADriverContextP ctx, Drawable draw) +{ + INIT_DRIVER_DATA; + union dri_buffer *dri_buffer; + PPVR2DMEMINFO dri2_bb_export_meminfo; struct psb_texture_s *texture_priv = &driver_data->ctexture_priv; + struct dri_drawable *tmp_drawable; + int i, ret; + + /* free the previous drawable buffer */ + if (texture_priv->dri_drawable) { + free_drawable(ctx, texture_priv->dri_drawable); + texture_priv->dri_drawable = NULL; + } - texture_priv->dri_drawable = dri_get_drawable(ctx, output->output_drawable); + texture_priv->dri_drawable = dri_get_drawable(ctx, draw); if (!texture_priv->dri_drawable) { psb__error_message("%s(): Failed to get dri_drawable\n", __func__); return VA_STATUS_ERROR_UNKNOWN; } + tmp_drawable = (struct dri_drawable *)texture_priv->dri_drawable; dri_buffer = dri_get_rendering_buffer(ctx, texture_priv->dri_drawable); if (!dri_buffer) { @@ -129,50 +165,53 @@ static VAStatus psb_dri_init(VADriverContextP ctx, Drawable draw) } /* pixmap */ - if (!texture_priv->dri_drawable->is_window) { - ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, (PVR2D_HANDLE)(dri_buffer->dri2.name & 0x00FFFFFF), &texture_priv->blt_meminfo_pixmap); + if (!tmp_drawable->is_window) { + if (texture_priv->blt_meminfo_pixmap) + PVR2DMemFree(driver_data->hPVR2DContext, texture_priv->blt_meminfo_pixmap); + + ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, (PVR2D_HANDLE)(dri_buffer->dri2.name & 0x00FFFFFF), &texture_priv->blt_meminfo_pixmap); + if (ret != PVR2D_OK) { + psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret); + return VA_STATUS_ERROR_UNKNOWN; + } + /* window */ + } else { + ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, (PVR2D_HANDLE)(dri_buffer->dri2.name & 0x00FFFFFF), &dri2_bb_export_meminfo); if (ret != PVR2D_OK) { psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret); return VA_STATUS_ERROR_UNKNOWN; } - texture_priv->dri_init_flag = 1; - return VA_STATUS_SUCCESS; - } - - ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, (PVR2D_HANDLE)(dri_buffer->dri2.name & 0x00FFFFFF), &dri2_bb_export_meminfo); - if (ret != PVR2D_OK) { - psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret); - return VA_STATUS_ERROR_UNKNOWN; - } - - memcpy(&texture_priv->dri2_bb_export, dri2_bb_export_meminfo->pBase, sizeof(PVRDRI2BackBuffersExport)); + memcpy(&texture_priv->dri2_bb_export, dri2_bb_export_meminfo->pBase, sizeof(PVRDRI2BackBuffersExport)); - if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS) { - psb__information_message("psb_dri_init: Now map buffer, DRI2 back buffer export type: DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS\n"); + if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS) { + psb__information_message("psb_dri_init: Now map buffer, DRI2 back buffer export type: DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS\n"); - for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) { - ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, texture_priv->dri2_bb_export.hBuffers[i], &texture_priv->blt_meminfo[i]); - if (ret != PVR2D_OK) { - psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret); - return VA_STATUS_ERROR_UNKNOWN; + for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) { + ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, texture_priv->dri2_bb_export.hBuffers[i], &texture_priv->blt_meminfo[i]); + if (ret != PVR2D_OK) { + psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret); + return VA_STATUS_ERROR_UNKNOWN; + } } - } - } else if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN) { - psb__information_message("psb_dri_init: Now map buffer, DRI2 back buffer export type: DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN\n"); - - for (i = 0; i < DRI2_FLIP_BUFFERS_NUM; i++) { - ret = PVR2DMemMap(texture_priv->hPVR2DContext, 0, texture_priv->dri2_bb_export.hBuffers[i], &texture_priv->flip_meminfo[i]); - if (ret != PVR2D_OK) { - psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret); - return VA_STATUS_ERROR_UNKNOWN; + } else if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN) { + psb__information_message("psb_dri_init: Now map buffer, DRI2 back buffer export type: DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN\n"); + + for (i = 0; i < DRI2_FLIP_BUFFERS_NUM; i++) { + ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, texture_priv->dri2_bb_export.hBuffers[i], &texture_priv->flip_meminfo[i]); + if (ret != PVR2D_OK) { + psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret); + return VA_STATUS_ERROR_UNKNOWN; + } } } + + PVR2DMemFree(driver_data->hPVR2DContext, dri2_bb_export_meminfo); } texture_priv->dri_init_flag = 1; - PVR2DMemFree(texture_priv->hPVR2DContext, dri2_bb_export_meminfo); + psb_dri_reset_mem(ctx); return VA_STATUS_SUCCESS; } @@ -205,6 +244,7 @@ VAStatus psb_putsurface_ctexture( psb_output_device local_device, extend_device; unsigned short tmp; struct psb_texture_s *texture_priv = &driver_data->ctexture_priv; + struct dri_drawable *tmp_drawable; obj_surface = SURFACE(surface); @@ -213,13 +253,13 @@ VAStatus psb_putsurface_ctexture( return VA_STATUS_ERROR_INVALID_SURFACE; } - if (driver_data->video_rotate == VA_ROTATION_NONE) { + if (driver_data->va_rotate == VA_ROTATION_NONE) { psb_surface = obj_surface->psb_surface; surface_width = obj_surface->width; surface_height = obj_surface->height; } else { psb_surface = obj_surface->psb_surface_rotate; - if (driver_data->video_rotate != VA_ROTATION_180) { + if (driver_data->va_rotate != VA_ROTATION_180) { tmp = srcw; srcw = srch; srch = tmp; @@ -365,17 +405,17 @@ VAStatus psb_putsurface_ctexture( srcx, srcy, srcw, srch, xoffset, yoffset, xres, yres, texture_priv->extend_current_blt_buffer); if (subtitle == BOTH || subtitle == ONLY_HDMI) - psb_putsurface_textureblit(ctx, texture_priv->extend_blt_meminfo[texture_priv->extend_current_blt_buffer], surface, srcx, srcy, srcw, srch, 0, 0, + psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->extend_blt_meminfo[texture_priv->extend_current_blt_buffer], surface, srcx, srcy, srcw, srch, 0, 0, xres, yres, 1, surface_width, surface_height, psb_surface->stride, psb_surface->buf.drm_buf, - psb_surface->buf.pl_flags); + psb_surface->buf.pl_flags, 0 /* no wrap for dst */); else - psb_putsurface_textureblit(ctx, texture_priv->extend_blt_meminfo[texture_priv->extend_current_blt_buffer], surface, srcx, srcy, srcw, srch, 0, 0, + psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->extend_blt_meminfo[texture_priv->extend_current_blt_buffer], surface, srcx, srcy, srcw, srch, 0, 0, xres, yres, 0, surface_width, surface_height, psb_surface->stride, psb_surface->buf.drm_buf, - psb_surface->buf.pl_flags); + psb_surface->buf.pl_flags, 0 /* no wrap for dst */); dri_swap_buffer(ctx, texture_priv->extend_dri_drawable); texture_priv->extend_current_blt_buffer = (texture_priv->extend_current_blt_buffer + 1) & 0x01; @@ -419,19 +459,20 @@ VAStatus psb_putsurface_ctexture( } /* Main Video for pixmap*/ - if (!texture_priv->dri_drawable->is_window) { + tmp_drawable = (struct dri_drawable *)texture_priv->dri_drawable; + if (!tmp_drawable->is_window) { psb__information_message("psb_putsurface_ctexture: Main video Pixmap, coordinate: srcx= %d, srcy=%d, srcw=%d, srch=%d, destx=%d, desty=%d, destw=%d, desth=%d, cur_buffer=%d\n", srcx, srcy, srcw, srch, destx, desty, destw, desth, texture_priv->current_blt_buffer); if (subtitle == BOTH || (subtitle == NOSUBTITLE && obj_surface->subpic_count)) - psb_putsurface_textureblit(ctx, texture_priv->blt_meminfo_pixmap, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1, + psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo_pixmap, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1, surface_width, surface_height, psb_surface->stride, psb_surface->buf.drm_buf, - psb_surface->buf.pl_flags); + psb_surface->buf.pl_flags, 0 /* no wrap for dst */); else - psb_putsurface_textureblit(ctx, texture_priv->blt_meminfo_pixmap, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 0, + psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo_pixmap, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 0, surface_width, surface_height, psb_surface->stride, psb_surface->buf.drm_buf, - psb_surface->buf.pl_flags); + psb_surface->buf.pl_flags, 0 /* no wrap for dst */); return VA_STATUS_SUCCESS; } @@ -442,15 +483,15 @@ VAStatus psb_putsurface_ctexture( srcx, srcy, srcw, srch, destx, desty, destw, desth, texture_priv->current_blt_buffer); if (subtitle == BOTH || (subtitle == NOSUBTITLE && obj_surface->subpic_count)) - psb_putsurface_textureblit(ctx, texture_priv->blt_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1, + psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1, surface_width, surface_height, psb_surface->stride, psb_surface->buf.drm_buf, - psb_surface->buf.pl_flags); + psb_surface->buf.pl_flags, 0 /* no wrap for dst */); else - psb_putsurface_textureblit(ctx, texture_priv->blt_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 0, + psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 0, surface_width, surface_height, psb_surface->stride, psb_surface->buf.drm_buf, - psb_surface->buf.pl_flags); + psb_surface->buf.pl_flags, 0 /* no wrap for dst */); dri_swap_buffer(ctx, texture_priv->dri_drawable); texture_priv->current_blt_buffer = (texture_priv->current_blt_buffer + 1) & 0x01; @@ -460,15 +501,15 @@ VAStatus psb_putsurface_ctexture( srcx, srcy, srcw, srch, destx, desty, display_width, display_height, texture_priv->current_blt_buffer); if (subtitle == BOTH || (subtitle == NOSUBTITLE && obj_surface->subpic_count)) - psb_putsurface_textureblit(ctx, texture_priv->flip_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, + psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->flip_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, display_width, display_height, 1, surface_width, surface_height, psb_surface->stride, psb_surface->buf.drm_buf, - psb_surface->buf.pl_flags); + psb_surface->buf.pl_flags, 0 /* no wrap for dst */); else - psb_putsurface_textureblit(ctx, texture_priv->flip_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, + psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->flip_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, display_width, display_height, 0, surface_width, surface_height, psb_surface->stride, psb_surface->buf.drm_buf, - psb_surface->buf.pl_flags); + psb_surface->buf.pl_flags, 0 /* no wrap for dst */); dri_swap_buffer(ctx, texture_priv->dri_drawable); texture_priv->current_blt_buffer++; diff --git a/src/x11/psb_x11.c b/src/x11/psb_x11.c index 092f75a..ce9a474 100644 --- a/src/x11/psb_x11.c +++ b/src/x11/psb_x11.c @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -30,6 +30,7 @@ #include <X11/Xutil.h> #include <X11/extensions/Xrandr.h> #include <X11/extensions/dpms.h> +#include <va/va_dricommon.h> #include <va/va_backend.h> #include "psb_output.h" #include "psb_surface.h" @@ -53,6 +54,9 @@ #define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id )) +void psb_x11_freeWindowClipBoxList(psb_x11_clip_list_t * pHead); + + //X error trap static int x11_error_code = 0; static int (*old_error_handler)(Display *, XErrorEvent *); @@ -268,6 +272,9 @@ void *psb_x11_output_init(VADriverContextP ctx) return NULL; } + if (getenv("PSB_VIDEO_EXTEND_FULLSCREEN")) + driver_data->extend_fullscreen = 1; + if (getenv("PSB_VIDEO_PUTSURFACE_X11")) { psb__information_message("Putsurface force to SW rendering\n"); driver_data->output_method = PSB_PUTSURFACE_X11; @@ -277,11 +284,34 @@ void *psb_x11_output_init(VADriverContextP ctx) psb_init_xvideo(ctx, output); + output->output_drawable = 0; + output->extend_drawable = 0; + output->pClipBoxList = NULL; + output->ui32NumClipBoxList = 0; + output->frame_count = 0; + output->bIsVisible = 0; + /* always init CTEXTURE and COVERLAY */ driver_data->coverlay = 1; driver_data->color_key = 0x11; driver_data->ctexture = 1; + driver_data->xrandr_dirty = 0; + driver_data->xrandr_update = 0; + + if (getenv("PSB_VIDEO_EXTEND_FULLSCREEN")) { + driver_data->extend_fullscreen = 1; + } + + driver_data->xrandr_thread_id = 0; + if (getenv("PSB_VIDEO_NOTRD") || IS_MRST(driver_data)) { + psb__information_message("Force not to start psb xrandr thread.\n"); + driver_data->use_xrandr_thread = 0; + } else { + psb__information_message("By default, use psb xrandr thread.\n"); + driver_data->use_xrandr_thread = 1; + } + if (IS_MFLD(driver_data) && /* force MFLD to use COVERLAY */ (driver_data->output_method == PSB_PUTSURFACE_OVERLAY)) { psb__information_message("Use client overlay mode for post-processing\n"); @@ -323,7 +353,23 @@ error_handler(Display *dpy, XErrorEvent *error) void psb_x11_output_deinit(VADriverContextP ctx) { + INIT_DRIVER_DATA; + INIT_OUTPUT_PRIV; + struct dri_state *dri_state = (struct dri_state *)ctx->dri_state; + + psb_x11_freeWindowClipBoxList(output->pClipBoxList); + output->pClipBoxList = NULL; + + if (output->extend_drawable) { + XDestroyWindow(ctx->native_dpy, output->extend_drawable); + output->extend_drawable = 0; + } + psb_deinit_xvideo(ctx); + + /* close dri fd and release all drawable buffer */ + if (driver_data->ctexture == 1) + (*dri_state->close)(ctx); } static void @@ -363,8 +409,14 @@ static int pnw_check_output_method(VADriverContextP ctx, object_surface_p obj_su return 0; } + /* Assign default value for MRST */ + if (IS_MRST(driver_data)) + driver_data->output_method = PSB_PUTSURFACE_OVERLAY; + else if (IS_MFLD(driver_data)) + driver_data->output_method = PSB_PUTSURFACE_COVERLAY; + if (driver_data->overlay_auto_paint_color_key) - driver_data->output_method = PSB_PUTSURFACE_COVERLAY; + driver_data->output_method = PSB_PUTSURFACE_COVERLAY; /* Avoid call is_window()/XGetWindowAttributes() every frame */ if (output->output_drawable_save != draw) { @@ -375,14 +427,24 @@ static int pnw_check_output_method(VADriverContextP ctx, object_surface_p obj_su output->is_pixmap = 0; } - if (output->is_pixmap == 1 || (IS_MRST(driver_data) && obj_surface->subpic_count > 0) || width >= 2048 || height >= 2048 || - /*FIXME: overlay path can't handle subpicture scaling. when surface size > dest box, fallback to texblit.*/ - (IS_MFLD(driver_data) && obj_surface->subpic_count && ((width > destw) || (height > desth)))) { + /*FIXME: overlay path can't handle subpicture scaling. when surface size > dest box, fallback to texblit.*/ + if ((output->is_pixmap == 1) + || (IS_MRST(driver_data) && obj_surface->subpic_count > 0) + || (IS_MFLD(driver_data) && obj_surface->subpic_count && ((width > destw) || (height > desth))) + || (width >= 2048) + || (height >= 2048) + ) { psb__information_message("Putsurface fall back to use Client Texture\n"); driver_data->output_method = PSB_PUTSURFACE_CTEXTURE; } + if (IS_MFLD(driver_data) && + (driver_data->xrandr_dirty & PSB_NEW_ROTATION)) { + psb_RecalcRotate(ctx); + driver_data->xrandr_dirty &= ~PSB_NEW_ROTATION; + } + return 0; } @@ -449,6 +511,11 @@ VAStatus psb_PutSurface( psb__information_message("Using client Overlay for PutSurface\n"); srcw = srcw <= 1920 ? srcw : 1920; + /* init overlay*/ + if (!driver_data->coverlay_init) { + psb_coverlay_init(ctx); + driver_data->coverlay_init = 1; + } psb_putsurface_coverlay( ctx, surface, draw, diff --git a/src/x11/psb_x11.h b/src/x11/psb_x11.h index fff7be0..277a48f 100644 --- a/src/x11/psb_x11.h +++ b/src/x11/psb_x11.h @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. diff --git a/src/x11/psb_xrandr.c b/src/x11/psb_xrandr.c index 0d7edc6..6b1ffc1 100644 --- a/src/x11/psb_xrandr.c +++ b/src/x11/psb_xrandr.c @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -27,7 +27,7 @@ * */ - +#include <unistd.h> #include "psb_xrandr.h" #include "psb_x11.h" @@ -165,7 +165,7 @@ static void psb_xrandr_hdmi_property(VADriverContextP ctx) static void psb_xrandr_mipi_location_init(psb_output_device_mode output_device_mode) { - psb_xrandr_crtc_p local_crtc, extend_crtc; + psb_xrandr_crtc_p local_crtc = NULL, extend_crtc = NULL; switch (output_device_mode) { case SINGLE_MIPI0: @@ -210,7 +210,7 @@ static void psb_xrandr_mipi_location_init(psb_output_device_mode output_device_m static void psb_xrandr_hdmi_location_init(psb_output_device_mode output_device_mode) { - psb_xrandr_crtc_p local_crtc, extend_crtc; + psb_xrandr_crtc_p local_crtc = NULL, extend_crtc = NULL; switch (output_device_mode) { case SINGLE_HDMI: @@ -479,6 +479,8 @@ void psb_xrandr_refresh(VADriverContextP ctx) } psb_xrandr_coordinate_init(ctx); + + psb_RecalcRotate(ctx); pthread_mutex_unlock(&psb_xrandr_info->psb_extvideo_mutex); } diff --git a/src/x11/psb_xrandr.h b/src/x11/psb_xrandr.h index 6f211c4..a2e6b0d 100644 --- a/src/x11/psb_xrandr.h +++ b/src/x11/psb_xrandr.h @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. diff --git a/src/x11/psb_xvva.c b/src/x11/psb_xvva.c index 2fd2158..d9c1982 100644 --- a/src/x11/psb_xvva.c +++ b/src/x11/psb_xvva.c @@ -8,11 +8,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |