#include "yagl_state.h"
#include "yagl_client_interface.h"
#include "yagl_client_image.h"
+#include "drm_fourcc.h"
#include "vigs.h"
#include <tbm_bufmgr.h>
#include <tbm_bufmgr_backend.h>
return (0xff000000 | (r << 16) | (g << 8) | b);
}
-/* TODO need to think about HW convertion */
static bool yagl_onscreen_image_tizen_sfc_convert(struct yagl_onscreen_image_tizen_sfc *image)
{
uint32_t *dst;
YAGL_LOG_FUNC_SET(yagl_onscreen_image_tizen_sfc_convert);
- if (!image->need_convert) {
- return true;
- }
-
ret = tbm_surface_map(image->sfc, TBM_SURF_OPTION_READ, &info);
if (ret != TBM_SURFACE_ERROR_NONE) {
struct yagl_onscreen_image_tizen_sfc *tizen_sfc_image =
(struct yagl_onscreen_image_tizen_sfc *)image;
+ YAGL_LOG_FUNC_SET(yagl_onscreen_image_tizen_sfc_update);
+
+ if (!tizen_sfc_image->need_convert) {
+ return;
+ }
+
+ if (tizen_sfc_image->format == TBM_FORMAT_ARGB8888) {
+ tbm_bo bo = tbm_surface_internal_get_bo(tizen_sfc_image->sfc, 0);
+ struct vigs_drm_surface *src = bo ? tbm_backend_get_bo_priv(bo) : NULL;
+ int ret;
+
+ /*
+ * No actual format conversion in ARGB8888 case. We just need to
+ * y-invert the image.
+ */
+ ret = vigs_drm_surface_convert(src,
+ DRM_FORMAT_ARGB8888,
+ tizen_sfc_image->drm_sfc,
+ DRM_FORMAT_ARGB8888,
+ true);
+
+ if (ret == 0) {
+ return;
+ }
+
+ YAGL_LOG_ERROR("vigs_drm_surface_convert failed %s\n", strerror(-ret));
+
+ /*
+ * Fallback to software converson in case of error.
+ */
+ }
+
yagl_onscreen_image_tizen_sfc_convert(tizen_sfc_image);
}
image->sfc = sfc;
image->need_convert = need_convert;
image->drm_sfc = drm_sfc;
+ image->format = info.format;
YAGL_LOG_DEBUG("%ux%u/%u, sfc_id = %u, need_convert = %d (0x%X), num_planes = %u, size = %u",
info.width,